Skip to main content

PendingNonceAt

PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.

warning

It requires connected wallet.

func PendingNonceAt() (nonce uint64, err error)
func main() {
setting := gas.AlchemySetting{
ApiKey: "api-key",
Network: types.EthMainnet,
}
alchemy := gas.NewAlchemy(setting)

w, _ := wallet.New("<privateKey>")
w.Connect(alchemy.GetProvider())
nonce, _ := w.PendingNonceAt()
}