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
130 }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});130 }, {provider: new WsProvider('ws://127.0.0.1:' + KARURA_PORT)});
131 });131 });
132132
133 /// TODO Under construction. The test won't pass.
134 it.skip('Should connect to Karura and send OPL back', async () => {133 it('Should connect to Karura and send OPL back', async () => {
135 let balanceBefore: bigint;134 let balanceBefore: bigint;
136 135
137 await usingApi(async (api) => {136 await usingApi(async (api) => {
138 [balanceBefore] = await getBalance(api, [alicesPublicKey]);137 [balanceBefore] = await getBalance(api, [alicesPublicKey]);
139 });138 });
140139
141 await usingApi(async (api) => {140 await usingApi(async (api) => {
142 const destination = {
143 V0: {
144 X2: [
145 'Parent',
146 {
147 Parachain: UNIQUE_CHAIN,
148 },
149 ],
150 },
151 };
152
153 const beneficiary = {141 const destination = {
154 V0: {142 V0: {
155 X1: {143 X3: [
144 'Parent',
145 {
146 Parachain: UNIQUE_CHAIN,
147 },
148 {
156 AccountId32: {149 AccountId32: {
157 network: 'Any',150 network: 'Any',
158 id: alice.addressRaw,151 id: alice.addressRaw,
159 },152 },
160 },153 },
154 ],
161 },155 },
162 };156 };
163157
164 const assets = {158 const id = {
165 V1: [159 ForeignAsset: 0,
166 {
167 id: {
168 Concrete: {
169 parents: 0,
170 interior: 'Here',
171 },
172 },
173 fun: {
174 Fungible: 5000000000,
175 },
176 },
177 ],
178 };160 };
179161
180 const feeAssetItem = 0;162 const amount = 5000000000;
181
182 const weightLimit = {163 const destWeight = 50000000;
183 Limited: 5000000000,164
184 };
185
186 // todo The functionality to be tested is not complete yet. The metadata above are subject to change, as is the transaction below.
187 const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);165 const tx = api.tx.xTokens.transfer(id, amount, destination, destWeight);
188 const events = await submitTransactionAsync(alice, tx);166 const events = await submitTransactionAsync(alice, tx);
189 const result = getGenericResult(events);167 const result = getGenericResult(events);
190 expect(result.success).to.be.true;168 expect(result.success).to.be.true;