Documentation
¶
Overview ¶
Package explorer provides a simplified blockchain explorer client interface with only the methods that are actually used in production code.
This interface removes debugging, monitoring, and example-only methods to provide a cleaner, more focused API.
Index ¶
- Variables
- func NewExplorerClient(addr string) (*explorerClient, error)
- type BlockTimestamp
- type Explorer
- type Outpoint
- type RBFTxn
- type RbfTxId
- type TxInput
- type Utxo
- type VtxoWithValue
- type Wallet
- func (w *Wallet) BroadcastTransaction(ctx context.Context, txs ...string) (string, error)
- func (w *Wallet) Close()
- func (w *Wallet) ConnectorsAccountBalance(ctx context.Context) (uint64, uint64, error)
- func (w *Wallet) Create(ctx context.Context, seed, password string) error
- func (w *Wallet) DeriveAddresses(ctx context.Context, num int) ([]string, error)
- func (w *Wallet) DeriveConnectorAddress(ctx context.Context) (string, error)
- func (w *Wallet) EstimateFees(ctx context.Context, psbt string) (uint64, error)
- func (w *Wallet) FeeRate(ctx context.Context) (uint64, error)
- func (w *Wallet) GenSeed(ctx context.Context) (string, error)
- func (w *Wallet) GetCurrentBlockTime(ctx context.Context) (*BlockTimestamp, error)
- func (w *Wallet) GetDustAmount(ctx context.Context) (uint64, error)
- func (w *Wallet) GetForfeitPubkey(ctx context.Context) (*btcec.PublicKey, error)
- func (w *Wallet) GetNetwork(ctx context.Context) (*arklib.Network, error)
- func (w *Wallet) GetNotificationChannel(ctx context.Context) <-chan map[string][]VtxoWithValue
- func (w *Wallet) GetOutpointStatus(ctx context.Context, outpoint Outpoint) (spent bool, err error)
- func (w *Wallet) GetReadyUpdate(ctx context.Context) (<-chan struct{}, error)
- func (w *Wallet) GetTransaction(ctx context.Context, txid string) (string, error)
- func (w *Wallet) IsTransactionConfirmed(ctx context.Context, txid string) (bool, int64, int64, error)
- func (w *Wallet) ListConnectorUtxos(ctx context.Context, connectorAddress string) ([]TxInput, error)
- func (w *Wallet) LoadSignerKey(ctx context.Context, prvkey string) error
- func (w *Wallet) Lock(ctx context.Context) error
- func (w *Wallet) LockConnectorUtxos(ctx context.Context, utxos []Outpoint) error
- func (w *Wallet) MainAccountBalance(ctx context.Context) (uint64, uint64, error)
- func (w *Wallet) Restore(ctx context.Context, seed, password string) error
- func (w *Wallet) SelectUtxos(ctx context.Context, asset string, amount uint64, confirmedOnly bool) ([]TxInput, uint64, error)
- func (w *Wallet) SignMessage(ctx context.Context, message []byte) ([]byte, error)
- func (w *Wallet) SignTransaction(ctx context.Context, partialTx string, extractRawTx bool) (string, error)
- func (w *Wallet) SignTransactionTapscript(ctx context.Context, partialTx string, inputIndexes []int) (string, error)
- func (w *Wallet) Status(ctx context.Context) (WalletStatus, error)
- func (w *Wallet) Unlock(ctx context.Context, password string) error
- func (w *Wallet) UnwatchScripts(ctx context.Context, scripts []string) error
- func (w *Wallet) VerifyMessageSignature(ctx context.Context, message, signature []byte) (bool, error)
- func (w *Wallet) WatchScripts(ctx context.Context, scripts []string) error
- func (w *Wallet) Withdraw(ctx context.Context, address string, amount uint64, all bool) (string, error)
- type WalletStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNonFinalBIP68 is returned when a transaction spending a CSV-locked output is not final. ErrNonFinalBIP68 = errors.New("non-final BIP68 sequence") )
Local error definitions
Functions ¶
func NewExplorerClient ¶
gRPC client for nbxplorer explorer service
Types ¶
type BlockTimestamp ¶
BlockTimestamp represents a block timestamp
type Explorer ¶
type Explorer interface {
// GetTxHex retrieves the raw transaction hex for a given transaction ID.
GetTxHex(txid string) (string, error)
// Broadcast broadcasts one or more raw transactions to the network.
// Returns the transaction ID of the first transaction on success.
Broadcast(txs ...string) (string, error)
// GetTxs retrieves all transactions associated with a given address.
GetTxs(addr string) ([]tx, error)
// GetTxOutspends returns the spent status of all outputs for a given transaction.
GetTxOutspends(tx string) ([]spentStatus, error)
// GetUtxos retrieves all unspent transaction outputs (UTXOs) for a given address.
GetUtxos(addr string) ([]Utxo, error)
// GetRedeemedVtxosBalance calculates the redeemed virtual UTXO balance for an address
// considering the unilateral exit delay.
GetRedeemedVtxosBalance(
addr string, unilateralExitDelay arklib.RelativeLocktime,
) (uint64, map[int64]uint64, error)
// GetTxBlockTime returns whether a transaction is confirmed and its block time.
GetTxBlockTime(
txid string,
) (confirmed bool, blocktime int64, err error)
// BaseUrl returns the base URL of the explorer service.
BaseUrl() string
// GetFeeRate retrieves the current recommended fee rate in sat/vB.
GetFeeRate() (float64, error)
// GetAddressesEvents returns a channel that receives onchain address events
// (new UTXOs, spent UTXOs, confirmed UTXOs) for all subscribed addresses.
GetAddressesEvents() <-chan types.OnchainAddressEvent
// SubscribeForAddresses subscribes to address updates via WebSocket connections.
// Addresses are automatically distributed across multiple connections using hash-based routing.
// Subscriptions are batched to prevent overwhelming individual connections.
// Duplicate subscriptions are automatically prevented via instance-scoped deduplication.
SubscribeForAddresses(addresses []string) error
// UnsubscribeForAddresses removes address subscriptions and updates the WebSocket connections.
UnsubscribeForAddresses(addresses []string) error
// Stop gracefully shuts down the explorer, closing all WebSocket connections and channels.
Stop()
}
Explorer provides the core methods to interact with blockchain explorers. This is a simplified version of the Explorer interface that only includes methods that are actually used in production code.
type VtxoWithValue ¶
VtxoWithValue represents a VTXO with its value
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func (*Wallet) BroadcastTransaction ¶
func (*Wallet) ConnectorsAccountBalance ¶
func (*Wallet) DeriveAddresses ¶
func (*Wallet) DeriveConnectorAddress ¶
func (*Wallet) EstimateFees ¶
func (*Wallet) GetCurrentBlockTime ¶
func (w *Wallet) GetCurrentBlockTime( ctx context.Context, ) (*BlockTimestamp, error)
func (*Wallet) GetForfeitPubkey ¶
func (*Wallet) GetNetwork ¶
func (*Wallet) GetNotificationChannel ¶
func (w *Wallet) GetNotificationChannel( ctx context.Context, ) <-chan map[string][]VtxoWithValue
func (*Wallet) GetOutpointStatus ¶
func (*Wallet) GetReadyUpdate ¶
func (*Wallet) GetTransaction ¶
func (*Wallet) IsTransactionConfirmed ¶
func (*Wallet) ListConnectorUtxos ¶
func (*Wallet) LoadSignerKey ¶
func (*Wallet) LockConnectorUtxos ¶
func (*Wallet) MainAccountBalance ¶
func (*Wallet) SelectUtxos ¶
func (*Wallet) SignMessage ¶
func (*Wallet) SignTransaction ¶
func (*Wallet) SignTransactionTapscript ¶
func (*Wallet) UnwatchScripts ¶
func (*Wallet) VerifyMessageSignature ¶
func (*Wallet) WatchScripts ¶
type WalletStatus ¶
WalletStatus interface defines wallet status methods
Click to show internal directories.
Click to hide internal directories.