keymachine

package
v0.60.13 Latest Latest
Warning

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

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

Documentation

Overview

sessions v0.0.1 48681273e3b0249c5feb593b9af1b59dc6a14869 -- Code generated by webrpc-gen@v0.22.1 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 DefaultKeymachineServiceURL = "https://sessions.sequence.app"
View Source
const SessionsPathPrefix = "/rpc/Sessions/"
View Source
const WebrpcHeader = "Webrpc"
View Source
const WebrpcHeaderValue = "webrpc@v0.22.1;gen-golang@v0.17.0;sessions@v0.0.1"

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

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

func MethodNameFromContext

func MethodNameFromContext(ctx context.Context) string

func RequestFromContext

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

func ServiceNameFromContext

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 WebrpcMethods

func WebrpcMethods() map[string]method

func WithHTTPRequestHeaders

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

Types

type ArweaveBundleInfo

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

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

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

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

type ArweaveStatus

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

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 Options added in v0.60.8

type Options struct {
	// ProjectAccessKey is an optional project access key to authenticate with
	// the keymachine service.
	ProjectAccessKey string

	// JWTAuthToken is an optional JWT token to authenticate with the keymachine service.
	JWTAuthToken string

	// KeymachineServiceURL is an optional custom URL for the Sequence Keymachine service.
	// If not provided, the default URL in `DefaultKeymachineServiceURL` will be used.
	KeymachineServiceURL string

	// HTTPClient is an optional custom HTTP client to use for communicating with the
	// keymachine service.
	HTTPClient HTTPClient
}

type RecorderInfo

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

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

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 NewClient added in v0.60.8

func NewClient(clientOptions ...Options) SessionsClient

NewClient creates a new Sequence Keymachine client instance.

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

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

func (SignatureType) MarshalText

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

func (SignatureType) String

func (x SignatureType) String() string

func (*SignatureType) UnmarshalText

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

type SignerSignature

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

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

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

func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError

Deprecated: Use .WithCause() method on WebRPCError.

func (WebRPCError) Error

func (e WebRPCError) Error() string

func (WebRPCError) Is

func (e WebRPCError) Is(target error) bool

func (WebRPCError) Unwrap

func (e WebRPCError) Unwrap() error

func (WebRPCError) WithCause

func (e WebRPCError) WithCause(cause error) WebRPCError

func (WebRPCError) WithCausef

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

type WebrpcGenVersions

type WebrpcGenVersions struct {
	WebrpcGenVersion string
	CodeGenName      string
	CodeGenVersion   string
	SchemaName       string
	SchemaVersion    string
}

func VersionFromHeader

func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error)

Jump to

Keyboard shortcuts

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