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"
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) }
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
func NewKeyFromPrivateKeyString ¶
NewKeyFromPrivateKeyString returns a new *Key given a hex-encoded private key.
func (*Key) PrivateKey ¶
func (k *Key) PrivateKey() *ecdsa.PrivateKey
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"` }