indexer

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

sequence-indexer v0.4.0 42a988bcb0871f1249450f0d92967db5b47ff33e -- Code generated by webrpc-gen@v0.20.0 with golang generator. DO NOT EDIT.

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

Index

Constants

View Source
const IndexerPathPrefix = "/rpc/Indexer/"
View Source
const StreamKeepAliveInterval = 10 * time.Second

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}
	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}
	ErrTimeout            = WebRPCError{Code: 2000, Name: "Timeout", Message: "Request timed out", HTTPStatus: 408}
	ErrInvalidArgument    = WebRPCError{Code: 2001, 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}
	ErrResourceExhausted  = WebRPCError{Code: 2004, Name: "ResourceExhausted", Message: "Resource exhausted", HTTPStatus: 400}
	ErrNotFound           = WebRPCError{Code: 3000, Name: "NotFound", Message: "Resource not found", HTTPStatus: 400}
	ErrProjectNotFound    = WebRPCError{Code: 3002, Name: "ProjectNotFound", Message: "Project not found", HTTPStatus: 400}
	ErrMetadataCallFailed = WebRPCError{Code: 3003, Name: "MetadataCallFailed", Message: "Metadata service call failed", HTTPStatus: 400}
)

Schema errors

View Source
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",
}
View Source
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,
}
View Source
var EventLogDataType_name = map[uint8]string{
	0: "EVENT",
	1: "TOKEN_TRANSFER",
	2: "NATIVE_TOKEN_TRANSFER",
	3: "SEQUENCE_TXN",
}
View Source
var EventLogDataType_value = map[string]uint8{
	"EVENT":                 0,
	"TOKEN_TRANSFER":        1,
	"NATIVE_TOKEN_TRANSFER": 2,
	"SEQUENCE_TXN":          3,
}
View Source
var EventLogType_name = map[uint8]string{
	0: "UNKNOWN",
	1: "BLOCK_ADDED",
	2: "BLOCK_REMOVED",
}
View Source
var EventLogType_value = map[string]uint8{
	"UNKNOWN":       0,
	"BLOCK_ADDED":   1,
	"BLOCK_REMOVED": 2,
}
View Source
var OrderStatus_name = map[uint32]string{
	0: "OPEN",
	1: "CLOSED",
	2: "CANCELLED",
}
View Source
var OrderStatus_value = map[string]uint32{
	"OPEN":      0,
	"CLOSED":    1,
	"CANCELLED": 2,
}
View Source
var SortOrder_name = map[uint32]string{
	0: "DESC",
	1: "ASC",
}
View Source
var SortOrder_value = map[string]uint32{
	"DESC": 0,
	"ASC":  1,
}
View Source
var TransactionStatus_name = map[uint32]string{
	0: "FAILED",
	1: "SUCCESSFUL",
}
View Source
var TransactionStatus_value = map[string]uint32{
	"FAILED":     0,
	"SUCCESSFUL": 1,
}
View Source
var TransactionType_name = map[uint32]string{
	0: "LegacyTxnType",
	1: "AccessListTxnType",
	2: "DynamicFeeTxnType",
}
View Source
var TransactionType_value = map[string]uint32{
	"LegacyTxnType":     0,
	"AccessListTxnType": 1,
	"DynamicFeeTxnType": 2,
}
View Source
var TxnTransferType_name = map[uint32]string{
	0: "UNKNOWN",
	1: "SEND",
	2: "RECEIVE",
}
View Source
var TxnTransferType_value = map[string]uint32{
	"UNKNOWN": 0,
	"SEND":    1,
	"RECEIVE": 2,
}
View Source
var WebRPCServices = map[string][]string{
	"Indexer": {
		"Ping",
		"Version",
		"RuntimeStatus",
		"GetChainID",
		"GetEtherBalance",
		"GetNativeTokenBalance",
		"GetTokenBalancesSummary",
		"GetTokenBalancesDetails",
		"GetTokenBalancesByContract",
		"GetTokenBalances",
		"GetTokenSupplies",
		"GetTokenSuppliesMap",
		"GetBalanceUpdates",
		"GetTransactionHistory",
		"SyncBalance",
		"FetchTransactionReceipt",
		"GetOrderbookOrders",
		"GetTopOrders",
		"FetchTransactionReceiptWithFilter",
		"GetAllWebhookListeners",
		"GetWebhookListener",
		"AddWebhookListener",
		"UpdateWebhookListener",
		"RemoveWebhookListener",
		"ToggleWebhookListener",
		"PauseAllWebhookListeners",
		"ResumeAllWebhookListeners",
		"SubscribeReceipts",
		"SubscribeEvents",
		"SubscribeBalanceUpdates",
	},
}

Functions

func HTTPRequestHeaders

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

func MethodCtx added in v0.42.0

func MethodCtx(ctx context.Context) (method, bool)

func MethodNameFromContext added in v0.30.0

func MethodNameFromContext(ctx context.Context) string

func RequestFromContext added in v0.30.0

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

func ServiceNameFromContext added in v0.30.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 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 BloomStatus struct {
	Enabled              bool   `json:"enabled"`
	Initialized          bool   `json:"initialized"`
	BloomInitElapsedTime string `json:"bloomInitElapsedTime"`
}

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

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:"-"`
	OgImage       string `json:"ogImage" 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 (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 DiskUsage added in v0.30.0

type DiskUsage struct {
	HumanReadable string            `json:"humanReadable"`
	Used          uint64            `json:"used"`
	Size          uint64            `json:"size"`
	Percent       float32           `json:"percent"`
	Dirs          map[string]string `json:"dirs"`
}

type EtherBalance

type EtherBalance struct {
	AccountAddress prototyp.Hash `json:"accountAddress" cbor:"-"`
	// ETH balance in wei
	BalanceWei prototyp.BigInt `json:"balanceWei" cbor:"-"`
}

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 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 IndexState

type IndexState struct {
	ChainID       prototyp.BigInt `json:"chainId" cbor:"chain_id,extension"`
	LastBlockNum  uint64          `json:"lastBlockNum" cbor:"last_block_num"`
	LastBlockHash prototyp.Hash   `json:"lastBlockHash" cbor:"last_block_hash,extension"`
}

type IndexedBlock added in v0.19.7

type IndexedBlock struct {
	BlockNumber    uint64        `json:"blockNumber" cbor:"1"`
	BlockShortHash prototyp.Hash `json:"blockShortHash" cbor:"2,extension"`
}

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
	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, []*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, []*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)
	// Get balance update aggregate values -- useful for syncing balance details of a contract, ie. from Skyweaver
	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)
	// Re-sync an incorrect token balance with the correct on-chain balance
	SyncBalance(ctx context.Context, accountAddress string, contractAddress string, tokenID *string) error
	// Fetches a single receipt and then will stop the subscription
	FetchTransactionReceipt(ctx context.Context, txnHash string, maxBlockWait *int) (*TransactionReceipt, error)
	// Fetch orderbook orders
	GetOrderbookOrders(ctx context.Context, page *Page, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, filter *OrderbookOrderFilter, orderStatuses []OrderStatus) (*Page, []*OrderbookOrder, error)
	GetTopOrders(ctx context.Context, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, tokenIDs []string, isListing bool, priceSort SortOrder, excludeUser *string) ([]*OrderbookOrder, error)
	// Fetches a single receipt with filter and then will stop the subscription
	FetchTransactionReceiptWithFilter(ctx context.Context, filter *TransactionFilter, maxBlockWait *int) (*TransactionReceipt, error)
	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)
	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)
	SubscribeReceipts(ctx context.Context, filter *TransactionFilter, stream SubscribeReceiptsStreamWriter) error
	// TODO: pass optional block ...
	// can pass too, reorg true, etc. or stay behind, etc.
	SubscribeEvents(ctx context.Context, filter *EventFilter, stream SubscribeEventsStreamWriter) error
	SubscribeBalanceUpdates(ctx context.Context, contractAddress string, stream SubscribeBalanceUpdatesStreamWriter) 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
	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, []*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, []*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)
	// Get balance update aggregate values -- useful for syncing balance details of a contract, ie. from Skyweaver
	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)
	// Re-sync an incorrect token balance with the correct on-chain balance
	SyncBalance(ctx context.Context, accountAddress string, contractAddress string, tokenID *string) error
	// Fetches a single receipt and then will stop the subscription
	FetchTransactionReceipt(ctx context.Context, txnHash string, maxBlockWait *int) (*TransactionReceipt, error)
	// Fetch orderbook orders
	GetOrderbookOrders(ctx context.Context, page *Page, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, filter *OrderbookOrderFilter, orderStatuses []OrderStatus) (*Page, []*OrderbookOrder, error)
	GetTopOrders(ctx context.Context, orderbookContractAddress string, collectionAddress string, currencyAddresses []string, tokenIDs []string, isListing bool, priceSort SortOrder, excludeUser *string) ([]*OrderbookOrder, error)
	// Fetches a single receipt with filter and then will stop the subscription
	FetchTransactionReceiptWithFilter(ctx context.Context, filter *TransactionFilter, maxBlockWait *int) (*TransactionReceipt, error)
	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)
	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)
	SubscribeReceipts(ctx context.Context, filter *TransactionFilter) (SubscribeReceiptsStreamReader, error)
	// TODO: pass optional block ...
	// can pass too, reorg true, etc. or stay behind, etc.
	SubscribeEvents(ctx context.Context, filter *EventFilter) (SubscribeEventsStreamReader, error)
	SubscribeBalanceUpdates(ctx context.Context, contractAddress string) (SubscribeBalanceUpdatesStreamReader, 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 MetadataOptions added in v0.23.3

type MetadataOptions struct {
	VerifiedOnly     bool            `json:"verifiedOnly"`
	UnverifiedOnly   bool            `json:"unverifiedOnly"`
	IncludeContracts []prototyp.Hash `json:"includeContracts"`
}

type NativeTokenBalance added in v0.42.0

type NativeTokenBalance struct {
	AccountAddress prototyp.Hash   `json:"accountAddress" cbor:"-"`
	Balance        prototyp.BigInt `json:"balance" cbor:"-"`
}

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

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 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 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.30.0

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

func (SortOrder) MarshalText added in v0.30.0

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

func (SortOrder) String

func (x SortOrder) String() string

func (*SortOrder) UnmarshalText added in v0.30.0

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

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 SubscribeEventsStreamReader interface {
	Read() (log *EventLog, err error)
}

type SubscribeEventsStreamWriter added in v0.31.0

type SubscribeEventsStreamWriter interface {
	Write(log *EventLog) error
}

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 TokenBalanceFilter struct {
	ContractAddress  prototyp.Hash `json:"contractAddress"`
	SinceBlockNumber uint64        `json:"sinceBlockNumber"`
}

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

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

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 TransactionFilter struct {
	TxnHash         *prototyp.Hash `json:"txnHash"`
	From            *prototyp.Hash `json:"from"`
	To              *prototyp.Hash `json:"to"`
	ContractAddress *prototyp.Hash `json:"contractAddress"`
	// event signature, ie. Transfer(address indexed,address indexed,uint256)
	Event *string `json:"event"`
}

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 TransactionLog struct {
	ContractAddress prototyp.Hash   `json:"contractAddress"`
	Topics          []prototyp.Hash `json:"topics"`
	Data            string          `json:"data"`
	Index           uint64          `json:"index"`
}

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

type TxnInfo struct {
	From  prototyp.Hash   `json:"from" cbor:"from"`
	To    prototyp.Hash   `json:"to" cbor:"to"`
	Value prototyp.BigInt `json:"value" cbor:"value"`
}

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 Version

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

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

Jump to

Keyboard shortcuts

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