indexer

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	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"`
}

func (*Capacity) UnmarshalJSON

func (r *Capacity) UnmarshalJSON(input []byte) error

type Cell

type Cell struct {
	IoType  IoType `json:"io_type"`
	IoIndex uint   `json:"io_index"`
}

func (*Cell) UnmarshalJSON

func (r *Cell) UnmarshalJSON(input []byte) error

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) (*TxsWithCell, error)

	// GetTransactionsGrouped returns the grouped transactions collection by the lock or type script.
	GetTransactionsGrouped(ctx context.Context, searchKey *SearchKey, order SearchOrder, limit uint64, afterCursor string) (*TxsWithCells, 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 Filter

type Filter struct {
	Script              *types.Script `json:"script"`
	ScriptLenRange      *[2]uint64    `json:"script_len_range,omitempty"`
	OutputDataLenRange  *[2]uint64    `json:"output_data_len_range,omitempty"`
	OutputCapacityRange *[2]uint64    `json:"output_capacity_range,omitempty"`
	BlockRange          *[2]uint64    `json:"block_range,omitempty"`
}

func (Filter) MarshalJSON

func (r Filter) MarshalJSON() ([]byte, error)

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

func (*LiveCell) UnmarshalJSON

func (r *LiveCell) UnmarshalJSON(input []byte) error

type LiveCells

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

type SearchKey

type SearchKey struct {
	Script     *types.Script    `json:"script"`
	ScriptType types.ScriptType `json:"script_type"`
	Filter     *Filter          `json:"filter,omitempty"`
	WithData   bool             `json:"with_data"`
}

type SearchOrder

type SearchOrder string

type TipHeader

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

func (*TipHeader) UnmarshalJSON

func (r *TipHeader) UnmarshalJSON(input []byte) error

type TxWithCell

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

func (*TxWithCell) UnmarshalJSON

func (r *TxWithCell) UnmarshalJSON(input []byte) error

type TxWithCells

type TxWithCells struct {
	TxHash      types.Hash `json:"tx_hash"`
	BlockNumber uint64     `json:"block_number"`
	TxIndex     uint       `json:"tx_index"`
	Cells       []*Cell    `json:"Cells"`
}

func (*TxWithCells) UnmarshalJSON

func (r *TxWithCells) UnmarshalJSON(input []byte) error

type TxsWithCell

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

type TxsWithCells

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

Jump to

Keyboard shortcuts

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