Documentation ¶
Overview ¶
sequence-api v0.4.0 4d2479b7b4da1f3902a2593f729835aa16931146 -- 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
- Variables
- func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)
- func HTTPStatusFromErrorCode(code ErrorCode) int
- func IsErrorCode(err error, code ErrorCode) bool
- func IsValidErrorCode(code ErrorCode) bool
- func WebRPCSchemaHash() string
- func WebRPCSchemaVersion() string
- func WebRPCVersion() string
- func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)
- type API
- type ContractCall
- type Error
- func ErrorInternal(format string, args ...interface{}) Error
- func ErrorInvalidArgument(argument string, validationMsg string) Error
- func ErrorNotFound(format string, args ...interface{}) Error
- func ErrorRequiredArgument(argument string) Error
- func Errorf(code ErrorCode, msgf string, args ...interface{}) Error
- func Failf(format string, args ...interface{}) Error
- func WrapError(code ErrorCode, cause error, format string, args ...interface{}) Error
- func WrapFailf(cause error, format string, args ...interface{}) Error
- type ErrorCode
- type ErrorPayload
- type ExchangeRate
- type Friend
- type HTTPClient
- type InviteCode
- type InviteCodeAccount
- type InviteInfo
- type Page
- type Price
- type RuntimeChecks
- type RuntimeStatus
- type SequenceContext
- type SortBy
- type SortOrder
- type Token
- type TokenPrice
- type Transaction
- type TupleComponent
- type User
- type UserStorage
- type Version
- type WalletBackup
Constants ¶
View Source
const APIPathPrefix = "/rpc/API/"
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 SortOrder_name = map[uint32]string{
0: "DESC",
1: "ASC",
}
View Source
var SortOrder_value = map[string]uint32{
"DESC": 0,
"ASC": 1,
}
View Source
var WebRPCServices = map[string][]string{
"API": {
"Ping",
"Version",
"RuntimeStatus",
"GetSequenceContext",
"GetAuthToken",
"SendPasswordlessLink",
"FriendList",
"GetFriendByAddress",
"SearchFriends",
"AddFriend",
"UpdateFriendNickname",
"RemoveFriend",
"ContractCall",
"DecodeContractCall",
"LookupContractCallSelectors",
"UserStorageFetch",
"UserStorageSave",
"UserStorageDelete",
"UserStorageFetchAll",
"GetMoonpayLink",
"IsUsingGoogleMail",
"GetCoinPrices",
"GetCollectiblePrices",
"GetExchangeRate",
"GetInviteInfo",
"IsValidAccessCode",
"InternalClaimAccessCode",
"WalletRecover",
},
}
Functions ¶
func HTTPStatusFromErrorCode ¶
func IsErrorCode ¶
func IsValidErrorCode ¶
Types ¶
type API ¶
type API 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) GetAuthToken(ctx context.Context, ewtString string, testnetMode *bool) (bool, string, string, *User, error) SendPasswordlessLink(ctx context.Context, email string, redirectUri string, intent string) (bool, error) FriendList(ctx context.Context, page *Page) (*Page, []*Friend, error) GetFriendByAddress(ctx context.Context, friendAddress string) (bool, *Friend, error) SearchFriends(ctx context.Context, filterUsername string) ([]*Friend, error) AddFriend(ctx context.Context, friendAddress string, optionalNickname *string) (bool, *Friend, error) UpdateFriendNickname(ctx context.Context, friendAddress string, nickname string) (bool, *Friend, error) RemoveFriend(ctx context.Context, friendAddress string) (bool, error) ContractCall(ctx context.Context, chainID string, contract string, inputExpr string, outputExpr string, args []string) ([]string, error) DecodeContractCall(ctx context.Context, callData string) (*ContractCall, error) LookupContractCallSelectors(ctx context.Context, selectors []string) ([][]string, error) UserStorageFetch(ctx context.Context, key string) (interface{}, error) UserStorageSave(ctx context.Context, key string, object interface{}) (bool, error) UserStorageDelete(ctx context.Context, key string) (bool, error) UserStorageFetchAll(ctx context.Context, keys []string) (map[string]interface{}, error) GetMoonpayLink(ctx context.Context, url string) (string, error) IsUsingGoogleMail(ctx context.Context, domain string) (bool, error) GetCoinPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error) GetCollectiblePrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error) GetExchangeRate(ctx context.Context, toCurrency string) (*ExchangeRate, error) GetInviteInfo(ctx context.Context) (*InviteInfo, error) IsValidAccessCode(ctx context.Context, accessCode string) (bool, error) InternalClaimAccessCode(ctx context.Context, address string, accessCode string) (bool, error) WalletRecover(ctx context.Context, username string, secretHash string) (string, error) }
func NewAPIClient ¶
func NewAPIClient(addr string, client HTTPClient) API
type ContractCall ¶
type ContractCall struct { Signature string `json:"signature"` Function string `json:"function"` Args []*TupleComponent `json:"args"` }
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 ErrorInvalidArgument ¶
func ErrorNotFound ¶
func ErrorRequiredArgument ¶
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" // 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 ExchangeRate ¶ added in v0.11.7
type Friend ¶
type Friend struct { ID uint64 `json:"id" db:"id,omitempty"` UserAddress prototyp.Hash `json:"userAddress" db:"user_address"` FriendAddress prototyp.Hash `json:"friendAddress" db:"friend_address"` Nickname string `json:"nickname" db:"nickname"` User *User `json:"user" db:"-"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` }
type HTTPClient ¶
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 InviteCode ¶
type InviteCode struct { Code string `json:"-" db:"code"` Source string `json:"-" db:"source"` UsesLeft uint32 `json:"usesLeft" db:"uses_left"` OwnerAccount prototyp.HashMaybe `json:"ownerAccount" db:"owner_account"` Email *string `json:"email" db:"email"` Url string `json:"url"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` ExpiresAt *time.Time `json:"expiresAt,omitempty" db:"expires_at,omitempty"` }
type InviteCodeAccount ¶
type InviteInfo ¶
type InviteInfo struct { ExpiryInHours uint32 `json:"expiryInHours"` Max uint32 `json:"max"` Invites []*InviteCode `json:"invites"` }
type RuntimeChecks ¶
type RuntimeChecks struct { }
type RuntimeStatus ¶
type SequenceContext ¶
type SortOrder ¶
type SortOrder uint32
func (SortOrder) MarshalJSON ¶
func (*SortOrder) UnmarshalJSON ¶
type TokenPrice ¶ added in v0.11.7
type Transaction ¶
type TupleComponent ¶ added in v0.11.7
type User ¶
type User struct { Address prototyp.Hash `json:"address" db:"address"` Username string `json:"username" db:"username"` NormalizedUsername string `json:"-" db:"normalized_username"` Avatar string `json:"avatar" db:"avatar"` Bio string `json:"bio" db:"bio"` Location string `json:"location" db:"location"` Locale string `json:"locale" db:"locale"` Backup *bool `json:"backup,omitempty" db:"-"` BackupConfirmed *bool `json:"backupConfirmed,omitempty" db:"-"` MaxInvites *uint32 `json:"maxInvites" db:"max_invites"` UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` SysAdmin bool `json:"-" db:"sys_admin"` }
type UserStorage ¶ added in v0.5.9
type UserStorage struct { UserAddress prototyp.Hash `json:"userAddress" db:"user_address"` Key string `json:"key"` Value prototyp.JSONString `json:"value"` }
type WalletBackup ¶
type WalletBackup struct { AccountAddress prototyp.Hash `json:"accountAddress" db:"account_address"` SecretHash string `json:"secretHash" db:"secret_hash"` EncryptedWallet string `json:"encryptedWallet" db:"encrypted_wallet"` UserConfirmed bool `json:"userConfirmed" db:"user_confirmed"` UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` }
Click to show internal directories.
Click to hide internal directories.