difftreelog
fix yarn fix
in: master
2 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterbothno syntactic changes
tests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -36,232 +36,232 @@
const TRANSFER_AMOUNT = 2000000000000000000000000n;
describe('Integration test: Exchanging UNQ with Acala', () => {
- let alice: IKeyringPair;
- let randomAccount: IKeyringPair;
+ let alice: IKeyringPair;
+ let randomAccount: IKeyringPair;
- let balanceUniqueTokenBefore: bigint;
- let balanceUniqueTokenAfter: bigint;
- let balanceUniqueTokenFinal: bigint;
- let balanceAcalaTokenBefore: bigint;
- let balanceAcalaTokenAfter: bigint;
- let balanceAcalaTokenFinal: bigint;
- let balanceUniqueForeignTokenAfter: bigint;
- let balanceUniqueForeignTokenBefore: bigint;
- let balanceUniqueForeignTokenFinal: bigint;
+ let balanceUniqueTokenBefore: bigint;
+ let balanceUniqueTokenAfter: bigint;
+ let balanceUniqueTokenFinal: bigint;
+ let balanceAcalaTokenBefore: bigint;
+ let balanceAcalaTokenAfter: bigint;
+ let balanceAcalaTokenFinal: bigint;
+ let balanceUniqueForeignTokenAfter: bigint;
+ let balanceUniqueForeignTokenBefore: bigint;
+ let balanceUniqueForeignTokenFinal: bigint;
- before(async () => {
- await usingApi(async (api, privateKeyWrapper) => {
- alice = privateKeyWrapper('//Alice');
- randomAccount = generateKeyringPair();
- });
+ before(async () => {
+ await usingApi(async (api, privateKeyWrapper) => {
+ alice = privateKeyWrapper('//Alice');
+ randomAccount = generateKeyringPair();
+ });
- const acalaApiOptions: ApiOptions = {
- provider: new WsProvider('ws://127.0.0.1:' + ACALA_PORT),
- };
+ const acalaApiOptions: ApiOptions = {
+ provider: new WsProvider('ws://127.0.0.1:' + ACALA_PORT),
+ };
- // Acala side
- await usingApi(
- async (api) => {
- const destination = {
- V0: {
- X2: [
- 'Parent',
- {
- Parachain: UNIQUE_CHAIN,
- },
- ],
- },
- };
+ // Acala side
+ await usingApi(
+ async (api) => {
+ const destination = {
+ V0: {
+ X2: [
+ 'Parent',
+ {
+ Parachain: UNIQUE_CHAIN,
+ },
+ ],
+ },
+ };
- const metadata = {
- name: 'UNQ',
- symbol: 'UNQ',
- decimals: 18,
- minimalBalance: 1,
- };
+ const metadata = {
+ name: 'UNQ',
+ symbol: 'UNQ',
+ decimals: 18,
+ minimalBalance: 1,
+ };
- const tx = api.tx.assetRegistry.registerForeignAsset(destination, metadata);
- const sudoTx = api.tx.sudo.sudo(tx as any);
- const events = await submitTransactionAsync(alice, sudoTx);
- const result = getGenericResult(events);
- expect(result.success).to.be.true;
+ const tx = api.tx.assetRegistry.registerForeignAsset(destination, metadata);
+ const sudoTx = api.tx.sudo.sudo(tx as any);
+ const events = await submitTransactionAsync(alice, sudoTx);
+ const result = getGenericResult(events);
+ expect(result.success).to.be.true;
- const tx1 = api.tx.balances.transfer(randomAccount.address, 10000000000000n);
- const events1 = await submitTransactionAsync(alice, tx1);
- const result1 = getGenericResult(events1);
- expect(result1.success).to.be.true;
+ const tx1 = api.tx.balances.transfer(randomAccount.address, 10000000000000n);
+ const events1 = await submitTransactionAsync(alice, tx1);
+ const result1 = getGenericResult(events1);
+ expect(result1.success).to.be.true;
- [balanceAcalaTokenBefore] = await getBalance(api, [randomAccount.address]);
- {
- const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
- balanceUniqueForeignTokenBefore = BigInt(free);
- }
- },
- acalaApiOptions,
- );
+ [balanceAcalaTokenBefore] = await getBalance(api, [randomAccount.address]);
+ {
+ const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+ balanceUniqueForeignTokenBefore = BigInt(free);
+ }
+ },
+ acalaApiOptions,
+ );
- // Unique side
- await usingApi(async (api) => {
- const tx0 = api.tx.balances.transfer(randomAccount.address, 10n * TRANSFER_AMOUNT);
- const events0 = await submitTransactionAsync(alice, tx0);
- const result0 = getGenericResult(events0);
- expect(result0.success).to.be.true;
+ // Unique side
+ await usingApi(async (api) => {
+ const tx0 = api.tx.balances.transfer(randomAccount.address, 10n * TRANSFER_AMOUNT);
+ const events0 = await submitTransactionAsync(alice, tx0);
+ const result0 = getGenericResult(events0);
+ expect(result0.success).to.be.true;
- [balanceUniqueTokenBefore] = await getBalance(api, [randomAccount.address]);
- });
+ [balanceUniqueTokenBefore] = await getBalance(api, [randomAccount.address]);
});
+ });
- it('Should connect and send UNQ to Acala', async () => {
+ it('Should connect and send UNQ to Acala', async () => {
- // Unique side
- await usingApi(async (api) => {
+ // Unique side
+ await usingApi(async (api) => {
- const destination = {
- V0: {
- X2: [
- 'Parent',
- {
- Parachain: ACALA_CHAIN,
- },
- ],
- },
- };
+ const destination = {
+ V0: {
+ X2: [
+ 'Parent',
+ {
+ Parachain: ACALA_CHAIN,
+ },
+ ],
+ },
+ };
- const beneficiary = {
- V0: {
- X1: {
- AccountId32: {
- network: 'Any',
- id: randomAccount.addressRaw,
- },
+ const beneficiary = {
+ V0: {
+ X1: {
+ AccountId32: {
+ network: 'Any',
+ id: randomAccount.addressRaw,
},
},
- };
+ },
+ };
- const assets = {
- V1: [
- {
- id: {
- Concrete: {
- parents: 0,
- interior: 'Here',
- },
+ const assets = {
+ V1: [
+ {
+ id: {
+ Concrete: {
+ parents: 0,
+ interior: 'Here',
},
- fun: {
- Fungible: TRANSFER_AMOUNT,
- },
},
- ],
- };
+ fun: {
+ Fungible: TRANSFER_AMOUNT,
+ },
+ },
+ ],
+ };
- const feeAssetItem = 0;
+ const feeAssetItem = 0;
- const weightLimit = {
- Limited: 5000000000,
- };
+ const weightLimit = {
+ Limited: 5000000000,
+ };
- const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
- const events = await submitTransactionAsync(randomAccount, tx);
- const result = getGenericResult(events);
- expect(result.success).to.be.true;
+ const tx = api.tx.polkadotXcm.limitedReserveTransferAssets(destination, beneficiary, assets, feeAssetItem, weightLimit);
+ const events = await submitTransactionAsync(randomAccount, tx);
+ const result = getGenericResult(events);
+ expect(result.success).to.be.true;
- [balanceUniqueTokenAfter] = await getBalance(api, [randomAccount.address]);
+ [balanceUniqueTokenAfter] = await getBalance(api, [randomAccount.address]);
- const unqFees = balanceUniqueTokenBefore - balanceUniqueTokenAfter;
- console.log('[Unique -> Acala] transaction fees on Unique: %s UNQ', unqFees);
- expect(unqFees > 0n).to.be.true;
- });
+ const unqFees = balanceUniqueTokenBefore - balanceUniqueTokenAfter;
+ console.log('[Unique -> Acala] transaction fees on Unique: %s UNQ', unqFees);
+ expect(unqFees > 0n).to.be.true;
+ });
- // Acala side
- await usingApi(
- async (api) => {
- // todo do something about instant sealing, where there might not be any new blocks
- await waitNewBlocks(api, 3);
- const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
- balanceUniqueForeignTokenAfter = BigInt(free);
+ // Acala side
+ await usingApi(
+ async (api) => {
+ // todo do something about instant sealing, where there might not be any new blocks
+ await waitNewBlocks(api, 3);
+ const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+ balanceUniqueForeignTokenAfter = BigInt(free);
- [balanceAcalaTokenAfter] = await getBalance(api, [randomAccount.address]);
+ [balanceAcalaTokenAfter] = await getBalance(api, [randomAccount.address]);
- const acaFees = balanceAcalaTokenBefore - balanceAcalaTokenAfter;
- const unqDiffAfterIncomeTransfer = balanceUniqueForeignTokenAfter - balanceUniqueForeignTokenBefore;
+ const acaFees = balanceAcalaTokenBefore - balanceAcalaTokenAfter;
+ const unqDiffAfterIncomeTransfer = balanceUniqueForeignTokenAfter - balanceUniqueForeignTokenBefore;
- const unqFees = unqDiffAfterIncomeTransfer - TRANSFER_AMOUNT;
+ const unqFees = unqDiffAfterIncomeTransfer - TRANSFER_AMOUNT;
- console.log('[Unique -> Acala] transaction fees on Acala: %s ACA', acaFees);
- console.log('[Unique -> Acala] transaction fees on Acala: %s UNQ', unqFees);
- expect(acaFees == 0n).to.be.true;
- expect(unqFees == 0n).to.be.true;
- },
- {provider: new WsProvider('ws://127.0.0.1:' + ACALA_PORT)},
- );
- });
+ console.log('[Unique -> Acala] transaction fees on Acala: %s ACA', acaFees);
+ console.log('[Unique -> Acala] transaction fees on Acala: %s UNQ', unqFees);
+ expect(acaFees == 0n).to.be.true;
+ expect(unqFees == 0n).to.be.true;
+ },
+ {provider: new WsProvider('ws://127.0.0.1:' + ACALA_PORT)},
+ );
+ });
- it('Should connect to Acala and send UNQ back', async () => {
+ it('Should connect to Acala and send UNQ back', async () => {
- // Acala side
- await usingApi(
- async (api) => {
- const destination = {
- V1: {
- parents: 1,
- interior: {
- X2: [
- {Parachain: UNIQUE_CHAIN},
- {
- AccountId32: {
- network: 'Any',
- id: randomAccount.addressRaw,
- },
+ // Acala side
+ await usingApi(
+ async (api) => {
+ const destination = {
+ V1: {
+ parents: 1,
+ interior: {
+ X2: [
+ {Parachain: UNIQUE_CHAIN},
+ {
+ AccountId32: {
+ network: 'Any',
+ id: randomAccount.addressRaw,
},
- ],
- },
+ },
+ ],
},
- };
+ },
+ };
- const id = {
- ForeignAsset: 0,
- };
+ const id = {
+ ForeignAsset: 0,
+ };
- const amount = TRANSFER_AMOUNT;
- const destWeight = 50000000;
+ const amount = TRANSFER_AMOUNT;
+ const destWeight = 50000000;
- const tx = api.tx.xTokens.transfer(id, amount, destination, destWeight);
- const events = await submitTransactionAsync(randomAccount, tx);
- const result = getGenericResult(events);
- expect(result.success).to.be.true;
+ const tx = api.tx.xTokens.transfer(id, amount, destination, destWeight);
+ const events = await submitTransactionAsync(randomAccount, tx);
+ const result = getGenericResult(events);
+ expect(result.success).to.be.true;
- [balanceAcalaTokenFinal] = await getBalance(api, [randomAccount.address]);
- {
- const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
- balanceUniqueForeignTokenFinal = BigInt(free);
- }
+ [balanceAcalaTokenFinal] = await getBalance(api, [randomAccount.address]);
+ {
+ const {free} = (await api.query.tokens.accounts(randomAccount.addressRaw, {ForeignAsset: 0})).toJSON() as any;
+ balanceUniqueForeignTokenFinal = BigInt(free);
+ }
- const acaFees = balanceAcalaTokenAfter - balanceAcalaTokenFinal;
- const unqDiffAfterOutcomeTransfer = balanceUniqueForeignTokenAfter - TRANSFER_AMOUNT;
+ const acaFees = balanceAcalaTokenAfter - balanceAcalaTokenFinal;
+ const unqDiffAfterOutcomeTransfer = balanceUniqueForeignTokenAfter - TRANSFER_AMOUNT;
- const unqFees = unqDiffAfterOutcomeTransfer - balanceUniqueForeignTokenFinal;
+ const unqFees = unqDiffAfterOutcomeTransfer - balanceUniqueForeignTokenFinal;
- console.log('[Acala -> Unique] transaction fees on Acala: %s ACA', acaFees);
- console.log('[Acala -> Unique] transaction fees on Acala: %s UNQ', unqFees);
+ console.log('[Acala -> Unique] transaction fees on Acala: %s ACA', acaFees);
+ console.log('[Acala -> Unique] transaction fees on Acala: %s UNQ', unqFees);
- expect(acaFees > 0).to.be.true;
- expect(unqFees == 0n).to.be.true;
- },
- {provider: new WsProvider('ws://127.0.0.1:' + ACALA_PORT)},
- );
+ expect(acaFees > 0).to.be.true;
+ expect(unqFees == 0n).to.be.true;
+ },
+ {provider: new WsProvider('ws://127.0.0.1:' + ACALA_PORT)},
+ );
- // Unique side
- await usingApi(async (api) => {
- // todo do something about instant sealing, where there might not be any new blocks
- await waitNewBlocks(api, 3);
+ // Unique side
+ await usingApi(async (api) => {
+ // todo do something about instant sealing, where there might not be any new blocks
+ await waitNewBlocks(api, 3);
- [balanceUniqueTokenFinal] = await getBalance(api, [randomAccount.address]);
- const actuallyDelivered = balanceUniqueTokenFinal - balanceUniqueTokenAfter;
- expect(actuallyDelivered > 0).to.be.true;
+ [balanceUniqueTokenFinal] = await getBalance(api, [randomAccount.address]);
+ const actuallyDelivered = balanceUniqueTokenFinal - balanceUniqueTokenAfter;
+ expect(actuallyDelivered > 0).to.be.true;
- const unqFees = TRANSFER_AMOUNT - actuallyDelivered;
- console.log('[Acala -> Unique] transaction fees on Unique: %s UNQ', unqFees);
- expect(unqFees == 0n).to.be.true;
- });
+ const unqFees = TRANSFER_AMOUNT - actuallyDelivered;
+ console.log('[Acala -> Unique] transaction fees on Unique: %s UNQ', unqFees);
+ expect(unqFees == 0n).to.be.true;
});
});
+});