Documentation ¶
Overview ¶
sequence-api v0.4.0 d026b8c7eb9ac3c9c5ed52994a34e2463c1aaa14 -- 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 PayCard
- type PayCardAuth
- type Price
- type RuntimeChecks
- type RuntimeStatus
- type SequenceContext
- type SmartRampOrder
- type SmartRampOrderStatus
- type SmartRampPurchaseReceipt
- type SmartRampQuoteDetails
- type SmartRampQuoteRequest
- 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 SmartRampOrderStatus_name = map[uint32]string{
0: "UNKNOWN",
1: "RUNNING_CHECKS",
2: "PROCESSING",
3: "FAILED",
4: "COMPLETE",
}
View Source
var SmartRampOrderStatus_value = map[string]uint32{
"UNKNOWN": 0,
"RUNNING_CHECKS": 1,
"PROCESSING": 2,
"FAILED": 3,
"COMPLETE": 4,
}
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",
"IsValidSignature",
"IsValidMessageSignature",
"IsValidTypedDataSignature",
"IsValidETHAuthProof",
"GetCoinPrices",
"GetCollectiblePrices",
"GetExchangeRate",
"ListPayCardsOnFile",
"SavePayCard",
"UpdatePayCardCVC",
"DeletePayCard",
"SmartRampQuote",
"SmartRampPurchase",
"SmartRampWaitOrderConfirmation",
"SmartRampGetOrder",
"SmartRampCheckCardAuthorization",
"SmartRampSubmitCardAuthorization",
"SmartRampOrdersList",
"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) IsValidSignature(ctx context.Context, chainId string, walletAddress string, digest string, signature string) (bool, error) IsValidMessageSignature(ctx context.Context, chainId string, walletAddress string, message string, signature string) (bool, error) IsValidTypedDataSignature(ctx context.Context, chainId string, walletAddress string, typedData interface{}, signature string) (bool, error) IsValidETHAuthProof(ctx context.Context, chainId string, walletAddress string, ethAuthProof 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) ListPayCardsOnFile(ctx context.Context) ([]*PayCard, error) SavePayCard(ctx context.Context, payCard *PayCard) (bool, *PayCard, error) UpdatePayCardCVC(ctx context.Context, payCardId uint64, payCardCVC string) (bool, error) DeletePayCard(ctx context.Context, payCardId uint64) (bool, error) SmartRampQuote(ctx context.Context, quoteRequest *SmartRampQuoteRequest) (bool, *SmartRampQuoteDetails, error) SmartRampPurchase(ctx context.Context, quoteDetails *SmartRampQuoteDetails, payCardId uint64, payCardCVC *string) (bool, *SmartRampPurchaseReceipt, error) SmartRampWaitOrderConfirmation(ctx context.Context, orderId string) (bool, *SmartRampPurchaseReceipt, error) SmartRampGetOrder(ctx context.Context, orderId *string, id *uint64) (*SmartRampOrder, error) SmartRampCheckCardAuthorization(ctx context.Context, orderId string) (*PayCardAuth, error) SmartRampSubmitCardAuthorization(ctx context.Context, orderId string, sms *string, card2fa *string) (bool, error) SmartRampOrdersList(ctx context.Context, page *Page, userAddressFilter *string) (*Page, []*SmartRampOrder, 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 PayCard ¶ added in v0.12.3
type PayCard struct { ID uint64 `json:"id" db:"id,omitempty"` UserAddress prototyp.Hash `json:"userAddress" db:"user_address"` CardType string `json:"cardType" db:"card_type"` CardFirstName string `json:"cardFirstName" db:"card_first_name"` CardLastName string `json:"cardLastName" db:"card_last_name"` CardNumberLastFourDigits string `json:"cardNumberLastFourDigits" db:"card_num_last_four"` CardNumberToken string `json:"cardNumberToken" db:"card_num_token"` CardCVCToken string `json:"cardCVCToken" db:"card_cvc_token"` CardExpMonth uint32 `json:"cardExpMonth" db:"card_exp_month"` CardExpYear uint32 `json:"cardExpYear" db:"card_exp_year"` ContactAddressToken string `json:"contactAddressToken" db:"contact_address_token"` ContactCityToken string `json:"contactCityToken" db:"contact_city_token"` ContactProvinceToken string `json:"contactProvinceToken" db:"contact_province_token"` ContactPostalCodeToken string `json:"contactPostalCodeToken" db:"contact_postal_code_token"` ContactCountryCode string `json:"contactCountryCode" db:"contact_country_code"` ContactEmail string `json:"contactEmail" db:"contact_email"` ContactPhoneToken string `json:"contactPhoneToken" db:"contact_phone_token"` UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` }
type PayCardAuth ¶ added in v0.12.3
type RuntimeChecks ¶
type RuntimeChecks struct { }
type RuntimeStatus ¶
type SequenceContext ¶
type SmartRampOrder ¶ added in v0.12.3
type SmartRampOrder struct { ID uint64 `json:"id" db:"id,omitempty"` UserAddress prototyp.Hash `json:"userAddress" db:"user_address"` ContractAddress prototyp.Hash `json:"contractAddress" db:"contract_address"` PayCardID uint64 `json:"payCardId" db:"pay_card_id"` OrderID string `json:"orderId" db:"order_id"` QuoteID string `json:"quoteId" db:"quote_id"` Status SmartRampOrderStatus `json:"status" db:"status"` AuthCodesRequested bool `json:"authCodesRequested" db:"auth_codes_requested"` AuthCodesSubmitted bool `json:"authCodesSubmitted" db:"auth_codes_submitted"` CountryCode string `json:"countryCode" db:"country_code"` Email string `json:"email" db:"email"` SourceCurrency string `json:"sourceCurrency" db:"source_currency"` DestCurrency string `json:"destCurrency" db:"dest_currency"` PurchaseAmount float64 `json:"purchaseAmount" db:"purchase_amount"` PurchaseFees float64 `json:"purchaseFees" db:"purchase_fees"` PurchaseTotal float64 `json:"purchaseTotal" db:"purchase_total"` SmartScriptParams map[string]interface{} `json:"smartScriptParams" db:"smart_script_params"` UpdatedAt *time.Time `json:"updatedAt,omitempty" db:"updated_at,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"` }
type SmartRampOrderStatus ¶ added in v0.12.3
type SmartRampOrderStatus uint32
const ( SmartRampOrderStatus_UNKNOWN SmartRampOrderStatus = 0 SmartRampOrderStatus_RUNNING_CHECKS SmartRampOrderStatus = 1 SmartRampOrderStatus_PROCESSING SmartRampOrderStatus = 2 SmartRampOrderStatus_FAILED SmartRampOrderStatus = 3 SmartRampOrderStatus_COMPLETE SmartRampOrderStatus = 4 )
func (SmartRampOrderStatus) MarshalJSON ¶ added in v0.12.3
func (x SmartRampOrderStatus) MarshalJSON() ([]byte, error)
func (SmartRampOrderStatus) String ¶ added in v0.12.3
func (x SmartRampOrderStatus) String() string
func (*SmartRampOrderStatus) UnmarshalJSON ¶ added in v0.12.3
func (x *SmartRampOrderStatus) UnmarshalJSON(b []byte) error
type SmartRampPurchaseReceipt ¶ added in v0.12.3
type SmartRampPurchaseReceipt struct { OrderID string `json:"orderId"` QuoteID string `json:"quoteId"` SmartScriptID string `json:"smartScriptId"` CreatedAt time.Time `json:"createdAt"` Status SmartRampOrderStatus `json:"status"` AuthCodesRequested bool `json:"authCodesRequested"` AuthCodesSubmitted bool `json:"authCodesSubmitted"` SourceCurrency string `json:"sourceCurrency"` PurchaseAmount float64 `json:"purchaseAmount"` PurchaseFees float64 `json:"purchaseFees"` PurchaseTotal float64 `json:"purchaseTotal"` }
type SmartRampQuoteDetails ¶ added in v0.12.3
type SmartRampQuoteDetails struct { QuoteID string `json:"quoteId"` SmartScriptID string `json:"smartScriptId"` QuoteRequest *SmartRampQuoteRequest `json:"quoteRequest"` RecipientAddress string `json:"recipientAddress"` PurchaseAmount float64 `json:"purchaseAmount"` PurchaseFees float64 `json:"purchaseFees"` PurchaseTotal float64 `json:"purchaseTotal"` SourceCurrency string `json:"sourceCurrency"` DestCurrency string `json:"destCurrency"` CreatedAt time.Time `json:"createdAt"` ExpiresAt time.Time `json:"expiresAt"` }
type SmartRampQuoteRequest ¶ added in v0.12.3
type SmartRampQuoteRequest struct { CountryCode string `json:"countryCode"` NiftyswapContractAddress string `json:"niftyswapContractAddress"` TokenIDs []prototyp.BigInt `json:"tokenIds"` TokensBoughtAmounts []prototyp.BigInt `json:"tokensBoughtAmounts"` MaxCurrency float64 `json:"maxCurrency"` ExtraFeeRecipients []prototyp.Hash `json:"extraFeeRecipients"` ExtraFeeAmounts []prototyp.BigInt `json:"extraFeeAmounts"` }
type SortOrder ¶
type SortOrder uint32
func (SortOrder) MarshalJSON ¶
func (*SortOrder) UnmarshalJSON ¶
type TokenPrice ¶ added in v0.11.7
type TokenPrice struct { Token *Token `json:"token"` Price *Price `json:"price"` Price24hChange *Price `json:"price24hChange"` FloorPrice *Price `json:"floorPrice,omitempty"` BuyPrice *Price `json:"buyPrice,omitempty"` SellPrice *Price `json:"sellPrice,omitempty"` UpdatedAt *time.Time `json:"updatedAt"` }
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.