proto

package
v0.25.2 Latest Latest
Warning

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

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

Documentation

Overview

sequence-dapp-signing-server v0.4.0 127eca8a4e204625345db5ab95e4c446487f86d4 -- Code generated by webrpc-gen@v0.11.x-dev with golang generator. DO NOT EDIT.

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

Index

Constants

View Source
const SigningServicePathPrefix = "/rpc/SigningService/"

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 (
	ErrWebrpcEndpoint      = WebRPCError{Code: 0, Name: "WebrpcEndpoint", Message: "endpoint error", HTTPStatus: 400}
	ErrWebrpcRequestFailed = WebRPCError{Code: -1, Name: "WebrpcRequestFailed", Message: "request failed", HTTPStatus: 0}
	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}
)

Webrpc errors

View Source
var WebRPCServices = map[string][]string{
	"SigningService": {
		"Ping",
		"Version",
		"RuntimeStatus",
		"GetSignerConfig",
		"Sign",
		"SignWith",
	},
}

Functions

func HTTPRequestHeaders

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

func RespondWithError

func RespondWithError(w http.ResponseWriter, err error)

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

type SignRequest

type SignRequest struct {
	ChainId uint64 `json:"chainId"`
	Msg     string `json:"msg"`
	AuxData string `json:"auxData"`
}

type SigningService

type SigningService interface {
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	GetSignerConfig(ctx context.Context, signer string) (*WalletConfig, error)
	Sign(ctx context.Context, request *SignRequest) (string, error)
	SignWith(ctx context.Context, signer string, request *SignRequest) (string, error)
}

func NewSigningServiceClient

func NewSigningServiceClient(addr string, client HTTPClient) SigningService

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"`
	Content string `json:"content"`
}

type WalletSigner

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

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

func ErrorWithCause(rpcErr WebRPCError, cause error) 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

type WebRPCServer

type WebRPCServer interface {
	http.Handler
}

func NewSigningServiceServer

func NewSigningServiceServer(svc SigningService) WebRPCServer

Jump to

Keyboard shortcuts

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