proto

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

sequence-relayer v0.4.0 59a862f763edcaca2fb2e11901b24873c4c02034 -- This file has been generated by https://github.com/webrpc/webrpc using gen/golang Do not edit by hand. Update your webrpc schema and re-generate.

Index

Constants

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

Variables

View Source
var (
	// For Client
	HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"}

	// For Server
	HTTPResponseWriterCtxKey = &contextKey{"HTTPResponseWriter"}

	HTTPRequestCtxKey = &contextKey{"HTTPRequest"}

	ServiceNameCtxKey = &contextKey{"ServiceName"}

	MethodNameCtxKey = &contextKey{"MethodName"}
)
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",
		"UpdateMetaTxnGasLimits",
		"FeeTokens",
		"GetMetaTxnNetworkFeeOptions",
		"SentTransactions",
		"PendingTransactions",
	},
}

Functions

func HTTPRequestHeaders

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

func HTTPStatusFromErrorCode

func HTTPStatusFromErrorCode(code ErrorCode) int

func IsErrorCode

func IsErrorCode(err error, code ErrorCode) bool

func IsValidErrorCode

func IsValidErrorCode(code ErrorCode) bool

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
	ETHTxnStatus_DROPPED          ETHTxnStatus = 1
	ETHTxnStatus_QUEUED           ETHTxnStatus = 2
	ETHTxnStatus_SENT             ETHTxnStatus = 3
	ETHTxnStatus_SUCCEEDED        ETHTxnStatus = 4
	ETHTxnStatus_PARTIALLY_FAILED ETHTxnStatus = 5
	ETHTxnStatus_FAILED           ETHTxnStatus = 6
)

func (ETHTxnStatus) MarshalJSON

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

func (ETHTxnStatus) String

func (x ETHTxnStatus) String() string

func (*ETHTxnStatus) UnmarshalJSON

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

type Error

type Error interface {
	// Code is of the valid error codes
	Code() ErrorCode

	// Msg returns a human-readable, unstructured messages describing the error
	Msg() string

	// Cause is reason for the error
	Cause() error

	// Error returns a string of the form "webrpc error <Code>: <Msg>"
	Error() string

	// Error response payload
	Payload() ErrorPayload
}

func ErrorInternal

func ErrorInternal(format string, args ...interface{}) Error

func ErrorInvalidArgument

func ErrorInvalidArgument(argument string, validationMsg string) Error

func ErrorNotFound

func ErrorNotFound(format string, args ...interface{}) Error

func ErrorRequiredArgument

func ErrorRequiredArgument(argument string) Error

func Errorf

func Errorf(code ErrorCode, msgf string, args ...interface{}) Error

func Failf

func Failf(format string, args ...interface{}) Error

func WrapError

func WrapError(code ErrorCode, cause error, format string, args ...interface{}) Error

func WrapFailf

func WrapFailf(cause error, format string, args ...interface{}) Error

type ErrorCode

type ErrorCode string
const (
	// Unknown error. For example when handling errors raised by APIs that do not
	// return enough error information.
	ErrUnknown ErrorCode = "unknown"

	// Fail error. General failure error type.
	ErrFail ErrorCode = "fail"

	// Canceled indicates the operation was cancelled (typically by the caller).
	ErrCanceled ErrorCode = "canceled"

	// InvalidArgument indicates client specified an invalid argument. It
	// indicates arguments that are problematic regardless of the state of the
	// system (i.e. a malformed file name, required argument, number out of range,
	// etc.).
	ErrInvalidArgument ErrorCode = "invalid argument"

	// DeadlineExceeded means operation expired before completion. For operations
	// that change the state of the system, this error may be returned even if the
	// operation has completed successfully (timeout).
	ErrDeadlineExceeded ErrorCode = "deadline exceeded"

	// NotFound means some requested entity was not found.
	ErrNotFound ErrorCode = "not found"

	// BadRoute means that the requested URL path wasn't routable to a webrpc
	// service and method. This is returned by the generated server, and usually
	// shouldn't be returned by applications. Instead, applications should use
	// NotFound or Unimplemented.
	ErrBadRoute ErrorCode = "bad route"

	// AlreadyExists means an attempt to create an entity failed because one
	// already exists.
	ErrAlreadyExists ErrorCode = "already exists"

	// PermissionDenied indicates the caller does not have permission to execute
	// the specified operation. It must not be used if the caller cannot be
	// identified (Unauthenticated).
	ErrPermissionDenied ErrorCode = "permission denied"

	// Unauthenticated indicates the request does not have valid authentication
	// credentials for the operation.
	ErrUnauthenticated ErrorCode = "unauthenticated"

	// ResourceExhausted indicates some resource has been exhausted, perhaps a
	// per-user quota, or perhaps the entire file system is out of space.
	ErrResourceExhausted ErrorCode = "resource exhausted"

	// FailedPrecondition indicates operation was rejected because the system is
	// not in a state required for the operation's execution. For example, doing
	// an rmdir operation on a directory that is non-empty, or on a non-directory
	// object, or when having conflicting read-modify-write on the same resource.
	ErrFailedPrecondition ErrorCode = "failed precondition"

	// Aborted indicates the operation was aborted, typically due to a concurrency
	// issue like sequencer check failures, transaction aborts, etc.
	ErrAborted ErrorCode = "aborted"

	// OutOfRange means operation was attempted past the valid range. For example,
	// seeking or reading past end of a paginated collection.
	//
	// Unlike InvalidArgument, this error indicates a problem that may be fixed if
	// the system state changes (i.e. adding more items to the collection).
	//
	// There is a fair bit of overlap between FailedPrecondition and OutOfRange.
	// We recommend using OutOfRange (the more specific error) when it applies so
	// that callers who are iterating through a space can easily look for an
	// OutOfRange error to detect when they are done.
	ErrOutOfRange ErrorCode = "out of range"

	// Unimplemented indicates operation is not implemented or not
	// supported/enabled in this service.
	ErrUnimplemented ErrorCode = "unimplemented"

	// Internal errors. When some invariants expected by the underlying system
	// have been broken. In other words, something bad happened in the library or
	// backend service. Do not confuse with HTTP Internal Server Error; an
	// Internal error could also happen on the client code, i.e. when parsing a
	// server response.
	ErrInternal ErrorCode = "internal"

	// Unavailable indicates the service is currently unavailable. This is a most
	// likely a transient condition and may be corrected by retrying with a
	// backoff.
	ErrUnavailable ErrorCode = "unavailable"

	// DataLoss indicates unrecoverable data loss or corruption.
	ErrDataLoss ErrorCode = "data loss"

	// ErrNone is the zero-value, is considered an empty error and should not be
	// used.
	ErrNone ErrorCode = ""
)

type ErrorPayload

type ErrorPayload struct {
	Status int    `json:"status"`
	Code   string `json:"code"`
	Cause  string `json:"cause,omitempty"`
	Msg    string `json:"msg"`
	Error  string `json:"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"`
	OriginAddress   *string       `json:"originAddress"`
	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) MarshalJSON added in v0.4.12

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

func (FeeTokenType) String added in v0.4.12

func (x FeeTokenType) String() string

func (*FeeTokenType) UnmarshalJSON added in v0.4.12

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

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"`
	Contract      string `json:"contract" db:"to_address"`
	Input         string `json:"input" db:"tx_data"`
}

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"`
}

type MetaTxnLog added in v0.4.12

type MetaTxnLog struct {
	ID              uint64                 `json:"id" db:"id,omitempty"`
	TxnHash         prototyp.HashMaybe     `json:"txnHash" db:"txn_hash"`
	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"`
	Target          prototyp.Hash          `json:"target" db:"target"`
	Input           prototyp.Hash          `json:"input" db:"input"`
	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"`
	UpdatedAt       *time.Time             `json:"updatedAt" db:"updated_at,omitempty"`
	CreatedAt       *time.Time             `json:"createdAt" db:"created_at,omitempty"`
}

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 Page added in v0.4.12

type Page struct {
	PageSize     *uint32      `json:"pageSize"`
	Page         *uint32      `json:"page"`
	TotalRecords *uint64      `json:"totalRecords"`
	Column       *string      `json:"column"`
	Before       *interface{} `json:"before"`
	After        *interface{} `json:"after"`
	Sort         []*SortBy    `json:"sort"`
}

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)
	GetChainID(ctx context.Context) (uint64, error)
	SendMetaTxn(ctx context.Context, call *MetaTxn) (bool, string, error)
	GetMetaTxnNonce(ctx context.Context, walletContractAddress string, space *string) (string, error)
	GetMetaTxnReceipt(ctx context.Context, metaTxID string) (*MetaTxnReceipt, error)
	UpdateMetaTxnGasLimits(ctx context.Context, walletAddress string, walletConfig *WalletConfig, payload string) (string, error)
	FeeTokens(ctx context.Context) (bool, []*FeeToken, error)
	GetMetaTxnNetworkFeeOptions(ctx context.Context, walletConfig *WalletConfig, payload string) ([]*FeeOption, error)
	SentTransactions(ctx context.Context, filter *SentTransactionsFilter, page *Page) (*Page, []*Transaction, error)
	PendingTransactions(ctx context.Context, page *Page) (*Page, []*Transaction, error)
}

func NewRelayerClient

func NewRelayerClient(addr string, client HTTPClient) Relayer

type RuntimeChecks added in v0.5.6

type RuntimeChecks struct {
}

type RuntimeStatus

type RuntimeStatus struct {
	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"`
	Senders    []*SenderStatus `json:"senders"`
	Checks     *RuntimeChecks  `json:"checks"`
}

type SenderStatus added in v0.5.6

type SenderStatus struct {
	Index   uint32 `json:"index"`
	Address string `json:"address"`
	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 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) MarshalJSON added in v0.4.12

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

func (SortOrder) String added in v0.4.12

func (x SortOrder) String() string

func (*SortOrder) UnmarshalJSON added in v0.4.12

func (x *SortOrder) UnmarshalJSON(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"`
	Users       map[string]*TxnLogUser `json:"users"`
	Timestamp   *time.Time             `json:"timestamp" db:"ts,omitempty"`
}

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) MarshalJSON added in v0.4.12

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

func (TransferType) String added in v0.4.12

func (x TransferType) String() string

func (*TransferType) UnmarshalJSON added in v0.4.12

func (x *TransferType) UnmarshalJSON(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"`
}

type Version

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

type WalletConfig

type WalletConfig struct {
	Address   string          `json:"address"`
	Signers   []*WalletSigner `json:"signers"`
	Threshold uint16          `json:"threshold"`
	ChainId   *uint64         `json:"chainId"`
}

type WalletSigner

type WalletSigner struct {
	Address string `json:"address"`
	Weight  uint8  `json:"weight"`
}

Jump to

Keyboard shortcuts

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