-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Description
// AccountNonce returns the current nonce of the account. This is the nonce to
// be used while building a new transaction.
func (client *Client) AccountNonce(ctx context.Context, addr address.Address) (pack.U256, error) {
targetAddr, err := NewAddressFromHex(string(pack.String(addr)))
if err != nil {
return pack.U256{}, fmt.Errorf("bad to address '%v': %v", addr, err)
}
nonce, err := client.EthClient.NonceAt(ctx, common.Address(targetAddr), nil)
if err != nil {
return pack.U256{}, fmt.Errorf("failed to get nonce for '%v': %v", addr, err)
}
return pack.NewU256FromU64(pack.NewU64(nonce)), nil
}Shouldn't this function use PendingNonceAt? After all, the comment above says that it should be used to craft the next Tx, but in Ethereum docs (https://pkg.go.dev/github.com/ethereum/go-ethereum/ethclient#Client.PendingNonceAt) it says to use PendingNonceAt. Any thoughts?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels