Skip to content

Commit

Permalink
fix asset-transfer test
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed May 9, 2024
1 parent 08330c3 commit 94c2675
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions e2e_tests/xc-transfer/asset-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ async function run(nodeName: string, networkInfo: any, _jsArgs: any) {
const assertRegionXBalance = async (address: string, balance: bigint) => {
const { free } = (
await regionXApi.query.tokens.accounts(address, RELAY_ASSET_ID)
).toHuman() as any;
).toJSON() as any;

console.log(`RegionX: ${free}`);
assert(balance - BigInt(free.toString().replace(/,/g, "")) < TOLERANCE);
console.log(`RegionX: ${BigInt(free).toString()} | Expected: ${balance}`);
assert(balance - BigInt(free) < TOLERANCE);
};

const assertRococoBalance = async (address: string, balance: bigint) => {
const {
data: { free },
} = (await rococoApi.query.system.account(address)).toHuman() as any;
} = (await rococoApi.query.system.account(address)).toJSON() as any;

console.log(`Rococo: ${free}`);
assert(balance - BigInt(free.toString().replace(/,/g, "")) < TOLERANCE);
console.log(`Rococo: ${BigInt(free).toString()} | Expected: ${balance}`);
assert(balance - BigInt(free) < TOLERANCE);
};

await assertRegionXBalance(alice.address, 10n ** 12n);
Expand Down Expand Up @@ -86,7 +86,7 @@ async function run(nodeName: string, networkInfo: any, _jsArgs: any) {

await sleep(5 * 1000);

await assertRegionXBalance(alice.address, 4n * 10n ** 12n);
await assertRegionXBalance(alice.address, 3n * 10n ** 12n);
await assertRococoBalance(alice.address, 10n ** 18n - 3n * 10n ** 12n);
}

Expand Down

0 comments on commit 94c2675

Please sign in to comment.