Documentation
¶
Overview ¶
sequence-indexer v0.4.0 0c066283983946c80bfa026c6893afab4fe88ad3 -- Code generated by webrpc-gen@v0.21.1 with golang generator. DO NOT EDIT.
webrpc-gen -schema=indexer.ridl -target=golang -pkg=indexer -client -out=./clients/indexer.gen.go
Index ¶
- Constants
- Variables
- func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)
- func MethodCtx(ctx context.Context) (method, bool)
- func MethodNameFromContext(ctx context.Context) string
- func RequestFromContext(ctx context.Context) *http.Request
- func ServiceNameFromContext(ctx context.Context) string
- func WebRPCSchemaHash() string
- func WebRPCSchemaVersion() string
- func WebRPCVersion() string
- func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)
- type Asset
- type BloomStatus
- type Bond
- type ContractInfo
- type ContractInfoExtensions
- type ContractType
- type ContractVerificationStatus
- type DiskUsage
- type EtherBalance
- type EventDecoded
- type EventFilter
- type EventLog
- type EventLogDataType
- type EventLogType
- type GatewayBackendResponseTime
- type GatewayBackendRuntimeStatus
- type GatewayEtherBalance
- type GatewayNativeTokenBalance
- type GatewayNativeTokenBalances
- type GatewayRuntimeStatus
- type GatewayTokenBalance
- type HTTPClient
- type IndexState
- type IndexedBlock
- type Indexer
- type IndexerClient
- type IndexerGateway
- type IndexerGatewayClient
- type MetadataOptions
- type NativeTokenBalance
- type Options
- type OrderStatus
- type OrderbookOrder
- type OrderbookOrderFilter
- type Page
- type PebbleMetrics
- type ResourceStatus
- type RuntimeChecks
- type RuntimeStatus
- type SortBy
- type SortOrder
- type SubscribeBalanceUpdatesStreamReader
- type SubscribeBalanceUpdatesStreamWriter
- type SubscribeEventsStreamReader
- type SubscribeEventsStreamWriter
- type SubscribeReceiptsStreamReader
- type SubscribeReceiptsStreamWriter
- type TokenBalance
- type TokenBalanceFilter
- type TokenBalancesByContractFilter
- type TokenBalancesFilter
- type TokenHistory
- type TokenIDRange
- type TokenMetadata
- type TokenSupply
- type Transaction
- type TransactionFilter
- type TransactionHistoryFilter
- type TransactionLog
- type TransactionReceipt
- type TransactionStatus
- type TransactionType
- type TxnInfo
- type TxnTransfer
- type TxnTransferType
- type Version
- type WALWriterRuntimeStatus
- type WebRPCError
- type WebhookListener
- type WebrpcGenVersions
Constants ¶
const IndexerGatewayPathPrefix = "/rpc/IndexerGateway/"
const IndexerPathPrefix = "/rpc/Indexer/"
const StreamKeepAliveInterval = 10 * time.Second
const WebrpcHeader = "Webrpc"
const WebrpcHeaderValue = "webrpc@v0.21.1;gen-golang@v0.16.0;sequence-indexer@v0.4.0"
Variables ¶
var ( HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} HTTPRequestCtxKey = &contextKey{"HTTPRequest"} ServiceNameCtxKey = &contextKey{"ServiceName"} MethodNameCtxKey = &contextKey{"MethodName"} )
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
var ( ErrPermissionDenied = WebRPCError{Code: 1001, Name: "PermissionDenied", Message: "Permission denied", HTTPStatus: 403} ErrSessionExpired = WebRPCError{Code: 1002, Name: "SessionExpired", Message: "Session expired", HTTPStatus: 403} ErrMethodNotFound = WebRPCError{Code: 1003, Name: "MethodNotFound", Message: "Method not found", HTTPStatus: 404} ErrRequestConflict = WebRPCError{Code: 1004, Name: "RequestConflict", Message: "Conflict with target resource", HTTPStatus: 409} ErrAborted = WebRPCError{Code: 1005, Name: "Aborted", Message: "Request aborted", HTTPStatus: 400} ErrGeoblocked = WebRPCError{Code: 1006, Name: "Geoblocked", Message: "Geoblocked region", HTTPStatus: 451} ErrRateLimited = WebRPCError{Code: 1007, Name: "RateLimited", Message: "Rate-limited. Please slow down.", HTTPStatus: 429} ErrProjectNotFound = WebRPCError{Code: 1100, Name: "ProjectNotFound", Message: "Project not found", HTTPStatus: 401} ErrAccessKeyNotFound = WebRPCError{Code: 1101, Name: "AccessKeyNotFound", Message: "Access key not found", HTTPStatus: 401} ErrAccessKeyMismatch = WebRPCError{Code: 1102, Name: "AccessKeyMismatch", Message: "Access key mismatch", HTTPStatus: 409} ErrInvalidOrigin = WebRPCError{Code: 1103, Name: "InvalidOrigin", Message: "Invalid origin for Access Key", HTTPStatus: 403} ErrInvalidService = WebRPCError{Code: 1104, Name: "InvalidService", Message: "Service not enabled for Access key", HTTPStatus: 403} ErrQuotaExceeded = WebRPCError{Code: 1200, Name: "QuotaExceeded", Message: "Quota exceeded", HTTPStatus: 429} ErrRateLimit = WebRPCError{Code: 1201, Name: "RateLimit", Message: "Rate limit exceeded", HTTPStatus: 429} ErrNoDefaultKey = WebRPCError{Code: 1300, Name: "NoDefaultKey", Message: "No default access key found", HTTPStatus: 403} ErrMaxAccessKeys = WebRPCError{Code: 1301, Name: "MaxAccessKeys", Message: "Access keys limit reached", HTTPStatus: 403} ErrAtLeastOneKey = WebRPCError{Code: 1302, Name: "AtLeastOneKey", Message: "You need at least one Access Key", HTTPStatus: 403} ErrTimeout = WebRPCError{Code: 1900, Name: "Timeout", Message: "Request timed out", HTTPStatus: 408} ErrInvalidArgument = WebRPCError{Code: 2001, Name: "InvalidArgument", Message: "Invalid argument", HTTPStatus: 400} ErrQueryFailed = WebRPCError{Code: 2003, Name: "QueryFailed", Message: "Query failed", HTTPStatus: 400} ErrResourceExhausted = WebRPCError{Code: 2004, Name: "ResourceExhausted", Message: "Resource exhausted", HTTPStatus: 400} ErrNotFound = WebRPCError{Code: 3000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400} ErrMetadataCallFailed = WebRPCError{Code: 3003, Name: "MetadataCallFailed", Message: "Metadata service call failed", HTTPStatus: 400} )
Schema errors
var ContractType_name = map[uint8]string{
0: "UNKNOWN",
1: "NATIVE",
2: "ERC20",
3: "ERC721",
4: "ERC1155",
5: "SEQUENCE_WALLET",
6: "ERC20_BRIDGE",
7: "ERC721_BRIDGE",
8: "ERC1155_BRIDGE",
9: "SEQ_MARKETPLACE",
}
var ContractType_value = map[string]uint8{
"UNKNOWN": 0,
"NATIVE": 1,
"ERC20": 2,
"ERC721": 3,
"ERC1155": 4,
"SEQUENCE_WALLET": 5,
"ERC20_BRIDGE": 6,
"ERC721_BRIDGE": 7,
"ERC1155_BRIDGE": 8,
"SEQ_MARKETPLACE": 9,
}
var EventLogDataType_name = map[uint8]string{
0: "EVENT",
1: "TOKEN_TRANSFER",
2: "NATIVE_TOKEN_TRANSFER",
3: "SEQUENCE_TXN",
}
var EventLogDataType_value = map[string]uint8{
"EVENT": 0,
"TOKEN_TRANSFER": 1,
"NATIVE_TOKEN_TRANSFER": 2,
"SEQUENCE_TXN": 3,
}
var EventLogType_name = map[uint8]string{
0: "UNKNOWN",
1: "BLOCK_ADDED",
2: "BLOCK_REMOVED",
}
var EventLogType_value = map[string]uint8{
"UNKNOWN": 0,
"BLOCK_ADDED": 1,
"BLOCK_REMOVED": 2,
}
var OrderStatus_name = map[uint32]string{
0: "OPEN",
1: "CLOSED",
2: "CANCELLED",
}
var OrderStatus_value = map[string]uint32{
"OPEN": 0,
"CLOSED": 1,
"CANCELLED": 2,
}
var ResourceStatus_name = map[uint32]string{
0: "NOT_AVAILABLE",
1: "STALE",
2: "AVAILABLE",
}
var ResourceStatus_value = map[string]uint32{
"NOT_AVAILABLE": 0,
"STALE": 1,
"AVAILABLE": 2,
}
var SortOrder_name = map[uint32]string{
0: "DESC",
1: "ASC",
}
var SortOrder_value = map[string]uint32{
"DESC": 0,
"ASC": 1,
}
var TransactionStatus_name = map[uint32]string{
0: "FAILED",
1: "SUCCESSFUL",
}
var TransactionStatus_value = map[string]uint32{
"FAILED": 0,
"SUCCESSFUL": 1,
}
var TransactionType_name = map[uint32]string{
0: "LegacyTxnType",
1: "AccessListTxnType",
2: "DynamicFeeTxnType",
}
var TransactionType_value = map[string]uint32{
"LegacyTxnType": 0,
"AccessListTxnType": 1,
"DynamicFeeTxnType": 2,
}
var TxnTransferType_name = map[uint32]string{
0: "UNKNOWN",
1: "SEND",
2: "RECEIVE",
}
var TxnTransferType_value = map[string]uint32{
"UNKNOWN": 0,
"SEND": 1,
"RECEIVE": 2,
}
var WebRPCServices = map[string][]string{
"Indexer": {
"Ping",
"Version",
"RuntimeStatus",
"GetChainID",
"GetEtherBalance",
"GetNativeTokenBalance",
"GetTokenBalancesSummary",
"GetTokenBalancesDetails",
"GetTokenBalancesByContract",
"GetTokenBalances",
"GetTokenSupplies",
"GetTokenSuppliesMap",
"GetTokenIDs",
"GetTokenIDRanges",
"GetBalanceUpdates",
"GetTransactionHistory",
"FetchTransactionReceipt",
"FetchTransactionReceiptWithFilter",
"SubscribeReceipts",
"SubscribeEvents",
"SubscribeBalanceUpdates",
"SyncBalance",
"GetAllWebhookListeners",
"GetWebhookListener",
"AddWebhookListener",
"UpdateWebhookListener",
"RemoveWebhookListener",
"RemoveAllWebhookListeners",
"ToggleWebhookListener",
"PauseAllWebhookListeners",
"ResumeAllWebhookListeners",
"GetOrderbookOrders",
"GetTopOrders",
},
"IndexerGateway": {
"GetNativeTokenBalance",
"GetTokenBalances",
"GetTokenBalancesSummary",
"GetTokenBalancesDetails",
"GetTokenBalancesByContract",
"GetBalanceUpdates",
"Ping",
"Version",
"RuntimeStatus",
},
}
Functions ¶
func MethodNameFromContext ¶ added in v0.30.0
func RequestFromContext ¶ added in v0.30.0
func ServiceNameFromContext ¶ added in v0.30.0
Types ¶
type Asset ¶ added in v0.30.0
type Asset struct {
// asset id
ID uint64 `json:"id" db:"id,omitempty"`
// collection id associated to this asset
CollectionID uint64 `json:"collectionId" db:"collection_id"`
// token id associated to this collection
TokenID *prototyp.BigInt `json:"tokenId" db:"token_id,omitempty"`
// url where we can view the asset contents
// ie. https://metadata.sequence.app/projects/1/collections/1/tokens/1/image
URL string `json:"url" db:"-"`
// metadata field related to TokenMetadata, some field names:
// ['image', 'video', 'audio', 'animation_url', ...]
MetadataField string `json:"metadataField,omitempty" db:"metadata_field"`
// asset details
Filename string `json:"filename,omitempty" db:"filename"`
Filesize uint32 `json:"filesize,omitempty" db:"filesize"`
MimeType string `json:"mimeType,omitempty" db:"mime_type"`
Width *uint16 `json:"width,omitempty" db:"width"`
Height *uint16 `json:"height,omitempty" db:"height"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
Asset is a database type used by 'collections' to record static assets for a particular 'token' for the token metadata.
type BloomStatus ¶ added in v0.30.0
type Bond ¶ added in v0.23.3
type Bond struct {
Pebble *PebbleMetrics `json:"pebble"`
EstimatedDiskUsagePerTable interface{} `json:"estimatedDiskUsagePerTable"`
EstimatedDiskUsageTotal string `json:"estimatedDiskUsageTotal"`
}
type ContractInfo ¶ added in v0.12.6
type ContractInfo struct {
ChainID uint64 `json:"chainId" cbor:"-"`
Address string `json:"address" cbor:"-"`
Name string `json:"name" cbor:"-"`
Type string `json:"type" cbor:"-"`
Symbol string `json:"symbol" cbor:"-"`
Decimals *uint64 `json:"decimals,omitempty" cbor:"-"`
LogoURI string `json:"logoURI,omitempty" cbor:"-"`
Deployed bool `json:"deployed" cbor:"-"`
BytecodeHash prototyp.Hash `json:"bytecodeHash" cbor:"-"`
Extensions *ContractInfoExtensions `json:"extensions" cbor:"-"`
ContentHash uint64 `json:"-" cbor:"-"`
UpdatedAt time.Time `json:"updatedAt" cbor:"-"`
NotFound bool `json:"notFound"`
QueuedAt *time.Time `json:"queuedAt"`
Status ResourceStatus `json:"status"`
}
ContractInfo is RPC type for responding to clients that represents the contract-level metadata.
type ContractInfoExtensions ¶ added in v0.12.6
type ContractInfoExtensions struct {
Link string `json:"link" cbor:"-"`
Description string `json:"description" cbor:"-"`
Categories []string `json:"categories,omitempty" cbor:"-"`
OgImage string `json:"ogImage" cbor:"-"`
OgName string `json:"ogName" cbor:"-"`
OriginChainID uint64 `json:"originChainId" cbor:"-"`
OriginAddress string `json:"originAddress" cbor:"-"`
Blacklist bool `json:"blacklist,omitempty" cbor:"-"`
Verified bool `json:"verified" cbor:"-"`
VerifiedBy string `json:"verifiedBy,omitempty" cbor:"-"`
Featured bool `json:"featured,omitempty" cbor:"-"`
}
type ContractType ¶
type ContractType uint8
const ( ContractType_UNKNOWN ContractType = 0 ContractType_NATIVE ContractType = 1 ContractType_ERC20 ContractType = 2 ContractType_ERC721 ContractType = 3 ContractType_ERC1155 ContractType = 4 ContractType_SEQUENCE_WALLET ContractType = 5 ContractType_ERC20_BRIDGE ContractType = 6 ContractType_ERC721_BRIDGE ContractType = 7 ContractType_ERC1155_BRIDGE ContractType = 8 ContractType_SEQ_MARKETPLACE ContractType = 9 )
func (*ContractType) Is ¶ added in v0.30.0
func (x *ContractType) Is(values ...ContractType) bool
func (ContractType) MarshalText ¶ added in v0.30.0
func (x ContractType) MarshalText() ([]byte, error)
func (ContractType) String ¶
func (x ContractType) String() string
func (*ContractType) UnmarshalText ¶ added in v0.30.0
func (x *ContractType) UnmarshalText(b []byte) error
type ContractVerificationStatus ¶ added in v0.42.0
type ContractVerificationStatus string
const ( ContractVerificationStatus_VERIFIED ContractVerificationStatus = "VERIFIED" ContractVerificationStatus_UNVERIFIED ContractVerificationStatus = "UNVERIFIED" ContractVerificationStatus_ALL ContractVerificationStatus = "ALL" )
func (*ContractVerificationStatus) Is ¶ added in v0.42.0
func (x *ContractVerificationStatus) Is(values ...ContractVerificationStatus) bool
func (ContractVerificationStatus) MarshalText ¶ added in v0.42.0
func (x ContractVerificationStatus) MarshalText() ([]byte, error)
func (*ContractVerificationStatus) UnmarshalText ¶ added in v0.42.0
func (x *ContractVerificationStatus) UnmarshalText(b []byte) error
type EtherBalance ¶
type EventDecoded ¶ added in v0.42.0
type EventDecoded struct {
TopicHash string `json:"topicHash"`
// ie. 'Move(address indexed from, uint256 amount)'
EventSig string `json:"eventSig,omitempty"`
// ie. ['address', 'uint256']
Types []string `json:"types,omitempty"`
// ie. ['from', 'amount']
Names []string `json:"names,omitempty"`
// ie. ['0xabc..def', '0x000000....001234']
Values []string `json:"values,omitempty"`
}
type EventFilter ¶ added in v0.31.0
type EventFilter struct {
// event is the event name to filter, for example
// 'Transfer(address indexed from, address indexed to, uint256 value)'
Events []string `json:"events"`
// contract addresses
// TODO: maybe rename to just `contracts` ..?
ContractAddresses []prototyp.Hash `json:"contractAddresses"`
// wallet addresses
// NOTE: for EOA's, this checks a transactions from/to, in addition
// to 'Transfer' events From/To. For Smart wallets it checks the 'Transfer
// events From/To. For any generic event, this is unreliable method because
// the event could be emitted from any address (for example for a smart wallet),
// or some other kind of relayer.
Accounts []prototyp.Hash `json:"accounts"`
// token ids for events which have token ids
TokenIDs []prototyp.BigInt `json:"tokenIDs"`
}
type EventLog ¶
type EventLog struct {
ID uint64 `json:"id,omitempty" cbor:"id,omitempty"`
UID prototyp.Hash `json:"uid,omitempty" cbor:"uid,omitempty"`
Type EventLogType `json:"type" cbor:"type"`
BlockNumber uint64 `json:"blockNumber" cbor:"block_num"`
BlockHash prototyp.Hash `json:"blockHash" cbor:"block_hash,extension"`
ParentBlockHash prototyp.Hash `json:"parentBlockHash,omitempty" cbor:"parent_block_hash,extension" db:"parent_block_hash"`
ContractAddress prototyp.Hash `json:"contractAddress" cbor:"contract_address,extension"`
ContractType ContractType `json:"contractType" cbor:"contract_type"`
TxnHash prototyp.Hash `json:"txnHash" cbor:"txn_hash,extension"`
TxnIndex uint `json:"txnIndex" cbor:"txn_index"`
TxnLogIndex uint `json:"txnLogIndex" cbor:"txn_log_index"`
LogDataType EventLogDataType `json:"logDataType" cbor:"log_data_type"`
TS time.Time `json:"ts" cbor:"ts"`
TxnInfo *TxnInfo `json:"txnInfo,omitempty" cbor:"txn_info"`
// optional rawLog data returns for json responses
// such as for streaming events to SubscribeEvents(..),
// for webhooks this is left empty
RawLog map[string]interface{} `json:"rawLog,omitempty" cbor:"-"`
// optional decoded event data passed to streams
// and webhooks.
Event *EventDecoded `json:"event,omitempty" cbor:"-"`
}
type EventLogDataType ¶
type EventLogDataType uint8
const ( // aka, generic / unknown event type EventLogDataType_EVENT EventLogDataType = 0 EventLogDataType_TOKEN_TRANSFER EventLogDataType = 1 EventLogDataType_NATIVE_TOKEN_TRANSFER EventLogDataType = 2 EventLogDataType_SEQUENCE_TXN EventLogDataType = 3 )
func (*EventLogDataType) Is ¶ added in v0.30.0
func (x *EventLogDataType) Is(values ...EventLogDataType) bool
func (EventLogDataType) MarshalText ¶ added in v0.30.0
func (x EventLogDataType) MarshalText() ([]byte, error)
func (EventLogDataType) String ¶
func (x EventLogDataType) String() string
func (*EventLogDataType) UnmarshalText ¶ added in v0.30.0
func (x *EventLogDataType) UnmarshalText(b []byte) error
type EventLogType ¶
type EventLogType uint8
const ( EventLogType_UNKNOWN EventLogType = 0 EventLogType_BLOCK_ADDED EventLogType = 1 EventLogType_BLOCK_REMOVED EventLogType = 2 )
func (*EventLogType) Is ¶ added in v0.30.0
func (x *EventLogType) Is(values ...EventLogType) bool
func (EventLogType) MarshalText ¶ added in v0.30.0
func (x EventLogType) MarshalText() ([]byte, error)
func (EventLogType) String ¶
func (x EventLogType) String() string
func (*EventLogType) UnmarshalText ¶ added in v0.30.0
func (x *EventLogType) UnmarshalText(b []byte) error
type GatewayBackendResponseTime ¶ added in v0.47.0
type GatewayBackendRuntimeStatus ¶ added in v0.47.0
type GatewayBackendRuntimeStatus struct {
Name string `json:"name"`
ChainID uint64 `json:"chainId"`
ResponseTime *GatewayBackendResponseTime `json:"responseTime"`
}
type GatewayEtherBalance ¶ added in v0.45.0
type GatewayEtherBalance struct {
ChainID uint64 `json:"chainId"`
Error error `json:"error,omitempty"`
Result *EtherBalance `json:"result"`
}
type GatewayNativeTokenBalance ¶ added in v0.45.0
type GatewayNativeTokenBalance struct {
ChainID uint64 `json:"chainId"`
Error error `json:"error,omitempty"`
Result *NativeTokenBalance `json:"result"`
}
type GatewayNativeTokenBalances ¶ added in v0.45.0
type GatewayNativeTokenBalances struct {
ChainId uint64 `json:"chainId"`
Error error `json:"error,omitempty"`
Results []*NativeTokenBalance `json:"results"`
}
type GatewayRuntimeStatus ¶ added in v0.47.0
type GatewayTokenBalance ¶ added in v0.45.0
type GatewayTokenBalance struct {
ChainID uint64 `json:"chainId"`
Error error `json:"error,omitempty"`
Results []*TokenBalance `json:"results"`
}
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 IndexState ¶
type IndexedBlock ¶ added in v0.19.7
type Indexer ¶
type Indexer interface {
// Ping the indexer
Ping(ctx context.Context) (bool, error)
// Get the current version of the indexer
Version(ctx context.Context) (*Version, error)
// Get the current runtime health status of the indexer
RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
// Get the chain ID of the indexer
GetChainID(ctx context.Context) (uint64, error)
// Queries an ethereum node for the latest and confirm ETH balances
// DEPRECATED: use GetNativeTokenBalance instead
// Deprecated:
GetEtherBalance(ctx context.Context, accountAddress *string) (*EtherBalance, error)
// GetNativeTokenBalance queries an ethereum node for the latest native token account balance.
// The native token is the token of the chain the indexer is connected to, for example, ETH on Ethereum
// and POL on Polygon.
GetNativeTokenBalance(ctx context.Context, accountAddress *string) (*NativeTokenBalance, error)
// GetTokenBalancesSummary returns a summary of token balances for a specific
// accounts. The collection ERC721 & ERC1155 tokens are represented as a
// single aggregated balance.
//
// If `filter` is not provided, it will use the filter with account from the
// jwt session.
//
// If `filter.contractStatus` is not provided, it will include verified only
// tokens.
GetTokenBalancesSummary(ctx context.Context, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*NativeTokenBalance, []*TokenBalance, error)
// GetTokenBalancesDetails returns a detailed balance summary for a specific
// accounts. The collection ERC721 & ERC1155 tokens are represented as
// individual balances.
//
// If `filter` is not provided, it will use the filter with account from the
// jwt session.
//
// If `filter.contractStatus` is not provided, it will include verified only
// tokens.
GetTokenBalancesDetails(ctx context.Context, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*NativeTokenBalance, []*TokenBalance, error)
// GetTokenBalancesByContract returns a balances for a specific accounts and
// contracts. The collection ERC721 & ERC1155 tokens are represented as
// individual balances.
//
// If `filter` is not provided, it will error out as it requires at least
// contract address.
//
// If `filter.contractStatus` is not provided, it will include verified only
// tokens.
GetTokenBalancesByContract(ctx context.Context, filter *TokenBalancesByContractFilter, omitMetadata *bool, page *Page) (*Page, []*TokenBalance, error)
// GetTokenBalances returns a balance summary/details for a specific account. By default
// if accountAddress is left empty, it will use the account from the jwt session.
//
// Also, if contractAddress is undefined, then it will list all current user coins/collectibles.
// But, if contractAddress is provided, then it will return the token balances for the contract, this is
// only useful for 1155, but for other tokens, it can act as a filter for the single balance.
GetTokenBalances(ctx context.Context, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, metadataOptions *MetadataOptions, includeCollectionTokens *bool, page *Page) (*Page, []*TokenBalance, error)
// GetTokenSupplies returns the set of tokenIDs used by a contract address, supporting ERC-20, ERC-721, and ERC-1155
// contracts, and their respective supply as well.
GetTokenSupplies(ctx context.Context, contractAddress string, includeMetadata *bool, metadataOptions *MetadataOptions, page *Page) (*Page, ContractType, []*TokenSupply, error)
// GetTokenSuppliesMap returns the token supplies of ERC-20 and ERC-1155 tokens as requested in the `tokenMap`
// represented as a map of contractAddress :: []tokenIDs.
//
// For an ERC-20 specify tokenIDs as an empty array or [0], for example, { '0xdef': [] } or { '0xdef': [0] }
// For ERC-1155 pass the array of tokens are strings, ie. { '0xabc': ['1', '2', '3'] }
GetTokenSuppliesMap(ctx context.Context, tokenMap map[string][]string, includeMetadata *bool, metadataOptions *MetadataOptions) (map[string][]*TokenSupply, error)
// GetTokenIDs returns the list of each individual token id for a token collection contract.
// This is useful for ERC-721 and ERC-1155 contracts to get the list of valid tokenIDs.
GetTokenIDs(ctx context.Context, contractAddress string, page *Page) (*Page, ContractType, []string, error)
// GetTokenIDRanges returns the range of tokenIDs for a token collection contract.
// This is useful for ERC-721 and ERC-1155 contracts to get the range of valid tokenIDs. It is similar to
// GetTokenIDs, but returns the range of tokenIDs instead of the list of tokenIDs, which is more efficient
// for large collections and very easy to the caller to expand the range into a list of tokenIDs.
//
// NOTE: this method will only return up to 15,000 ranges, if there are more ranges, it will return
// a boolean to indicate there are more ranges beyond the first 15,000. Therefore, if `moreRanges` is
// false then you have all the ranges, but if true, you need to make a follow up call to fetch the next
// page of ranges.
//
// As an example, if a NFT collection of 100,000 tokens uses ids from 1,2,3,...,100_000 then this endpoint
// will return just a single range from [1,100_000], but if there are gaps between the sequence, then
// those will be broken into separate range entries.
GetTokenIDRanges(ctx context.Context, contractAddress string) (ContractType, []*TokenIDRange, bool, error)
// Get balance update aggregate values -- useful for syncing balance details of a contract, ie. from Skyweaver.
// Also consider using SubscribeBalanceUpdates or SubscribeEvents as other alternatives.
GetBalanceUpdates(ctx context.Context, contractAddress string, lastBlockNumber uint64, lastBlockHash *string, page *Page) (*Page, []*TokenBalance, error)
// History of mined transactions for the account which includes a list of token transfers (sent/recieved)
// and sent transactions from a Sequence wallet
GetTransactionHistory(ctx context.Context, filter *TransactionHistoryFilter, page *Page, includeMetadata *bool, metadataOptions *MetadataOptions) (*Page, []*Transaction, error)
// Fetches a single receipt and then will stop the subscription
FetchTransactionReceipt(ctx context.Context, txnHash string, maxBlockWait *int) (*TransactionReceipt, error)
// Fetches a single receipt with filter and then will stop the subscription
FetchTransactionReceiptWithFilter(ctx context.Context, filter *TransactionFilter, maxBlockWait *int) (*TransactionReceipt, error)
// Listen to transaction receipts on-chain based on the filter criteria
SubscribeReceipts(ctx context.Context, filter *TransactionFilter, stream SubscribeReceiptsStreamWriter) error
// SubscribeEvents listens to events on-chain based on the filter criteria
//
// TODO: some additional options can be passed such as block, reorg true, etc.
// or stay behind, etc.
SubscribeEvents(ctx context.Context, filter *EventFilter, stream SubscribeEventsStreamWriter) error
// SubscribeBalanceUpdates listens to balance updates for a specific contract address
SubscribeBalanceUpdates(ctx context.Context, contractAddress string, stream SubscribeBalanceUpdatesStreamWriter) error
// Re-sync an incorrect token balance with the correct on-chain balance
// NOTE: this method is almost never used, but we've marked it internal in case
// we ever want to use it again. This method was written a very long time ago in
// scenarios when the indexer had little bugs, but now its solid.
SyncBalance(ctx context.Context, accountAddress string, contractAddress string, tokenID *string) error
// Webhooks
GetAllWebhookListeners(ctx context.Context, projectId *uint64) ([]*WebhookListener, error)
GetWebhookListener(ctx context.Context, id uint64, projectId *uint64) (*WebhookListener, error)
AddWebhookListener(ctx context.Context, url string, filters *EventFilter, projectId *uint64) (bool, *WebhookListener, error)
UpdateWebhookListener(ctx context.Context, listener *WebhookListener, projectId *uint64) (bool, error)
RemoveWebhookListener(ctx context.Context, id uint64, projectId *uint64) (bool, error)
RemoveAllWebhookListeners(ctx context.Context, projectId *uint64) (bool, error)
ToggleWebhookListener(ctx context.Context, id uint64, projectId *uint64) (*WebhookListener, error)
PauseAllWebhookListeners(ctx context.Context, projectId *uint64) (bool, error)
ResumeAllWebhookListeners(ctx context.Context, projectId *uint64) (bool, error)
// These parameters are depracated, please don't use them:
// - filters
// - beforeExpiryTimestamp
// - blockNumberAfter
// - createdAtAfter
// and in OrderbookOrderFilter these fields are depracated:
// - userAddress
// - excludeUserAddress
//
// Use 'filter' and these fields instead
// - userAddresses
// - excludeUserAddress'
GetOrderbookOrders(ctx context.Context, page *Page, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, filter *OrderbookOrderFilter, orderStatuses []OrderStatus, filters []*OrderbookOrderFilter, beforeExpiryTimestamp int64, blockNumberAfter int64, createdAtAfter int64) (*Page, []*OrderbookOrder, error)
GetTopOrders(ctx context.Context, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, tokenIDs []string, isListing bool, priceSort SortOrder, excludeUser *string) ([]*OrderbookOrder, error)
}
type IndexerClient ¶ added in v0.30.0
type IndexerClient interface {
// Ping the indexer
Ping(ctx context.Context) (bool, error)
// Get the current version of the indexer
Version(ctx context.Context) (*Version, error)
// Get the current runtime health status of the indexer
RuntimeStatus(ctx context.Context) (*RuntimeStatus, error)
// Get the chain ID of the indexer
GetChainID(ctx context.Context) (uint64, error)
// Queries an ethereum node for the latest and confirm ETH balances
// DEPRECATED: use GetNativeTokenBalance instead
// Deprecated:
GetEtherBalance(ctx context.Context, accountAddress *string) (*EtherBalance, error)
// GetNativeTokenBalance queries an ethereum node for the latest native token account balance.
// The native token is the token of the chain the indexer is connected to, for example, ETH on Ethereum
// and POL on Polygon.
GetNativeTokenBalance(ctx context.Context, accountAddress *string) (*NativeTokenBalance, error)
// GetTokenBalancesSummary returns a summary of token balances for a specific
// accounts. The collection ERC721 & ERC1155 tokens are represented as a
// single aggregated balance.
//
// If `filter` is not provided, it will use the filter with account from the
// jwt session.
//
// If `filter.contractStatus` is not provided, it will include verified only
// tokens.
GetTokenBalancesSummary(ctx context.Context, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*NativeTokenBalance, []*TokenBalance, error)
// GetTokenBalancesDetails returns a detailed balance summary for a specific
// accounts. The collection ERC721 & ERC1155 tokens are represented as
// individual balances.
//
// If `filter` is not provided, it will use the filter with account from the
// jwt session.
//
// If `filter.contractStatus` is not provided, it will include verified only
// tokens.
GetTokenBalancesDetails(ctx context.Context, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*NativeTokenBalance, []*TokenBalance, error)
// GetTokenBalancesByContract returns a balances for a specific accounts and
// contracts. The collection ERC721 & ERC1155 tokens are represented as
// individual balances.
//
// If `filter` is not provided, it will error out as it requires at least
// contract address.
//
// If `filter.contractStatus` is not provided, it will include verified only
// tokens.
GetTokenBalancesByContract(ctx context.Context, filter *TokenBalancesByContractFilter, omitMetadata *bool, page *Page) (*Page, []*TokenBalance, error)
// GetTokenBalances returns a balance summary/details for a specific account. By default
// if accountAddress is left empty, it will use the account from the jwt session.
//
// Also, if contractAddress is undefined, then it will list all current user coins/collectibles.
// But, if contractAddress is provided, then it will return the token balances for the contract, this is
// only useful for 1155, but for other tokens, it can act as a filter for the single balance.
GetTokenBalances(ctx context.Context, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, metadataOptions *MetadataOptions, includeCollectionTokens *bool, page *Page) (*Page, []*TokenBalance, error)
// GetTokenSupplies returns the set of tokenIDs used by a contract address, supporting ERC-20, ERC-721, and ERC-1155
// contracts, and their respective supply as well.
GetTokenSupplies(ctx context.Context, contractAddress string, includeMetadata *bool, metadataOptions *MetadataOptions, page *Page) (*Page, ContractType, []*TokenSupply, error)
// GetTokenSuppliesMap returns the token supplies of ERC-20 and ERC-1155 tokens as requested in the `tokenMap`
// represented as a map of contractAddress :: []tokenIDs.
//
// For an ERC-20 specify tokenIDs as an empty array or [0], for example, { '0xdef': [] } or { '0xdef': [0] }
// For ERC-1155 pass the array of tokens are strings, ie. { '0xabc': ['1', '2', '3'] }
GetTokenSuppliesMap(ctx context.Context, tokenMap map[string][]string, includeMetadata *bool, metadataOptions *MetadataOptions) (map[string][]*TokenSupply, error)
// GetTokenIDs returns the list of each individual token id for a token collection contract.
// This is useful for ERC-721 and ERC-1155 contracts to get the list of valid tokenIDs.
GetTokenIDs(ctx context.Context, contractAddress string, page *Page) (*Page, ContractType, []string, error)
// GetTokenIDRanges returns the range of tokenIDs for a token collection contract.
// This is useful for ERC-721 and ERC-1155 contracts to get the range of valid tokenIDs. It is similar to
// GetTokenIDs, but returns the range of tokenIDs instead of the list of tokenIDs, which is more efficient
// for large collections and very easy to the caller to expand the range into a list of tokenIDs.
//
// NOTE: this method will only return up to 15,000 ranges, if there are more ranges, it will return
// a boolean to indicate there are more ranges beyond the first 15,000. Therefore, if `moreRanges` is
// false then you have all the ranges, but if true, you need to make a follow up call to fetch the next
// page of ranges.
//
// As an example, if a NFT collection of 100,000 tokens uses ids from 1,2,3,...,100_000 then this endpoint
// will return just a single range from [1,100_000], but if there are gaps between the sequence, then
// those will be broken into separate range entries.
GetTokenIDRanges(ctx context.Context, contractAddress string) (ContractType, []*TokenIDRange, bool, error)
// Get balance update aggregate values -- useful for syncing balance details of a contract, ie. from Skyweaver.
// Also consider using SubscribeBalanceUpdates or SubscribeEvents as other alternatives.
GetBalanceUpdates(ctx context.Context, contractAddress string, lastBlockNumber uint64, lastBlockHash *string, page *Page) (*Page, []*TokenBalance, error)
// History of mined transactions for the account which includes a list of token transfers (sent/recieved)
// and sent transactions from a Sequence wallet
GetTransactionHistory(ctx context.Context, filter *TransactionHistoryFilter, page *Page, includeMetadata *bool, metadataOptions *MetadataOptions) (*Page, []*Transaction, error)
// Fetches a single receipt and then will stop the subscription
FetchTransactionReceipt(ctx context.Context, txnHash string, maxBlockWait *int) (*TransactionReceipt, error)
// Fetches a single receipt with filter and then will stop the subscription
FetchTransactionReceiptWithFilter(ctx context.Context, filter *TransactionFilter, maxBlockWait *int) (*TransactionReceipt, error)
// Listen to transaction receipts on-chain based on the filter criteria
SubscribeReceipts(ctx context.Context, filter *TransactionFilter) (SubscribeReceiptsStreamReader, error)
// SubscribeEvents listens to events on-chain based on the filter criteria
//
// TODO: some additional options can be passed such as block, reorg true, etc.
// or stay behind, etc.
SubscribeEvents(ctx context.Context, filter *EventFilter) (SubscribeEventsStreamReader, error)
// SubscribeBalanceUpdates listens to balance updates for a specific contract address
SubscribeBalanceUpdates(ctx context.Context, contractAddress string) (SubscribeBalanceUpdatesStreamReader, error)
// Re-sync an incorrect token balance with the correct on-chain balance
// NOTE: this method is almost never used, but we've marked it internal in case
// we ever want to use it again. This method was written a very long time ago in
// scenarios when the indexer had little bugs, but now its solid.
SyncBalance(ctx context.Context, accountAddress string, contractAddress string, tokenID *string) error
// Webhooks
GetAllWebhookListeners(ctx context.Context, projectId *uint64) ([]*WebhookListener, error)
GetWebhookListener(ctx context.Context, id uint64, projectId *uint64) (*WebhookListener, error)
AddWebhookListener(ctx context.Context, url string, filters *EventFilter, projectId *uint64) (bool, *WebhookListener, error)
UpdateWebhookListener(ctx context.Context, listener *WebhookListener, projectId *uint64) (bool, error)
RemoveWebhookListener(ctx context.Context, id uint64, projectId *uint64) (bool, error)
RemoveAllWebhookListeners(ctx context.Context, projectId *uint64) (bool, error)
ToggleWebhookListener(ctx context.Context, id uint64, projectId *uint64) (*WebhookListener, error)
PauseAllWebhookListeners(ctx context.Context, projectId *uint64) (bool, error)
ResumeAllWebhookListeners(ctx context.Context, projectId *uint64) (bool, error)
// These parameters are depracated, please don't use them:
// - filters
// - beforeExpiryTimestamp
// - blockNumberAfter
// - createdAtAfter
// and in OrderbookOrderFilter these fields are depracated:
// - userAddress
// - excludeUserAddress
//
// Use 'filter' and these fields instead
// - userAddresses
// - excludeUserAddress'
GetOrderbookOrders(ctx context.Context, page *Page, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, filter *OrderbookOrderFilter, orderStatuses []OrderStatus, filters []*OrderbookOrderFilter, beforeExpiryTimestamp int64, blockNumberAfter int64, createdAtAfter int64) (*Page, []*OrderbookOrder, error)
GetTopOrders(ctx context.Context, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, tokenIDs []string, isListing bool, priceSort SortOrder, excludeUser *string) ([]*OrderbookOrder, error)
}
func NewIndexer ¶ added in v0.24.0
func NewIndexer(indexerURL string, projectAccessKey string, options ...Options) IndexerClient
NewIndexer creates a new Sequence Indexer client instance. See https://docs.sequence.xyz for a list of indexer urls, and please see https://sequence.build to get a `projectAccessKey`.
func NewIndexerClient ¶
func NewIndexerClient(addr string, client HTTPClient) IndexerClient
type IndexerGateway ¶ added in v0.45.0
type IndexerGateway interface {
// GetNativeTokenBalance queries indexer nodes for the latest native token
// account balance.
GetNativeTokenBalance(ctx context.Context, chainIds []uint64, networks []string, accountAddress *string) ([]*GatewayNativeTokenBalance, error)
// GetTokenBalances returns a balance summary/details for a specific account
// on all indexer nodes. By default if accountAddress is left empty, it will
// use the account from the jwt session.
GetTokenBalances(ctx context.Context, chainIds []uint64, networks []string, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, metadataOptions *MetadataOptions, includeCollectionTokens *bool, page *Page) (*Page, []*GatewayTokenBalance, error)
// GetTokenBalancesSummary returns a summary of token balances for the given
// accounts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
// represented as a single aggregated balance.
GetTokenBalancesSummary(ctx context.Context, chainIds []uint64, networks []string, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*GatewayNativeTokenBalances, []*GatewayTokenBalance, error)
// GetTokenBalancesDetails returns a detailed balance summary for the given
// accounts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
// represented as individual balances.
GetTokenBalancesDetails(ctx context.Context, chainIds []uint64, networks []string, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*GatewayNativeTokenBalances, []*GatewayTokenBalance, error)
// GetTokenBalancesByContract returns a balances for specific accounts and
// contracts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
// represented as individual balances.
GetTokenBalancesByContract(ctx context.Context, chainIds []uint64, networks []string, filter *TokenBalancesByContractFilter, omitMetadata *bool, page *Page) (*Page, []*GatewayTokenBalance, error)
// GetTokenBalances returns a balance summary/details for an specific account
// on all indexer nodes. By default if accountAddress is left empty, it will
// use the account from the jwt session.
GetBalanceUpdates(ctx context.Context, chainIds []uint64, networks []string, contractAddress string, lastBlockNumber uint64, lastBlockHash *string, page *Page) (*Page, []*GatewayTokenBalance, error)
// Ping the indexer
Ping(ctx context.Context) (bool, error)
// Get the current version of the indexer
Version(ctx context.Context) (*Version, error)
// Get the current runtime health status of the indexer gatewya
RuntimeStatus(ctx context.Context) (*GatewayRuntimeStatus, error)
}
type IndexerGatewayClient ¶ added in v0.45.0
type IndexerGatewayClient interface {
// GetNativeTokenBalance queries indexer nodes for the latest native token
// account balance.
GetNativeTokenBalance(ctx context.Context, chainIds []uint64, networks []string, accountAddress *string) ([]*GatewayNativeTokenBalance, error)
// GetTokenBalances returns a balance summary/details for a specific account
// on all indexer nodes. By default if accountAddress is left empty, it will
// use the account from the jwt session.
GetTokenBalances(ctx context.Context, chainIds []uint64, networks []string, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, metadataOptions *MetadataOptions, includeCollectionTokens *bool, page *Page) (*Page, []*GatewayTokenBalance, error)
// GetTokenBalancesSummary returns a summary of token balances for the given
// accounts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
// represented as a single aggregated balance.
GetTokenBalancesSummary(ctx context.Context, chainIds []uint64, networks []string, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*GatewayNativeTokenBalances, []*GatewayTokenBalance, error)
// GetTokenBalancesDetails returns a detailed balance summary for the given
// accounts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
// represented as individual balances.
GetTokenBalancesDetails(ctx context.Context, chainIds []uint64, networks []string, filter *TokenBalancesFilter, omitMetadata *bool, page *Page) (*Page, []*GatewayNativeTokenBalances, []*GatewayTokenBalance, error)
// GetTokenBalancesByContract returns a balances for specific accounts and
// contracts on all indexer nodes. The collection ERC721 & ERC1155 tokens are
// represented as individual balances.
GetTokenBalancesByContract(ctx context.Context, chainIds []uint64, networks []string, filter *TokenBalancesByContractFilter, omitMetadata *bool, page *Page) (*Page, []*GatewayTokenBalance, error)
// GetTokenBalances returns a balance summary/details for an specific account
// on all indexer nodes. By default if accountAddress is left empty, it will
// use the account from the jwt session.
GetBalanceUpdates(ctx context.Context, chainIds []uint64, networks []string, contractAddress string, lastBlockNumber uint64, lastBlockHash *string, page *Page) (*Page, []*GatewayTokenBalance, error)
// Ping the indexer
Ping(ctx context.Context) (bool, error)
// Get the current version of the indexer
Version(ctx context.Context) (*Version, error)
// Get the current runtime health status of the indexer gatewya
RuntimeStatus(ctx context.Context) (*GatewayRuntimeStatus, error)
}
func NewIndexerGatewayClient ¶ added in v0.45.0
func NewIndexerGatewayClient(addr string, client HTTPClient) IndexerGatewayClient
type MetadataOptions ¶ added in v0.23.3
type NativeTokenBalance ¶ added in v0.42.0
type Options ¶ added in v0.24.0
type Options struct {
HTTPClient HTTPClient
JWTAuthToken string
}
type OrderStatus ¶ added in v0.28.2
type OrderStatus uint32
const ( OrderStatus_OPEN OrderStatus = 0 OrderStatus_CLOSED OrderStatus = 1 OrderStatus_CANCELLED OrderStatus = 2 )
func (*OrderStatus) Is ¶ added in v0.30.0
func (x *OrderStatus) Is(values ...OrderStatus) bool
func (OrderStatus) MarshalText ¶ added in v0.30.0
func (x OrderStatus) MarshalText() ([]byte, error)
func (OrderStatus) String ¶ added in v0.28.2
func (x OrderStatus) String() string
func (*OrderStatus) UnmarshalText ¶ added in v0.30.0
func (x *OrderStatus) UnmarshalText(b []byte) error
type OrderbookOrder ¶ added in v0.28.2
type OrderbookOrder struct {
OrderID prototyp.BigInt `json:"orderId" cbor:"1,extension"`
TokenContract prototyp.Hash `json:"tokenContract" cbor:"2,extension"`
TokenID prototyp.BigInt `json:"tokenId" cbor:"3,extension"`
IsListing bool `json:"isListing" cbor:"4,extension"`
Quantity prototyp.BigInt `json:"quantity" cbor:"5,extension"`
QuantityRemaining prototyp.BigInt `json:"quantityRemaining" cbor:"6,extension"`
CurrencyAddress prototyp.Hash `json:"currencyAddress" cbor:"7,extension"`
PricePerToken prototyp.BigInt `json:"pricePerToken" cbor:"8,extension"`
Expiry prototyp.BigInt `json:"expiry" cbor:"9,extension"`
OrderStatus OrderStatus `json:"orderStatus" cbor:"10,extension"`
CreatedBy prototyp.Hash `json:"createdBy" cbor:"11,extension"`
BlockNumber uint64 `json:"blockNumber" cbor:"12,extension"`
OrderbookContractAddress prototyp.Hash `json:"orderbookContractAddress" cbor:"13,extension"`
CreatedAt uint64 `json:"createdAt" cbor:"14,extension"`
}
type OrderbookOrderFilter ¶ added in v0.28.2
type OrderbookOrderFilter struct {
IsListing *bool `json:"isListing" cbor:"1,extension"`
UserAddresses []string `json:"userAddresses" cbor:"2,extension"`
TokenIDs []string `json:"tokenIds" cbor:"3,extension"`
ExcludeUserAddresses []string `json:"excludeUserAddresses" cbor:"4,extension"`
AfterBlockNumber uint64 `json:"afterBlockNumber" cbor:"5,extension"`
AfterCreatedAt int64 `json:"afterCreatedAt" cbor:"6,extension"`
BeforeExpiry int64 `json:"beforeExpiry" cbor:"7,extension"`
// deprecated
UserAddress *string `json:"userAddress" cbor:"8,extension"`
// deprecated
ExcludeUserAddress *string `json:"excludeUserAddress" cbor:"9,extension"`
}
Pass this object to 'filter' and not to 'filters' parameter in GetOrderbookOrders() 'filters' are deprecated use 'filter' and these fields instead - 'userAddresses' or 'excludeUserAddresses'
type Page ¶
type Page struct {
// Numbered pages: Page number, this is multiplied by the value of the <pageSize> parameter.
Page *uint32 `json:"page,omitempty"`
// Cursor: column to compare before/after to
Column *string `json:"column,omitempty"`
// Cursor: return column < before - include to get previous page
Before *interface{} `json:"before,omitempty"`
// Cursor: return column > after - include to get next page
After *interface{} `json:"after,omitempty"`
// Sorting filter
Sort []*SortBy `json:"sort,omitempty"`
// Number of items per page
PageSize *uint32 `json:"pageSize,omitempty"`
// Indicates if there are more results available
More *bool `json:"more,omitempty"`
}
Page represents a results page. This can be used both to request a page and to store the state of a page.
type PebbleMetrics ¶ added in v0.23.3
type PebbleMetrics struct {
CompactionCount int64 `json:"compactionCount"`
CompactionEstimatedDebt uint64 `json:"compactionEstimatedDebt"`
CompactionInProgressBytes int64 `json:"compactionInProgressBytes"`
CompactionNumInProgress int64 `json:"compactionNumInProgress"`
CompactionMarkedFiles int `json:"compactionMarkedFiles"`
}
type ResourceStatus ¶ added in v0.45.0
type ResourceStatus uint32
const ( ResourceStatus_NOT_AVAILABLE ResourceStatus = 0 ResourceStatus_STALE ResourceStatus = 1 ResourceStatus_AVAILABLE ResourceStatus = 2 )
func (*ResourceStatus) Is ¶ added in v0.45.0
func (x *ResourceStatus) Is(values ...ResourceStatus) bool
func (ResourceStatus) MarshalText ¶ added in v0.45.0
func (x ResourceStatus) MarshalText() ([]byte, error)
func (ResourceStatus) String ¶ added in v0.45.0
func (x ResourceStatus) String() string
func (*ResourceStatus) UnmarshalText ¶ added in v0.45.0
func (x *ResourceStatus) UnmarshalText(b []byte) error
type RuntimeChecks ¶
type RuntimeChecks struct {
Running bool `json:"running"`
Runnables interface{} `json:"runnables"`
CgoEnabled bool `json:"cgoEnabled"`
QuotaControlEnabled bool `json:"quotaControlEnabled"`
SyncMode string `json:"syncMode"`
PercentIndexed float64 `json:"percentIndexed"`
LastBlockNum uint64 `json:"lastBlockNum"`
LastBlockNumWithState uint64 `json:"lastBlockNumWithState"`
BloomStatus *BloomStatus `json:"bloomStatus"`
Bond *Bond `json:"bond"`
DiskUsage *DiskUsage `json:"diskUsage"`
}
type RuntimeStatus ¶
type RuntimeStatus struct {
// overall status, true/false
HealthOK bool `json:"healthOK"`
IndexerEnabled bool `json:"indexerEnabled"`
StartTime time.Time `json:"startTime"`
Uptime uint64 `json:"uptime"`
Ver string `json:"ver"`
Branch string `json:"branch"`
CommitHash string `json:"commitHash"`
ChainID uint64 `json:"chainID"`
Checks *RuntimeChecks `json:"checks"`
}
type SortOrder ¶
type SortOrder uint32
func (SortOrder) MarshalText ¶ added in v0.30.0
func (*SortOrder) UnmarshalText ¶ added in v0.30.0
type SubscribeBalanceUpdatesStreamReader ¶ added in v0.36.0
type SubscribeBalanceUpdatesStreamReader interface {
Read() (balance *TokenBalance, err error)
}
type SubscribeBalanceUpdatesStreamWriter ¶ added in v0.36.0
type SubscribeBalanceUpdatesStreamWriter interface {
Write(balance *TokenBalance) error
}
type SubscribeEventsStreamReader ¶ added in v0.31.0
type SubscribeEventsStreamWriter ¶ added in v0.31.0
type SubscribeReceiptsStreamReader ¶ added in v0.31.0
type SubscribeReceiptsStreamReader interface {
Read() (receipt *TransactionReceipt, err error)
}
type SubscribeReceiptsStreamWriter ¶ added in v0.31.0
type SubscribeReceiptsStreamWriter interface {
Write(receipt *TransactionReceipt) error
}
type TokenBalance ¶
type TokenBalance struct {
ContractType ContractType `json:"contractType" cbor:"2,omitempty"`
ContractAddress prototyp.Hash `json:"contractAddress" cbor:"1,extension"`
AccountAddress prototyp.HashMaybe `json:"accountAddress,omitempty" cbor:"3,extension,omitempty"`
TokenID *prototyp.BigInt `json:"tokenID,omitempty" cbor:"4,extension"`
Balance prototyp.BigInt `json:"balance" cbor:"5,extension"`
BlockHash prototyp.Hash `json:"blockHash,omitempty" cbor:"6,extension"`
BlockNumber uint64 `json:"blockNumber,omitempty" cbor:"7"`
// included to remind the receiver of network source
ChainID uint64 `json:"chainId" cbor:"-"`
UniqueCollectibles *prototyp.BigInt `json:"uniqueCollectibles,omitempty" cbor:"-"`
IsSummary bool `json:"isSummary,omitempty" cbor:"9"`
ContractInfo *ContractInfo `json:"contractInfo,omitempty" cbor:"-"`
TokenMetadata *TokenMetadata `json:"tokenMetadata,omitempty" cbor:"-"`
}
Token Balances
type TokenBalanceFilter ¶ added in v0.36.0
type TokenBalancesByContractFilter ¶ added in v0.42.0
type TokenBalancesByContractFilter struct {
ContractAddresses []prototyp.Hash `json:"contractAddresses"`
AccountAddresses []prototyp.Hash `json:"accountAddresses"`
ContractStatus ContractVerificationStatus `json:"contractStatus"`
}
type TokenBalancesFilter ¶ added in v0.42.0
type TokenBalancesFilter struct {
AccountAddresses []prototyp.Hash `json:"accountAddresses"`
ContractStatus ContractVerificationStatus `json:"contractStatus"`
ContractWhitelist []prototyp.Hash `json:"contractWhitelist"`
ContractBlacklist []prototyp.Hash `json:"contractBlacklist"`
OmitNativeBalances bool `json:"omitNativeBalances,omitempty"`
}
type TokenHistory ¶
type TokenHistory struct {
BlockNumber uint64 `json:"blockNumber" cbor:"1"`
BlockHash prototyp.Hash `json:"blockHash" cbor:"2,extension"`
AccountAddress prototyp.Hash `json:"accountAddress" cbor:"3,extension"`
ContractAddress prototyp.Hash `json:"contractAddress" cbor:"4,extension"`
ContractType ContractType `json:"contractType" cbor:"5"`
FromAddress prototyp.Hash `json:"fromAddress" cbor:"6,extension"`
ToAddress prototyp.Hash `json:"toAddress" cbor:"7,extension"`
TxnHash prototyp.Hash `json:"txnHash" cbor:"8,extension"`
TxnIndex uint `json:"txnIndex" cbor:"9"`
TxnLogIndex uint `json:"txnLogIndex" cbor:"a"`
// deprecated in favour of TokenIDs and Amounts
LogData string `json:"logData" cbor:"b"`
TokenIDs []prototyp.BigInt `json:"tokenIDs" cbor:"d,extension"`
Amounts []prototyp.BigInt `json:"Amounts" cbor:"e,extension"`
TS time.Time `json:"ts" cbor:"c"`
}
Token History
type TokenIDRange ¶ added in v0.45.0
type TokenMetadata ¶ added in v0.12.6
type TokenMetadata struct {
TokenID string `json:"tokenId" cbor:"-"`
Name string `json:"name" cbor:"-"`
Description string `json:"description" cbor:"-"`
// url
Image string `json:"image" cbor:"-"`
// non-standard fields we've added for Sequence. Others should adopt
// these too and we should prompt, similar to how `image` field works.
// url
Video string `json:"video,omitempty" cbor:"-"`
// url
Audio string `json:"audio,omitempty" cbor:"-"`
Properties map[string]interface{} `json:"properties" cbor:"-"`
// OpenSea fields
// see https://docs.opensea.io/docs/metadata-standards
//
// NOTE: its a bit unfortunate OpenSea didn't use camelCase, and
// also introduces 'attributes' when 'properties' is actually the correct property name.
// TODO: we could smooth this out / normalize it, but we can leave it for now.
Attributes []map[string]interface{} `json:"attributes" cbor:"-"`
ImageData string `json:"image_data,omitempty" cbor:"-"`
ExternalUrl string `json:"external_url,omitempty" cbor:"-"`
BackgroundColor string `json:"background_color,omitempty" cbor:"-"`
AnimationUrl string `json:"animation_url,omitempty" cbor:"-"`
//
// Misc
//
// decimals is deprecated, but still used by some
Decimals *uint64 `json:"decimals,omitempty" cbor:"-"`
UpdatedAt time.Time `json:"updatedAt" cbor:"-"`
// Assets associated to this token metadata
Assets []*Asset `json:"assets,omitempty" cbor:"-"`
Status ResourceStatus `json:"status"`
QueuedAt *time.Time `json:"queuedAt"`
LastFetched *time.Time `json:"lastFetched,omitempty"`
}
TokenMetadata based on 721/1155 standards, as well including some fields which are used by OpenSea.
TokenMetadata is RPC type for responding to clients that represents the token-level metadata.
type TokenSupply ¶
type TokenSupply struct {
TokenID prototyp.BigInt `json:"tokenID,omitempty" cbor:"token_id,extension"`
Supply prototyp.BigInt `json:"supply" cbor:"supply,extension"`
// included to remind the receiver of network source
ChainID uint64 `json:"chainId" cbor:"-"`
ContractInfo *ContractInfo `json:"contractInfo,omitempty" cbor:"-"`
TokenMetadata *TokenMetadata `json:"tokenMetadata,omitempty" cbor:"-"`
}
type Transaction ¶
type Transaction struct {
TxnHash prototyp.Hash `json:"txnHash" cbor:"1,extension"`
BlockNumber uint64 `json:"blockNumber" cbor:"2"`
BlockHash prototyp.Hash `json:"blockHash" cbor:"3,extension"`
ChainID uint64 `json:"chainId" cbor:"4"`
MetaTxnID *string `json:"metaTxnID" cbor:"5"`
Transfers []*TxnTransfer `json:"transfers" cbor:"6"`
Timestamp *time.Time `json:"timestamp" cbor:"7" db:"ts,omitempty"`
}
type TransactionFilter ¶ added in v0.31.0
type TransactionHistoryFilter ¶
type TransactionHistoryFilter struct {
// short-hand for accountAddresses[]
AccountAddress *string `json:"accountAddress"`
// short-hand for contractAddresses[]
ContractAddress *string `json:"contractAddress"`
AccountAddresses []string `json:"accountAddresses"`
ContractAddresses []string `json:"contractAddresses"`
// TODO: rename to txnHashes
TransactionHashes []string `json:"transactionHashes"`
// TODO: rename to metaTxnIds
MetaTransactionIDs []string `json:"metaTransactionIDs"`
FromBlock *uint64 `json:"fromBlock"`
ToBlock *uint64 `json:"toBlock"`
TokenID *prototyp.BigInt `json:"tokenID"`
}
TODO: rename to TxnHistoryFilter
type TransactionLog ¶ added in v0.19.7
type TransactionReceipt ¶ added in v0.19.7
type TransactionReceipt struct {
TxnHash prototyp.Hash `json:"txnHash"`
TxnStatus TransactionStatus `json:"txnStatus"`
TxnIndex uint64 `json:"txnIndex"`
TxnType TransactionType `json:"txnType"`
BlockHash prototyp.Hash `json:"blockHash"`
BlockNumber uint64 `json:"blockNumber"`
GasUsed uint64 `json:"gasUsed"`
// number as string, since its BigInt ..
EffectiveGasPrice prototyp.BigInt `json:"effectiveGasPrice"`
From prototyp.Hash `json:"from"`
To prototyp.Hash `json:"to"`
Logs []*TransactionLog `json:"logs"`
Final bool `json:"final"`
Reorged bool `json:"reorged"`
}
type TransactionStatus ¶ added in v0.19.7
type TransactionStatus uint32
const ( TransactionStatus_FAILED TransactionStatus = 0 TransactionStatus_SUCCESSFUL TransactionStatus = 1 )
func (*TransactionStatus) Is ¶ added in v0.30.0
func (x *TransactionStatus) Is(values ...TransactionStatus) bool
func (TransactionStatus) MarshalText ¶ added in v0.30.0
func (x TransactionStatus) MarshalText() ([]byte, error)
func (TransactionStatus) String ¶ added in v0.19.7
func (x TransactionStatus) String() string
func (*TransactionStatus) UnmarshalText ¶ added in v0.30.0
func (x *TransactionStatus) UnmarshalText(b []byte) error
type TransactionType ¶ added in v0.19.7
type TransactionType uint32
const ( TransactionType_LegacyTxnType TransactionType = 0 TransactionType_AccessListTxnType TransactionType = 1 TransactionType_DynamicFeeTxnType TransactionType = 2 )
func (*TransactionType) Is ¶ added in v0.30.0
func (x *TransactionType) Is(values ...TransactionType) bool
func (TransactionType) MarshalText ¶ added in v0.30.0
func (x TransactionType) MarshalText() ([]byte, error)
func (TransactionType) String ¶ added in v0.19.7
func (x TransactionType) String() string
func (*TransactionType) UnmarshalText ¶ added in v0.30.0
func (x *TransactionType) UnmarshalText(b []byte) error
type TxnTransfer ¶
type TxnTransfer struct {
TransferType TxnTransferType `json:"transferType" cbor:"1"`
ContractAddress prototyp.Hash `json:"contractAddress" cbor:"2,extension"`
ContractType ContractType `json:"contractType" cbor:"3"`
From prototyp.Hash `json:"from" cbor:"4,extension"`
To prototyp.Hash `json:"to" cbor:"5,extension"`
TokenIds []prototyp.BigInt `json:"tokenIds,omitempty" cbor:"6,extension"`
Amounts []prototyp.BigInt `json:"amounts" cbor:"7,extension"`
LogIndex uint `json:"logIndex" cbor:"8"`
ContractInfo *ContractInfo `json:"contractInfo,omitempty" cbor:"-"`
TokenMetadata map[string]*TokenMetadata `json:"tokenMetadata,omitempty" cbor:"-"`
}
type TxnTransferType ¶
type TxnTransferType uint32
const ( TxnTransferType_UNKNOWN TxnTransferType = 0 TxnTransferType_SEND TxnTransferType = 1 TxnTransferType_RECEIVE TxnTransferType = 2 )
func (*TxnTransferType) Is ¶ added in v0.30.0
func (x *TxnTransferType) Is(values ...TxnTransferType) bool
func (TxnTransferType) MarshalText ¶ added in v0.30.0
func (x TxnTransferType) MarshalText() ([]byte, error)
func (TxnTransferType) String ¶
func (x TxnTransferType) String() string
func (*TxnTransferType) UnmarshalText ¶ added in v0.30.0
func (x *TxnTransferType) UnmarshalText(b []byte) error
type WALWriterRuntimeStatus ¶ added in v0.30.0
type WALWriterRuntimeStatus 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"`
ChainID uint64 `json:"chainID"`
PercentWALWritten float64 `json:"percentWALWritten"`
}
type WebRPCError ¶ added in v0.30.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.30.0
func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError
Deprecated: Use .WithCause() method on WebRPCError.
func (WebRPCError) Error ¶ added in v0.30.0
func (e WebRPCError) Error() string
func (WebRPCError) Is ¶ added in v0.30.0
func (e WebRPCError) Is(target error) bool
func (WebRPCError) Unwrap ¶ added in v0.30.0
func (e WebRPCError) Unwrap() error
func (WebRPCError) WithCause ¶ added in v0.30.0
func (e WebRPCError) WithCause(cause error) WebRPCError
func (WebRPCError) WithCausef ¶ added in v0.30.0
func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError
type WebhookListener ¶ added in v0.23.3
type WebhookListener struct {
ID uint64 `json:"id" db:"id"`
ProjectID uint64 `json:"projectID" db:"project_id"`
Url string `json:"url" db:"url"`
Filters *EventFilter `json:"filters" db:"filters"`
Name string `json:"name" db:"name"`
UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
Active bool `json:"active" db:"active"`
}
type WebrpcGenVersions ¶ added in v0.45.0
type WebrpcGenVersions struct {
WebrpcGenVersion string
CodeGenName string
CodeGenVersion string
SchemaName string
SchemaVersion string
}
func VersionFromHeader ¶ added in v0.45.0
func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error)