proto

package
v0.32.1 Latest Latest
Warning

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

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

Documentation

Overview

sessions v0.0.1 d81ea64cbe41c1ab8b0107bce2f118817b34ebc0 -- Code generated by webrpc-gen@v0.18.6 with golang generator. DO NOT EDIT.

webrpc-gen -schema=sessions.ridl -target=golang -pkg=proto -server -client -out=./sessions.gen.go

Index

Constants

View Source
const SessionsPathPrefix = "/rpc/Sessions/"

Variables

View Source
var (
	HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"}
	HTTPResponseWriterCtxKey       = &contextKey{"HTTPResponseWriter"}

	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 (
	ErrInvalidArgument = WebRPCError{Code: 1, Name: "InvalidArgument", Message: "invalid argument", HTTPStatus: 400}
	ErrNotFound        = WebRPCError{Code: 2, Name: "NotFound", Message: "not found", HTTPStatus: 404}
)

Schema errors

View Source
var SignatureType_name = map[int32]string{
	0: "EIP712",
	1: "EthSign",
	2: "EIP1271",
}
View Source
var SignatureType_value = map[string]int32{
	"EIP712":  0,
	"EthSign": 1,
	"EIP1271": 2,
}
View Source
var WebRPCServices = map[string][]string{
	"Sessions": {
		"Ping",
		"Config",
		"Wallets",
		"DeployHash",
		"ConfigUpdates",
		"Migrations",
		"SaveConfig",
		"SaveWallet",
		"SaveSignature",
		"SaveSignerSignatures",
		"SaveMigration",
	},
}

Functions

func HTTPRequestHeaders

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

func MethodNameFromContext added in v0.32.0

func MethodNameFromContext(ctx context.Context) string

func NewSessionsServer

func NewSessionsServer(svc Sessions) *sessionsServer

func RequestFromContext added in v0.32.0

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

func RespondWithError

func RespondWithError(w http.ResponseWriter, err error)

func ResponseWriterFromContext added in v0.32.0

func ResponseWriterFromContext(ctx context.Context) http.ResponseWriter

func ServiceNameFromContext added in v0.32.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 ConfigUpdate

type ConfigUpdate struct {
	ToImageHash prototyp.Hash `json:"toImageHash"`
	Signature   prototyp.Hash `json:"signature"`
}

type Context

type Context struct {
	Version              int           `json:"version"`
	Factory              prototyp.Hash `json:"factory"`
	MainModule           prototyp.Hash `json:"mainModule"`
	MainModuleUpgradable prototyp.Hash `json:"mainModuleUpgradable"`
	GuestModule          prototyp.Hash `json:"guestModule"`
	WalletCreationCode   prototyp.Hash `json:"walletCreationCode"`
}

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 RecorderStatus added in v0.32.0

type RecorderStatus struct {
	Requests              uint64            `json:"requests"`
	Buffer                uint64            `json:"buffer"`
	LastFlush             *time.Time        `json:"lastFlush"`
	SecondsSinceLastFlush *uint64           `json:"secondsSinceLastFlush"`
	Endpoints             map[string]uint64 `json:"endpoints"`
}

type RuntimeStatus added in v0.32.0

type RuntimeStatus struct {
	Healthy     bool              `json:"healthy"`
	Started     time.Time         `json:"started"`
	Uptime      uint64            `json:"uptime"`
	Version     string            `json:"version"`
	Branch      string            `json:"branch"`
	Commit      string            `json:"commit"`
	Wallets     map[string]uint64 `json:"wallets"`
	Configs     map[string]uint64 `json:"configs"`
	ConfigTrees uint64            `json:"configTrees"`
	Migrations  map[string]uint64 `json:"migrations"`
	Signatures  uint64            `json:"signatures"`
	Digests     uint64            `json:"digests"`
	Recorder    *RecorderStatus   `json:"recorder"`
}

type Sessions

type Sessions interface {
	Ping(ctx context.Context) error
	Config(ctx context.Context, imageHash string) (int, interface{}, error)
	Wallets(ctx context.Context, signer string) (map[string]*Signature, error)
	DeployHash(ctx context.Context, wallet string) (string, *Context, error)
	ConfigUpdates(ctx context.Context, wallet string, fromImageHash string, allUpdates *bool) ([]*ConfigUpdate, error)
	Migrations(ctx context.Context, wallet string, fromVersion int, fromImageHash string, chainID *string) (map[string]map[int]map[string]*TransactionBundle, error)
	SaveConfig(ctx context.Context, version int, config interface{}) error
	SaveWallet(ctx context.Context, version int, deployConfig interface{}) error
	SaveSignature(ctx context.Context, wallet string, digest string, chainID string, signature string, toConfig *interface{}) error
	SaveSignerSignatures(ctx context.Context, wallet string, digest string, chainID string, signatures []string, toConfig *interface{}) error
	SaveMigration(ctx context.Context, wallet string, fromVersion int, toVersion int, toConfig interface{}, executor string, transactions []*Transaction, nonce string, signature string, chainID *string) error
}

type SessionsClient added in v0.32.0

type SessionsClient interface {
	Ping(ctx context.Context) error
	Config(ctx context.Context, imageHash string) (int, interface{}, error)
	Wallets(ctx context.Context, signer string) (map[string]*Signature, error)
	DeployHash(ctx context.Context, wallet string) (string, *Context, error)
	ConfigUpdates(ctx context.Context, wallet string, fromImageHash string, allUpdates *bool) ([]*ConfigUpdate, error)
	Migrations(ctx context.Context, wallet string, fromVersion int, fromImageHash string, chainID *string) (map[string]map[int]map[string]*TransactionBundle, error)
	SaveConfig(ctx context.Context, version int, config interface{}) error
	SaveWallet(ctx context.Context, version int, deployConfig interface{}) error
	SaveSignature(ctx context.Context, wallet string, digest string, chainID string, signature string, toConfig *interface{}) error
	SaveSignerSignatures(ctx context.Context, wallet string, digest string, chainID string, signatures []string, toConfig *interface{}) error
	SaveMigration(ctx context.Context, wallet string, fromVersion int, toVersion int, toConfig interface{}, executor string, transactions []*Transaction, nonce string, signature string, chainID *string) error
}

func NewSessionsClient

func NewSessionsClient(addr string, client HTTPClient) SessionsClient

type Signature

type Signature struct {
	Digest      prototyp.Hash      `json:"digest"`
	ToImageHash prototyp.HashMaybe `json:"toImageHash,omitempty"`
	ChainID     prototyp.BigInt    `json:"chainID"`
	Type        SignatureType      `json:"type"`
	Signature   prototyp.Hash      `json:"signature"`
}

type SignatureType

type SignatureType int32
const (
	SignatureType_EIP712  SignatureType = 0
	SignatureType_EthSign SignatureType = 1
	SignatureType_EIP1271 SignatureType = 2
)

func (*SignatureType) Is added in v0.32.0

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

func (SignatureType) MarshalText added in v0.32.0

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

func (SignatureType) String

func (x SignatureType) String() string

func (*SignatureType) UnmarshalText added in v0.32.0

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

type Transaction

type Transaction struct {
	To            prototyp.Hash      `json:"to"`
	Value         prototyp.BigInt    `json:"value,omitempty"`
	Data          prototyp.HashMaybe `json:"data,omitempty"`
	GasLimit      prototyp.BigInt    `json:"gasLimit,omitempty"`
	DelegateCall  *bool              `json:"delegateCall,omitempty"`
	RevertOnError *bool              `json:"revertOnError,omitempty"`
}

type TransactionBundle

type TransactionBundle struct {
	Executor     prototyp.Hash   `json:"executor"`
	Transactions []*Transaction  `json:"transactions"`
	Nonce        prototyp.BigInt `json:"nonce"`
	Signature    prototyp.Hash   `json:"signature"`
}

type WebRPCError added in v0.32.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.32.0

func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError

Deprecated: Use .WithCause() method on WebRPCError.

func (WebRPCError) Error added in v0.32.0

func (e WebRPCError) Error() string

func (WebRPCError) Is added in v0.32.0

func (e WebRPCError) Is(target error) bool

func (WebRPCError) Unwrap added in v0.32.0

func (e WebRPCError) Unwrap() error

func (WebRPCError) WithCause added in v0.32.0

func (e WebRPCError) WithCause(cause error) WebRPCError

func (WebRPCError) WithCausef added in v0.32.0

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

type WebRPCServer

type WebRPCServer interface {
	http.Handler
}

Jump to

Keyboard shortcuts

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