From 686b7bd51dff8ef3a6dc91edc46fe407d2c832e6 Mon Sep 17 00:00:00 2001 From: rkv Date: Tue, 04 Oct 2022 14:07:48 +0000 Subject: [PATCH] fix: use newBlocks from playgrounds --- --- a/tests/src/eth/collectionAdmin.test.ts +++ b/tests/src/eth/collectionAdmin.test.ts @@ -16,24 +16,10 @@ import {IKeyringPair} from '@polkadot/types/types'; import {usingEthPlaygrounds, itEth, expect, EthUniqueHelper} from './util/playgrounds'; -async function waitNewBlocks(helper: EthUniqueHelper, count: number) { - // eslint-disable-next-line no-async-promise-executor - return new Promise(async (resolve) => { - const unsubscribe = await helper.callRpc('api.rpc.chain.subscribeNewHeads', [() => { - if (count > 0) { - count--; - } else { - unsubscribe(); - resolve(); - } - }]); - }); -} - async function recordEthFee(helper: EthUniqueHelper, userAddress: string, call: () => Promise) { const before = await helper.balance.getSubstrate(helper.address.ethToSubstrate(userAddress)); await call(); - waitNewBlocks(helper, 1); + await helper.wait.newBlocks(1); const after = await helper.balance.getSubstrate(helper.address.ethToSubstrate(userAddress)); expect(after < before).to.be.true; -- gitstuff