Skip to content

Commit c0a4781

Browse files
committed
Enforce gas fee on recovery test
1 parent e4ff57c commit c0a4781

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/wallet/wdk/test/recovery.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import { Bytes, Hex, Mnemonic, Provider, RpcTransport } from 'ox'
44
import { Network, Payload } from '@0xsequence/wallet-primitives'
55
import { LOCAL_RPC_URL, newManager } from './constants'
66

7+
async function feeParams(provider: Provider.Provider) {
8+
const gasPrice = (await provider.request({ method: 'eth_gasPrice', params: [] as any })) as `0x${string}`
9+
return {
10+
maxFeePerGas: gasPrice,
11+
maxPriorityFeePerGas: '0x0' as const,
12+
}
13+
}
14+
715
describe('Recovery', () => {
816
it('Should execute a recovery', async () => {
917
const manager = newManager({
@@ -106,13 +114,15 @@ describe('Recovery', () => {
106114
const { to, data } = await manager.recovery.completePayload(requestId2)
107115

108116
// Send this transaction to anvil so we queue the payload
117+
const fees1 = await feeParams(provider)
109118
await provider.request({
110119
method: 'eth_sendTransaction',
111120
params: [
112121
{
113122
from: relayerFrom,
114123
to,
115124
data,
125+
...fees1,
116126
},
117127
],
118128
})
@@ -325,9 +335,10 @@ describe('Recovery', () => {
325335

326336
// Complete the recovery payload and send to blockchain
327337
const { to, data } = await manager.recovery.completePayload(requestId2)
338+
const fees2 = await feeParams(provider)
328339
await provider.request({
329340
method: 'eth_sendTransaction',
330-
params: [{ from: relayerFrom, to, data }],
341+
params: [{ from: relayerFrom, to, data, ...fees2 }],
331342
})
332343

333344
// Wait for payload to become valid
@@ -472,11 +483,12 @@ describe('Recovery', () => {
472483
await (signer as SignerReady).handle()
473484

474485
const { to, data } = await manager.recovery.completePayload(requestId)
486+
const fees = await feeParams(provider)
475487

476488
// Send transactions sequentially to avoid nonce conflicts
477489
await provider.request({
478490
method: 'eth_sendTransaction',
479-
params: [{ from: relayerFrom, to, data }],
491+
params: [{ from: relayerFrom, to, data, ...fees }],
480492
})
481493

482494
// Small delay to ensure transaction ordering

0 commit comments

Comments
 (0)