api

package
v0.40.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

sequence-api v0.4.0 7578ce7543fbe82fa6e423652b4fa3d384362329 -- Code generated by webrpc-gen@v0.18.7 with golang generator. DO NOT EDIT.

webrpc-gen -schema=api.ridl -target=golang -pkg=api -client -out=./clients/api.gen.go

Index

Constants

View Source
const APIPathPrefix = "/rpc/API/"

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 (
	ErrUnauthorized     = WebRPCError{Code: 1000, Name: "Unauthorized", Message: "Unauthorized access", HTTPStatus: 401}
	ErrPermissionDenied = WebRPCError{Code: 1001, Name: "PermissionDenied", Message: "Permission denied", HTTPStatus: 403}
	ErrSessionExpired   = WebRPCError{Code: 1002, Name: "SessionExpired", Message: "Session expired", HTTPStatus: 403}
	ErrAborted          = WebRPCError{Code: 1005, Name: "Aborted", Message: "Request aborted", HTTPStatus: 400}
	ErrGeoblocked       = WebRPCError{Code: 1006, Name: "Geoblocked", Message: "Geoblocked region", HTTPStatus: 451}
	ErrInvalidArgument  = WebRPCError{Code: 2000, Name: "InvalidArgument", Message: "Invalid argument", HTTPStatus: 400}
	ErrUnavailable      = WebRPCError{Code: 2002, Name: "Unavailable", Message: "Unavailable resource", HTTPStatus: 400}
	ErrQueryFailed      = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400}
	ErrNotFound         = WebRPCError{Code: 3000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400}
)

Schema errors

View Source
var SardinePaymentType_name = map[uint32]string{
	0: "ach",
	1: "debit",
	2: "credit",
	3: "us_debit",
	4: "international_debit",
	5: "international_credit",
}
View Source
var SardinePaymentType_value = map[string]uint32{
	"ach":                  0,
	"debit":                1,
	"credit":               2,
	"us_debit":             3,
	"international_debit":  4,
	"international_credit": 5,
}
View Source
var SardineQuoteType_name = map[uint32]string{
	0: "buy",
	1: "sell",
}
View Source
var SardineQuoteType_value = map[string]uint32{
	"buy":  0,
	"sell": 1,
}
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 TokenType_name = map[uint8]string{
	0: "ERC20",
	1: "ERC721",
	2: "ERC1155",
}
View Source
var TokenType_value = map[string]uint8{
	"ERC20":   0,
	"ERC721":  1,
	"ERC1155": 2,
}
View Source
var WebRPCServices = map[string][]string{
	"API": {
		"Ping",
		"Version",
		"RuntimeStatus",
		"Clock",
		"GetSequenceContext",
		"GetAuthToken",
		"GetAuthToken2",
		"SendPasswordlessLink",
		"FriendList",
		"GetFriendByAddress",
		"SearchFriends",
		"AddFriend",
		"UpdateFriendNickname",
		"RemoveFriend",
		"ContractCall",
		"DecodeContractCall",
		"LookupContractCallSelectors",
		"UserStorageFetch",
		"UserStorageSave",
		"UserStorageDelete",
		"UserStorageFetchAll",
		"GetMoonpayLink",
		"ResolveENSAddress",
		"IsValidSignature",
		"IsValidMessageSignature",
		"IsValidTypedDataSignature",
		"IsValidETHAuthProof",
		"SardineGetClientToken",
		"SardineGetNFTCheckoutToken",
		"SardineGetNFTCheckoutOrderStatus",
		"SardineGetSupportedRegions",
		"SardineGetSupportedFiatCurrencies",
		"SardineGetSupportedTokens",
		"SardineGetEnabledTokens",
		"SardineGetQuote",
		"GetSardineClientToken",
		"GetSardineNFTCheckoutToken",
		"GetSardineNFTCheckoutOrderStatus",
		"GetCoinPrices",
		"GetCollectiblePrices",
		"GetExchangeRate",
		"MemoryStore",
		"MemoryLoad",
		"GetInviteInfo",
		"IsValidAccessCode",
		"InternalClaimAccessCode",
		"BlockNumberAtTime",
		"PaperSessionSecret",
		"PaperSessionSecret2",
		"LinkWallet",
		"GetLinkedWallets",
		"RemoveLinkedWallet",
		"GenerateWaaSVerificationURL",
		"ValidateWaaSVerificationNonce",
		"GetSwapQuotes",
		"AddCurrencyGroup",
		"UpdateCurrencyGroup",
		"ListCurrencyGroups",
		"DeleteCurrencyGroup",
		"AddInventoryPaymentConfig",
		"GetInventoryPaymentConfig",
		"ListInventoryPaymentConfigs",
		"UpdateInventoryPaymentConfig",
		"DeleteInventoryPaymentConfig",
		"RequestInventoryPayment",
	},
}

Functions

func HTTPRequestHeaders

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

func MethodNameFromContext added in v0.31.0

func MethodNameFromContext(ctx context.Context) string

func RequestFromContext added in v0.31.0

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

func ServiceNameFromContext added in v0.31.0

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 WithHTTPRequestHeaders

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

Types

type API

type API interface {
	//
	// Runtime
	//
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	Clock(ctx context.Context) (time.Time, error)
	GetSequenceContext(ctx context.Context) (*SequenceContext, error)
	//
	// Auth
	//
	// TODO: rename 'ewtString' arg to 'ethauthProof'
	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)
	//
	// Contacts / Friends
	//
	FriendList(ctx context.Context, nickname *string, page *Page) (*Page, []*Friend, error)
	GetFriendByAddress(ctx context.Context, friendAddress string) (bool, *Friend, error)
	SearchFriends(ctx context.Context, filterUsername string, page *Page) ([]*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)
	//
	// Chain-Utils
	//
	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)
	//
	// User Storage
	//
	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)
	//
	// Wallet utils
	//
	GetMoonpayLink(ctx context.Context, url string) (string, error)
	// - IsUsingGoogleMail(domain: string) => (yes: bool)
	ResolveENSAddress(ctx context.Context, ens string) (string, bool, error)
	// TODO: we can add walletContext optional in the future when we need it
	// NOTE: chainId can be either a number or canonical name
	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)
	SardineGetClientToken(ctx context.Context) (string, error)
	SardineGetNFTCheckoutToken(ctx context.Context, params *SardineNFTCheckoutParams) (*SardineNFTCheckout, error)
	SardineGetNFTCheckoutOrderStatus(ctx context.Context, orderId string) (*SardineOrder, error)
	SardineGetSupportedRegions(ctx context.Context) ([]*SardineRegion, error)
	SardineGetSupportedFiatCurrencies(ctx context.Context) ([]*SardineFiatCurrency, error)
	SardineGetSupportedTokens(ctx context.Context) ([]*SardineSupportedToken, error)
	SardineGetEnabledTokens(ctx context.Context) ([]*SardineEnabledToken, error)
	SardineGetQuote(ctx context.Context, params *SardineGetQuoteParams) (*SardineQuote, error)
	// Deprecated use SardineGetClientToken()
	GetSardineClientToken(ctx context.Context) (string, error)
	// Deprecated use SardineGetNFTCheckoutToken()
	GetSardineNFTCheckoutToken(ctx context.Context, params *SardineNFTCheckoutParams) (*SardineNFTCheckout, error)
	// Deprecated use SardineGetNFTCheckoutOrderStatus()
	GetSardineNFTCheckoutOrderStatus(ctx context.Context, orderId string) (*SardineOrder, error)
	//
	// Price Feed
	//
	GetCoinPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error)
	GetCollectiblePrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error)
	//
	// Price Feed utils
	//
	GetExchangeRate(ctx context.Context, toCurrency string) (*ExchangeRate, error)
	//
	// Util / misc
	//
	MemoryStore(ctx context.Context, key string, value string) (bool, error)
	MemoryLoad(ctx context.Context, key string) (string, error)
	//
	// Legacy
	//
	GetInviteInfo(ctx context.Context) (*InviteInfo, error)
	// NOTE: we're still using this from SW-API to Sequence-API to claim invite code
	IsValidAccessCode(ctx context.Context, accessCode string) (bool, error)
	InternalClaimAccessCode(ctx context.Context, address string, accessCode string) (bool, error)
	// Utils
	BlockNumberAtTime(ctx context.Context, chainId uint64, timestamps []uint64) ([]uint64, error)
	//
	// Paper
	// TODO: deprecate in the future
	//
	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)
	//
	// Linked wallets (v0 -- simple support)
	//
	LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error)
	GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]string, error)
	RemoveLinkedWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error)
	// NOTE: these methods are deprecated, please do not use them. We may resurface them in the future, but just wanted
	// to be clear, they are not necessary for our linked wallets.
	GenerateWaaSVerificationURL(ctx context.Context, walletAddress string) (string, string, error)
	ValidateWaaSVerificationNonce(ctx context.Context, nonce string, signature string, sessionId string, chainId string) (string, error)
	//
	// Currency abstraction
	//
	GetSwapQuotes(ctx context.Context, userAddress string, currencyAddress string, currencyAmount string, chainId uint64, includeApprove bool) ([]*SwapQuote, error)
	//
	// Inventory, payments and management
	//
	AddCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) (uint64, error)
	UpdateCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) error
	ListCurrencyGroups(ctx context.Context) ([]*CurrencyGroup, error)
	DeleteCurrencyGroup(ctx context.Context, groupId uint64) (bool, error)
	AddInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) (uint64, error)
	GetInventoryPaymentConfig(ctx context.Context, configId uint64) (*InventoryPaymentConfig, error)
	ListInventoryPaymentConfigs(ctx context.Context, projectId uint64) ([]*InventoryPaymentConfig, error)
	UpdateInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) error
	DeleteInventoryPaymentConfig(ctx context.Context, configId uint64) (bool, error)
	RequestInventoryPayment(ctx context.Context, configId uint64, recipient string, chainId *uint64, tokenAddress *string) (*InventoryPaymentResponse, error)
}

func NewAPI added in v0.24.0

func NewAPI(projectAccessKey string, options ...Options) API

NewAPI creates a new Sequence API client instance. Please see https://sequence.build to get a `projectAccessKey`.

type APIClient added in v0.31.0

type APIClient interface {
	//
	// Runtime
	//
	Ping(ctx context.Context) (bool, error)
	Version(ctx context.Context) (*Version, error)
	RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
	Clock(ctx context.Context) (time.Time, error)
	GetSequenceContext(ctx context.Context) (*SequenceContext, error)
	//
	// Auth
	//
	// TODO: rename 'ewtString' arg to 'ethauthProof'
	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)
	//
	// Contacts / Friends
	//
	FriendList(ctx context.Context, nickname *string, page *Page) (*Page, []*Friend, error)
	GetFriendByAddress(ctx context.Context, friendAddress string) (bool, *Friend, error)
	SearchFriends(ctx context.Context, filterUsername string, page *Page) ([]*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)
	//
	// Chain-Utils
	//
	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)
	//
	// User Storage
	//
	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)
	//
	// Wallet utils
	//
	GetMoonpayLink(ctx context.Context, url string) (string, error)
	// - IsUsingGoogleMail(domain: string) => (yes: bool)
	ResolveENSAddress(ctx context.Context, ens string) (string, bool, error)
	// TODO: we can add walletContext optional in the future when we need it
	// NOTE: chainId can be either a number or canonical name
	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)
	SardineGetClientToken(ctx context.Context) (string, error)
	SardineGetNFTCheckoutToken(ctx context.Context, params *SardineNFTCheckoutParams) (*SardineNFTCheckout, error)
	SardineGetNFTCheckoutOrderStatus(ctx context.Context, orderId string) (*SardineOrder, error)
	SardineGetSupportedRegions(ctx context.Context) ([]*SardineRegion, error)
	SardineGetSupportedFiatCurrencies(ctx context.Context) ([]*SardineFiatCurrency, error)
	SardineGetSupportedTokens(ctx context.Context) ([]*SardineSupportedToken, error)
	SardineGetEnabledTokens(ctx context.Context) ([]*SardineEnabledToken, error)
	SardineGetQuote(ctx context.Context, params *SardineGetQuoteParams) (*SardineQuote, error)
	// Deprecated use SardineGetClientToken()
	GetSardineClientToken(ctx context.Context) (string, error)
	// Deprecated use SardineGetNFTCheckoutToken()
	GetSardineNFTCheckoutToken(ctx context.Context, params *SardineNFTCheckoutParams) (*SardineNFTCheckout, error)
	// Deprecated use SardineGetNFTCheckoutOrderStatus()
	GetSardineNFTCheckoutOrderStatus(ctx context.Context, orderId string) (*SardineOrder, error)
	//
	// Price Feed
	//
	GetCoinPrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error)
	GetCollectiblePrices(ctx context.Context, tokens []*Token) ([]*TokenPrice, error)
	//
	// Price Feed utils
	//
	GetExchangeRate(ctx context.Context, toCurrency string) (*ExchangeRate, error)
	//
	// Util / misc
	//
	MemoryStore(ctx context.Context, key string, value string) (bool, error)
	MemoryLoad(ctx context.Context, key string) (string, error)
	//
	// Legacy
	//
	GetInviteInfo(ctx context.Context) (*InviteInfo, error)
	// NOTE: we're still using this from SW-API to Sequence-API to claim invite code
	IsValidAccessCode(ctx context.Context, accessCode string) (bool, error)
	InternalClaimAccessCode(ctx context.Context, address string, accessCode string) (bool, error)
	// Utils
	BlockNumberAtTime(ctx context.Context, chainId uint64, timestamps []uint64) ([]uint64, error)
	//
	// Paper
	// TODO: deprecate in the future
	//
	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)
	//
	// Linked wallets (v0 -- simple support)
	//
	LinkWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error)
	GetLinkedWallets(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, signatureChainId string) ([]string, error)
	RemoveLinkedWallet(ctx context.Context, parentWalletAddress string, parentWalletMessage string, parentWalletSignature string, linkedWalletAddress string, linkedWalletMessage string, linkedWalletSignature string, signatureChainId string) (bool, error)
	// NOTE: these methods are deprecated, please do not use them. We may resurface them in the future, but just wanted
	// to be clear, they are not necessary for our linked wallets.
	GenerateWaaSVerificationURL(ctx context.Context, walletAddress string) (string, string, error)
	ValidateWaaSVerificationNonce(ctx context.Context, nonce string, signature string, sessionId string, chainId string) (string, error)
	//
	// Currency abstraction
	//
	GetSwapQuotes(ctx context.Context, userAddress string, currencyAddress string, currencyAmount string, chainId uint64, includeApprove bool) ([]*SwapQuote, error)
	//
	// Inventory, payments and management
	//
	AddCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) (uint64, error)
	UpdateCurrencyGroup(ctx context.Context, currencyGroup *CurrencyGroup) error
	ListCurrencyGroups(ctx context.Context) ([]*CurrencyGroup, error)
	DeleteCurrencyGroup(ctx context.Context, groupId uint64) (bool, error)
	AddInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) (uint64, error)
	GetInventoryPaymentConfig(ctx context.Context, configId uint64) (*InventoryPaymentConfig, error)
	ListInventoryPaymentConfigs(ctx context.Context, projectId uint64) ([]*InventoryPaymentConfig, error)
	UpdateInventoryPaymentConfig(ctx context.Context, config *InventoryPaymentConfig) error
	DeleteInventoryPaymentConfig(ctx context.Context, configId uint64) (bool, error)
	RequestInventoryPayment(ctx context.Context, configId uint64, recipient string, chainId *uint64, tokenAddress *string) (*InventoryPaymentResponse, error)
}

func NewAPIClient

func NewAPIClient(addr string, client HTTPClient) APIClient

type ContractCall

type ContractCall struct {
	Signature string            `json:"signature"`
	Function  string            `json:"function"`
	Args      []*TupleComponent `json:"args"`
}

type CurrencyGroup added in v0.39.0

type CurrencyGroup struct {
	ID     uint64                `json:"id" db:"id,omitempty"`
	Name   string                `json:"name" db:"name"`
	Tokens []*CurrencyGroupToken `json:"tokens"`
}

Cross chain matching tokens

type CurrencyGroupToken added in v0.39.0

type CurrencyGroupToken struct {
	ID              uint64        `json:"id" db:"id,omitempty"`
	CurrencyGroupID uint64        `json:"currencyGroupId" db:"currency_group_id"`
	ChainID         uint64        `json:"chainId" db:"chain_id"`
	TokenAddress    prototyp.Hash `json:"tokenAddress" db:"token_address"`
}

type ExchangeRate added in v0.11.7

type ExchangeRate struct {
	Name         string  `json:"name"`
	Symbol       string  `json:"symbol"`
	Value        float64 `json:"value"`
	VsCurrency   string  `json:"vsCurrency"`
	CurrencyType string  `json:"currencyType"`
}

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 allows the user to assign a friend a label, useful for the case
	// when that friend doesn't have an arcadeum user account
	Nickname  string     `json:"nickname" db:"nickname"`
	User      *User      `json:"user" db:"-"`
	CreatedAt *time.Time `json:"createdAt,omitempty" db:"created_at,omitempty"`
}

Friends

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 InventoryPayment added in v0.39.0

type InventoryPayment struct {
	ID                       uint64        `json:"id" db:"id,omitempty"`
	InventoryPaymentConfigID uint64        `json:"inventoryPaymentConfigId" db:"inventory_payment_config_id"`
	ProductRecipient         prototyp.Hash `json:"productRecipient" db:"product_recipient"`
	PaymentChainID           uint64        `json:"paymentChainId" db:"payment_chain_id"`
	PaymentTokenAddress      prototyp.Hash `json:"paymentTokenAddress" db:"payment_token_address"`
	Expiration               *time.Time    `json:"expiration" db:"expiration"`
	CreatedAt                *time.Time    `json:"createdAt" db:"created_at"`
	CompletedAt              *time.Time    `json:"completedAt" db:"completed_at"`
	ProcessedAt              *time.Time    `json:"processedAt" db:"processed_at"`
}

type InventoryPaymentConfig added in v0.39.0

type InventoryPaymentConfig struct {
	ID                  uint64        `json:"id" db:"id,omitempty"`
	ProjectID           uint64        `json:"projectId" db:"project_id"`
	ChainID             uint64        `json:"chainId" db:"chain_id"`
	ExternalProductID   string        `json:"externalProductId" db:"external_product_id"`
	PaymentTokenAddress prototyp.Hash `json:"paymentTokenAddress" db:"payment_token_address"`
	PaymentTokenType    TokenType     `json:"paymentTokenType" db:"payment_token_type"`
	PaymentTokenID      uint64        `json:"paymentTokenId" db:"payment_token_id"`
	PaymentAmount       uint64        `json:"paymentAmount" db:"payment_amount"`
	PaymentRecipient    prototyp.Hash `json:"paymentRecipient" db:"payment_recipient"`
	ChainedCallAddress  prototyp.Hash `json:"chainedCallAddress" db:"chained_call_address"`
	// product recipient address is added as the first argument (after selector)
	ChainedCallData         *string    `json:"chainedCallData" db:"chained_call_data"`
	AllowCrossChainPayments *bool      `json:"allowCrossChainPayments" db:"allow_cross_chain_payments"`
	CallbackURL             *string    `json:"callbackURL" db:"callback_url,omitempty"`
	CreatedAt               *time.Time `json:"createdAt" db:"created_at,omitempty"`
	DeletedAt               *time.Time `json:"-" db:"deleted_at,omitempty"`
}

type InventoryPaymentResponse added in v0.39.0

type InventoryPaymentResponse struct {
	PaymentID                uint64        `json:"paymentId"`
	InventoryPaymentConfigID uint64        `json:"inventoryPaymentConfigId"`
	ChainID                  uint64        `json:"chainId"`
	ExternalProductID        string        `json:"externalProductId"`
	PaymentTokenAddress      prototyp.Hash `json:"paymentTokenAddress"`
	PaymentTokenType         TokenType     `json:"paymentTokenType"`
	PaymentTokenID           uint64        `json:"paymentTokenId"`
	PaymentTotal             uint64        `json:"paymentTotal"`
	Expiration               *time.Time    `json:"expiration"`
	Signature                string        `json:"signature"`
	TxTo                     prototyp.Hash `json:"txTo"`
	TxData                   string        `json:"txData"`
}

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

InviteCode

type InviteCodeAccount

type InviteCodeAccount struct {
	Code                 string        `json:"-" db:"code"`
	ClaimedByUserAddress prototyp.Hash `json:"claimedByUserAddress" db:"claimed_by_user_address"`
	ClaimedAt            *time.Time    `json:"claimedAt,omitempty" db:"claimed_at,omitempty"`
}

InviteCode Account

type InviteInfo

type InviteInfo struct {
	ExpiryInHours uint32        `json:"expiryInHours"`
	Max           uint32        `json:"max"`
	Invites       []*InviteCode `json:"invites"`
}

Invite info

type LinkedWallet added in v0.29.3

type LinkedWallet struct {
	ID                  uint64        `json:"id" db:"id,omitempty"`
	WalletAddress       prototyp.Hash `json:"walletAddress" db:"wallet_address"`
	LinkedWalletAddress prototyp.Hash `json:"linkedWalletAddress" db:"linked_wallet_address"`
	CreatedAt           *time.Time    `json:"createdAt,omitempty" db:"created_at,omitempty"`
}

type NumTxnsRelayed added in v0.21.2

type NumTxnsRelayed struct {
	ChainID uint64 `json:"chainID"`
	Prev    uint64 `json:"prev"`
	Current uint64 `json:"current"`
	Period  uint64 `json:"period"`
}

type Options added in v0.24.0

type Options struct {
	HTTPClient    HTTPClient
	JWTAuthToken  string
	APIServiceURL string
}

type Page

type Page struct {
	// Common for both numbered pages and cursor: Number of items per page
	// TODO: REMOVE..
	PageSize *uint32 `json:"pageSize"`
	// Numbered pages: Page number, this is multiplied by the value of the <pageSize> parameter.
	// TODO: REMOVE..
	Page *uint32 `json:"page"`
	// Number of total items on this query.
	// TODO: REMOVE..
	TotalRecords *uint64 `json:"totalRecords"`
	// Cursor: column to compare before/after to
	Column *string `json:"column"`
	// Cursor: return column < before - include to get previous page
	Before *interface{} `json:"before"`
	// Cursor: return column > after - include to get next page
	After *interface{} `json:"after"`
	// Sorting filter
	Sort []*SortBy `json:"sort"`
	// Indicates if there are more results available
	More *bool `json:"more,omitempty"`
}

TOOD: refactor, we should be returning a cursor always.. see indexer/indexer.ridl Page object..

---

Page represents a results page. This can be used both to request a page and to store the state of a page.

type Price added in v0.11.7

type Price struct {
	Value    float64 `json:"value"`
	Currency string  `json:"currency"`
}

type RuntimeChecks

type RuntimeChecks struct {
}

type RuntimeStatus

type RuntimeStatus struct {
	// overall status, true/false
	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 SardineEnabledToken added in v0.40.1

type SardineEnabledToken struct {
	Network      string `json:"network,omitempty"`
	AssetSymbol  string `json:"assetSymbol,omitempty"`
	AssetName    string `json:"assetName,omitempty"`
	ChainID      string `json:"chainId,omitempty"`
	TokenName    string `json:"tokenName,omitempty"`
	Token        string `json:"token,omitempty"`
	TokenAddress string `json:"tokenAddress,omitempty"`
}

type SardineFiatCurrency added in v0.40.1

type SardineFiatCurrency struct {
	CurrencyCode        string                  `json:"currencyCode"`
	Name                string                  `json:"name"`
	CurrencySymbol      string                  `json:"currencySymbol"`
	PaymentOptions      []*SardinePaymentOption `json:"paymentOptions"`
	SupportingCountries []string                `json:"supportingCountries"`
}

type SardineGetQuoteParams added in v0.40.1

type SardineGetQuoteParams struct {
	// Cryptocurrency asset user wants to purchase
	AssetType string `json:"assetType"`
	// Blockchain on which the asset_type is present
	Network string `json:"network"`
	// Amount the user wants to buy or sell.
	Total uint64 `json:"total"`
	// The currency type in which the quote is supplied. Default 'USD'
	Currency *string `json:"currency"`
	// The payment method that the user will use for the transaction
	PaymentType *SardinePaymentType `json:"paymentType"`
	// Select for the required activity buy for on ramp and sell for off ramp. Default 'buy'
	QuoteType *SardineQuoteType `json:"quoteType"`
	// Wallet address of User. This is used to calculate if User has previously used Sardine, and provide them with a more accurate quote.
	WalletAddress *string `json:"walletAddress"`
}

type SardineNFTCheckout added in v0.40.1

type SardineNFTCheckout struct {
	Token     string `json:"token"`
	ExpiresAt string `json:"expiresAt"`
	OrderID   string `json:"orderId"`
}

type SardineNFTCheckoutParams added in v0.40.1

type SardineNFTCheckoutParams struct {
	Name                   string  `json:"name"`
	ImageURL               string  `json:"imageUrl"`
	Network                string  `json:"network"`
	RecipientAddress       string  `json:"recipientAddress"`
	BlockchainNFTID        string  `json:"blockchainNftId"`
	ContractAddress        string  `json:"contractAddress"`
	Quantity               int     `json:"quantity"`
	Decimals               *int    `json:"decimals"`
	TokenAmount            string  `json:"tokenAmount"`
	TokenAddress           string  `json:"tokenAddress"`
	TokenSymbol            string  `json:"tokenSymbol"`
	TokenDecimals          *int    `json:"tokenDecimals"`
	Calldata               string  `json:"calldata"`
	Platform               string  `json:"platform"`
	ApprovedSpenderAddress *string `json:"approvedSpenderAddress"`
}

type SardineOrder added in v0.31.0

type SardineOrder struct {
	ID                  string     `json:"id"`
	CreatedAt           *time.Time `json:"createdAt"`
	ReferenceID         string     `json:"referenceId"`
	Status              string     `json:"status"`
	FiatCurrency        string     `json:"fiatCurrency"`
	FiatExchangeRateUSD float64    `json:"fiatExchangeRateUSD"`
	TransactionID       string     `json:"transactionId"`
	ExpiresAt           *time.Time `json:"expiresAt"`
	Total               float64    `json:"total"`
	SubTotal            float64    `json:"subTotal"`
	TransactionFee      float64    `json:"transactionFee"`
	NetworkFee          float64    `json:"networkFee"`
	PaymentCurrency     *string    `json:"paymentCurrency"`
	PaymentMethodType   *string    `json:"paymentMethodType"`
	TransactionType     string     `json:"transactionType"`
	Name                string     `json:"name"`
	Price               int        `json:"price"`
	ImageURL            string     `json:"imageUrl"`
	ContractAddress     *string    `json:"contractAddress"`
	TransactionHash     *string    `json:"transactionHash"`
	RecipientAddress    string     `json:"recipientAddress"`
}

type SardinePaymentOption added in v0.40.1

type SardinePaymentOption struct {
	Name           string   `json:"name"`
	DailyLimit     float64  `json:"dailyLimit"`
	WeeklyLimit    float64  `json:"weeklyLimit"`
	MonthlyLimit   float64  `json:"monthlyLimit"`
	MaxAmount      float64  `json:"maxAmount"`
	MinAmount      float64  `json:"minAmount"`
	SubTypes       []string `json:"subTypes"`
	Type           string   `json:"type"`
	SubType        string   `json:"subType"`
	ProcessingTime string   `json:"processingTime"`
}

type SardinePaymentType added in v0.40.1

type SardinePaymentType uint32
const (
	SardinePaymentType_ach                  SardinePaymentType = 0
	SardinePaymentType_debit                SardinePaymentType = 1
	SardinePaymentType_credit               SardinePaymentType = 2
	SardinePaymentType_us_debit             SardinePaymentType = 3
	SardinePaymentType_international_debit  SardinePaymentType = 4
	SardinePaymentType_international_credit SardinePaymentType = 5
)

func (*SardinePaymentType) Is added in v0.40.1

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

func (SardinePaymentType) MarshalText added in v0.40.1

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

func (SardinePaymentType) String added in v0.40.1

func (x SardinePaymentType) String() string

func (*SardinePaymentType) UnmarshalText added in v0.40.1

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

type SardineQuote added in v0.40.1

type SardineQuote struct {
	Quantity            float64 `json:"quantity"`
	Network             string  `json:"network"`
	AssetType           string  `json:"assetType"`
	Total               float64 `json:"total"`
	Currency            string  `json:"currency"`
	ExpiresAt           string  `json:"expiresAt"`
	PaymentType         string  `json:"paymentType"`
	Price               float64 `json:"price"`
	Subtotal            float64 `json:"subtotal"`
	TransactionFee      float64 `json:"transactionFee"`
	NetworkFee          float64 `json:"networkFee"`
	HighNetworkFee      bool    `json:"highNetworkFee"`
	MinTransactionValue float64 `json:"minTransactionValue"`
	MaxTransactionValue float64 `json:"maxTransactionValue"`
	LiquidityProvider   string  `json:"liquidityProvider"`
}

type SardineQuoteType added in v0.40.1

type SardineQuoteType uint32
const (
	SardineQuoteType_buy  SardineQuoteType = 0
	SardineQuoteType_sell SardineQuoteType = 1
)

func (*SardineQuoteType) Is added in v0.40.1

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

func (SardineQuoteType) MarshalText added in v0.40.1

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

func (SardineQuoteType) String added in v0.40.1

func (x SardineQuoteType) String() string

func (*SardineQuoteType) UnmarshalText added in v0.40.1

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

type SardineRegion added in v0.40.1

type SardineRegion struct {
	CountryCode        string                        `json:"countryCode"`
	IsAllowedOnRamp    bool                          `json:"isAllowedOnRamp"`
	IsAllowedOnNFT     bool                          `json:"isAllowedOnNFT"`
	IsBasicKycRequired []string                      `json:"isBasicKycRequired"`
	IsSsnRequired      []string                      `json:"isSsnRequired"`
	Name               string                        `json:"name"`
	CurrencyCode       string                        `json:"currencyCode"`
	IsPayrollSupported bool                          `json:"isPayrollSupported"`
	SupportedDocuments []string                      `json:"supportedDocuments"`
	PaymentMethods     []*SardineRegionPaymentMethod `json:"paymentMethods"`
	States             []*SardineRegionState         `json:"states"`
}

type SardineRegionPaymentMethod added in v0.40.1

type SardineRegionPaymentMethod struct {
	Name            string   `json:"name"`
	IsAllowedOnRamp bool     `json:"isAllowedOnRamp"`
	IsAllowedOnNFT  bool     `json:"isAllowedOnNFT"`
	SubTypes        []string `json:"subTypes"`
	Type            string   `json:"type"`
	SubType         string   `json:"subType"`
}

type SardineRegionState added in v0.40.1

type SardineRegionState struct {
	Code            string `json:"code"`
	Name            string `json:"name"`
	IsAllowedOnRamp bool   `json:"isAllowedOnRamp"`
	IsAllowedOnNFT  bool   `json:"isAllowedOnNFT"`
}

type SardineSupportedToken added in v0.40.1

type SardineSupportedToken struct {
	Network      string `json:"network,omitempty"`
	AssetSymbol  string `json:"assetSymbol,omitempty"`
	AssetName    string `json:"assetName,omitempty"`
	ChainID      string `json:"chainId,omitempty"`
	TokenName    string `json:"tokenName,omitempty"`
	Token        string `json:"token,omitempty"`
	TokenAddress string `json:"tokenAddress,omitempty"`
}

type SequenceContext

type SequenceContext struct {
	Factory              string `json:"factory"`
	MainModule           string `json:"mainModule"`
	MainModuleUpgradable string `json:"mainModuleUpgradable"`
	GuestModule          string `json:"guestModule"`
	Utils                string `json:"utils"`
}

type SortBy

type SortBy struct {
	Column string    `json:"column"`
	Order  SortOrder `json:"order"`
}

type SortOrder

type SortOrder uint32
const (
	SortOrder_DESC SortOrder = 0
	SortOrder_ASC  SortOrder = 1
)

func (*SortOrder) Is added in v0.31.0

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

func (SortOrder) MarshalText added in v0.31.0

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

func (SortOrder) String

func (x SortOrder) String() string

func (*SortOrder) UnmarshalText added in v0.31.0

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

type SwapQuote added in v0.39.0

type SwapQuote struct {
	CurrencyAddress string          `json:"currencyAddress"`
	CurrencyBalance prototyp.BigInt `json:"currencyBalance"`
	Price           prototyp.BigInt `json:"price"`
	// Guaranteed price for the swap.
	MaxPrice prototyp.BigInt `json:"maxPrice"`
	// to must be approved to access maxPrice of currencyAddress for the sender
	To               string          `json:"to"`
	TransactionData  string          `json:"transactionData"`
	TransactionValue prototyp.BigInt `json:"transactionValue"`
	// Supplied when includeApprove is true
	ApproveData string `json:"approveData"`
}

type Token added in v0.11.7

type Token struct {
	ChainId         uint64        `json:"chainId"`
	ContractAddress prototyp.Hash `json:"contractAddress"`
	TokenId         *string       `json:"tokenId"`
}

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 TokenType added in v0.39.0

type TokenType uint8
const (
	TokenType_ERC20   TokenType = 0
	TokenType_ERC721  TokenType = 1
	TokenType_ERC1155 TokenType = 2
)

func (*TokenType) Is added in v0.39.0

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

func (TokenType) MarshalText added in v0.39.0

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

func (TokenType) String added in v0.39.0

func (x TokenType) String() string

func (*TokenType) UnmarshalText added in v0.39.0

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

type Transaction

type Transaction struct {
	DelegateCall  bool            `json:"delegateCall"`
	RevertOnError bool            `json:"revertOnError"`
	GasLimit      prototyp.BigInt `json:"gasLimit"`
	Target        string          `json:"target"`
	Value         prototyp.BigInt `json:"value"`
	Data          string          `json:"data"`
	Call          *ContractCall   `json:"call"`
}

type TupleComponent added in v0.11.7

type TupleComponent struct {
	Name  *string     `json:"name"`
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

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

Users

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 Version

type Version struct {
	WebrpcVersion string `json:"webrpcVersion"`
	SchemaVersion string `json:"schemaVersion"`
	SchemaHash    string `json:"schemaHash"`
	AppVersion    string `json:"appVersion"`
}

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 is a flag that the user tells us they've backed up
	// their wallet mnemonic for future recovery. It's just a user-experience field
	// so we can nag them if they haven't confirmed yet.
	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"`
}

Wallet Backup

type WebRPCError added in v0.31.0

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

func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError

Deprecated: Use .WithCause() method on WebRPCError.

func (WebRPCError) Error added in v0.31.0

func (e WebRPCError) Error() string

func (WebRPCError) Is added in v0.31.0

func (e WebRPCError) Is(target error) bool

func (WebRPCError) Unwrap added in v0.31.0

func (e WebRPCError) Unwrap() error

func (WebRPCError) WithCause added in v0.31.0

func (e WebRPCError) WithCause(cause error) WebRPCError

func (WebRPCError) WithCausef added in v0.31.0

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

Jump to

Keyboard shortcuts

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