diff --git a/e2e_tests/region-transfer.js b/e2e_tests/region-transfer.js new file mode 100644 index 00000000..49466ddd --- /dev/null +++ b/e2e_tests/region-transfer.js @@ -0,0 +1,63 @@ +const { ApiPromise, WsProvider, Keyring } = require("@polkadot/api"); +const { submitExtrinsic, setupRelayAsset } = require("./common"); + +async function run(nodeName, networkInfo, _jsArgs) { + const { wsUri: regionXUri } = networkInfo.nodesByName[nodeName]; + const { wsUri: rococoUri } = networkInfo.nodesByName["rococo-validator01"]; + const { wsUri: coretimeUri } = networkInfo.nodesByName["coretime-collator01"]; + + const rococoApi = await ApiPromise.create({ + provider: new WsProvider(rococoUri), + }); + const regionXApi = await ApiPromise.create({provider: new WsProvider(regionXUri)}); + + // account to submit tx + const keyring = new zombie.Keyring({ type: "sr25519" }); + const alice = keyring.addFromUri("//Alice"); + + const setRelayXcmVersion = rococoApi.tx.xcmPallet.forceDefaultXcmVersion([3]); + await submitExtrinsic(alice, rococoApi.tx.sudo.sudo(setRelayXcmVersion), {}); + const setCoretimeXcmVersion = coretimeUri.tx.xcmPallet.forceDefaultXcmVersion([3]); + await submitExtrinsic(alice, coretimeUri.tx.sudo.sudo(setCoretimeXcmVersion), {}); + + await setupRelayAsset(regionXApi, alice); + + const receiverKeypair = new Keyring(); + receiverKeypair.addFromAddress(alice.address); + + const feeAssetItem = 0; + const weightLimit = "Unlimited"; + const reserveTransfer = rococoApi.tx.xcmPallet.limitedReserveTransferAssets( + { V3: { parents: 0, interior: { X1: { Parachain: 2000 } } } }, //dest + { + V3: { + parents: 0, + interior: { + X1: { + AccountId32: { + chain: "Any", + id: receiverKeypair.pairs[0].publicKey, + }, + }, + }, + }, + }, //beneficiary + { + V3: [ + { + id: { + Concrete: { parents: 0, interior: "Here" }, + }, + fun: { + Fungible: 10n ** 9n, + }, + }, + ], + }, //asset + feeAssetItem, + weightLimit, + ); + await submitExtrinsic(alice, reserveTransfer, {}); +} + +module.exports = { run }; diff --git a/zombienet_tests/0006-region-transfer.toml b/zombienet_tests/0006-region-transfer.toml new file mode 100644 index 00000000..c6810bd7 --- /dev/null +++ b/zombienet_tests/0006-region-transfer.toml @@ -0,0 +1,33 @@ +[settings] +timeout = 1000 + +[relaychain] +chain = "rococo-local" +command = "polkadot" + + [[relaychain.nodes]] + name = "rococo-validator01" + validator = true + + [[relaychain.nodes]] + name = "rococo-validator02" + validator = true + +[[parachains]] +id = 1005 +chain = "coretime-rococo-local" +addToGenesis = true + + [parachains.collator] + name = "coretime-collator01" + command = "polkadot-parachain" + args = [ "-lruntime=debug,parachain=trace" ] + +[[parachains]] +id = 2000 +addToGenesis = false + + [parachains.collator] + name = "regionx-collator01" + command = "regionx-node" + args = [ "-lruntime=debug,parachain=trace" ] diff --git a/zombienet_tests/0006-region-transfer.zndsl b/zombienet_tests/0006-region-transfer.zndsl new file mode 100644 index 00000000..b292dd12 --- /dev/null +++ b/zombienet_tests/0006-region-transfer.zndsl @@ -0,0 +1,10 @@ +Description: Native currency fee payment +Network: ./0006-region-transfer.toml +Creds: config + +rococo-validator01: is up +rococo-validator02: is up + +rococo-validator01: parachain 2000 is registered within 225 seconds + +regionx-collator01: js-script ../e2e_tests/region-transfer.js return is 0 within 400 seconds