Documentation ¶
Overview ¶
sequence-indexer v0.4.0 b1272cb0621038e4142bd24d87ccd2cfa1ac30c9 -- Code generated by webrpc-gen@v0.10.x-dev with golang@v0.10.0 generator. DO NOT EDIT.
webrpc-gen -schema=indexer.ridl -target=golang@v0.10.0 -pkg=indexer -client -out=./clients/indexer.gen.go
Index ¶
- Constants
- Variables
- func HTTPRequestHeaders(ctx context.Context) (http.Header, bool)
- func HTTPStatusFromErrorCode(code ErrorCode) int
- func IsErrorCode(err error, code ErrorCode) bool
- func IsValidErrorCode(code ErrorCode) bool
- func WebRPCSchemaHash() string
- func WebRPCSchemaVersion() string
- func WebRPCVersion() string
- func WithHTTPRequestHeaders(ctx context.Context, h http.Header) (context.Context, error)
- type ContractInfo
- type ContractInfoExtensions
- type ContractType
- type Error
- func ErrorInternal(format string, args ...interface{}) Error
- func ErrorInvalidArgument(argument string, validationMsg string) Error
- func ErrorNotFound(format string, args ...interface{}) Error
- func ErrorRequiredArgument(argument string) Error
- func Errorf(code ErrorCode, msgf string, args ...interface{}) Error
- func Failf(format string, args ...interface{}) Error
- func WrapError(code ErrorCode, cause error, format string, args ...interface{}) Error
- func WrapFailf(cause error, format string, args ...interface{}) Error
- type ErrorCode
- type ErrorPayload
- type EtherBalance
- type EventLog
- type EventLogDataType
- type EventLogType
- type Filter
- type HTTPClient
- type IndexState
- type IndexedBlock
- type Indexer
- type Page
- type RuntimeChecks
- type RuntimeStatus
- type SortBy
- type SortOrder
- type TokenBalance
- type TokenHistory
- type TokenMetadata
- type TokenSupply
- type Transaction
- type TransactionHistoryFilter
- type TransactionLog
- type TransactionReceipt
- type TransactionStatus
- type TransactionType
- type TxnData
- type TxnTransfer
- type TxnTransferType
- type Version
Constants ¶
View Source
const IndexerPathPrefix = "/rpc/Indexer/"
Variables ¶
View Source
var ( // For Client HTTPClientRequestHeadersCtxKey = &contextKey{"HTTPClientRequestHeaders"} // For Server HTTPResponseWriterCtxKey = &contextKey{"HTTPResponseWriter"} HTTPRequestCtxKey = &contextKey{"HTTPRequest"} ServiceNameCtxKey = &contextKey{"ServiceName"} MethodNameCtxKey = &contextKey{"MethodName"} )
View Source
var ContractType_name = map[uint8]string{
0: "UNKNOWN",
1: "ERC20",
2: "ERC721",
3: "ERC1155",
4: "SEQUENCE_WALLET",
5: "ERC20_BRIDGE",
6: "ERC721_BRIDGE",
7: "ERC1155_BRIDGE",
}
View Source
var ContractType_value = map[string]uint8{
"UNKNOWN": 0,
"ERC20": 1,
"ERC721": 2,
"ERC1155": 3,
"SEQUENCE_WALLET": 4,
"ERC20_BRIDGE": 5,
"ERC721_BRIDGE": 6,
"ERC1155_BRIDGE": 7,
}
View Source
var EventLogDataType_name = map[uint8]string{
0: "UNKNOWN",
1: "TOKEN_TRANSFER",
2: "NATIVE_TOKEN_TRANSFER",
3: "SEQUENCE_TXN",
}
View Source
var EventLogDataType_value = map[string]uint8{
"UNKNOWN": 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 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",
"GetTokenBalances",
"GetTokenSupplies",
"GetTokenSuppliesMap",
"GetBalanceUpdates",
"GetTransactionHistory",
"SyncBalance",
"FetchTransactionReceipt",
"FetchTransactionReceiptWithFilter",
},
}
Functions ¶
func HTTPStatusFromErrorCode ¶
func IsErrorCode ¶
func IsValidErrorCode ¶
Types ¶
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:"-"` }
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:"-"` }
type ContractType ¶
type ContractType uint8
const ( ContractType_UNKNOWN ContractType = 0 ContractType_ERC20 ContractType = 1 ContractType_ERC721 ContractType = 2 ContractType_ERC1155 ContractType = 3 ContractType_SEQUENCE_WALLET ContractType = 4 ContractType_ERC20_BRIDGE ContractType = 5 ContractType_ERC721_BRIDGE ContractType = 6 ContractType_ERC1155_BRIDGE ContractType = 7 )
func (ContractType) MarshalJSON ¶
func (x ContractType) MarshalJSON() ([]byte, error)
func (ContractType) String ¶
func (x ContractType) String() string
func (*ContractType) UnmarshalJSON ¶
func (x *ContractType) UnmarshalJSON(b []byte) error
type Error ¶
type Error interface { // Code is of the valid error codes Code() ErrorCode // Msg returns a human-readable, unstructured messages describing the error Msg() string // Cause is reason for the error Cause() error // Error returns a string of the form "webrpc error <Code>: <Msg>" Error() string // Error response payload Payload() ErrorPayload }
func ErrorInternal ¶
func ErrorInvalidArgument ¶
func ErrorNotFound ¶
func ErrorRequiredArgument ¶
type ErrorCode ¶
type ErrorCode string
const ( // Unknown error. For example when handling errors raised by APIs that do not // return enough error information. ErrUnknown ErrorCode = "unknown" // Fail error. General failure error type. ErrFail ErrorCode = "fail" // Canceled indicates the operation was cancelled (typically by the caller). ErrCanceled ErrorCode = "canceled" // InvalidArgument indicates client specified an invalid argument. It // indicates arguments that are problematic regardless of the state of the // system (i.e. a malformed file name, required argument, number out of range, // etc.). ErrInvalidArgument ErrorCode = "invalid argument" // DeadlineExceeded means operation expired before completion. For operations // that change the state of the system, this error may be returned even if the // operation has completed successfully (timeout). ErrDeadlineExceeded ErrorCode = "deadline exceeded" // NotFound means some requested entity was not found. ErrNotFound ErrorCode = "not found" // BadRoute means that the requested URL path wasn't routable to a webrpc // service and method. This is returned by the generated server, and usually // shouldn't be returned by applications. Instead, applications should use // NotFound or Unimplemented. ErrBadRoute ErrorCode = "bad route" // AlreadyExists means an attempt to create an entity failed because one // already exists. ErrAlreadyExists ErrorCode = "already exists" // PermissionDenied indicates the caller does not have permission to execute // the specified operation. It must not be used if the caller cannot be // identified (Unauthenticated). ErrPermissionDenied ErrorCode = "permission denied" // Unauthenticated indicates the request does not have valid authentication // credentials for the operation. ErrUnauthenticated ErrorCode = "unauthenticated" // ResourceExhausted indicates some resource has been exhausted, perhaps a // per-user quota, or perhaps the entire file system is out of space. ErrResourceExhausted ErrorCode = "resource exhausted" // FailedPrecondition indicates operation was rejected because the system is // not in a state required for the operation's execution. For example, doing // an rmdir operation on a directory that is non-empty, or on a non-directory // object, or when having conflicting read-modify-write on the same resource. ErrFailedPrecondition ErrorCode = "failed precondition" // Aborted indicates the operation was aborted, typically due to a concurrency // issue like sequencer check failures, transaction aborts, etc. ErrAborted ErrorCode = "aborted" // OutOfRange means operation was attempted past the valid range. For example, // seeking or reading past end of a paginated collection. // // Unlike InvalidArgument, this error indicates a problem that may be fixed if // the system state changes (i.e. adding more items to the collection). // // There is a fair bit of overlap between FailedPrecondition and OutOfRange. // We recommend using OutOfRange (the more specific error) when it applies so // that callers who are iterating through a space can easily look for an // OutOfRange error to detect when they are done. ErrOutOfRange ErrorCode = "out of range" // Unimplemented indicates operation is not implemented or not // supported/enabled in this service. ErrUnimplemented ErrorCode = "unimplemented" // Internal errors. When some invariants expected by the underlying system // have been broken. In other words, something bad happened in the library or // backend service. Do not confuse with HTTP Internal Server Error; an // Internal error could also happen on the client code, i.e. when parsing a // server response. ErrInternal ErrorCode = "internal" // likely a transient condition and may be corrected by retrying with a // backoff. ErrUnavailable ErrorCode = "unavailable" // DataLoss indicates unrecoverable data loss or corruption. ErrDataLoss ErrorCode = "data loss" // ErrNone is the zero-value, is considered an empty error and should not be // used. ErrNone ErrorCode = "" )
type ErrorPayload ¶
type EtherBalance ¶
type EventLog ¶
type EventLog struct { ID uint64 `json:"id" cbor:"id,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" 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"` TxnData TxnData `json:"txnData" cbor:"txn_data"` TxnLogIndex uint `json:"txnLogIndex" cbor:"txn_log_index"` LogDataType EventLogDataType `json:"logDataType" cbor:"log_data_type"` TS time.Time `json:"ts" cbor:"ts"` LogData string `json:"logData" cbor:"log_data"` }
type EventLogDataType ¶
type EventLogDataType uint8
const ( EventLogDataType_UNKNOWN EventLogDataType = 0 EventLogDataType_TOKEN_TRANSFER EventLogDataType = 1 EventLogDataType_NATIVE_TOKEN_TRANSFER EventLogDataType = 2 EventLogDataType_SEQUENCE_TXN EventLogDataType = 3 )
func (EventLogDataType) MarshalJSON ¶
func (x EventLogDataType) MarshalJSON() ([]byte, error)
func (EventLogDataType) String ¶
func (x EventLogDataType) String() string
func (*EventLogDataType) UnmarshalJSON ¶
func (x *EventLogDataType) UnmarshalJSON(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) MarshalJSON ¶
func (x EventLogType) MarshalJSON() ([]byte, error)
func (EventLogType) String ¶
func (x EventLogType) String() string
func (*EventLogType) UnmarshalJSON ¶
func (x *EventLogType) UnmarshalJSON(b []byte) error
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(ctx context.Context) (bool, error) Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) GetChainID(ctx context.Context) (uint64, error) GetEtherBalance(ctx context.Context, accountAddress *string) (*EtherBalance, error) GetTokenBalances(ctx context.Context, accountAddress *string, contractAddress *string, tokenID *string, includeMetadata *bool, page *Page) (*Page, []*TokenBalance, error) GetTokenSupplies(ctx context.Context, contractAddress string, includeMetadata *bool, page *Page) (*Page, *ContractType, []*TokenSupply, error) GetTokenSuppliesMap(ctx context.Context, tokenMap map[string][]string, includeMetadata *bool) (map[string][]*TokenSupply, error) GetBalanceUpdates(ctx context.Context, contractAddress string, lastBlockNumber uint64, lastBlockHash *string, page *Page) (*Page, []*TokenBalance, error) GetTransactionHistory(ctx context.Context, filter *TransactionHistoryFilter, page *Page, includeMetadata *bool) (*Page, []*Transaction, error) SyncBalance(ctx context.Context, accountAddress string, contractAddress string, tokenID *string) error FetchTransactionReceipt(ctx context.Context, txnHash string, maxBlockWait *int) (*TransactionReceipt, error) FetchTransactionReceiptWithFilter(ctx context.Context, filter *Filter, maxBlockWait *int) (*TransactionReceipt, error) }
func NewIndexerClient ¶
func NewIndexerClient(addr string, client HTTPClient) Indexer
type Page ¶
type Page struct { Page *uint32 `json:"page,omitempty"` Column *string `json:"column,omitempty"` Before *interface{} `json:"before,omitempty"` After *interface{} `json:"after,omitempty"` Sort []*SortBy `json:"sort,omitempty"` PageSize *uint32 `json:"pageSize,omitempty"` More *bool `json:"more,omitempty"` }
type RuntimeChecks ¶
type RuntimeStatus ¶
type RuntimeStatus struct { 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) MarshalJSON ¶
func (*SortOrder) UnmarshalJSON ¶
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"` ChainID uint64 `json:"chainId" cbor:"-"` IsNFTSummary bool `json:"-" cbor:"9"` ContractInfo *ContractInfo `json:"contractInfo,omitempty" cbor:"-"` TokenMetadata *TokenMetadata `json:"tokenMetadata,omitempty" cbor:"-"` }
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"` 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"` }
type TokenMetadata ¶ added in v0.12.6
type TokenMetadata struct { TokenID string `json:"tokenId" cbor:"-"` ContractAddress prototyp.Hash `json:"contractAddress" cbor:"-"` Name string `json:"name" cbor:"-"` Description string `json:"description" cbor:"-"` Image string `json:"image" cbor:"-"` Decimals uint64 `json:"decimals" cbor:"-"` Properties map[string]interface{} `json:"properties" cbor:"-"` Video string `json:"video,omitempty" cbor:"-"` Audio string `json:"audio,omitempty" 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:"-"` Attributes []map[string]interface{} `json:"attributes" cbor:"-"` }
type TokenSupply ¶
type TokenSupply struct { TokenID prototyp.BigInt `json:"tokenID,omitempty" cbor:"token_id,extension"` Supply prototyp.BigInt `json:"supply" cbor:"supply,extension"` 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 TransactionHistoryFilter ¶
type TransactionHistoryFilter struct { AccountAddress *string `json:"accountAddress"` ContractAddress *string `json:"contractAddress"` AccountAddresses []string `json:"accountAddresses"` ContractAddresses []string `json:"contractAddresses"` TransactionHashes []string `json:"transactionHashes"` MetaTransactionIDs []string `json:"metaTransactionIDs"` FromBlock *uint64 `json:"fromBlock"` ToBlock *uint64 `json:"toBlock"` TokenID *prototyp.BigInt `json:"tokenID"` }
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"` 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) MarshalJSON ¶ added in v0.19.7
func (x TransactionStatus) MarshalJSON() ([]byte, error)
func (TransactionStatus) String ¶ added in v0.19.7
func (x TransactionStatus) String() string
func (*TransactionStatus) UnmarshalJSON ¶ added in v0.19.7
func (x *TransactionStatus) UnmarshalJSON(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) MarshalJSON ¶ added in v0.19.7
func (x TransactionType) MarshalJSON() ([]byte, error)
func (TransactionType) String ¶ added in v0.19.7
func (x TransactionType) String() string
func (*TransactionType) UnmarshalJSON ¶ added in v0.19.7
func (x *TransactionType) UnmarshalJSON(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) MarshalJSON ¶
func (x TxnTransferType) MarshalJSON() ([]byte, error)
func (TxnTransferType) String ¶
func (x TxnTransferType) String() string
func (*TxnTransferType) UnmarshalJSON ¶
func (x *TxnTransferType) UnmarshalJSON(b []byte) error
Click to show internal directories.
Click to hide internal directories.