relayer

package
v0.60.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

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

type Client struct {
	proto.Relayer
	// contains filtered or unexported fields
}

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 (r *Client) FeeOptions(ctx context.Context, signedTxs *sequence.SignedTransactions) ([]*sequence.RelayerFeeOption, *sequence.RelayerFeeQuote, error)

func (*Client) GetChainID added in v0.60.8

func (r *Client) GetChainID(ctx context.Context) (*big.Int, error)

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 (r *Client) GetProvider() *ethrpc.Provider

func (*Client) IsDeployTransaction added in v0.60.8

func (r *Client) IsDeployTransaction(signedTxs *sequence.SignedTransactions) bool

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.

func (*Client) Simulate added in v0.60.8

func (r *Client) Simulate(ctx context.Context, wallet common.Address, transactions sequence.Transactions) ([]*sequence.SimulateResult, error)

func (*Client) Wait added in v0.60.8

func (r *Client) Wait(ctx context.Context, metaTxnID sequence.MetaTxnID, optTimeout ...time.Duration) (sequence.MetaTxnStatus, *types.Receipt, error)

....

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
}

func (*FeeQuote) Message added in v0.60.0

func (q *FeeQuote) Message() ([]byte, error)

func (*FeeQuote) Sign added in v0.60.0

func (q *FeeQuote) Sign(wallet *ethwallet.Wallet, validFor time.Duration) error

func (*FeeQuote) Verify added in v0.60.0

func (q *FeeQuote) Verify(wallet *ethwallet.Wallet) error

func (*FeeQuote) VerifySignedBy added in v0.60.0

func (q *FeeQuote) VerifySignedBy(expectedAddresses ...common.Address) error

VerifySignedBy verifies the quote against one or more expected signer addresses

type LocalRelayer

type LocalRelayer struct {
	Sender *ethwallet.Wallet
	// contains filtered or unexported fields
}

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) GetNonce

func (r *LocalRelayer) GetNonce(ctx context.Context, walletConfig core.WalletConfig, walletContext sequence.WalletContext, space *big.Int, blockNum *big.Int) (*big.Int, 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)

func (*LocalRelayer) Simulate added in v0.13.0

func (r *LocalRelayer) Simulate(ctx context.Context, wallet common.Address, transactions sequence.Transactions) ([]*sequence.SimulateResult, error)

func (*LocalRelayer) Wait

func (r *LocalRelayer) Wait(ctx context.Context, metaTxnID sequence.MetaTxnID, optTimeout ...time.Duration) (sequence.MetaTxnStatus, *types.Receipt, 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
}

Directories

Path Synopsis
sequence-relayer v0.4.1 62fe2b49d57c4a0d3960ac1176d48ecfffc7af5a -- Code generated by webrpc-gen@v0.26.0 with golang generator.
sequence-relayer v0.4.1 62fe2b49d57c4a0d3960ac1176d48ecfffc7af5a -- Code generated by webrpc-gen@v0.26.0 with golang generator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL