Hey everyone!
Has anyone else faced issues when using js-soroban-cllient regarding the sequence number?
In the snippet below, we're creating a soroban transaction and during this process we fetch the accoung using getAccount, build the transaction and then use the prepareTransaction before moving on to submit it.
During these steps, on the first console.log we can see the envelope correctly has the right sequence number for the next valid transaction, while at the second console.log the sequence number has been incremented once more, which is just 1 above the right sequence.
Yesterday while testing we noticed that sometimes the asynchrony was even larger, up to +3 numbers of difference. I wonder if it could be the case that when preparing the transaction it is updated with information from the RPC server that is not correctly synchronized.
Additional info:
We're using testnet with the RPC https://soroban-testnet.stellar.org:443
Snippet:
...
const sourceAccount = await server.getAccount(
'GA7FLYHBEVVZK6NCR7I3Y352VW4D7UNALTIZF4GDLULHA3P2CH5LM56D'
)
const transaction = new SorobanClient.TransactionBuilder(sourceAccount, {
fee: sorobanConfig.fee,
networkPassphrase: sorobanConfig.network.passphrase,
})
.addOperation(operation)
.setTimeout(sorobanConfig.txTimeout)
.build()
console.log(transaction.toXDR())
try {
const preparedTransaction = await server.prepareTransaction(transaction)
console.log(preparedTransaction.toXDR())
... proceed to submit