proto

package
v0.43.6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

sessions v0.0.1 67f782e8acfe452f905078a7423ed5d27c6639a8 -- Code generated by webrpc-gen@v0.20.3 with golang generator. DO NOT EDIT.

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

Index

Constants

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

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

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",
		"SaveSignerSignatures2",
		"SaveMigration",
	},
}

Functions

func HTTPRequestHeaders

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

func MethodCtx added in v0.43.4

func MethodCtx(ctx context.Context) (method, bool)

func MethodNameFromContext added in v0.32.0

func MethodNameFromContext(ctx context.Context) string

func RequestFromContext added in v0.32.0

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

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 ArweaveBundleInfo added in v0.43.4

type ArweaveBundleInfo struct {
	Transaction   string    `json:"transaction"`
	Block         uint64    `json:"block"`
	Items         uint64    `json:"items"`
	SentAt        time.Time `json:"sentAt"`
	Confirmations uint64    `json:"confirmations"`
}

type ArweaveInfo added in v0.43.4

type ArweaveInfo struct {
	NodeURL          string              `json:"nodeURL"`
	Namespace        string              `json:"namespace"`
	Sender           *ArweaveSenderInfo  `json:"sender"`
	Signer           string              `json:"signer"`
	FlushInterval    string              `json:"flushInterval"`
	BundleDelay      string              `json:"bundleDelay"`
	BundleLimit      int                 `json:"bundleLimit"`
	Confirmations    int                 `json:"confirmations"`
	LockTTL          string              `json:"lockTTL"`
	Healthy          bool                `json:"healthy"`
	LastFlush        *time.Time          `json:"lastFlush"`
	LastFlushSeconds *uint64             `json:"lastFlushSeconds"`
	Bundles          uint64              `json:"bundles"`
	Pending          *ArweavePendingInfo `json:"pending"`
}

type ArweavePendingInfo added in v0.43.4

type ArweavePendingInfo struct {
	Wallets    uint64               `json:"wallets"`
	Configs    uint64               `json:"configs"`
	Migrations uint64               `json:"migrations"`
	Signatures uint64               `json:"signatures"`
	Bundles    []*ArweaveBundleInfo `json:"bundles"`
}

type ArweaveSenderInfo added in v0.43.4

type ArweaveSenderInfo struct {
	Address string `json:"address"`
	Balance string `json:"balance"`
}

type ArweaveStatus added in v0.43.4

type ArweaveStatus struct {
	NodeURL          string     `json:"nodeURL"`
	Namespace        string     `json:"namespace"`
	Sender           string     `json:"sender"`
	Signer           string     `json:"signer"`
	FlushInterval    string     `json:"flushInterval"`
	BundleDelay      string     `json:"bundleDelay"`
	BundleLimit      int        `json:"bundleLimit"`
	Confirmations    int        `json:"confirmations"`
	LockTTL          string     `json:"lockTTL"`
	Healthy          bool       `json:"healthy"`
	LastFlush        *time.Time `json:"lastFlush"`
	LastFlushSeconds *uint64    `json:"lastFlushSeconds"`
}

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 Info added in v0.43.4

type Info struct {
	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    *RecorderInfo     `json:"recorder,omitempty"`
	Arweave     *ArweaveInfo      `json:"arweave,omitempty"`
}

type RecorderInfo added in v0.43.4

type RecorderInfo struct {
	Requests         uint64            `json:"requests"`
	Buffer           uint64            `json:"buffer"`
	LastFlush        *time.Time        `json:"lastFlush"`
	LastFlushSeconds *uint64           `json:"lastFlushSeconds"`
	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"`
	Arweave *ArweaveStatus `json:"arweave"`
}

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, cursor *uint64, limit *uint64) (map[string]*Signature, uint64, 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{}, referenceChainID *string) error
	SaveSignerSignatures(ctx context.Context, wallet string, digest string, chainID string, signatures []string, toConfig *interface{}) error
	SaveSignerSignatures2(ctx context.Context, wallet string, digest string, chainID string, signatures []*SignerSignature, 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, cursor *uint64, limit *uint64) (map[string]*Signature, uint64, 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{}, referenceChainID *string) error
	SaveSignerSignatures(ctx context.Context, wallet string, digest string, chainID string, signatures []string, toConfig *interface{}) error
	SaveSignerSignatures2(ctx context.Context, wallet string, digest string, chainID string, signatures []*SignerSignature, 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"`
	ValidOnChain     *prototyp.BigInt   `json:"validOnChain,omitempty"`
	ValidOnBlock     *prototyp.BigInt   `json:"validOnBlock,omitempty"`
	ValidOnBlockHash prototyp.HashMaybe `json:"validOnBlockHash,omitempty"`
}

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 SignerSignature added in v0.43.4

type SignerSignature struct {
	ReferenceChainID *string `json:"referenceChainID"`
	Signer           *string `json:"signer"`
	Signature        string  `json:"signature"`
}

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

Jump to

Keyboard shortcuts

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