Skip to content

Commit

Permalink
bugfix/prepareTx (#56)
Browse files Browse the repository at this point in the history
* replace client.prepareTransactionRequest w/ customProvider calls

* lint
  • Loading branch information
zeroXbrock authored Jul 17, 2024
1 parent 86dc9d5 commit 10caf97
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/chains/suave/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,23 @@ function newSuaveWallet<TTransport extends Transport>(params: {
console.warn('no gas provided, using default 30000000')
return 30000000n
})()
const preparedTx = await this.customProvider.prepareTransactionRequest({
account: client.account,
...txRequest,
gas,
})
const gasPrice =
preparedTx.gasPrice ?? (await this.customProvider.getGasPrice())

const from = txRequest.from ?? client.account.address

return {
...txRequest,
from: txRequest.from ?? preparedTx.from,
nonce: txRequest.nonce ?? preparedTx.nonce,
gas: txRequest.gas ?? preparedTx.gas,
gasPrice: txRequest.gasPrice ?? gasPrice,
from,
nonce:
txRequest.nonce ??
(await this.customProvider.getTransactionCount({ address: from })),
gas,
gasPrice:
txRequest.gasPrice ?? (await this.customProvider.getGasPrice()),
chainId: txRequest.chainId ?? suaveRigil.id,
type:
txRequest.type ?? txRequest.kettleAddress
? SuaveTxRequestTypes.ConfidentialRequest
: '0x0',
}
},

Expand Down

0 comments on commit 10caf97

Please sign in to comment.