diff --git a/helpers/api/index.ts b/helpers/api/index.ts index 2a022c1..5615ecf 100644 --- a/helpers/api/index.ts +++ b/helpers/api/index.ts @@ -120,6 +120,15 @@ export const xcmPallet = { }, }, }), + parachainV4: (parents: number, paraId: any) => ({ + V4: { + parents, + interior: { + X1: [{ Parachain: paraId }], + }, + }, + }), + limitedTeleportAssets: (token: any, amount: any, dest: any) => ({ api }: { api: ApiPromise }, acc: any) => @@ -206,6 +215,37 @@ export const xcmPallet = { 0, 'Unlimited', ), + transferAssetsV4: + (token: any, amount: any, dest: any) => + ({ api }: { api: ApiPromise }, acc: any) => + (api.tx.xcmPallet || api.tx.polkadotXcm).transferAssets( + dest, + { + V4: { + parents: 0, + interior: { + X1: [ + { + AccountId32: { + id: acc, + }, + network: undefined, + }, + ], + }, + }, + }, + { + V4: [ + { + id: token, + fun: { Fungible: amount }, + }, + ], + }, + 0, + 'Unlimited', + ), } export const tx = { diff --git a/networks/darwinia.ts b/networks/darwinia.ts index e120e4b..a53ccb8 100644 --- a/networks/darwinia.ts +++ b/networks/darwinia.ts @@ -7,7 +7,7 @@ export default { }, kusama: { name: 'crab' as const, - endpoint: 'wss://crab-rpc.darwinia.network', + endpoint: 'wss://darwiniacrab-rpc.dwellir.com', }, config: ({ alice }) => ({ storages: { diff --git a/networks/moonbeam.ts b/networks/moonbeam.ts index bc76a03..ca96a6b 100644 --- a/networks/moonbeam.ts +++ b/networks/moonbeam.ts @@ -25,6 +25,7 @@ export default { export const moonbeam = { paraId: 2004, dot: 42259045809535163221576417993425387648n, + parachainDot: { parents: 1, interior: 'Here' }, } as const export const moonriver = { diff --git a/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap b/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap index 20e644b..38cfc68 100644 --- a/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap +++ b/tests/xcm-transfer/__snapshots__/polkadot-para.test.ts.snap @@ -706,6 +706,17 @@ exports[`'moonbeam' -> 'acala' xcm transfer 'DOT' > xtokens transfer > balance o } `; +exports[`'moonbeam' -> 'acala' xcm transfer 'DOT' > xtokens transfer > balance on from chain 2`] = ` +{ + "balance": 9000000000000, + "extra": null, + "reason": { + "consumer": null, + }, + "status": "Liquid", +} +`; + exports[`'moonbeam' -> 'acala' xcm transfer 'DOT' > xtokens transfer > balance on to chain 1`] = ` { "free": "(rounded 11000000000000)", @@ -887,3 +898,5 @@ exports[`'moonbeam' -> 'acala' xcm transfer 'DOT' > xtokens transfer > tx events }, ] `; + +exports[`'moonbeam' -> 'acala' xcm transfer 'DOT' > xtokens transfer > tx events 2`] = `[]`; diff --git a/tests/xcm-transfer/polkadot-para.test.ts b/tests/xcm-transfer/polkadot-para.test.ts index e621bd7..46556d7 100644 --- a/tests/xcm-transfer/polkadot-para.test.ts +++ b/tests/xcm-transfer/polkadot-para.test.ts @@ -100,7 +100,7 @@ const tests = [ }), test: { xtokenstHorizontal: { - tx: tx.xtokens.transfer({ ForeignAsset: moonbeam.dot }, 1e12, tx.xtokens.parachainV3(acala.paraId)), + tx: tx.xcmPallet.transferAssetsV4(moonbeam.parachainDot, 1e12, tx.xcmPallet.parachainV4(1, acala.paraId)), fromBalance: query.assets(moonbeam.dot), toBalance: query.tokens(acala.dot), checkUmp: true,