Skip to content

Commit 5701603

Browse files
committed
cmd/common: Fetch nonce from staking backend
1 parent 3888347 commit 5701603

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

cmd/common/transaction.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,14 @@ func SignConsensusTransaction(
168168

169169
// Query nonce if not specified.
170170
if !txOffline && tx.Nonce == invalidNonce {
171-
var nonce uint64
172-
nonce, err = conn.Consensus().GetSignerNonce(ctx, &consensus.GetSignerNonceRequest{
173-
AccountAddress: account.Address().ConsensusAddress(),
174-
Height: consensus.HeightLatest,
171+
account, err := conn.Consensus().Staking().Account(ctx, &staking.OwnerQuery{
172+
Height: consensus.HeightLatest,
173+
Owner: account.Address().ConsensusAddress(),
175174
})
176175
if err != nil {
177-
return nil, fmt.Errorf("failed to query nonce: %w", err)
176+
return nil, fmt.Errorf("failed to query account: %w", err)
178177
}
179-
tx.Nonce = nonce
178+
tx.Nonce = account.General.Nonce
180179
}
181180

182181
// If we are using offline mode and either nonce or gas limit is not specified, abort.

0 commit comments

Comments
 (0)