indexer

package
v0.0.0-...-8e00526 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyGetTxHistoryOptions

func ApplyGetTxHistoryOptions(opts ...GetTxHistoryOption) (*getTxHistoryOption, error)

func ApplyGetVtxosOptions

func ApplyGetVtxosOptions(opts ...GetVtxosOption) (*getVtxosOption, error)

func ApplyPageOptions

func ApplyPageOptions(opts ...PageOption) (*pageOption, error)

Types

type AssetInfo

type AssetInfo struct {
	AssetId        string
	Supply         string
	ControlAssetId string
	Metadata       []asset.Metadata
}

type Batch

type Batch struct {
	TotalOutputAmount uint64
	TotalOutputVtxos  int32
	ExpiresAt         int64
	Swept             bool
}

type ChainWithExpiry

type ChainWithExpiry struct {
	Txid      string
	ExpiresAt int64
	Type      IndexerChainedTxType
	Spends    []string
}

type CommitmentTx

type CommitmentTx struct {
	StartedAt         int64
	EndedAt           int64
	TotalInputAmount  uint64
	TotalInputVtxos   int32
	TotalOutputAmount uint64
	TotalOutputVtxos  int32
	Batches           map[uint32]*Batch
}

type ConnectorsResponse

type ConnectorsResponse struct {
	Tree []TxNode
	Page *PageResponse
}

type ForfeitTxsResponse

type ForfeitTxsResponse struct {
	Txids []string
	Page  *PageResponse
}

type GetTxHistoryOption

type GetTxHistoryOption func(*getTxHistoryOption) error

GetTxHistoryOption is a functional option for GetTxHistory requests.

func WithEndTime

func WithEndTime(endTime time.Time) GetTxHistoryOption

func WithStartTime

func WithStartTime(startTime time.Time) GetTxHistoryOption

type GetVtxosOption

type GetVtxosOption func(*getVtxosOption) error

GetVtxosOption is a functional option for GetVtxos requests.

func WithOutpoints

func WithOutpoints(outpoints []types.Outpoint) GetVtxosOption

func WithPendingOnly

func WithPendingOnly() GetVtxosOption

func WithRecoverableOnly

func WithRecoverableOnly() GetVtxosOption

func WithScripts

func WithScripts(scripts []string) GetVtxosOption

func WithSpendableOnly

func WithSpendableOnly() GetVtxosOption

func WithSpentOnly

func WithSpentOnly() GetVtxosOption

func WithTimeRange

func WithTimeRange(before, after int64) GetVtxosOption

func WithVtxosPage

func WithVtxosPage(page *PageRequest) GetVtxosOption

type Indexer

type Indexer interface {
	GetCommitmentTx(ctx context.Context, txid string) (*CommitmentTx, error)
	GetVtxoTree(
		ctx context.Context, batchOutpoint types.Outpoint, opts ...PageOption,
	) (*VtxoTreeResponse, error)
	GetFullVtxoTree(
		ctx context.Context, batchOutpoint types.Outpoint, opts ...PageOption,
	) ([]tree.TxTreeNode, error)
	GetVtxoTreeLeaves(
		ctx context.Context, batchOutpoint types.Outpoint, opts ...PageOption,
	) (*VtxoTreeLeavesResponse, error)
	GetForfeitTxs(
		ctx context.Context, txid string, opts ...PageOption,
	) (*ForfeitTxsResponse, error)
	GetConnectors(
		ctx context.Context, txid string, opts ...PageOption,
	) (*ConnectorsResponse, error)
	GetVtxos(ctx context.Context, opts ...GetVtxosOption) (*VtxosResponse, error)
	GetVtxoChain(
		ctx context.Context, outpoint types.Outpoint, opts ...PageOption,
	) (*VtxoChainResponse, error)
	GetVirtualTxs(
		ctx context.Context, txids []string, opts ...PageOption,
	) (*VirtualTxsResponse, error)
	GetBatchSweepTxs(ctx context.Context, batchOutpoint types.Outpoint) ([]string, error)
	NewSubscription(
		ctx context.Context, scripts []string,
	) (string, <-chan ScriptEvent, func(), error)
	UpdateSubscription(
		ctx context.Context, subscriptionId string, scriptsToAdd, scriptsToRemove []string,
	) error
	GetAsset(ctx context.Context, assetID string) (*AssetInfo, error)

	Close()
}

type IndexerChainedTxType

type IndexerChainedTxType string
const (
	IndexerChainedTxTypeUnspecified IndexerChainedTxType = "unspecified"
	IndexerChainedTxTypeCommitment  IndexerChainedTxType = "commitment"
	IndexerChainedTxTypeArk         IndexerChainedTxType = "ark"
	IndexerChainedTxTypeTree        IndexerChainedTxType = "tree"
	IndexerChainedTxTypeCheckpoint  IndexerChainedTxType = "checkpoint"
)

type PageOption

type PageOption func(*pageOption) error

PageOption is a functional option for paginated requests.

func WithPage

func WithPage(page *PageRequest) PageOption

type PageRequest

type PageRequest struct {
	Size  int32
	Index int32
}

type PageResponse

type PageResponse struct {
	Current int32
	Next    int32
	Total   int32
}

type ScriptEvent

type ScriptEvent struct {
	Data       *ScriptEventData
	Connection *types.StreamConnectionEvent
	Err        error
}

type ScriptEventData

type ScriptEventData struct {
	Txid          string
	Tx            string
	Scripts       []string
	NewVtxos      []types.Vtxo
	SpentVtxos    []types.Vtxo
	CheckpointTxs map[string]TxData
}

type TxData

type TxData struct {
	Txid string
	Tx   string
}

type TxHistoryResponse

type TxHistoryResponse struct {
	History []types.Transaction
	Page    *PageResponse
}

type TxNode

type TxNode struct {
	Txid     string
	Children map[uint32]string
}

type TxNodes

type TxNodes []TxNode

func (TxNodes) ToTree

func (t TxNodes) ToTree(txMap map[string]string) []tree.TxTreeNode

func (TxNodes) Txids

func (t TxNodes) Txids() []string

type VirtualTxsResponse

type VirtualTxsResponse struct {
	Txs  []string
	Page *PageResponse
}

type VtxoChainResponse

type VtxoChainResponse struct {
	Chain []ChainWithExpiry
	Page  *PageResponse
}

type VtxoTreeLeavesResponse

type VtxoTreeLeavesResponse struct {
	Leaves []types.Outpoint
	Page   *PageResponse
}

type VtxoTreeResponse

type VtxoTreeResponse struct {
	Tree []TxNode
	Page *PageResponse
}

type VtxosResponse

type VtxosResponse struct {
	Vtxos []types.Vtxo
	Page  *PageResponse
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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