sequence.js
sequence.js copied to clipboard
[@0xsequence/relayer] prepareTransactions doesn't work with undeployed wallets
When calling prepareTransactions
from base-relayer for the first transactions of an undeployed sequence wallet, this error was thrown
Uncaught Error: Unable to prepare transactions without a defined nonce
My approach was that I firstly signed the txns using wallet.signTransactions
and then passed the attributes from the signed Transactions to prepareTransactions
.
I found the issue was in these LOC
const nonce = readSequenceNonce(...transactions)
if (!nonce) {
throw new Error('Unable to prepare transactions without a defined nonce')
}
The transaction produced by signTransactions has the nonce of 0
instead of BigNumber { 0x0 }
hence this check !nonce
is true for both undefined
and 0
values.
How can I do differently to use this prepareTransactions
for the first txns?
Thanks for your report, could you please add what version of sequence.js you encountered this error on?
Also, can you try calling:
await wallet.sendSignedTransactions(signedTransactions)
directly to see if that resolves your issue?
could you please add what version of sequence.js you encountered this error on?
I'm tested against v0.42.8
await wallet.sendSignedTransactions(signedTransactions)
This successfully deploy the wallet and execute the given transaction. However I wanted to get the output data to pass to our local relayer in another process instead of executing it immediately. Hence I needed the prepareTransactions
output.
Can you please try is copying this: https://github.com/0xsequence/sequence.js/blob/114d881a5125cdd2cf2faf9ec750397831fd3e3a/packages/relayer/src/rpc-relayer/index.ts#L189-L197. This code should give you to
(the "to" address) and input
(the calldata).
(Replace this
with your BaseRelayer if necessary.)
Thanks for the suggestion. I already gave it a try and it worked well. I guess the !nonce
check with 0
value is a bug with prepareTransactions
then.