Documentation ¶
Index ¶
- Constants
- func GetEIP712DomainSeparator(name, version string, chainID *big.Int, address ethcommon.Address) ([32]byte, error)
- func GetForwardRequestDigestToSign(req ForwardRequest, domainSeparator [32]byte, suffixData []byte) ([32]byte, error)
- func GetFunctionSignature(fn string) []byte
- type ForwardRequest
- type Forwarder
- type Key
- type SubmitTransactionRequest
- type SubmitTransactionResponse
Constants ¶
const DefaultEthEndpoint = "http://localhost:8545"
DefaultEthEndpoint is the default local ethereum endpoint.
Variables ¶
This section is empty.
Functions ¶
func GetEIP712DomainSeparator ¶
func GetEIP712DomainSeparator( name, version string, chainID *big.Int, address ethcommon.Address, ) ([32]byte, error)
GetEIP712DomainSeparator ... Note: address = forwarder contract address
func GetForwardRequestDigestToSign ¶
func GetForwardRequestDigestToSign( req ForwardRequest, domainSeparator [32]byte, suffixData []byte, ) ([32]byte, error)
GetForwardRequestDigestToSign returns a 32-byte digest for signing
func GetFunctionSignature ¶
GetFunctionSignature returns the 4-byte function signature of a Solidity function.
Types ¶
type ForwardRequest ¶
type ForwardRequest interface { // FromSubmitTransactionRequest set the type underlying the ForwardRequest // using a *SubmitTransactionRequest. // // Note: not all fields in the *SubmitTransactionRequest need be used depending // on the implementation. FromSubmitTransactionRequest(*SubmitTransactionRequest) // Pack uses ABI encoding to pack the underlying ForwardRequest, appending // optional `suffixData` to the end. // // See examples/gsn_forwarder/IForwarderForwardRequest.Pack() or // examples/minimal_forwarder/IMinimalForwarderForwardRequest.Pack() // for details. Pack(suffixData []byte) ([]byte, error) }
ForwardRequest must be implemented by a request type used by a forwarder contract.
See `examples/gsn_forwarder/request.go` or `examples/minimal_forwarder/request.go` for examples.
type Forwarder ¶
type Forwarder interface { GetNonce(opts *bind.CallOpts, from ethcommon.Address) (*big.Int, error) Verify( opts *bind.CallOpts, req ForwardRequest, domainSeparator, requestTypeHash [32]byte, suffixData, signature []byte, ) (bool, error) Execute( opts *bind.TransactOpts, req ForwardRequest, domainSeparator, requestTypeHash [32]byte, suffixData, signature []byte, ) (*types.Transaction, error) NewEmptyForwardRequest() ForwardRequest }
Forwarder must be implemented by a forwarder contract used by a *relayer.Relayer. These methods are wrappers around the methods auto-generated by abigen.
See `examples/gsn_forwarder/i_forwarder_wrapped.go` or `examples/minimal_forwarder/i_minimal_forwarder_wrapped.go`for examples.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key represents an Ethereum public-private keypair.
func GenerateKey ¶
GenerateKey returns a new randomly-generated *Key.
func NewKeyFromPrivateKey ¶
func NewKeyFromPrivateKey(priv *ecdsa.PrivateKey) *Key
NewKeyFromPrivateKey returns a new *Key from the given private key.
func NewKeyFromPrivateKeyString ¶
NewKeyFromPrivateKeyString returns a new *Key given a hex-encoded private key.
func (*Key) PrivateKey ¶
func (k *Key) PrivateKey() *ecdsa.PrivateKey
PrivateKey returns the key's private key.
type SubmitTransactionRequest ¶
type SubmitTransactionRequest struct { From ethcommon.Address `json:"from"` To ethcommon.Address `json:"to"` Value *big.Int `json:"value"` Gas *big.Int `json:"gas"` Nonce *big.Int `json:"nonce"` Data []byte `json:"data"` Signature []byte `json:"signature"` // GSN-specific ValidUntilTime *big.Int `json:"validUntilTime,omitempty"` DomainSeparator [32]byte `json:"domainSeparator,omitempty"` RequestTypeHash [32]byte `json:"requestTypeHash,omitempty"` SuffixData []byte `json:"suffixData,omitempty"` }
SubmitTransactionRequest represents a request for a relayer to submit a transaction on the sender's behalf. It contains all the necessary info for the relayer to construct a forward request.
func NewGSNSubmitTransactionRequest ¶
func NewGSNSubmitTransactionRequest( from, to ethcommon.Address, value, gas, nonce *big.Int, data, signature []byte, validUntilTime *big.Int, domainSeparator, requestTypeHash [32]byte, suffixData []byte, ) *SubmitTransactionRequest
NewGSNSubmitTransactionRequest returns a SubmitTransactionRequest containing all the information needed for a GSN Forwarder forward request.
func NewMinimalSubmitTransactionRequest ¶
func NewMinimalSubmitTransactionRequest( from, to ethcommon.Address, value, gas, nonce *big.Int, data, signature []byte, ) *SubmitTransactionRequest
NewMinimalSubmitTransactionRequest returns a SubmitTransactionRequest containing all the information needed for a MinimalForwarder forward request.
type SubmitTransactionResponse ¶
SubmitTransactionResponse is returned by a relayer upon successful transaction submission. It contains the transaction hash.