Documentation ¶
Overview ¶
sequence-api v0.4.0 6982b401100a3d0b3e6856f4301b8712d1ff4378 -- Code generated by webrpc-gen@v0.12.x-dev with golang@v0.10.0 generator. DO NOT EDIT.
webrpc-gen -schema=api.ridl -target=golang@v0.10.0 -pkg=api -client -out=./clients/api.gen.go
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 NumTxnsRelayed
- type Options
- 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 SmartRampTxnStatus
- 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 SmartRampTxnStatus_name = map[uint32]string{
0: "UNKNOWN",
1: "SUCCESSFUL",
2: "FAILED",
}
View Source
var SmartRampTxnStatus_value = map[string]uint32{
"UNKNOWN": 0,
"SUCCESSFUL": 1,
"FAILED": 2,
}
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",
"GetAuthToken2",
"SendPasswordlessLink",
"FriendList",
"GetFriendByAddress",
"SearchFriends",
"AddFriend",
"UpdateFriendNickname",
"RemoveFriend",
"ContractCall",
"DecodeContractCall",
"LookupContractCallSelectors",
"UserStorageFetch",
"UserStorageSave",
"UserStorageDelete",
"UserStorageFetchAll",
"GetMoonpayLink",
"GetSardineClientToken",
"IsUsingGoogleMail",
"ResolveENSAddress",
"IsValidSignature",
"IsValidMessageSignature",
"IsValidTypedDataSignature",
"IsValidETHAuthProof",
"GetCoinPrices",
"GetCollectiblePrices",
"GetExchangeRate",
"MemoryStore",
"MemoryLoad",
"WalletRecover",
"BlockNumberAtTime",
"PaperSessionSecret",
"PaperSessionSecret2",
},
}
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) GetAuthToken2(ctx context.Context, ewtString string, chainID string) (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) GetSardineClientToken(ctx context.Context) (string, error) IsUsingGoogleMail(ctx context.Context, domain string) (bool, error) ResolveENSAddress(ctx context.Context, ens string) (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, ethAuthProofString 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) MemoryStore(ctx context.Context, key string, value string) (bool, error) MemoryLoad(ctx context.Context, key string) (string, error) WalletRecover(ctx context.Context, username string, secretHash string) (string, error) BlockNumberAtTime(ctx context.Context, chainId uint64, timestamps []uint64) ([]uint64, error) PaperSessionSecret(ctx context.Context, chainName string, contractAddress string, paramsJson string, contractType string) (string, error) PaperSessionSecret2(ctx context.Context, chainName string, contractAddress string, paramsJson string, abi 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 NumTxnsRelayed ¶ added in v0.21.2
type Options ¶ added in v0.24.0
type Options struct { HTTPClient HTTPClient JWTAuthToken string APIServiceURL string }
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"` CardFirstNameToken string `json:"cardFirstNameToken" db:"card_first_name_token"` CardLastNameToken string `json:"cardLastNameToken" db:"card_last_name_token"` 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"` ContactProvince string `json:"contactProvinceToken" db:"contact_province"` ContactPostalCodeToken string `json:"contactPostalCodeToken" db:"contact_postal_code_token"` ContactCountryCode string `json:"contactCountryCodeToken" db:"contact_country_code"` ContactEmail string `json:"contactEmailToken" 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 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"` Checks *RuntimeChecks `json:"checks"` NumTxnsRelayed map[string]*NumTxnsRelayed `json:"numTxnsRelayed"` }
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"` ErrorReason string `json:"errorReason,omitempty" db:"error_reason"` ErrorCode string `json:"errorCode,omitempty" db:"error_code"` AuthCodesRequested bool `json:"authCodesRequested" db:"auth_codes_requested"` 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"` TxnHash prototyp.Hash `json:"txnHash" db:"txn_hash"` TxnSuccessful SmartRampTxnStatus `json:"txnSuccessful" db:"txn_successful"` 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"` CreatedAt time.Time `json:"createdAt"` Status SmartRampOrderStatus `json:"status"` ErrorReason *string `json:"errorReason"` ErrorCode *string `json:"errorCode"` AuthCodesRequested bool `json:"authCodesRequested"` CountryCode string `json:"countryCode"` SourceCurrency string `json:"sourceCurrency"` PurchaseAmount float64 `json:"purchaseAmount"` PurchaseFees float64 `json:"purchaseFees"` PurchaseTotal float64 `json:"purchaseTotal"` TxnHash prototyp.Hash `json:"txnHash"` TxnSuccessful SmartRampTxnStatus `json:"txnSuccessful"` }
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"` CountryIsSupported bool `json:"countryIsSupported"` 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 []string `json:"tokenIds"` TokensBoughtAmounts []string `json:"tokensBoughtAmounts"` MaxCurrency string `json:"maxCurrency"` ExtraFeeRecipients []string `json:"extraFeeRecipients"` ExtraFeeAmounts []string `json:"extraFeeAmounts"` }
type SmartRampTxnStatus ¶ added in v0.21.2
type SmartRampTxnStatus uint32
const ( SmartRampTxnStatus_UNKNOWN SmartRampTxnStatus = 0 SmartRampTxnStatus_SUCCESSFUL SmartRampTxnStatus = 1 SmartRampTxnStatus_FAILED SmartRampTxnStatus = 2 )
func (SmartRampTxnStatus) MarshalJSON ¶ added in v0.21.2
func (x SmartRampTxnStatus) MarshalJSON() ([]byte, error)
func (SmartRampTxnStatus) String ¶ added in v0.21.2
func (x SmartRampTxnStatus) String() string
func (*SmartRampTxnStatus) UnmarshalJSON ¶ added in v0.21.2
func (x *SmartRampTxnStatus) UnmarshalJSON(b []byte) error
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.