git.delta.rocks / unique-network / refs/commits / e862576ef71d

difftreelog

Xcm tests completed

str-mv2022-01-27parent: #253e15b.patch.diff
in: master

2 files changed

modifiedtests/package.jsondiffbeforeafterboth
68 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",68 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",
69 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",69 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",
70 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",70 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",
71 "testXcm": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts",
71 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --input src/interfaces/ --package .",72 "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --input src/interfaces/ --package .",
72 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint ws://localhost:9944 --output src/interfaces/ --package .",73 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint ws://localhost:9944 --output src/interfaces/ --package .",
73 "polkadot-types": "yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"74 "polkadot-types": "yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"
modifiedtests/src/xcmTransfer.test.tsdiffbeforeafterboth
--- 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;