From e862576ef71d939cf91d639a49ee2ec9273326b2 Mon Sep 17 00:00:00 2001 From: str-mv Date: Thu, 27 Jan 2022 12:41:03 +0000 Subject: [PATCH] Xcm tests completed --- --- a/tests/package.json +++ b/tests/package.json @@ -68,6 +68,7 @@ "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts", "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts", "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts", + "testXcm": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts", "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --input src/interfaces/ --package .", "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint ws://localhost:9944 --output src/interfaces/ --package .", "polkadot-types": "yarn polkadot-types-from-defs && yarn polkadot-types-from-chain" --- a/tests/src/xcmTransfer.test.ts +++ b/tests/src/xcmTransfer.test.ts @@ -130,8 +130,7 @@ }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)}); }); - /// TODO Under construction. The test won't pass. - it.skip('Should connect to Karura and send OPL back', async () => { + it('Should connect to Karura and send OPL back', async () => { let balanceBefore: bigint; await usingApi(async (api) => { @@ -141,50 +140,29 @@ await usingApi(async (api) => { const destination = { V0: { - X2: [ + X3: [ 'Parent', { Parachain: UNIQUE_CHAIN, }, + { + AccountId32: { + network: 'Any', + id: alice.addressRaw, + }, + }, ], }, }; - const beneficiary = { - V0: { - X1: { - AccountId32: { - network: 'Any', - id: alice.addressRaw, - }, - }, - }, + const id = { + ForeignAsset: 0, }; - const assets = { - V1: [ - { - id: { - Concrete: { - parents: 0, - interior: 'Here', - }, - }, - fun: { - Fungible: 5000000000, - }, - }, - ], - }; + const amount = 5000000000; + const destWeight = 50000000; - const feeAssetItem = 0; - - const weightLimit = { - Limited: 5000000000, - }; - - // todo The functionality to be tested is not complete yet. The metadata above are subject to change, as is the transaction below. - const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit); + const tx = api.tx.xTokens.transfer(id, amount, destination, destWeight); const events = await submitTransactionAsync(alice, tx); const result = getGenericResult(events); expect(result.success).to.be.true; -- gitstuff