--- a/tests/src/util/playgrounds/unique.ts +++ b/tests/src/util/playgrounds/unique.ts @@ -2959,47 +2959,59 @@ await this.helper.executeExtrinsic(signer, `api.tx.${this.palletName}.teleportAssets`, [destination, beneficiary, assets, feeAssetItem], true); } - async teleportNativeAsset(signer: TSigner, destinationParaId: number, targetAccount: Uint8Array, amount: bigint) { - const destination = { - V1: { - parents: 0, - interior: { - X1: { - Parachain: destinationParaId, - }, + async teleportNativeAsset(signer: TSigner, destinationParaId: number, targetAccount: Uint8Array, amount: bigint, xcmVersion: number = 3) { + const destinationContent = { + parents: 0, + interior: { + X1: { + Parachain: destinationParaId, }, }, }; - const beneficiary = { - V1: { - parents: 0, - interior: { - X1: { - AccountId32: { - network: 'Any', - id: targetAccount, - }, + const beneficiaryContent = { + parents: 0, + interior: { + X1: { + AccountId32: { + network: 'Any', + id: targetAccount, }, }, }, }; - const assets = { - V1: [ - { - id: { - Concrete: { - parents: 0, - interior: 'Here', - }, + const assetsContent = [ + { + id: { + Concrete: { + parents: 0, + interior: 'Here', }, - fun: { - Fungible: amount, - }, }, - ], - }; + fun: { + Fungible: amount, + }, + }, + ]; + + let destination; + let beneficiary; + let assets; + + if (xcmVersion == 2) { + destination = { V1: destinationContent }; + beneficiary = { V1: beneficiaryContent }; + assets = { V1: assetsContent }; + + } else if (xcmVersion == 3) { + destination = { V2: destinationContent }; + beneficiary = { V2: beneficiaryContent }; + assets = { V2: assetsContent }; + + } else { + throw Error("Unknown XCM version: " + xcmVersion); + } const feeAssetItem = 0; --- a/tests/src/xcm/xcmQuartz.test.ts +++ b/tests/src/xcm/xcmQuartz.test.ts @@ -154,7 +154,7 @@ // (fee for USDT XCM are paid in relay tokens) await usingRelayPlaygrounds(relayUrl, async (helper) => { const destination = { - V1: { + V2: { parents: 0, interior: {X1: { Parachain: QUARTZ_CHAIN, @@ -163,7 +163,7 @@ }}; const beneficiary = { - V1: { + V2: { parents: 0, interior: {X1: { AccountId32: { @@ -175,7 +175,7 @@ }; const assets = { - V1: [ + V2: [ { id: { Concrete: { @@ -200,7 +200,7 @@ itSub('Should connect and send USDT from Statemine to Quartz', async ({helper}) => { await usingStateminePlaygrounds(statemineUrl, async (helper) => { const dest = { - V1: { + V2: { parents: 1, interior: {X1: { Parachain: QUARTZ_CHAIN, @@ -209,7 +209,7 @@ }}; const beneficiary = { - V1: { + V2: { parents: 0, interior: {X1: { AccountId32: { @@ -221,7 +221,7 @@ }; const assets = { - V1: [ + V2: [ { id: { Concrete: { @@ -341,7 +341,7 @@ await usingRelayPlaygrounds(relayUrl, async (helper) => { const destination = { - V1: { + V2: { parents: 0, interior: {X1: { Parachain: QUARTZ_CHAIN, @@ -350,7 +350,7 @@ }}; const beneficiary = { - V1: { + V2: { parents: 0, interior: {X1: { AccountId32: { @@ -362,7 +362,7 @@ }; const assets = { - V1: [ + V2: [ { id: { Concrete: { --- a/tests/src/xcm/xcmUnique.test.ts +++ b/tests/src/xcm/xcmUnique.test.ts @@ -85,8 +85,9 @@ await usingRelayPlaygrounds(relayUrl, async (helper) => { // Fund accounts on Statemint - await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, alice.addressRaw, FUNDING_AMOUNT); - await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, bob.addressRaw, FUNDING_AMOUNT); + const relayXcmVersion = 2; + await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, alice.addressRaw, FUNDING_AMOUNT, relayXcmVersion); + await helper.xcm.teleportNativeAsset(alice, STATEMINT_CHAIN, bob.addressRaw, FUNDING_AMOUNT, relayXcmVersion); }); await usingStatemintPlaygrounds(statemintUrl, async (helper) => {