proto

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

sequence-relayer v0.4.1 e4df7ceb0987a6b6fd6a61d65e57a0a072b101aa -- Code generated by webrpc-gen@v0.18.7 with golang generator. DO NOT EDIT.

webrpc-gen -schema=relayer.ridl -target=golang -pkg=proto -client -out=./clients/relayer.gen.go

Index

Constants

View Source
const RelayerPathPrefix = "/rpc/Relayer/"

Variables

View Source
var (
	HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"}
	HTTPRequestCtxKey              = &contextKey{"HTTPRequest"}

	ServiceNameCtxKey = &contextKey{"ServiceName"}

	MethodNameCtxKey = &contextKey{"MethodName"}
)
View Source
var (
	ErrWebrpcEndpoint           = WebRPCError{Code: 0, Name: "WebrpcEndpoint", Message: "endpoint error", HTTPStatus: 400}
	ErrWebrpcRequestFailed      = WebRPCError{Code: -1, Name: "WebrpcRequestFailed", Message: "request failed", HTTPStatus: 400}
	ErrWebrpcBadRoute           = WebRPCError{Code: -2, Name: "WebrpcBadRoute", Message: "bad route", HTTPStatus: 404}
	ErrWebrpcBadMethod          = WebRPCError{Code: -3, Name: "WebrpcBadMethod", Message: "bad method", HTTPStatus: 405}
	ErrWebrpcBadRequest         = WebRPCError{Code: -4, Name: "WebrpcBadRequest", Message: "bad request", HTTPStatus: 400}
	ErrWebrpcBadResponse        = WebRPCError{Code: -5, Name: "WebrpcBadResponse", Message: "bad response", HTTPStatus: 500}
	ErrWebrpcServerPanic        = WebRPCError{Code: -6, Name: "WebrpcServerPanic", Message: "server panic", HTTPStatus: 500}
	ErrWebrpcInternalError      = WebRPCError{Code: -7, Name: "WebrpcInternalError", Message: "internal error", HTTPStatus: 500}
	ErrWebrpcClientDisconnected = WebRPCError{Code: -8, Name: "WebrpcClientDisconnected", Message: "client disconnected", HTTPStatus: 400}
	ErrWebrpcStreamLost         = WebRPCError{Code: -9, Name: "WebrpcStreamLost", Message: "stream lost", HTTPStatus: 400}
	ErrWebrpcStreamFinished     = WebRPCError{Code: -10, Name: "WebrpcStreamFinished", Message: "stream finished", HTTPStatus: 200}
)

Webrpc errors

View Source
var (
	ErrUnauthorized     = WebRPCError{Code: 1000, Name: "Unauthorized", Message: "Unauthorized access", HTTPStatus: 401}
	ErrPermissionDenied = WebRPCError{Code: 1001, Name: "PermissionDenied", Message: "Permission denied", HTTPStatus: 403}
	ErrMethodNotFound   = WebRPCError{Code: 1003, Name: "MethodNotFound", Message: "Method not found", HTTPStatus: 404}
	ErrAborted          = WebRPCError{Code: 1005, Name: "Aborted", Message: "Request aborted", HTTPStatus: 400}
	ErrGeoblocked       = WebRPCError{Code: 1006, Name: "Geoblocked", Message: "Geoblocked region", HTTPStatus: 451}
	ErrInvalidArgument  = WebRPCError{Code: 2001, Name: "InvalidArgument", Message: "Invalid argument", HTTPStatus: 400}
	ErrUnavailable      = WebRPCError{Code: 2002, Name: "Unavailable", Message: "Unavailable resource", HTTPStatus: 400}
	ErrQueryFailed      = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400}
	ErrNotFound         = WebRPCError{Code: 3000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400}
	ErrInsufficientFee  = WebRPCError{Code: 3004, Name: "InsufficientFee", Message: "Insufficient fee", HTTPStatus: 402}
)

Schema errors

View Source
var ETHTxnStatus_name = map[uint]string{
	0: "UNKNOWN",
	1: "DROPPED",
	2: "QUEUED",
	3: "SENT",
	4: "SUCCEEDED",
	5: "PARTIALLY_FAILED",
	6: "FAILED",
}
View Source
var ETHTxnStatus_value = map[string]uint{
	"UNKNOWN":          0,
	"DROPPED":          1,
	"QUEUED":           2,
	"SENT":             3,
	"SUCCEEDED":        4,
	"PARTIALLY_FAILED": 5,
	"FAILED":           6,
}
View Source
var FeeTokenType_name = map[uint32]string{
	0: "UNKNOWN",
	1: "ERC20_TOKEN",
	2: "ERC1155_TOKEN",
}
View Source
var FeeTokenType_value = map[string]uint32{
	"UNKNOWN":       0,
	"ERC20_TOKEN":   1,
	"ERC1155_TOKEN": 2,
}
View Source
var SortOrder_name = map[uint32]string{
	0: "DESC",
	1: "ASC",
}
View Source
var SortOrder_value = map[string]uint32{
	"DESC": 0,
	"ASC":  1,
}
View Source
var TransferType_name = map[uint32]string{
	0: "SEND",
	1: "RECEIVE",
	2: "BRIDGE_DEPOSIT",
	3: "BRIDGE_WITHDRAW",
	4: "BURN",
	5: "UNKNOWN",
}
View Source
var TransferType_value = map[string]uint32{
	"SEND":            0,
	"RECEIVE":         1,
	"BRIDGE_DEPOSIT":  2,
	"BRIDGE_WITHDRAW": 3,
	"BURN":            4,
	"UNKNOWN":         5,
}
View Source
var WebRPCServices = map[string][]string{
	"Relayer": {
		"Ping",
		"Version",
		"RuntimeStatus",
		"GetSequenceContext",
		"GetChainID",
		"SendMetaTxn",
		"GetMetaTxnNonce",
		"GetMetaTxnReceipt",
		"Simulate",
		"UpdateMetaTxnGasLimits",
		"FeeTokens",
		"FeeOptions",
		"GetMetaTxnNetworkFeeOptions",
		"GetMetaTransactions",
		"SentTransactions",
		"PendingTransactions",
		"GetGasTank",
		"AddGasTank",
		"UpdateGasTank",
		"GetGasSponsor",
		"AddressGasSponsors",
		"ListGasSponsors",
		"AddGasSponsor",
		"UpdateGasSponsor",
		"RemoveGasSponsor",
		"ReportGasSponsorUsage",
		"NextGasTankBalanceAdjustmentNonce",
		"AdjustGasTankBalance",
		"GetGasTankBalanceAdjustment",
		"ListGasTankBalanceAdjustments",
	},
}

Functions

func HTTPRequestHeaders

func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)

func MethodNameFromContext added in v0.31.0

func MethodNameFromContext(ctx context.Context) string

func RequestFromContext added in v0.31.0

func RequestFromContext(ctx context.Context) *http.Request

func ServiceNameFromContext added in v0.31.0

func ServiceNameFromContext(ctx context.Context) string

func WebRPCSchemaHash

func WebRPCSchemaHash() string

Schema hash generated from your RIDL schema

func WebRPCSchemaVersion

func WebRPCSchemaVersion() string

Schema version of your RIDL schema

func WebRPCVersion

func WebRPCVersion() string

WebRPC description and code-gen version

func WithHTTPRequestHeaders

func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)

Types

type ETHTxnStatus

type ETHTxnStatus uint
const (
	ETHTxnStatus_UNKNOWN ETHTxnStatus = 0
	// txn rejected by relayer
	ETHTxnStatus_DROPPED ETHTxnStatus = 1
	// txn accepted by relayer, waiting to be sent
	ETHTxnStatus_QUEUED ETHTxnStatus = 2
	// txn sent, waiting for txn to be mined
	ETHTxnStatus_SENT ETHTxnStatus = 3
	// txn mined, all txns in the bundle succeeded
	ETHTxnStatus_SUCCEEDED ETHTxnStatus = 4
	// txn mined, but some txns in the bundle failed
	ETHTxnStatus_PARTIALLY_FAILED ETHTxnStatus = 5
	// txn mined, but all txns in the bundle failed
	ETHTxnStatus_FAILED ETHTxnStatus = 6
)

func (*ETHTxnStatus) Is added in v0.31.0

func (x *ETHTxnStatus) Is(values ...ETHTxnStatus) bool

func (ETHTxnStatus) MarshalText added in v0.31.0

func (x ETHTxnStatus) MarshalText() ([]byte, error)

func (ETHTxnStatus) String

func (x ETHTxnStatus) String() string

func (*ETHTxnStatus) UnmarshalText added in v0.31.0

func (x *ETHTxnStatus) UnmarshalText(b []byte) error

type FeeOption

type FeeOption struct {
	Token    *FeeToken `json:"token"`
	To       string    `json:"to"`
	Value    string    `json:"value"`
	GasLimit uint      `json:"gasLimit"`
}

type FeeToken

type FeeToken struct {
	ChainId         uint64       `json:"chainId"`
	Name            string       `json:"name"`
	Symbol          string       `json:"symbol"`
	Type            FeeTokenType `json:"type"`
	Decimals        *uint32      `json:"decimals"`
	LogoURL         string       `json:"logoURL"`
	ContractAddress *string      `json:"contractAddress"`
	TokenID         *string      `json:"tokenID"`
}

type FeeTokenType added in v0.4.12

type FeeTokenType uint32
const (
	FeeTokenType_UNKNOWN       FeeTokenType = 0
	FeeTokenType_ERC20_TOKEN   FeeTokenType = 1
	FeeTokenType_ERC1155_TOKEN FeeTokenType = 2
)

func (*FeeTokenType) Is added in v0.31.0

func (x *FeeTokenType) Is(values ...FeeTokenType) bool

func (FeeTokenType) MarshalText added in v0.31.0

func (x FeeTokenType) MarshalText() ([]byte, error)

func (FeeTokenType) String added in v0.4.12

func (x FeeTokenType) String() string

func (*FeeTokenType) UnmarshalText added in v0.31.0

func (x *FeeTokenType) UnmarshalText(b []byte) error

type GasSponsor added in v0.13.0

type GasSponsor struct {
	ID        uint64        `json:"id" db:"id,omitempty"`
	GasTankID uint64        `json:"gasTankId" db:"gas_tank_id,omitempty"`
	ProjectID uint64        `json:"projectId" db:"project_id"`
	Address   prototyp.Hash `json:"address" db:"address"`
	Name      string        `json:"name" db:"name"`
	Active    bool          `json:"active" db:"active"`
	UpdatedAt *time.Time    `json:"updatedAt" db:"updated_at,omitempty"`
	CreatedAt *time.Time    `json:"createdAt" db:"created_at,omitempty"`
	DeletedAt *time.Time    `json:"-" db:"deleted_at,omitempty"`
}

type GasSponsorUsage added in v0.13.0

type GasSponsorUsage struct {
	Name            string          `json:"name" db:"name"`
	ID              uint64          `json:"id" db:"gas_sponsor_id,omitempty"`
	TotalGasUsed    int64           `json:"totalGasUsed" db:"total_gas_used"`
	TotalTxnFees    float64         `json:"totalTxnFees" db:"total_txn_fees"`
	TotalTxnFeesUSD decimal.Decimal `json:"totalTxnFeesUsd" db:"total_txn_fees_usd"`
	AvgGasPrice     float64         `json:"avgGasPrice" db:"avg_gas_price"`
	TotalTxns       int64           `json:"totalTxns" db:"total_txns"`
	StartTime       *time.Time      `json:"startTime"`
	EndTime         *time.Time      `json:"endTime"`
}

type GasTank added in v0.29.1

type GasTank struct {
	ID              uint64          `json:"id" db:"id,omitempty"`
	Name            string          `json:"name" db:"name"`
	CurrentBalance  decimal.Decimal `json:"currentBalance" db:"current_balance"`
	Unlimited       bool            `json:"unlimited" db:"unlimited"`
	FeeMarkupFactor decimal.Decimal `json:"feeMarkupFactor" db:"fee_markup_factor"`
	UpdatedAt       *time.Time      `json:"updatedAt" db:"updated_at,omitempty"`
	CreatedAt       *time.Time      `json:"createdAt" db:"created_at,omitempty"`
}

type GasTankBalanceAdjustment added in v0.29.1

type GasTankBalanceAdjustment struct {
	GasTankID        uint64          `json:"gasTankId" db:"gas_tank_id"`
	Nonce            uint64          `json:"nonce" db:"nonce"`
	Amount           decimal.Decimal `json:"amount" db:"amount"`
	TotalBalance     decimal.Decimal `json:"totalBalance" db:"total_balance"`
	BalanceTimestamp time.Time       `json:"balanceTimestamp" db:"balance_timestamp"`
	CreatedAt        *time.Time      `json:"createdAt" db:"created_at,omitempty"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

type MetaTxn

type MetaTxn struct {
	WalletAddress string `json:"walletAddress" db:"wallet_address"`
	// TODO (later): rename this to `to: string`
	Contract string `json:"contract" db:"to_address"`
	// TODO: rename to 'execdata'
	Input string `json:"input" db:"tx_data"`
}

TODO: rename this to MetaTxnRaw (eventually), we can leave it for now to not break compat or name it, MetaTxnArgs ..?

type MetaTxnEntry added in v0.4.12

type MetaTxnEntry struct {
	ID              uint64        `json:"id" db:"id,omitempty"`
	MetaTxnID       string        `json:"metaTxnID" db:"metatx_logs_id"`
	TxnStatus       ETHTxnStatus  `json:"txnStatus" db:"status"`
	TxnRevertReason string        `json:"txnRevertReason" db:"revert_reason"`
	Index           uint64        `json:"index" db:"index"`
	Logs            []interface{} `json:"logs" db:"logs,omitempty"`
	UpdatedAt       *time.Time    `json:"updatedAt" db:"updated_at,omitempty"`
	CreatedAt       *time.Time    `json:"createdAt" db:"created_at,omitempty"`
}

TODO: review

type MetaTxnLog added in v0.4.12

type MetaTxnLog struct {
	ID        uint64 `json:"id" db:"id,omitempty"`
	ProjectID uint64 `json:"projectId" db:"project_id"`
	// this is optional, but we don't specify txnHash?: string,
	// otherwise it sets go.field.type to pointer-type which we dont want.
	TxnHash prototyp.HashMaybe `json:"txnHash" db:"txn_hash"`
	// TODO: this should be txnNonce?: string, but pgx giving issues
	// with *prototyp.BigInt scanning
	TxnNonce        prototyp.BigInt `json:"txnNonce" db:"txn_nonce"`
	MetaTxnID       *string         `json:"metaTxnID" db:"meta_txn_id"`
	TxnStatus       ETHTxnStatus    `json:"txnStatus" db:"txn_status"`
	TxnRevertReason string          `json:"txnRevertReason" db:"txn_revert_reason"`
	Requeues        uint            `json:"requeues" db:"requeues"`
	QueuedAt        *time.Time      `json:"queuedAt" db:"queued_at,omitempty"`
	SentAt          *time.Time      `json:"sentAt" db:"sent_at,omitempty"`
	MinedAt         *time.Time      `json:"minedAt" db:"mined_at,omitempty"`
	Target          prototyp.Hash   `json:"target" db:"target"`
	Input           prototyp.Hash   `json:"input" db:"input"`
	// TODO: review this field.. we may not want it.. what goes in here..? is it just
	// the input/target from MetaTxn above? we already have these as separate columns..
	TxnArgs       map[string]interface{} `json:"txnArgs" db:"txn_args"`
	TxnReceipt    map[string]interface{} `json:"txnReceipt" db:"txn_receipt,omitempty"`
	WalletAddress prototyp.Hash          `json:"walletAddress" db:"wallet_address"`
	MetaTxnNonce  prototyp.BigInt        `json:"metaTxnNonce" db:"metatx_nonce"`
	GasLimit      uint64                 `json:"gasLimit" db:"gas_limit"`
	GasPrice      prototyp.BigInt        `json:"gasPrice" db:"gas_price"`
	GasUsed       uint64                 `json:"gasUsed" db:"gas_used"`
	GasEstimated  uint64                 `json:"gasEstimated" db:"gas_estimated"`
	GasFeeMarkup  *uint64                `json:"gasFeeMarkup" db:"gas_fee_markup"`
	UsdRate       prototyp.BigInt        `json:"usdRate" db:"usd_rate"`
	CreditsUsed   uint64                 `json:"creditsUsed" db:"credits_used"`
	IsWhitelisted bool                   `json:"isWhitelisted" db:"is_whitelisted,omitempty"`
	GasSponsor    *uint64                `json:"gasSponsor" db:"gas_sponsor_id,omitempty"`
	GasTank       *uint64                `json:"gasTank" db:"gas_tank_id,omitempty"`
	UpdatedAt     *time.Time             `json:"updatedAt" db:"updated_at,omitempty"`
	CreatedAt     *time.Time             `json:"createdAt" db:"created_at,omitempty"`
}

TODO: review

type MetaTxnReceipt

type MetaTxnReceipt struct {
	ID           string               `json:"id"`
	Status       string               `json:"status"`
	RevertReason *string              `json:"revertReason"`
	Index        uint                 `json:"index"`
	Logs         []*MetaTxnReceiptLog `json:"logs"`
	Receipts     []*MetaTxnReceipt    `json:"receipts"`
	TxnReceipt   string               `json:"txnReceipt"`
}

type MetaTxnReceiptLog added in v0.4.12

type MetaTxnReceiptLog struct {
	Address string   `json:"address"`
	Topics  []string `json:"topics"`
	Data    string   `json:"data"`
}

type NumTxnsRelayed added in v0.29.1

type NumTxnsRelayed struct {
	Prev    uint64 `json:"prev"`
	Current uint64 `json:"current"`
	Period  uint64 `json:"period"`
}

type Page added in v0.4.12

type Page struct {
	// Common for both numbered pages and cursor: Number of items per page
	PageSize *uint32 `json:"pageSize"`
	// Numbered pages: Page number, this is multiplied by the value of the <pageSize> parameter.
	Page *uint32 `json:"page"`
	More *bool   `json:"more"`
	// Number of total items on this query.
	TotalRecords *uint64 `json:"totalRecords"`
	// Cursor: column to compare before/after to
	Column *string `json:"column"`
	// Cursor: return column < before - include to get previous page
	Before *interface{} `json:"before"`
	// Cursor: return column > after - include to get next page
	After *interface{} `json:"after"`
	// Sorting filter
	Sort []*SortBy `json:"sort"`
}

Page represents a results page. This can be used both to request a page and to store the state of a page.

type Relayer

type Relayer interface {
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	GetSequenceContext(ctx context.Context) (*SequenceContext, error)
	// TODO: return a string instead
	GetChainID(ctx context.Context) (uint64, error)
	//
	// Transactions
	//
	// TODO (future): rename this to just, 'SendTransaction(txn: MetaTransaction)' or 'SendTransaction(txn: SignedTransaction)', or something..
	// TODO: rename return txnHash: string to metaTxnID: string
	SendMetaTxn(ctx context.Context, call *MetaTxn, quote *string) (bool, string, error)
	GetMetaTxnNonce(ctx context.Context, walletContractAddress string, space *string) (string, error)
	// TODO: one day, make GetMetaTxnReceipt respond immediately with receipt or not
	// and add WaitTransactionReceipt method, which will block and wait, similar to how GetMetaTxnReceipt
	// is implemented now.
	// For backwards compat, we can leave the current GetMetaTxnReceipt how it is, an deprecate it, and introduce
	// new, GetTransactionReceipt and WaitTransactionReceipt methods
	// we can also accept metaTxnId and txnHash .. so can take either or.. I wonder if ERC-4337 has any convention on this?
	GetMetaTxnReceipt(ctx context.Context, metaTxID string) (*MetaTxnReceipt, error)
	Simulate(ctx context.Context, wallet string, transactions string) ([]*SimulateResult, error)
	// TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
	UpdateMetaTxnGasLimits(ctx context.Context, walletAddress string, walletConfig interface{}, payload string) (string, error)
	FeeTokens(ctx context.Context) (bool, []*FeeToken, error)
	FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool) ([]*FeeOption, bool, *string, error)
	// TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
	GetMetaTxnNetworkFeeOptions(ctx context.Context, walletConfig interface{}, payload string) ([]*FeeOption, error)
	GetMetaTransactions(ctx context.Context, projectId uint64, gasTankId uint64, page *Page) (*Page, []*MetaTxnLog, error)
	// Sent transactions from an account. If filter is omitted then it will return all transactions.
	SentTransactions(ctx context.Context, filter *SentTransactionsFilter, page *Page) (*Page, []*Transaction, error)
	// Pending transactions waiting to be mined for an account. This endpoint is just a sugar of `SentTransactions`
	// with the filter set to pending: true.
	PendingTransactions(ctx context.Context, page *Page) (*Page, []*Transaction, error)
	GetGasTank(ctx context.Context, id uint64) (*GasTank, error)
	AddGasTank(ctx context.Context, name string, feeMarkupFactor float64, unlimited *bool) (bool, *GasTank, error)
	UpdateGasTank(ctx context.Context, id uint64, name *string, feeMarkupFactor *float64, unlimited *bool) (bool, *GasTank, error)
	GetGasSponsor(ctx context.Context, id uint64) (*GasSponsor, error)
	AddressGasSponsors(ctx context.Context, address string, page *Page) (*Page, []*GasSponsor, error)
	ListGasSponsors(ctx context.Context, projectId uint64, gasTankId uint64, page *Page) (*Page, []*GasSponsor, error)
	AddGasSponsor(ctx context.Context, projectId uint64, gasTankId uint64, address string, name *string, active *bool) (bool, *GasSponsor, error)
	UpdateGasSponsor(ctx context.Context, id uint64, name *string, active *bool) (bool, *GasSponsor, error)
	RemoveGasSponsor(ctx context.Context, id uint64) (bool, error)
	ReportGasSponsorUsage(ctx context.Context, projectId uint64, gasTankId uint64, startTime *time.Time, endTime *time.Time) ([]*GasSponsorUsage, error)
	NextGasTankBalanceAdjustmentNonce(ctx context.Context, id uint64) (uint64, error)
	AdjustGasTankBalance(ctx context.Context, id uint64, nonce uint64, amount float64) (bool, *GasTankBalanceAdjustment, error)
	GetGasTankBalanceAdjustment(ctx context.Context, id uint64, nonce uint64) (*GasTankBalanceAdjustment, error)
	ListGasTankBalanceAdjustments(ctx context.Context, id uint64, page *Page) (*Page, []*GasTankBalanceAdjustment, error)
}

type RelayerClient added in v0.31.0

type RelayerClient interface {
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	GetSequenceContext(ctx context.Context) (*SequenceContext, error)
	// TODO: return a string instead
	GetChainID(ctx context.Context) (uint64, error)
	//
	// Transactions
	//
	// TODO (future): rename this to just, 'SendTransaction(txn: MetaTransaction)' or 'SendTransaction(txn: SignedTransaction)', or something..
	// TODO: rename return txnHash: string to metaTxnID: string
	SendMetaTxn(ctx context.Context, call *MetaTxn, quote *string) (bool, string, error)
	GetMetaTxnNonce(ctx context.Context, walletContractAddress string, space *string) (string, error)
	// TODO: one day, make GetMetaTxnReceipt respond immediately with receipt or not
	// and add WaitTransactionReceipt method, which will block and wait, similar to how GetMetaTxnReceipt
	// is implemented now.
	// For backwards compat, we can leave the current GetMetaTxnReceipt how it is, an deprecate it, and introduce
	// new, GetTransactionReceipt and WaitTransactionReceipt methods
	// we can also accept metaTxnId and txnHash .. so can take either or.. I wonder if ERC-4337 has any convention on this?
	GetMetaTxnReceipt(ctx context.Context, metaTxID string) (*MetaTxnReceipt, error)
	Simulate(ctx context.Context, wallet string, transactions string) ([]*SimulateResult, error)
	// TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
	UpdateMetaTxnGasLimits(ctx context.Context, walletAddress string, walletConfig interface{}, payload string) (string, error)
	FeeTokens(ctx context.Context) (bool, []*FeeToken, error)
	FeeOptions(ctx context.Context, wallet string, to string, data string, simulate *bool) ([]*FeeOption, bool, *string, error)
	// TODO: deprecated, to be removed by https://github.com/0xsequence/stack/pull/356 at a later date
	GetMetaTxnNetworkFeeOptions(ctx context.Context, walletConfig interface{}, payload string) ([]*FeeOption, error)
	GetMetaTransactions(ctx context.Context, projectId uint64, gasTankId uint64, page *Page) (*Page, []*MetaTxnLog, error)
	// Sent transactions from an account. If filter is omitted then it will return all transactions.
	SentTransactions(ctx context.Context, filter *SentTransactionsFilter, page *Page) (*Page, []*Transaction, error)
	// Pending transactions waiting to be mined for an account. This endpoint is just a sugar of `SentTransactions`
	// with the filter set to pending: true.
	PendingTransactions(ctx context.Context, page *Page) (*Page, []*Transaction, error)
	GetGasTank(ctx context.Context, id uint64) (*GasTank, error)
	AddGasTank(ctx context.Context, name string, feeMarkupFactor float64, unlimited *bool) (bool, *GasTank, error)
	UpdateGasTank(ctx context.Context, id uint64, name *string, feeMarkupFactor *float64, unlimited *bool) (bool, *GasTank, error)
	GetGasSponsor(ctx context.Context, id uint64) (*GasSponsor, error)
	AddressGasSponsors(ctx context.Context, address string, page *Page) (*Page, []*GasSponsor, error)
	ListGasSponsors(ctx context.Context, projectId uint64, gasTankId uint64, page *Page) (*Page, []*GasSponsor, error)
	AddGasSponsor(ctx context.Context, projectId uint64, gasTankId uint64, address string, name *string, active *bool) (bool, *GasSponsor, error)
	UpdateGasSponsor(ctx context.Context, id uint64, name *string, active *bool) (bool, *GasSponsor, error)
	RemoveGasSponsor(ctx context.Context, id uint64) (bool, error)
	ReportGasSponsorUsage(ctx context.Context, projectId uint64, gasTankId uint64, startTime *time.Time, endTime *time.Time) ([]*GasSponsorUsage, error)
	NextGasTankBalanceAdjustmentNonce(ctx context.Context, id uint64) (uint64, error)
	AdjustGasTankBalance(ctx context.Context, id uint64, nonce uint64, amount float64) (bool, *GasTankBalanceAdjustment, error)
	GetGasTankBalanceAdjustment(ctx context.Context, id uint64, nonce uint64) (*GasTankBalanceAdjustment, error)
	ListGasTankBalanceAdjustments(ctx context.Context, id uint64, page *Page) (*Page, []*GasTankBalanceAdjustment, error)
}

func NewRelayerClient

func NewRelayerClient(addr string, client HTTPClient) RelayerClient

type RuntimeChecks added in v0.5.6

type RuntimeChecks struct {
}

type RuntimeStatus

type RuntimeStatus struct {
	// overall status, true/false
	HealthOK       bool            `json:"healthOK"`
	StartTime      time.Time       `json:"startTime"`
	Uptime         uint64          `json:"uptime"`
	Ver            string          `json:"ver"`
	Branch         string          `json:"branch"`
	CommitHash     string          `json:"commitHash"`
	UseEIP1559     bool            `json:"useEIP1559"`
	Senders        []*SenderStatus `json:"senders"`
	Checks         *RuntimeChecks  `json:"checks"`
	NumTxnsRelayed *NumTxnsRelayed `json:"numTxnsRelayed"`
}

type SenderStatus added in v0.5.6

type SenderStatus struct {
	Index        uint32  `json:"index"`
	Address      string  `json:"address"`
	EtherBalance float64 `json:"etherBalance"`
	Active       bool    `json:"active"`
}

type SentTransactionsFilter added in v0.4.12

type SentTransactionsFilter struct {
	Pending *bool `json:"pending"`
	Failed  *bool `json:"failed"`
}

type SequenceContext

type SequenceContext struct {
	Factory              string `json:"factory"`
	MainModule           string `json:"mainModule"`
	MainModuleUpgradable string `json:"mainModuleUpgradable"`
	GuestModule          string `json:"guestModule"`
	Utils                string `json:"utils"`
}

type SimulateResult added in v0.13.0

type SimulateResult struct {
	Executed  bool    `json:"executed"`
	Succeeded bool    `json:"succeeded"`
	Result    *string `json:"result"`
	Reason    *string `json:"reason"`
	GasUsed   uint    `json:"gasUsed"`
	GasLimit  uint    `json:"gasLimit"`
}

type SortBy added in v0.4.12

type SortBy struct {
	Column string    `json:"column"`
	Order  SortOrder `json:"order"`
}

type SortOrder added in v0.4.12

type SortOrder uint32
const (
	SortOrder_DESC SortOrder = 0
	SortOrder_ASC  SortOrder = 1
)

func (*SortOrder) Is added in v0.31.0

func (x *SortOrder) Is(values ...SortOrder) bool

func (SortOrder) MarshalText added in v0.31.0

func (x SortOrder) MarshalText() ([]byte, error)

func (SortOrder) String added in v0.4.12

func (x SortOrder) String() string

func (*SortOrder) UnmarshalText added in v0.31.0

func (x *SortOrder) UnmarshalText(b []byte) error

type Transaction added in v0.4.12

type Transaction struct {
	TxnHash     *string           `json:"txnHash"`
	BlockNumber uint64            `json:"blockNumber"`
	ChainId     uint64            `json:"chainId"`
	MetaTxnID   *string           `json:"metaTxnID"`
	Transfers   []*TxnLogTransfer `json:"transfers"`
	// TODO: review ..
	Users map[string]*TxnLogUser `json:"users"`
	// - contracts?: map<string, Contract> TODO: review.. this gives us contract metadata which is useful
	// - tokenMetadata?: map<string,map<string,TokenMetadata>>
	Timestamp *time.Time `json:"timestamp" db:"ts,omitempty"`
}

TODO: review and update this type ..

type TransferType added in v0.4.12

type TransferType uint32
const (
	TransferType_SEND            TransferType = 0
	TransferType_RECEIVE         TransferType = 1
	TransferType_BRIDGE_DEPOSIT  TransferType = 2
	TransferType_BRIDGE_WITHDRAW TransferType = 3
	TransferType_BURN            TransferType = 4
	TransferType_UNKNOWN         TransferType = 5
)

func (*TransferType) Is added in v0.31.0

func (x *TransferType) Is(values ...TransferType) bool

func (TransferType) MarshalText added in v0.31.0

func (x TransferType) MarshalText() ([]byte, error)

func (TransferType) String added in v0.4.12

func (x TransferType) String() string

func (*TransferType) UnmarshalText added in v0.31.0

func (x *TransferType) UnmarshalText(b []byte) error

type TxnLogTransfer added in v0.4.12

type TxnLogTransfer struct {
	TransferType    TransferType      `json:"transferType"`
	ContractAddress string            `json:"contractAddress"`
	From            string            `json:"from"`
	To              string            `json:"to"`
	Ids             []prototyp.BigInt `json:"ids"`
	Amounts         []prototyp.BigInt `json:"amounts"`
}

type TxnLogUser added in v0.4.12

type TxnLogUser struct {
	Username string `json:"username"`
}

TODO: remove this.. we're not going to include username here anymore, the client will have to do it.

type Version

type Version struct {
	WebrpcVersion string `json:"webrpcVersion"`
	SchemaVersion string `json:"schemaVersion"`
	SchemaHash    string `json:"schemaHash"`
	AppVersion    string `json:"appVersion"`
}

type WebRPCError added in v0.31.0

type WebRPCError struct {
	Name       string `json:"error"`
	Code       int    `json:"code"`
	Message    string `json:"msg"`
	Cause      string `json:"cause,omitempty"`
	HTTPStatus int    `json:"status"`
	// contains filtered or unexported fields
}

func ErrorWithCause deprecated added in v0.31.0

func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError

Deprecated: Use .WithCause() method on WebRPCError.

func (WebRPCError) Error added in v0.31.0

func (e WebRPCError) Error() string

func (WebRPCError) Is added in v0.31.0

func (e WebRPCError) Is(target error) bool

func (WebRPCError) Unwrap added in v0.31.0

func (e WebRPCError) Unwrap() error

func (WebRPCError) WithCause added in v0.31.0

func (e WebRPCError) WithCause(cause error) WebRPCError

func (WebRPCError) WithCausef added in v0.31.0

func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError

Jump to

Keyboard shortcuts

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