lightclient

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	SetScripts(ctx context.Context, scriptDetails []*ScriptDetail) error
	GetScripts(ctx context.Context) ([]*ScriptDetail, error)
	SendTransaction(ctx context.Context, tx *types.Transaction) (*types.Hash, error)
	GetTipHeader(ctx context.Context) (*types.Header, error)
	GetGenesisBlock(ctx context.Context) (*types.Block, error)
	GetHeader(ctx context.Context, hash types.Hash) (*types.Header, error)
	GetTransaction(ctx context.Context, hash types.Hash) (*TransactionStatus, error)
	FetchHeader(ctx context.Context, hash types.Hash) (*FetchedHeader, error)
	FetchTransaction(ctx context.Context, hash types.Hash) (*FetchedTransaction, error)
	GetPeers(ctx context.Context) ([]*types.RemoteNode, error)
	LocalNodeInfo(ctx context.Context) (*types.LocalNode, error)
	GetCells(ctx context.Context, searchKey *indexer.SearchKey, order indexer.SearchOrder, limit uint64, afterCursor string) (*indexer.LiveCells, error)
	GetTransactions(ctx context.Context, searchKey *indexer.SearchKey, order indexer.SearchOrder, limit uint64, afterCursor string) (*TxsWithCell, error)
	GetTransactionsGrouped(ctx context.Context, searchKey *indexer.SearchKey, order indexer.SearchOrder, limit uint64, afterCursor string) (*TxsWithCells, error)
	GetCellsCapacity(ctx context.Context, searchKey *indexer.SearchKey) (*indexer.Capacity, error)
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	Close()
	GetRawClient() types.GenericRPCClient
}

func Dial

func Dial(url string) (Client, error)

func DialContext

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

func DialMockContext added in v2.2.0

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

func NewClient

func NewClient(c *rpc.Client) Client

func NewMockingClient added in v2.2.0

func NewMockingClient(c *mocking.MockClient) Client

type FetchStatus

type FetchStatus string
const (
	FetchStatusFetched  FetchStatus = "fetched"
	FetchStatusFetching FetchStatus = "fetching"
	FetchStatusAdded    FetchStatus = "added"
	FetchStatusNotFound FetchStatus = "not_found"
)

type FetchedHeader

type FetchedHeader struct {
	Status    FetchStatus   `json:"status"`
	Data      *types.Header `json:"data"`
	FirstSent uint64        `json:"first_sent"`
	TimeStamp uint64        `json:"time_stamp"`
}

func (*FetchedHeader) UnmarshalJSON

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

type FetchedTransaction

type FetchedTransaction struct {
	Status    FetchStatus            `json:"status"`
	Data      *TransactionWithHeader `json:"data"`
	FirstSent uint64                 `json:"first_sent"`
	TimeStamp uint64                 `json:"time_stamp"`
}

func (*FetchedTransaction) UnmarshalJSON

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

type ScriptDetail

type ScriptDetail struct {
	Script      *types.Script    `json:"script"`
	ScriptType  types.ScriptType `json:"script_type"`
	BlockNumber uint64           `json:"block_number"`
}

func (ScriptDetail) MarshalJSON

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

func (*ScriptDetail) UnmarshalJSON

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

type TransactionStatus added in v2.2.0

type TransactionStatus struct {
	Transaction *types.Transaction `json:"transaction"`
	Cycles      uint64             `json:"cycles"`
	TxStatus    *TxStatus          `json:"tx_status"`
}

type TransactionWithHeader

type TransactionWithHeader struct {
	Transaction *types.Transaction `json:"transaction"`
	Header      *types.Header      `json:"header"`
}

type TxStatus added in v2.2.0

type TxStatus struct {
	Status    TxStatusString `json:"status"`
	BlockHash *types.Hash    `json:"block_hash"`
}

type TxStatusString added in v2.2.0

type TxStatusString string
const (
	TxStatusPending   TxStatusString = "pending"
	TxStatusCommitted TxStatusString = "committed"
	TxStatusUnknown   TxStatusString = "unknown"
)

type TxWithCell

type TxWithCell struct {
	BlockNumber uint64             `json:"block_number"`
	IoIndex     uint               `json:"io_index"`
	IoType      indexer.IoType     `json:"io_type"`
	Transaction *types.Transaction `json:"transaction"`
	TxIndex     uint               `json:"tx_index"`
}

func (*TxWithCell) UnmarshalJSON

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

type TxWithCells

type TxWithCells struct {
	Transaction *types.Transaction `json:"transaction"`
	BlockNumber uint64             `json:"block_number"`
	TxIndex     uint               `json:"tx_index"`
	Cells       []*indexer.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