Documentation
¶
Index ¶
- func MetaTxnStatusFromString(s string) sequence.MetaTxnStatus
- type Client
- func (r *Client) Client() proto.RelayerClient
- func (r *Client) FeeOptions(ctx context.Context, signedTxs *sequence.SignedTransactions) ([]*sequence.RelayerFeeOption, *sequence.RelayerFeeQuote, error)
- func (r *Client) GetChainID(ctx context.Context) (*big.Int, error)
- func (r *Client) GetNonce(ctx context.Context, walletConfig core.WalletConfig, ...) (*big.Int, error)
- func (r *Client) GetProvider() *ethrpc.Provider
- func (r *Client) IsDeployTransaction(signedTxs *sequence.SignedTransactions) bool
- func (r *Client) Relay(ctx context.Context, signedTxs *sequence.SignedTransactions, ...) (sequence.MetaTxnID, *types.Transaction, ethtxn.WaitReceipt, error)
- func (r *Client) Simulate(ctx context.Context, wallet common.Address, transactions sequence.Transactions) ([]*sequence.SimulateResult, error)
- func (r *Client) Wait(ctx context.Context, metaTxnID sequence.MetaTxnID, optTimeout ...time.Duration) (sequence.MetaTxnStatus, *types.Receipt, error)
- type FeeQuote
- type LocalRelayer
- func (r *LocalRelayer) Client() proto.RelayerClient
- func (r *LocalRelayer) FeeOptions(ctx context.Context, signedTxs *sequence.SignedTransactions) ([]*sequence.RelayerFeeOption, *sequence.RelayerFeeQuote, error)
- func (r *LocalRelayer) GetNonce(ctx context.Context, walletConfig core.WalletConfig, ...) (*big.Int, error)
- func (r *LocalRelayer) GetProvider() *ethrpc.Provider
- func (r *LocalRelayer) IsDeployTransaction(signedTxs *sequence.SignedTransactions) bool
- func (r *LocalRelayer) Relay(ctx context.Context, signedTxs *sequence.SignedTransactions, ...) (sequence.MetaTxnID, *types.Transaction, ethtxn.WaitReceipt, error)
- func (r *LocalRelayer) Simulate(ctx context.Context, wallet common.Address, transactions sequence.Transactions) ([]*sequence.SimulateResult, error)
- func (r *LocalRelayer) Wait(ctx context.Context, metaTxnID sequence.MetaTxnID, optTimeout ...time.Duration) (sequence.MetaTxnStatus, *types.Receipt, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MetaTxnStatusFromString ¶ added in v0.29.0
func MetaTxnStatusFromString(s string) sequence.MetaTxnStatus
Types ¶
type Client ¶ added in v0.60.8
func NewClient ¶ added in v0.60.8
func NewClient(relayerURL string, projectAccessKey string, rpcProvider *ethrpc.Provider, clientOptions ...Options) (*Client, error)
NewClient creates a new Sequence Relayer client instance for a specific chain. Please see https://sequence.build to get a `projectAccessKey`, which is your project's access key used to communicate with Sequence services.
NOTE: the `projectAccessKey` may be optional if you're using a JWT auth token passed in via the `clientOptions`.
The `relayerURL` is the URL of the relayer service to connect to, for example: https://mainnet-relayer.sequence.app for Ethereum mainnet and https://polygon-relayer.sequence.app for Polygon mainnet. See https://docs.sequence.xyz for a complete list of relayer urls.
The `rpcProvider` is an instance of ethrpc.Provider that is used to communicate with the underlying blockchain network. This is required for certain operations, such as fetching the chain ID and wallet nonces. You may pass in `nil` if you don't need those methods.
Finally, you may pass in optional `clientOptions` to configure the relayer client with jwt-based authentication, a receipts listener, and a custom HTTP client.
func (*Client) Client ¶ added in v0.60.8
func (r *Client) Client() proto.RelayerClient
func (*Client) FeeOptions ¶ added in v0.60.8
func (*Client) GetChainID ¶ added in v0.60.8
func (*Client) GetNonce ¶ added in v0.60.8
func (r *Client) GetNonce(ctx context.Context, walletConfig core.WalletConfig, walletContext sequence.WalletContext, space *big.Int, blockNum *big.Int) (*big.Int, error)
NOTE: nonce space is 160 bits wide
func (*Client) GetProvider ¶ added in v0.60.8
func (*Client) IsDeployTransaction ¶ added in v0.60.8
func (*Client) Relay ¶ added in v0.60.8
func (r *Client) Relay(ctx context.Context, signedTxs *sequence.SignedTransactions, quote ...*sequence.RelayerFeeQuote) (sequence.MetaTxnID, *types.Transaction, ethtxn.WaitReceipt, error)
Relay will submit the Sequence signed meta transaction to the relayer. The method will block until the relayer responds with the native transaction hash (*types.Transaction), which means the relayer has submitted the transaction request to the network. Clients can use WaitReceipt to wait until the metaTxnID has been mined.
type FeeQuote ¶ added in v0.60.0
type FeeQuote struct {
TransactionDigest common.Hash
IsWhitelisted bool
GasSponsor *uint64
GasTank *uint64
GasUsage *uint64
GasPrice *big.Int
NativePrice *big.Int
TokenPrices map[string]*big.Int
ExpiresAt *time.Time
Signature []byte
}
type LocalRelayer ¶
LocalRelayer is a simple implementation of a relayer which will dispatch meta transactions locally. This should only be used for testing / debugging, and never seriously in a real app.
func NewLocalRelayer ¶
func NewLocalRelayer(sender *ethwallet.Wallet, receiptListener *ethreceipts.ReceiptsListener) (*LocalRelayer, error)
func (*LocalRelayer) Client ¶ added in v0.29.0
func (r *LocalRelayer) Client() proto.RelayerClient
func (*LocalRelayer) FeeOptions ¶ added in v0.29.1
func (r *LocalRelayer) FeeOptions(ctx context.Context, signedTxs *sequence.SignedTransactions) ([]*sequence.RelayerFeeOption, *sequence.RelayerFeeQuote, error)
func (*LocalRelayer) GetProvider ¶
func (r *LocalRelayer) GetProvider() *ethrpc.Provider
func (*LocalRelayer) IsDeployTransaction ¶ added in v0.29.0
func (r *LocalRelayer) IsDeployTransaction(signedTxs *sequence.SignedTransactions) bool
func (*LocalRelayer) Relay ¶
func (r *LocalRelayer) Relay(ctx context.Context, signedTxs *sequence.SignedTransactions, quote ...*sequence.RelayerFeeQuote) (sequence.MetaTxnID, *types.Transaction, ethtxn.WaitReceipt, error)
type Options ¶ added in v0.25.1
type Options struct {
// JWTAuthToken is an optional JWT token to authenticate with the relayer service.
JWTAuthToken string
// Receipts listener is an optional ethreceipts.ReceiptsListener instance to use for fetching
// transaction receipts. If unspecified, the relayer client will poll the relayer service for
// transaction receipts instead.
ReceiptsListener *ethreceipts.ReceiptsListener
// HTTPClient is an optional custom HTTP client to use for communicating with the
// relayer service.
HTTPClient proto.HTTPClient
}