Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyListVtxosOptions(opts ...ListVtxosOption) (*listVtxosOptions, error)
- func GetEventStreamTopics(spentOutpoints []types.Outpoint, signerSessions []tree.SignerSession) []string
- func JoinBatchSession(ctx context.Context, eventsCh <-chan client.BatchEventChannel, ...) (string, string, time.Duration, []string, *tree.TxTree, error)
- func NetVtxoAssets(gross, subtract []types.Vtxo) []types.Asset
- type ArkClient
- type Balance
- type BatchEventHandlerOption
- type BatchEventsHandler
- type BatchSessionOption
- func WithCancelCh(ch <-chan struct{}) BatchSessionOption
- func WithEventsCh(ch chan<- any) BatchSessionOption
- func WithExpiryThreshold(threshold int64) BatchSessionOption
- func WithExtraSigner(signerSessions ...tree.SignerSession) BatchSessionOption
- func WithFunds(boardingUtxos []types.Utxo, vtxos []types.VtxoWithTapTree) BatchSessionOption
- func WithRecoverableVtxos() BatchSessionOption
- func WithRetries(num int) BatchSessionOption
- func WithoutWalletSigner() BatchSessionOption
- type BatchTxRes
- type BurnAssetRes
- type CollaborativeExitRes
- type FinalizePendingTxsRes
- type InitArgs
- type InitWithWalletArgs
- type IssueAssetRes
- type ListVtxosOption
- type LockedOnchainBalance
- type OffchainBalance
- type OffchainTxRes
- type OnchainBalance
- type RedeemNotesRes
- type ReissueAssetRes
- type SendOffChainRes
- type SendOption
- type ServiceOption
- type SettleRes
- type UnrollOption
- type UnrollRes
- type VtxoDetails
Constants ¶
const ( // wallet SingleKeyWallet = wallet.SingleKeyWallet // store FileStore = types.FileStore InMemoryStore = types.InMemoryStore // explorer BitcoinExplorer = mempool_explorer.BitcoinExplorer )
Variables ¶
var ( ErrAlreadyInitialized = fmt.Errorf("client already initialized") ErrNotInitialized = fmt.Errorf("client not initialized") )
var ErrWaitingForConfirmation = fmt.Errorf("waiting for confirmation(s), please retry later")
var Version string
var WithSubDustVtxos = WithRecoverableVtxos
name alias, sub-dust vtxos are recoverable vtxos
Functions ¶
func ApplyListVtxosOptions ¶
func ApplyListVtxosOptions(opts ...ListVtxosOption) (*listVtxosOptions, error)
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 ...BatchEventHandlerOption, ) (string, string, time.Duration, []string, *tree.TxTree, error)
func NetVtxoAssets ¶
NetVtxoAssets returns the per-asset balance for a vtxo movement: assets found in `gross` minus the portion in `subtract` that effectively stayed in the wallet (change, already-owned vtxos, etc.).
The output preserves asset-id order as first encountered in `gross`, drops zero-net assets, and returns nil when there is no asset data (common pure-BTC case).
It is exported so that external SDKs reproducing the same vtxosToTxs reconstruction (e.g. go-sdk) can derive Transaction.Assets with identical semantics, rather than keeping a parallel copy of the helper.
Types ¶
type ArkClient ¶
type ArkClient interface {
Wallet() wallet.WalletService
Transport() client.TransportClient
Indexer() indexer.Indexer
Explorer() explorer.Explorer
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 string, offchainAddr, boardingAddr *types.Address, err error)
GetAddresses(ctx context.Context) (
onchainAddresses, offchainAddresses, boardingAddresses, redemptionAddresses []string,
err error,
)
Balance(ctx context.Context) (*Balance, error)
ListVtxos(ctx context.Context, opts ...ListVtxosOption) (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,
) (*IssueAssetRes, error)
ReissueAsset(
ctx context.Context, assetId string, amount uint64, opts ...SendOption,
) (*ReissueAssetRes, error)
BurnAsset(
ctx context.Context, assetID string, amount uint64, opts ...SendOption,
) (*BurnAssetRes, error)
// ** Offchain txs **
SendOffChain(
ctx context.Context, receivers []types.Receiver, opts ...SendOption,
) (*SendOffChainRes, error)
FinalizePendingTxs(ctx context.Context, createdAfter *time.Time) ([]string, error)
// ** Batch session **
Settle(ctx context.Context, opts ...BatchSessionOption) (*SettleRes, error)
CollaborativeExit(
ctx context.Context, addr string, amount uint64, opts ...BatchSessionOption,
) (*CollaborativeExitRes, error)
RedeemNotes(ctx context.Context, notes []string, opts ...BatchSessionOption) (*RedeemNotesRes, 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) ([]UnrollRes, 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 BatchEventHandlerOption ¶
type BatchEventHandlerOption func(*options)
func WithCancel ¶
func WithCancel(cancelCh <-chan struct{}) BatchEventHandlerOption
func WithReplay ¶
func WithReplay(ch chan<- any) BatchEventHandlerOption
func WithSkipVtxoTreeSigning ¶
func WithSkipVtxoTreeSigning() BatchEventHandlerOption
type BatchEventsHandler ¶
type BatchEventsHandler interface {
OnBatchStarted(
ctx context.Context, event client.BatchStartedEvent,
) (bool, time.Duration, 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,
) ([]string, error)
OnStreamStarted(
ctx context.Context, event client.StreamStartedEvent,
) error
}
type BatchSessionOption ¶
type BatchSessionOption func(options *batchSessionOptions) error
func WithCancelCh ¶
func WithCancelCh(ch <-chan struct{}) BatchSessionOption
WithCancelCh allows to cancel the settlement process
func WithEventsCh ¶
func WithEventsCh(ch chan<- any) BatchSessionOption
func WithExpiryThreshold ¶
func WithExpiryThreshold(threshold int64) BatchSessionOption
func WithExtraSigner ¶
func WithExtraSigner(signerSessions ...tree.SignerSession) BatchSessionOption
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) BatchSessionOption
func WithRecoverableVtxos ¶
func WithRecoverableVtxos() BatchSessionOption
func WithRetries ¶
func WithRetries(num int) BatchSessionOption
func WithoutWalletSigner ¶
func WithoutWalletSigner() BatchSessionOption
WithoutWalletSigner disables the wallet signer
type BatchTxRes ¶
type BurnAssetRes ¶
type BurnAssetRes = OffchainTxRes
type CollaborativeExitRes ¶
type CollaborativeExitRes = BatchTxRes
type FinalizePendingTxsRes ¶
type FinalizePendingTxsRes = []OffchainTxRes
type InitWithWalletArgs ¶
type IssueAssetRes ¶
type IssueAssetRes struct {
OffchainTxRes
IssuedAssets []asset.AssetId
}
type ListVtxosOption ¶
type ListVtxosOption func(options *listVtxosOptions) error
func WithTimeRange ¶
func WithTimeRange(before, after int64) ListVtxosOption
type LockedOnchainBalance ¶
type OffchainBalance ¶
type OffchainBalance struct {
Total uint64 `json:"total"`
NextExpiration string `json:"next_expiration,omitempty"`
Details []VtxoDetails `json:"details"`
}
type OffchainTxRes ¶
type OnchainBalance ¶
type OnchainBalance struct {
SpendableAmount uint64 `json:"spendable_amount"`
LockedAmount []LockedOnchainBalance `json:"locked_amount,omitempty"`
}
type RedeemNotesRes ¶
type RedeemNotesRes = BatchTxRes
type ReissueAssetRes ¶
type ReissueAssetRes = OffchainTxRes
type SendOffChainRes ¶
type SendOffChainRes = OffchainTxRes
type SendOption ¶
type SendOption func(options *sendOptions) error
func WithExtraPacket ¶
func WithExtraPacket(packets ...extension.Packet) SendOption
WithExtraPacket appends extra extension.Packet values to the OP_RETURN extension blob that is included in the ark transaction alongside the asset packet (type 0x00).
Type 0x00 is reserved for the asset packet, automatically built depending on the Transaction. Passing type 0x00 returns an error.
Duplicate packet types are not permitted.
func WithVtxos ¶
func WithVtxos(vtxos []types.VtxoWithTapTree) SendOption
func WithoutExpirySorting ¶
func WithoutExpirySorting() SendOption
type ServiceOption ¶
type ServiceOption func(*service)
func WithExplorer ¶
func WithExplorer(explorer explorer.Explorer) ServiceOption
func WithVerbose ¶
func WithVerbose() ServiceOption
func WithWallet ¶
func WithWallet(wallet wallet.WalletService) ServiceOption
func WithoutFinalizePendingTxs ¶
func WithoutFinalizePendingTxs() ServiceOption
type SettleRes ¶
type SettleRes = BatchTxRes
type UnrollOption ¶
type UnrollOption func(options *unrollOptions) error
func WithVtxosToUnroll ¶
func WithVtxosToUnroll(vtxos []types.Vtxo) UnrollOption
type VtxoDetails ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
alice_to_bob
command
|
|
|
multi_connection_demo
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
|
|