1234567891011121314151617import type {IKeyringPair} from '@polkadot/types/types';18import {itEth, usingEthPlaygrounds, expect} from '@unique/test-utils/eth/util.js';1920describe('Eth fees are correct', () => {21 let donor: IKeyringPair;22 let minter: IKeyringPair;23 let alice: IKeyringPair;2425 before(async () => {26 await usingEthPlaygrounds(async (helper, privateKey) => {27 donor = await privateKey({url: import.meta.url});28 [minter, alice] = await helper.arrange.createAccounts([100n, 200n], donor);29 });30 });313233 itEth('web3 fees are the same as evm.call fees', async ({helper}) => {34 const collection = await helper.nft.mintCollection(minter, {});3536 const owner = await helper.eth.createAccountWithBalance(donor);37 const receiver = await helper.eth.createAccountWithBalance(donor);38 const aliceEth = helper.address.substrateToEth(alice.address);3940 const {tokenId: tokenA} = await collection.mintToken(minter, {Ethereum: owner});41 const {tokenId: tokenB} = await collection.mintToken(minter, {Ethereum: aliceEth});4243 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);44 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);4546 const balanceBeforeWeb3Transfer = await helper.balance.getEthereum(owner);47 await contract.methods.transfer(receiver, tokenA).send({from: owner, maxFeePerGas: ((await helper.eth.getGasPrice())!).toString()});48 const balanceAfterWeb3Transfer = await helper.balance.getEthereum(owner);49 const web3Diff = balanceBeforeWeb3Transfer - balanceAfterWeb3Transfer;5051 const encodedCall = contract.methods.transfer(receiver, tokenB)52 .encodeABI();5354 const balanceBeforeEvmCall = await helper.balance.getSubstrate(alice.address);55 await helper.eth.sendEVM(56 alice,57 collectionAddress,58 encodedCall,59 '0',60 );61 const balanceAfterEvmCall = await helper.balance.getSubstrate(alice.address);62 const evmCallDiff = balanceBeforeEvmCall - balanceAfterEvmCall;6364 expect(web3Diff).to.be.equal(evmCallDiff);65 });66});