Documentation ¶
Index ¶
- Variables
- type Forwarder
- type ForwarderContract
- type ITXTransactor
- type MinimalForwarder
- func (c *MinimalForwarder) ChainId() *big.Int
- func (c *MinimalForwarder) ForwarderAddress() common.Address
- func (c *MinimalForwarder) ForwarderData(to *common.Address, data []byte, opts transactor.TransactOptions) ([]byte, error)
- func (c *MinimalForwarder) LockNonce()
- func (c *MinimalForwarder) UnlockNonce()
- func (c *MinimalForwarder) UnsafeIncreaseNonce()
- func (c *MinimalForwarder) UnsafeNonce() (*big.Int, error)
- type NonceStorer
- type RelayCaller
- type RelayTx
- type SignedRelayTx
- type Signer
Constants ¶
This section is empty.
Variables ¶
var ( DefaultTransactionOptions = transactor.TransactOptions{ GasLimit: 400000, GasPrice: big.NewInt(1), Priority: 1, Value: big.NewInt(0), } )
var ItxTxPriorities = map[uint8]string{
1: "slow",
2: "slow",
3: "fast",
}
itx only supports priority as string - we use uint8 to save on data currently we support only "slow" and "fast" - that's why 2 (medium) defaults to slow
Functions ¶
This section is empty.
Types ¶
type ForwarderContract ¶
type ITXTransactor ¶
type ITXTransactor struct {
// contains filtered or unexported fields
}
func NewITXTransactor ¶
func NewITXTransactor(relayCaller RelayCaller, forwarder Forwarder, signer Signer) *ITXTransactor
func (*ITXTransactor) Transact ¶
func (itx *ITXTransactor) Transact(to *common.Address, data []byte, opts transactor.TransactOptions) (*common.Hash, error)
Transact packs tx into a forwarded transaction, signs it and sends the relayed transaction to Infura ITX
type MinimalForwarder ¶
type MinimalForwarder struct {
// contains filtered or unexported fields
}
func NewMinimalForwarder ¶
func NewMinimalForwarder(chainID *big.Int, signer Signer, forwarderContract ForwarderContract, nonceStore NonceStorer) *MinimalForwarder
NewMinimalForwarder creates an instance of MinimalForwarder
func (*MinimalForwarder) ChainId ¶
func (c *MinimalForwarder) ChainId() *big.Int
func (*MinimalForwarder) ForwarderAddress ¶
func (c *MinimalForwarder) ForwarderAddress() common.Address
func (*MinimalForwarder) ForwarderData ¶
func (c *MinimalForwarder) ForwarderData(to *common.Address, data []byte, opts transactor.TransactOptions) ([]byte, error)
ForwarderData returns ABI packed and signed byte data for a forwarded transaction
func (*MinimalForwarder) LockNonce ¶
func (c *MinimalForwarder) LockNonce()
LockNonce locks mutex for nonce to prevent nonce duplication
func (*MinimalForwarder) UnlockNonce ¶
func (c *MinimalForwarder) UnlockNonce()
UnlockNonce unlocks mutext for nonce and stores nonce into storage.
Nonce is stored on unlock, because current nonce should always be the correct one when unlocking.
func (*MinimalForwarder) UnsafeIncreaseNonce ¶
func (c *MinimalForwarder) UnsafeIncreaseNonce()
UnsafeIncreaseNonce increases nonce value by 1. Should be used while nonce is locked.
func (*MinimalForwarder) UnsafeNonce ¶
func (c *MinimalForwarder) UnsafeNonce() (*big.Int, error)
UnsafeNonce returns current valid nonce for a forwarded transaction.
If nonce is not set, looks for nonce in storage and on contract and returns the higher one. Nonce in storage can be higher if there are pending transactions after relayer has been manually shutdown.
type NonceStorer ¶
type RelayCaller ¶
type SignedRelayTx ¶
type SignedRelayTx struct { *RelayTx // contains filtered or unexported fields }