indexer

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 4 Imported by: 11

Documentation

Index

Constants

View Source
const (
	ScriptTypeLock ScriptType = "lock"
	ScriptTypeType ScriptType = "type"

	SearchOrderAsc  SearchOrder = "asc"
	SearchOrderDesc SearchOrder = "desc"

	IOTypeIn  IoType = "input"
	IOTypeOut IoType = "output"
)
View Source
const SearchLimit uint64 = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type Capacity

type Capacity struct {
	Capacity    uint64     `json:"capacity"`
	BlockHash   types.Hash `json:"block_hash"`
	BlockNumber uint64     `json:"block_number"`
}

type CellsFilter added in v0.3.0

type CellsFilter struct {
	Script              *types.Script `json:"script"`
	OutputDataLenRange  *[2]uint64    `json:"output_data_len_range"`
	OutputCapacityRange *[2]uint64    `json:"output_capacity_range"`
	BlockRange          *[2]uint64    `json:"block_range"`
}

type Client

type Client interface {
	// GetCells returns the live cells collection by the lock or type script.
	GetCells(ctx context.Context, searchKey *SearchKey, order SearchOrder, limit uint64, afterCursor string) (*LiveCells, error)

	// GetTransactions returns the transactions collection by the lock or type script.
	GetTransactions(ctx context.Context, searchKey *SearchKey, order SearchOrder, limit uint64, afterCursor string) (*Transactions, error)

	//GetTip returns the latest height processed by indexer
	GetTip(ctx context.Context) (*TipHeader, error)

	//GetCellsCapacity returns the live cells capacity by the lock or type script.
	GetCellsCapacity(ctx context.Context, searchKey *SearchKey) (*Capacity, error)

	// Close close client
	Close()
}

func Dial

func Dial(url string) (Client, error)

func DialContext

func DialContext(ctx context.Context, url string) (Client, error)

func NewClient

func NewClient(c *rpc.Client) Client

type IoType

type IoType string

type LiveCell

type LiveCell struct {
	BlockNumber uint64            `json:"block_number"`
	OutPoint    *types.OutPoint   `json:"out_point"`
	Output      *types.CellOutput `json:"output"`
	OutputData  []byte            `json:"output_data"`
	TxIndex     uint              `json:"tx_index"`
}

type LiveCells

type LiveCells struct {
	LastCursor string      `json:"last_cursor"`
	Objects    []*LiveCell `json:"objects"`
}

type ScriptType

type ScriptType string

type SearchKey

type SearchKey struct {
	Script     *types.Script `json:"script"`
	ScriptType ScriptType    `json:"script_type"`
	ArgsLen    uint          `json:"args_len,omitempty"`
	Filter     *CellsFilter  `json:"filter,omitempty"`
}

type SearchOrder

type SearchOrder string

type TipHeader

type TipHeader struct {
	BlockHash   types.Hash `json:"block_hash"`
	BlockNumber uint64     `json:"block_number"`
}

type Transaction

type Transaction struct {
	BlockNumber uint64     `json:"block_number"`
	IoIndex     uint       `json:"io_index"`
	IoType      IoType     `json:"io_type"`
	TxHash      types.Hash `json:"tx_hash"`
	TxIndex     uint       `json:"tx_index"`
}

type Transactions

type Transactions struct {
	LastCursor string         `json:"last_cursor"`
	Objects    []*Transaction `json:"objects"`
}

Jump to

Keyboard shortcuts

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