polkawallet-io / bridge Goto Github PK
View Code? Open in Web Editor NEWPolkadot bridge js SDK with XCM transfer.
License: Apache License 2.0
Polkadot bridge js SDK with XCM transfer.
License: Apache License 2.0
Are you guys planning on adding routes for statemint anytime soon?
Is it possible to move to an implementation without dependencies on @acala-network/*
?
This would be awesome for projects that doesn't use Acala sdks
This is small and not catastrophic, but is worth mentioning:
The function available on the router getDestiantionsChains
is spelt incorrectly. I believe this should be getDestinationChains
or getDestinationsChains
:)
Thanks!
Statemint <--> Acala USDT
decimals: 6
acala 上 ForeignAssetId 为 12,minimalBalance 10,000
statemint 上 id 1984, minBalance: 700,000
statemint --> acala
enconded call data: 0x1f0801010100411f0100010100c0997c4f2b3a83eb07ef74a867cf672a25a2a30cc61abc936dcc994df77ba84a0104000002043205011f0002093d000000000000
Destination Chain Transfer Fee 为 808
需要注意的是,无法全部转走,statemint上需要保留 e.d, 即 minBalance: 700,000
acala --> statemint
enconded call data:
0x36010100010300a10f043205011f0002093d0001010200a10f0100c0997c4f2b3a83eb07ef74a867cf672a25a2a30cc61abc936dcc994df77ba84a00
Destination Chain Transfer Fee 为 700,000
需要注意的是,由于 Destination Chain Transfer Fee 跟 e.d 都为 700,000,因此在 acala 直接将 usdt 跨链到 statemint 上没有 usdt 的账户时,转账数量需要大于 1,400,000
Got the below error only with the following routes:
I'm using version 0.0.6-15
Uncaught Error: createType(Call):: Call: failed decoding xTokens.transfer:: Struct: failed on args: {"currency_id":"{\"_enum\":{\"Token\":\"AcalaPrimitivesCurrencyTokenSymbol\",\"DexShare\":\"(AcalaPrimitivesCurrencyDexShare,AcalaPrimitivesCurrencyDexShare)\",\"Erc20\":\"H160\",\"StableAssetPoolToken\":\"u32\",\"LiquidCrowdloan\":\"u32\",\"ForeignAsset\":\"u16\"}}","amount":"u128","dest":"{\"_enum\":{\"V0\":\"XcmV0MultiLocation\",\"V1\":\"XcmV1MultiLocation\"}}","dest_weight_limit":"{\"_enum\":{\"Unlimited\":\"Null\",\"Limited\":\"Compact<u64>\"}}"}:: Struct: failed on dest: {"_enum":{"V0":"XcmV0MultiLocation","V1":"XcmV1MultiLocation"}}:: Enum(V1):: Struct: failed on interior: {"_enum":{"Here":"Null","X1":"XcmV1Junction","X2":"(XcmV1Junction,XcmV1Junction)","X3":"(XcmV1Junction,XcmV1Junction,XcmV1Junction)","X4":"(XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction)","X5":"(XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction)","X6":"(XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction)","X7":"(XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction)","X8":"(XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction,XcmV1Junction)"}}:: Enum(X2):: Tuple: failed on 1:: Enum(AccountKey20):: Struct: failed on key: [u8;20]:: Expected input with 20 bytes (160 bits), found 48 bytes
createTypeUnsafe type.js:54
createTypeUnsafe registry.js:276
extrinsicFn createUnchecked.js:16
decorated Decorate.js:466
createTx acala.js:810
estimateTxFee base-chain-adapter.js:111
subscribeInputConfig base-chain-adapter.js:36
subscription TeleportDialog.tsx:148
RxJS 59
type.js:54
createTypeUnsafe type.js:54
createTypeUnsafe registry.js:276
extrinsicFn createUnchecked.js:16
decorated Decorate.js:466
createTx acala.js:810
estimateTxFee base-chain-adapter.js:111
subscribeInputConfig base-chain-adapter.js:36
subscription TeleportDialog.tsx:148
RxJS 59
Following the example code from README
, it will result to an error if I try transferring from Acala/Karura network.
(Using version 0.0.3-2)
When I check in the built code in node_modules, the code used for acala adapter is old code, where it uses destWeight
using number, instead of Unlimited
.
Publish new version using the newest commit.
Here's a simple js script that I use to confirm the error.
const { Bridge, ApiProvider } = require('@polkawallet/bridge')
const { firstValueFrom } = require('rxjs')
const { AcalaAdapter } = require('@polkawallet/bridge/build/adapters/acala')
const { PolkadotAdapter } = require('@polkawallet/bridge/build/adapters/polkadot')
const { ParallelAdapter } = require('@polkawallet/bridge/build/adapters/parallel')
const { FN } = require('@polkawallet/bridge/build/types')
const availableAdapters = {
polkadot: new PolkadotAdapter(),
acala: new AcalaAdapter(),
parallel: new ParallelAdapter()
};
const bridge = new Bridge({
adapters: Object.values(availableAdapters),
});
async function main () {
const provider = new ApiProvider();
const chains = Object.keys(availableAdapters);
await firstValueFrom(provider.connectFromChain(chains, undefined));
await Promise.all(chains.map((chain) => availableAdapters[chain].setApi(provider.getApi(chain))));
bridge.findAdapter('acala').createTx({
address: '[address]',
amount: FN.fromInner('1000000000', 10),
to: 'parallel',
token: 'ACA'
})
}
main()
Acala --> Astar
LDOT : 3,692,000
AUSD: 252,800,000
ACA: 1,108,000,000
ASTR: 4,006,410,300,000,000
Astar --> Acala
ASTR: 8,082,400,000,000,000
ACA: 8,082,400,000
LDOT: 13,400,229
AUSD: 1,815,098,681
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.