Commit 18becd7e authored by smartcontracts's avatar smartcontracts Committed by GitHub

fix(sdk): bug with unsupported fields (#8902)

Fixes a bug that was introduced in a recent fix. The input type
(TransactionRequest) sometimes has fields that are not supported by the
UnsignedTransaction type. This fix explicitly uses the fields of the
UnsignedTransaction type to resolve this issue.
parent 2fc5c84d
---
'@eth-optimism/sdk': patch
---
Fixes a bug in the SDK that would fail if unsupported fields were provided.
......@@ -72,7 +72,16 @@ export const estimateL1Gas = async (
const gpo = connectGasPriceOracle(l2Provider)
return gpo.getL1GasUsed(
serialize({
...tx,
to: tx.to,
gasLimit: tx.gasLimit,
gasPrice: tx.gasPrice,
maxFeePerGas: tx.maxFeePerGas,
maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
data: tx.data,
value: tx.value,
chainId: tx.chainId,
type: tx.type,
accessList: tx.accessList,
nonce: tx.nonce
? BigNumber.from(tx.nonce).toNumber()
: await getNonceForTx(l2Provider, tx),
......@@ -94,7 +103,16 @@ export const estimateL1GasCost = async (
const gpo = connectGasPriceOracle(l2Provider)
return gpo.getL1Fee(
serialize({
...tx,
to: tx.to,
gasLimit: tx.gasLimit,
gasPrice: tx.gasPrice,
maxFeePerGas: tx.maxFeePerGas,
maxPriorityFeePerGas: tx.maxPriorityFeePerGas,
data: tx.data,
value: tx.value,
chainId: tx.chainId,
type: tx.type,
accessList: tx.accessList,
nonce: tx.nonce
? BigNumber.from(tx.nonce).toNumber()
: await getNonceForTx(l2Provider, tx),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment