Skip to content

Commit

Permalink
add test (but it doesn't work yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Aug 1, 2023
1 parent 70cda15 commit 0787ace
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/utils/transaction/prepareRequest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,42 @@ describe('prepareRequest', () => {
`)
})

test('zero base fee', async () => {
await setup()
await setNextBlockBaseFeePerGas(testClient, {
baseFeePerGas: 0n,
})

const {
maxFeePerGas,
nonce: _nonce,
...rest
} = await prepareRequest(walletClient, {
account: privateKeyToAccount(sourceAccount.privateKey),
to: targetAccount.address,
value: parseEther('1'),
})
expect(maxFeePerGas).toEqual(0n)
expect(rest).toMatchInlineSnapshot(`
{
"account": {
"address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"publicKey": "0x048318535b54105d4a7aae60c08fc45f9687181b4fdfc625bd1a753fa7397fed753547f11ca8696646f2f3acb08e31016afac23e630c5d11f59f61fef57b0d2aa5",
"signMessage": [Function],
"signTransaction": [Function],
"signTypedData": [Function],
"source": "privateKey",
"type": "local",
},
"from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"gas": 21000n,
"maxPriorityFeePerGas": 1500000000n,
"to": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
"value": 1000000000000000000n,
}
`)
})

test('legacy fees', async () => {
await setup()

Expand Down

0 comments on commit 0787ace

Please sign in to comment.