colorfulnotion / xcm-global-registry Goto Github PK
View Code? Open in Web Editor NEWXCM Global Asset Registry (GAR) for Polkadot and Kusama Ecosystem
License: Apache License 2.0
XCM Global Asset Registry (GAR) for Polkadot and Kusama Ecosystem
License: Apache License 2.0
Step to reproduce:
on https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fphala.api.onfinality.io%2Fpublic-ws#/js
Code:
let res = await api.query.assetsRegistry.registryInfoByIds.entries()
console.log(res)
Errors:
Error: Unable to decode storage assetsRegistry.registryInfoByIds: entry 1:: createType(AssetsRegistryAssetRegistryInfo):: decodeU8aStruct: failed at 0x43410c010080ca396124000000000000… on reserveLocation (index 2/5): Option<XcmV3MultiLocation>:: decodeU8aStruct: failed at 0x0c010080ca3961240000000000000000… on interior (index 2/2): {"_enum":{"Here":"Null","X1":"XcmV3Junction","X2":"(XcmV3Junction,XcmV3Junction)","X3":"(XcmV3Junction,XcmV3Junction,XcmV3Junction)","X4":"(XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction)","X5":"(XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction)","X6":"(XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction)","X7":"(XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction)","X8":"(XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction,XcmV3Junction)"}}:: Unable to create Enum via index 12, in Here, X1, X2, X3, X4, X5, X6, X7, X8
at T._newType (https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:6842)
at T._formatStorageSetEntry (https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:6328)
at https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:6069
at r.reduce (<anonymous>)
at T._formatStorageSet (https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:6039)
at https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:5754
at Array.map (<anonymous>)
at T._formatOutput (https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:5697)
at T._formatResult (https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:3438)
at h (https://polkadot.js.org/apps/modu.35d7b28670a9806f.js:50:3929)
Two BSX are registered on Khala. The one with "generalKey": "0x00000000"
should probably be removed?
See Kusama-2004 XcAsset Registry
{
"paraID": 2090,
"relayChain": "kusama",
"symbol": "BSX",
"decimals": 12,
"interiorType": "x2",
"xcmV1Standardized": [
{
"network": "kusama"
},
{
"parachain": 2090
},
{
"generalIndex": 0
}
],
"xcmV1MultiLocationByte": "0x010200a9200500",
"xcmV1MultiLocation": {
"v1": {
"parents": 1,
"interior": {
"x2": [
{
"parachain": 2090
},
{
"generalIndex": 0
}
]
}
}
},
"asset": "9",
"source": [
"2004"
]
},
{
"paraID": 2090,
"relayChain": "kusama",
"symbol": "BSX",
"decimals": 12,
"interiorType": "x2",
"xcmV1Standardized": [
{
"network": "kusama"
},
{
"parachain": 2090
},
{
"generalKey": "0x00000000"
}
],
"xcmV1MultiLocationByte": "0x010200a920061000000000",
"xcmV1MultiLocation": {
"v1": {
"parents": 1,
"interior": {
"x2": [
{
"parachain": 2090
},
{
"generalKey": "0x00000000"
}
]
}
}
},
"asset": "5",
"source": [
"2004"
]
}
Suggesting more (meta)information to add to assets in this registry:
originChain
, but hopefully in the near future, most assets will also have reserve on local AssetHub
. Bridged assets also need a local reserve, either AssetHub or the parachain that bridged them in.Having this would be very useful to the ecosystem, and significantly reduce complexity in figuring out how to transfer these assets between chains. Right now, information on asset reserve locations or teleport locations is very hard to come by.
We can then create tooling for automated building of asset transfer XCMs, based on the information in this registry.
Recent Khala runtime upgrade caused XcmV1MultiLocation byteEncode to fail at:
api.createType('XcmV1MultiLocation', multilocationStruct)
2023-04-04 15:36:57 REGISTRY: Unable to resolve type XcmV1MultiLocation, it will fail on construction
xcmV1MultiLocation_to_byte error {
"v1": {
"parents": 1,
"interior": {
"x2": [
{
"parachain": 2085
},
{
"generalKey": "0x484b4f"
}
]
}
}
} Error: createType(XcmV1MultiLocation):: DoNotConstruct: Cannot construct unknown type XcmV1MultiLocation
at createTypeUnsafe (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/node_modules/@polkadot/types-create/cjs/create/type.js:73:18)
at TypeRegistry.createType (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/node_modules/@polkadot/types/cjs/create/registry.js:345:46)
at ApiPromise.createType (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/node_modules/@polkadot/api/cjs/base/Decorate.js:135:27)
at convert_xcmV1MultiLocation_to_byte (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/xcmgarTool.js:191:33)
at Object.convertXcmV1MultiLocationToByte (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/xcmgarTool.js:456:16)
at PhalaParser.processXcmAssetIdToLocation (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/chainParsers/common_chainparser.js:340:80)
at PhalaParser.processPhalaXcGar (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/chainParsers/phala.js:122:89)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async PhalaParser.fetchXcGar (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/chainParsers/phala.js:43:9)
at async XCMGlobalAssetRegistryManager.crawlRegistry (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/xcmgarManager.js:486:13)
at async XCMGlobalAssetRegistryCLI.registry (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/xcmgar:51:21)
at async Command.<anonymous> (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/xcmgar:132:6)
at async Command.parseAsync (/Users/myichael/src/github.com/wolkdb/xcm-global-registry/node_modules/commander/lib/command.js:935:5)
Check the correctness of USDT with Centrifuge team. "generalKey": "0x31393834"
should have been "generalIndex": 1984
?
"[{\"network\":\"polkadot\"},{\"parachain\":1000},{\"palletInstance\":50},{\"generalKey\":\"0x31393834\"}]": {
"paraID": 1000,
"relayChain": "polkadot",
"symbol": "USDT",
"decimals": 6,
"interiorType": "x3",
"xcmV1Standardized": [
{
"network": "polkadot"
},
{
"parachain": 1000
},
{
"palletInstance": 50
},
{
"generalKey": "0x31393834"
}
],
"xcmV1MultiLocationByte": "0x010300a10f0432061031393834",
"xcmV1MultiLocation": {
"v1": {
"parents": 1,
"interior": {
"x3": [
{
"parachain": 1000
},
{
"palletInstance": 50
},
{
"generalKey": "0x31393834"
}
]
}
}
},
"xcContractAddress": {},
"xcCurrencyID": {
"2031": {
"ForeignAsset": "1"
}
},
"confidence": 1,
"source": [
2031
]
I think we miss a way to fetch the chain/parachain names..
Maybe integrate https://github.com/paritytech/polkadot_network_directory ?
Abnormal record picked up by confidence check. Was expecting BNC to have "generalKey": "0x0001"
instead of "generalKey": "0x0104"
See polkadot_2035 xcAsset registry
{
"paraID": 2030,
"relayChain": "polkadot",
"symbol": "BNC",
"decimals": 12,
"interiorType": "x2",
"xcmV1Standardized": [
{
"network": "polkadot"
},
{
"parachain": 2030
},
{
"generalKey": "0x0104"
}
],
"xcmV1MultiLocationByte": "0x010200b91f06080104",
"xcmV1MultiLocation": {
"v1": {
"parents": 1,
"interior": {
"x2": [
{
"parachain": 2030
},
{
"generalKey": "0x0104"
}
]
}
}
},
"asset": "8",
"source": [
"2035"
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.