1234567891011121314151617import {expect, itEth, usingEthPlaygrounds} from '@unique/test-utils/eth/util.js';18import type {IKeyringPair} from '@polkadot/types/types';192021describe('Ethereum native RPC calls', () => {22 let donor: IKeyringPair;23 const NATIVE_TOKEN_ADDRESS = '0x17c4e6453cc49aaaaeaca894e6d9683e00000000';2425 before(async function() {26 await usingEthPlaygrounds(async (_, privateKey) => {27 donor = await privateKey({url: import.meta.url});28 });29 });3031 itEth('estimate gas', async ({helper}) => {32 const BALANCE = 100n;33 const BALANCE_TO_TRANSFER = 90n;3435 const owner = await helper.eth.createAccountWithBalance(donor, BALANCE);36 const recepient = helper.eth.createAccount();3738 const web3 = helper.getWeb3();39 40 const data = web3.eth.abi.encodeFunctionCall({41 name: 'transfer',42 type: 'function',43 inputs: [{44 type: 'address',45 name: 'to',46 },{47 type: 'uint256',48 name: 'amount',49 }],50 }, [recepient, (BALANCE_TO_TRANSFER * (10n ** 18n)).toString()]);5152 const estimateGas = await web3.eth.estimateGas({53 to: NATIVE_TOKEN_ADDRESS,54 value: '0x0',55 data,56 from: owner,57 maxFeePerGas: '0x14c9338c61d',58 });5960 expect(estimateGas).to.be.greaterThan(35000).and.to.be.lessThan(50000);61 });62});