Documentation ¶
Overview ¶
Package nonce is the nonce manager
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainQuery ¶
type ChainQuery interface { // 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. PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) }
ChainQuery is a chain used to generate a nonce.
type Manager ¶
type Manager interface { // SignTx signs a legacy tx SignTx(ogTx *types.Transaction, signer types.Signer, prv *ecdsa.PrivateKey) (*types.Transaction, error) // NewKeyedTransactor wraps keyed transactor in a nonce manager. // right now, this only works if all txes are sent out (a safe assumption in test mode) // this can be obviated by signing at send time or loop + retrying on failure NewKeyedTransactor(realSigner *bind.TransactOpts) (*bind.TransactOpts, error) // NewKeyedTransactorFromKey creates a new keyed transactor from a private key. NewKeyedTransactorFromKey(key *ecdsa.PrivateKey) (*bind.TransactOpts, error) // GetNextNonce gets the next nonce for the address. GetNextNonce(address common.Address) (*big.Int, error) // ClearNonce clears the nonce for the address. ClearNonce(address common.Address) }
Manager is a singleton used to generate a nonce. This can be explicitly overrided by setting a nonce manually (not recommended). The issue here is many of the deploy helper functions are called asynchronously and there's a gap between the tx.Sequence generation and the transactor. This solves that by wrapping the transactor in a nonce manager.
func NewNonceManager ¶
NewNonceManager generates a new nonce manager. This should be called once, as nonce storage is not global.
Click to show internal directories.
Click to hide internal directories.