Skip to content

Commit

Permalink
Added some polling to getBalance.
Browse files Browse the repository at this point in the history
Signed-off-by: ebadiere <[email protected]>
  • Loading branch information
ebadiere committed Aug 29, 2023
1 parent 76ab030 commit 2433e27
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/hts-precompile/token-transfer/tokenTransferContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ describe('TokenTransferContract Test Suite', function () {
Constants.GAS_LIMIT_1_000_000
)

let wallet1BalanceAfter = await pollForNewERC20Balance(erc20Contract, tokenAddress, signers[0].address, wallet1BalanceBefore)
const wallet1BalanceAfter = await pollForNewERC20Balance(erc20Contract, tokenAddress, signers[0].address, wallet1BalanceBefore)

let wallet2BalanceAfter = await erc20Contract.balanceOf(
const wallet2BalanceAfter = await erc20Contract.balanceOf(
tokenAddress,
signers[1].address
)
Expand Down Expand Up @@ -441,10 +441,9 @@ describe('TokenTransferContract Test Suite', function () {
const signers1AfterHbarBalance = await signers[0].provider.getBalance(
signers[1].address
)
const signers0AfterTokenBalance = await erc20Contract.balanceOf(
tokenAddress,
signers[0].address
)

const signers0AfterTokenBalance = await pollForNewERC20Balance(erc20Contract, tokenAddress, signers[0].address, signers0BeforeHbarBalance)

const signers1AfterTokenBalance = await erc20Contract.balanceOf(
tokenAddress,
signers[1].address
Expand Down Expand Up @@ -486,3 +485,7 @@ async function pollForNewERC20Balance(erc20Contract, tokenAddress, signersAddres

throw new Error(`erc20Contract.balanceOf failed to get a different value after ${timesToTry} tries`);
}

function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

0 comments on commit 2433e27

Please sign in to comment.