arksdk

package module
v0.0.0-...-76f077b Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// wallet
	SingleKeyWallet = wallet.SingleKeyWallet
	// store
	FileStore     = types.FileStore
	InMemoryStore = types.InMemoryStore
	// explorer
	BitcoinExplorer = mempool_explorer.BitcoinExplorer
)

Variables

View Source
var (
	ErrAlreadyInitialized = fmt.Errorf("client already initialized")
	ErrNotInitialized     = fmt.Errorf("client not initialized")
)
View Source
var Version string
View Source
var WithSubDustVtxos = WithRecoverableVtxos

name alias, sub-dust vtxos are recoverable vtxos

Functions

func GetEventStreamTopics

func GetEventStreamTopics(
	spentOutpoints []types.Outpoint, signerSessions []tree.SignerSession,
) []string

func JoinBatchSession

func JoinBatchSession(
	ctx context.Context, eventsCh <-chan client.BatchEventChannel,
	eventsHandler BatchEventsHandler, opts ...BatchSessionOption,
) (string, error)

Types

type ArkClient

type ArkClient interface {
	GetVersion() string
	GetConfigData(ctx context.Context) (*types.Config, error)
	Init(ctx context.Context, args InitArgs) error
	InitWithWallet(ctx context.Context, args InitWithWalletArgs) error
	IsLocked(ctx context.Context) bool
	Unlock(ctx context.Context, password string) error
	Lock(ctx context.Context) error
	Dump(ctx context.Context) (seed string, err error)
	SignTransaction(ctx context.Context, tx string) (string, error)
	Reset(ctx context.Context)
	Stop()
	// ** Funding **
	Receive(ctx context.Context) (onchainAddr, offchainAddr, boardingAddr string, err error)
	GetAddresses(ctx context.Context) (
		onchainAddresses, offchainAddresses, boardingAddresses, redemptionAddresses []string,
		err error,
	)
	Balance(ctx context.Context) (*Balance, error)
	ListVtxos(ctx context.Context) (spendable, spent []types.Vtxo, err error)
	GetTransactionHistory(ctx context.Context) ([]types.Transaction, error)
	NotifyIncomingFunds(ctx context.Context, address string) ([]types.Vtxo, error)
	// ** Assets **
	IssueAsset(
		ctx context.Context, amount uint64, controlAsset types.ControlAsset,
		metadata []asset.Metadata, opts ...SendOption,
	) (string, []asset.AssetId, error)
	ReissueAsset(
		ctx context.Context, assetId string, amount uint64, opts ...SendOption,
	) (string, error)
	BurnAsset(
		ctx context.Context, assetID string, amount uint64, opts ...SendOption,
	) (string, error)
	// ** Offchain txs **
	SendOffChain(
		ctx context.Context, receivers []types.Receiver, opts ...SendOption,
	) (string, error)
	FinalizePendingTxs(ctx context.Context, createdAfter *time.Time) ([]string, error)
	// ** Batch session **
	Settle(ctx context.Context, opts ...SettleOption) (string, error)
	CollaborativeExit(
		ctx context.Context, addr string, amount uint64, opts ...SettleOption,
	) (string, error)
	RedeemNotes(ctx context.Context, notes []string, opts ...SettleOption) (string, error)
	RegisterIntent(
		ctx context.Context, vtxos []types.Vtxo, boardingUtxos []types.Utxo, notes []string,
		outputs []types.Receiver, cosignersPublicKeys []string,
	) (intentID string, err error)
	DeleteIntent(
		ctx context.Context, vtxos []types.Vtxo, boardingUtxos []types.Utxo, notes []string,
	) error
	// ** Unroll **
	Unroll(ctx context.Context, opts ...UnrollOption) error
	CompleteUnroll(ctx context.Context, to string) (string, error)
	OnboardAgainAllExpiredBoardings(ctx context.Context) (string, error)
	WithdrawFromAllExpiredBoardings(ctx context.Context, to string) (string, error)
}

func LoadArkClient

func LoadArkClient(storeSvc types.Store, opts ...ServiceOption) (ArkClient, error)

func LoadArkClientWithWallet

func LoadArkClientWithWallet(
	sdkStore types.Store, walletSvc wallet.WalletService, opts ...ServiceOption,
) (ArkClient, error)

func NewArkClient

func NewArkClient(storeSvc types.Store, opts ...ServiceOption) (ArkClient, error)

type Balance

type Balance struct {
	OnchainBalance  OnchainBalance    `json:"onchain_balance"`
	OffchainBalance OffchainBalance   `json:"offchain_balance"`
	AssetBalances   map[string]uint64 `json:"asset_balances,omitempty"`
}

type BatchEventsHandler

type BatchEventsHandler interface {
	OnBatchStarted(ctx context.Context, event client.BatchStartedEvent) (bool, error)
	OnBatchFinalized(ctx context.Context, event client.BatchFinalizedEvent) error
	OnBatchFailed(ctx context.Context, event client.BatchFailedEvent) error
	OnTreeTxEvent(ctx context.Context, event client.TreeTxEvent) error
	OnTreeSignatureEvent(ctx context.Context, event client.TreeSignatureEvent) error
	OnTreeSigningStarted(
		ctx context.Context, event client.TreeSigningStartedEvent, vtxoTree *tree.TxTree,
	) (bool, error)
	OnTreeNoncesAggregated(
		ctx context.Context,
		event client.TreeNoncesAggregatedEvent,
	) (signed bool, err error)
	OnTreeNonces(ctx context.Context, event client.TreeNoncesEvent) (signed bool, err error)
	OnBatchFinalization(
		ctx context.Context,
		event client.BatchFinalizationEvent, vtxoTree, connectorTree *tree.TxTree,
	) error
	OnStreamStarted(
		ctx context.Context, event client.StreamStartedEvent,
	) error
}

type BatchSessionOption

type BatchSessionOption func(*options)

func WithCancel

func WithCancel(cancelCh <-chan struct{}) BatchSessionOption

func WithReplay

func WithReplay(ch chan<- any) BatchSessionOption

func WithSkipVtxoTreeSigning

func WithSkipVtxoTreeSigning() BatchSessionOption

type InitArgs

type InitArgs struct {
	WalletType  string
	ServerUrl   string
	Seed        string
	Password    string
	ExplorerURL string
}

type InitWithWalletArgs

type InitWithWalletArgs struct {
	Wallet      wallet.WalletService
	ServerUrl   string
	Seed        string
	Password    string
	ExplorerURL string
}

type LockedOnchainBalance

type LockedOnchainBalance struct {
	SpendableAt string `json:"spendable_at"`
	Amount      uint64 `json:"amount"`
}

type OffchainBalance

type OffchainBalance struct {
	Total          uint64        `json:"total"`
	NextExpiration string        `json:"next_expiration,omitempty"`
	Details        []VtxoDetails `json:"details"`
}

type OnchainBalance

type OnchainBalance struct {
	SpendableAmount uint64                 `json:"spendable_amount"`
	LockedAmount    []LockedOnchainBalance `json:"locked_amount,omitempty"`
}

type SendOption

type SendOption func(options *sendOptions) error

func WithVtxos

func WithVtxos(vtxos []types.VtxoWithTapTree) SendOption

func WithoutExpirySorting

func WithoutExpirySorting() SendOption

type ServiceOption

type ServiceOption func(*service)

func WithExplorer

func WithExplorer(svc explorer.Explorer) ServiceOption

WithRefreshDb enables periodic refresh of the db when WithTransactionFeed is set

func WithMonitorConnection

func WithMonitorConnection() ServiceOption

func WithVerbose

func WithVerbose() ServiceOption

func WithoutFinalizePendingTxs

func WithoutFinalizePendingTxs() ServiceOption

type SettleOption

type SettleOption func(options *settleOptions) error

func WithCancelCh

func WithCancelCh(ch <-chan struct{}) SettleOption

WithCancelCh allows to cancel the settlement process

func WithEventsCh

func WithEventsCh(ch chan<- any) SettleOption

func WithExpiryThreshold

func WithExpiryThreshold(threshold int64) SettleOption

func WithExtraSigner

func WithExtraSigner(signerSessions ...tree.SignerSession) SettleOption

WithExtraSigner allows to use a set of custom signer for the vtxo tree signing process

func WithFunds

func WithFunds(boardingUtxos []types.Utxo, vtxos []types.VtxoWithTapTree) SettleOption

func WithRecoverableVtxos

func WithRecoverableVtxos() SettleOption

func WithoutWalletSigner

func WithoutWalletSigner() SettleOption

WithoutWalletSigner disables the wallet signer

type UnrollOption

type UnrollOption func(options *unrollOptions) error

func WithVtxosToUnroll

func WithVtxosToUnroll(vtxos []types.Vtxo) UnrollOption

type VtxoDetails

type VtxoDetails struct {
	ExpiryTime string `json:"expiry_time"`
	Amount     uint64 `json:"amount"`
}

Directories

Path Synopsis
example
alice_to_bob command
mempool
Package explorer provides an explorer client with support for multiple concurrent WebSocket connections for addresses tracking.
Package explorer provides an explorer client with support for multiple concurrent WebSocket connections for addresses tracking.
internal

Jump to

Keyboard shortcuts

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