Skip to content

Commit

Permalink
Build/941056 tests up (#938)
Browse files Browse the repository at this point in the history
Use XCM V2
  • Loading branch information
Maksandre authored and CertainLach committed May 24, 2023
1 parent 18191fc commit 748c609
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
22 changes: 16 additions & 6 deletions tests/src/xcm/xcmQuartz.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => {
let quartzParachainMultilocation: any;
let quartzAccountMultilocation: any;
let quartzCombinedMultilocation: any;
let quartzCombinedMultilocationKarura: any; // TODO remove it when Karura goes V2

let messageSent: any;

Expand Down Expand Up @@ -847,6 +848,15 @@ describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => {
},
};

quartzCombinedMultilocationKarura = {
V1: {
parents: 1,
interior: {
X2: [quartzParachainJunction, quartzAccountJunction],
},
},
};

// Set the default version to wrap the first message to other chains.
await helper.getSudo().xcm.setSafeXcmVersion(alice, SAFE_XCM_VERSION);
});
Expand All @@ -869,7 +879,7 @@ describeXCM('[XCM] Integration test: Quartz rejects non-native tokens', () => {
const id = {
Token: 'KAR',
};
const destination = quartzCombinedMultilocation;
const destination = quartzCombinedMultilocationKarura;
await helper.xTokens.transfer(alice, id, testAmount, destination, 'Unlimited');

messageSent = await helper.wait.expectEvent(maxWaitBlocks, Event.XcmpQueue.XcmpMessageSent);
Expand Down Expand Up @@ -1433,7 +1443,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {
itSub('Should connect to Shiden and send QTZ back', async ({helper}) => {
await usingShidenPlaygrounds(shidenUrl, async (helper) => {
const destination = {
V1: {
V2: {
parents: 1,
interior: {
X1: {
Expand All @@ -1444,7 +1454,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {
};

const beneficiary = {
V1: {
V2: {
parents: 0,
interior: {
X1: {
Expand All @@ -1458,7 +1468,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {
};

const assets = {
V1: [
V2: [
{
id: {
Concrete: {
Expand Down Expand Up @@ -1515,7 +1525,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {
const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice);

const quartzMultilocation = {
V1: {
V2: {
parents: 1,
interior: {
X1: {Parachain: QUARTZ_CHAIN},
Expand Down Expand Up @@ -1580,7 +1590,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {
const [targetAccount] = await helper.arrange.createAccounts([0n], alice);

const quartzMultilocation = {
V1: {
V2: {
parents: 1,
interior: {
X1: {
Expand Down
25 changes: 17 additions & 8 deletions tests/src/xcm/xcmUnique.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
let uniqueParachainMultilocation: any;
let uniqueAccountMultilocation: any;
let uniqueCombinedMultilocation: any;
let uniqueCombinedMultilocationAcala: any; // TODO remove when Acala goes V2

let messageSent: any;

Expand All @@ -823,7 +824,7 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
};

uniqueParachainMultilocation = {
V1: {
V2: {
parents: 1,
interior: {
X1: uniqueParachainJunction,
Expand All @@ -849,6 +850,15 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
},
};

uniqueCombinedMultilocationAcala = {
V1: {
parents: 1,
interior: {
X2: [uniqueParachainJunction, uniqueAccountJunction],
},
},
};

// Set the default version to wrap the first message to other chains.
await helper.getSudo().xcm.setSafeXcmVersion(alice, SAFE_XCM_VERSION);
});
Expand All @@ -871,7 +881,7 @@ describeXCM('[XCM] Integration test: Unique rejects non-native tokens', () => {
const id = {
Token: 'ACA',
};
const destination = uniqueCombinedMultilocation;
const destination = uniqueCombinedMultilocationAcala;
await helper.xTokens.transfer(alice, id, testAmount, destination, 'Unlimited');

messageSent = await helper.wait.expectEvent(maxWaitBlocks, Event.XcmpQueue.XcmpMessageSent);
Expand Down Expand Up @@ -1436,7 +1446,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => {
itSub('Should connect to Astar and send UNQ back', async ({helper}) => {
await usingAstarPlaygrounds(astarUrl, async (helper) => {
const destination = {
V1: {
V2: {
parents: 1,
interior: {
X1: {
Expand All @@ -1447,7 +1457,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => {
};

const beneficiary = {
V1: {
V2: {
parents: 0,
interior: {
X1: {
Expand All @@ -1461,7 +1471,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => {
};

const assets = {
V1: [
V2: [
{
id: {
Concrete: {
Expand Down Expand Up @@ -1517,7 +1527,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => {
const [targetAccount] = await helper.arrange.createAccounts([targetAccountBalance], alice);

const uniqueMultilocation = {
V1: {
V2: {
parents: 1,
interior: {
X1: {Parachain: UNIQUE_CHAIN},
Expand Down Expand Up @@ -1582,7 +1592,7 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => {
const [targetAccount] = await helper.arrange.createAccounts([0n], alice);

const uniqueMultilocation = {
V1: {
V2: {
parents: 1,
interior: {
X1: {
Expand Down Expand Up @@ -1652,5 +1662,4 @@ describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => {
accountBalance = await helper.balance.getSubstrate(targetAccount.address);
expect(accountBalance).to.be.equal(0n);
});

});

0 comments on commit 748c609

Please sign in to comment.