proto

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

sequence-relayer v0.4.0 b8eced5e5920e0f4ea5aaad391c6551d7936916d -- 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 ContractType_name = map[uint32]string{
	0: "UNKNOWN",
	1: "ERC20_TOKEN",
	2: "ERC721_TOKEN",
	3: "ERC1155_TOKEN",
	4: "META_ERC20_WRAPPER",
	5: "NIFTYSWAP",
	6: "BRIDGE",
}
View Source
var ContractType_value = map[string]uint32{
	"UNKNOWN":            0,
	"ERC20_TOKEN":        1,
	"ERC721_TOKEN":       2,
	"ERC1155_TOKEN":      3,
	"META_ERC20_WRAPPER": 4,
	"NIFTYSWAP":          5,
	"BRIDGE":             6,
}
View Source
var ETHTxnStatus_name = map[uint]string{
	0: "UNKNOWN",
	1: "FAILED",
	2: "PARTIALLY_FAILED",
	3: "SENT",
	4: "REVERTED",
	5: "SUCCESS",
	6: "FINAL",
	7: "DROPPED",
	8: "QUEUED",
}
View Source
var ETHTxnStatus_value = map[string]uint{
	"UNKNOWN":          0,
	"FAILED":           1,
	"PARTIALLY_FAILED": 2,
	"SENT":             3,
	"REVERTED":         4,
	"SUCCESS":          5,
	"FINAL":            6,
	"DROPPED":          7,
	"QUEUED":           8,
}
View Source
var WebRPCServices = map[string][]string{
	"Relayer": {
		"Ping",
		"Version",
		"RuntimeStatus",
		"GetSequenceContext",
		"GetChainID",
		"SendMetaTxn",
		"GetMetaTxnNonce",
		"GetMetaTxnReceipt",
		"TokenFee",
		"UpdateMetaTxnGasLimits",
		"FeeTokens",
		"GetMetaTxnNetworkFeeOptions",
		"PushMetaTxn",
		"GetMetaTxn",
	},
}

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 ContractType

type ContractType uint32
const (
	ContractType_UNKNOWN            ContractType = 0
	ContractType_ERC20_TOKEN        ContractType = 1
	ContractType_ERC721_TOKEN       ContractType = 2
	ContractType_ERC1155_TOKEN      ContractType = 3
	ContractType_META_ERC20_WRAPPER ContractType = 4
	ContractType_NIFTYSWAP          ContractType = 5
	ContractType_BRIDGE             ContractType = 6
)

func (ContractType) MarshalJSON

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

func (ContractType) String

func (x ContractType) String() string

func (*ContractType) UnmarshalJSON

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

type ETHTxnStatus

type ETHTxnStatus uint
const (
	ETHTxnStatus_UNKNOWN          ETHTxnStatus = 0
	ETHTxnStatus_FAILED           ETHTxnStatus = 1
	ETHTxnStatus_PARTIALLY_FAILED ETHTxnStatus = 2
	ETHTxnStatus_SENT             ETHTxnStatus = 3
	ETHTxnStatus_REVERTED         ETHTxnStatus = 4
	ETHTxnStatus_SUCCESS          ETHTxnStatus = 5
	ETHTxnStatus_FINAL            ETHTxnStatus = 6
	ETHTxnStatus_DROPPED          ETHTxnStatus = 7
	ETHTxnStatus_QUEUED           ETHTxnStatus = 8
)

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            *ContractType `json:"type"`
	Decimals        *uint32       `json:"decimals"`
	LogoURL         string        `json:"logoURL"`
	ContractAddress *string       `json:"contractAddress"`
	OriginAddress   *string       `json:"originAddress"`
	TokenID         *string       `json:"tokenID"`
}

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:"wallet_address"`
	Input         string  `json:"input" db:"tx_data"`
	Digest        *string `json:"digest" db:"tx_digest"`
}

type MetaTxnReceipt

type MetaTxnReceipt struct {
	ID           string  `json:"id"`
	Status       string  `json:"status"`
	RevertReason string  `json:"revertReason"`
	GasUsed      uint64  `json:"gasUsed"`
	TxnReceipt   string  `json:"txnReceipt"`
	Batch        *TxnObj `json:"batch"`
}

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)
	TokenFee(ctx context.Context) (bool, string, error)
	UpdateMetaTxnGasLimits(ctx context.Context, walletAddress string, payload string) (string, error)
	FeeTokens(ctx context.Context) (bool, []*FeeToken, error)
	GetMetaTxnNetworkFeeOptions(ctx context.Context, walletConfig *WalletConfig, payload string) ([]*FeeOption, error)
	PushMetaTxn(ctx context.Context, call *MetaTxn) (bool, error)
	GetMetaTxn(ctx context.Context, call *MetaTxn) (bool, *MetaTxn, error)
}

func NewRelayerClient

func NewRelayerClient(addr string, client HTTPClient) Relayer

type RuntimeStatus

type RuntimeStatus struct {
	HealthOK bool `json:"healthOK"`
}

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 TxnObj

type TxnObj struct {
	To              prototyp.Hash `json:"to"`
	Objs            []*TxnObj     `json:"objs"`
	TxnStatus       string        `json:"txnStatus"`
	TxnRevertReason string        `json:"txnRevertReason"`
	Logs            []interface{} `json:"logs"`
}

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 uint64          `json:"threshold"`
	ChainId   *uint64         `json:"chainId"`
}

type WalletSigner

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

Jump to

Keyboard shortcuts

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