Skip to content

Commit ae1b0e2

Browse files
committed
fix test
1 parent 08de36b commit ae1b0e2

File tree

1 file changed

+10
-28
lines changed
  • packages/eth-providers/src/__tests__/e2e

1 file changed

+10
-28
lines changed

packages/eth-providers/src/__tests__/e2e/tx.test.ts

+10-28
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { AcalaEvmTX, parseTransaction, serializeTransaction, signTransaction } from '@acala-network/eth-transactions';
22
import { BigNumber } from '@ethersproject/bignumber';
33
import { Contract } from '@ethersproject/contracts';
4-
import { EvmRpcProvider } from '../../rpc-provider';
54
import { Interface, parseUnits } from 'ethers/lib/utils';
65
import { Wallet } from '@ethersproject/wallet';
76
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
8-
import { calcEthereumTransactionParams, sendTx, sleep } from '../../utils';
9-
import { computeDefaultSubstrateAddress } from '../../utils/address';
107
import { createTestPairs } from '@polkadot/keyring/testingPairs';
118
import ACAABI from '@acala-network/contracts/build/contracts/Token.json';
129
import ADDRESS from '@acala-network/contracts/utils/MandalaAddress';
1310
import dotenv from 'dotenv';
11+
12+
import { EvmRpcProvider } from '../../rpc-provider';
13+
import { calcEthereumTransactionParams, sendTx, sleep } from '../../utils';
14+
import { computeDefaultSubstrateAddress } from '../../utils/address';
1415
import evmAccounts from '../evmAccounts';
15-
import type { UInt } from '@polkadot/types';
1616

1717
dotenv.config();
1818

@@ -38,8 +38,8 @@ describe('transaction tests', () => {
3838
await provider.isReady();
3939

4040
chainId = await provider.chainId();
41-
storageByteDeposit = (provider.api.consts.evm.storageDepositPerByte as UInt).toBigInt();
42-
txFeePerGas = (provider.api.consts.evm.txFeePerGas as UInt).toBigInt();
41+
storageByteDeposit = provider.api.consts.evm.storageDepositPerByte.toBigInt();
42+
txFeePerGas = provider.api.consts.evm.txFeePerGas.toBigInt();
4343

4444
({ txGasLimit, txGasPrice } = calcEthereumTransactionParams({
4545
gasLimit: 2100001n,
@@ -167,7 +167,7 @@ describe('transaction tests', () => {
167167
...partialDeployTx,
168168
type: 0,
169169
});
170-
const receipt = await response.wait(0);
170+
const receipt = await response.wait();
171171

172172
expect(receipt.type).equal(0);
173173
expect(receipt.status).equal(1);
@@ -195,7 +195,7 @@ describe('transaction tests', () => {
195195
expect(parsedTx.maxFeePerGas).equal(undefined);
196196

197197
const response = await provider.sendTransaction(rawTx);
198-
const receipt = await response.wait(0);
198+
const receipt = await response.wait();
199199

200200
expect(receipt.type).equal(0); // TODO: should be null, need to fix getPartialTransactionReceipt
201201
expect(receipt.status).equal(1);
@@ -283,7 +283,7 @@ describe('transaction tests', () => {
283283
const acaContract = new Contract(ADDRESS.ACA, ACAABI.abi, wallet1);
284284
const iface = new Interface(ACAABI.abi);
285285
const queryBalance = async (addr: string): Promise<BigNumber> => acaContract.balanceOf(addr);
286-
const transferAmount = parseUnits('100', ACADigits);
286+
const transferAmount = parseUnits('1.243', ACADigits);
287287
let partialTransferTX: any;
288288

289289
beforeAll(() => {
@@ -302,24 +302,6 @@ describe('transaction tests', () => {
302302
expect(computeDefaultSubstrateAddress(account2.evmAddress)).to.equal(account2.defaultSubstrateAddress);
303303
});
304304

305-
describe('with provider', () => {
306-
it('has correct balance after transfer', async () => {
307-
const pairs = createTestPairs();
308-
const alice = pairs.alice;
309-
310-
const oneAca = 10n ** BigInt(ACADigits);
311-
const amount = 1000n * oneAca;
312-
const balance = await queryBalance(account1.evmAddress);
313-
314-
const extrinsic = provider.api.tx.balances.transfer(account1.defaultSubstrateAddress, amount);
315-
await extrinsic.signAsync(alice);
316-
await sendTx(provider.api, extrinsic);
317-
318-
const _balance = await queryBalance(account1.evmAddress);
319-
expect(_balance.sub(balance).toBigInt()).equal(amount);
320-
});
321-
});
322-
323305
describe('with legacy EIP-155 signature', () => {
324306
it('has correct balance after transfer', async () => {
325307
const _balance1 = await queryBalance(account1.evmAddress);
@@ -334,7 +316,7 @@ describe('transaction tests', () => {
334316
const _parsedTx = parseTransaction(rawTx);
335317

336318
const response = await provider.sendTransaction(rawTx);
337-
const _receipt = await response.wait(0);
319+
const _receipt = await response.wait();
338320

339321
const __balance1 = await queryBalance(account1.evmAddress);
340322
const _balance2 = await queryBalance(account2.evmAddress);

0 commit comments

Comments
 (0)