I want to send OZ Defender Relay EIP-1559 transactions and only specify the maxFeePerGas
. I want to leave it up to the Alchemy node to calculate the maxPriorityFeePerGas
based on the baseFee
and the maxFeePerGas
. See the Alchemy docs about this.
Environment
I'm using the Defender Relayer to send transactions on behalf of users. We pay the gas fees for them and want to keep the fees bounded, so we have a preference to control the maxFeePerGas
and care a bit less about how quickly a transaction makes it into a block.
We use these packages:
ethers@5.6.1
defender-relay-client@1.37.0
defender-base-client@1.37.0
Details
I am trying to send transactions to the relayer using EIP-1559. I only want to set the maxFeePerGas
and leave maxPriorityFeePerGas
unset. I'm using the ethers.js Defender Relayer client because then I can easily wait on the transaction to be mined and use my standard ethers.js tooling that I've built elsewhere.
Looking at DefenderRelaySigner.sendTransaction
, it seems that if I do not set both maxFeePerGas
and maxPriorityFeePerGas
then it looks like it won't even recognize that I specified the maxFeePerGas
and it will recompute both the maxFeePerGas
and the maxPriorityFeePerGas
.
Is there any way to set just the maxFeePerGas
? I prefer to use the Ethers.js Defender Relay client, but I can switch to another Defender Relay client.
Code to reproduce
import { Relayer, RelayerTransaction } from 'defender-relay-client'
import { ApiRelayerParams } from 'defender-relay-client/lib'
import { ForwarderV1__factory } from '@supercoolxyz/checkout-contracts'
const relayerParams: ApiRelayerParams = {
apiKey: 'my key',
apiSecret: 'my secret',
}
const forwarderAddress = '0xdeadbeef'
const provider = new DefenderRelayProvider(relayerParams)
const signer = new DefenderRelaySigner(relayerParams, provider)
const forwarder = ForwarderV1__factory.connect(forwarderAddress, signer)
const ethersMintReq = {
// This is irrelevant. Use any typechain contract and its respective
// arguments.
// ...
}
const tx = await forwarder.forwardMint(ethersMintReq, {
value: ethersMintReq.value,
gasPrice: gasPrice,
maxFeePerGas: maxFeePerGas,
maxPriorityFeePerGas: maxPriorityFeePerGas,
gasLimit: gasLimit
})