arksdk

package module
v0.0.0-...-877b7d3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 36 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// transport
	GrpcClient = client.GrpcClient
	RestClient = client.RestClient
	// wallet
	SingleKeyWallet = wallet.SingleKeyWallet
	// store
	FileStore     = store.FileStore
	InMemoryStore = store.InMemoryStore
	// explorer
	BitcoinExplorer = explorer.BitcoinExplorer
	LiquidExplorer  = explorer.LiquidExplorer
)

Variables

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

Functions

This section is empty.

Types

type ArkClient

type ArkClient interface {
	GetConfigData(ctx context.Context) (*store.StoreData, 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, password string) error
	Balance(ctx context.Context, computeExpiryDetails bool) (*Balance, error)
	Receive(ctx context.Context) (offchainAddr, boardingAddr string, err error)
	SendOnChain(ctx context.Context, receivers []Receiver) (string, error)
	SendOffChain(
		ctx context.Context, withExpiryCoinselect bool, receivers []Receiver,
	) (string, error)
	UnilateralRedeem(ctx context.Context) error
	CollaborativeRedeem(
		ctx context.Context, addr string, amount uint64, withExpiryCoinselect bool,
	) (string, error)
	SendAsync(ctx context.Context, withExpiryCoinselect bool, receivers []Receiver) (string, error)
	Claim(ctx context.Context) (string, error)
	ListVtxos(ctx context.Context) (spendable, spent []client.Vtxo, err error)
	GetTransactionHistory(ctx context.Context) ([]Transaction, error)
	Dump(ctx context.Context) (seed string, err error)
}

func LoadCovenantClient

func LoadCovenantClient(storeSvc store.ConfigStore) (ArkClient, error)

func LoadCovenantClientWithWallet

func LoadCovenantClientWithWallet(
	storeSvc store.ConfigStore, walletSvc wallet.WalletService,
) (ArkClient, error)

func LoadCovenantlessClient

func LoadCovenantlessClient(storeSvc store.ConfigStore) (ArkClient, error)

func LoadCovenantlessClientWithWallet

func LoadCovenantlessClientWithWallet(
	storeSvc store.ConfigStore, walletSvc wallet.WalletService,
) (ArkClient, error)

func NewCovenantClient

func NewCovenantClient(storeSvc store.ConfigStore) (ArkClient, error)

func NewCovenantlessClient

func NewCovenantlessClient(storeSvc store.ConfigStore) (ArkClient, error)

type Balance

type Balance struct {
	OnchainBalance  OnchainBalance  `json:"onchain_balance"`
	OffchainBalance OffchainBalance `json:"offchain_balance"`
}

type InitArgs

type InitArgs struct {
	ClientType  string
	WalletType  string
	AspUrl      string
	Seed        string
	Password    string
	ExplorerURL string
}

type InitWithWalletArgs

type InitWithWalletArgs struct {
	ClientType  string
	Wallet      wallet.WalletService
	AspUrl      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 Receiver

type Receiver interface {
	To() string
	Amount() uint64

	IsOnchain() bool
}

func NewBitcoinReceiver

func NewBitcoinReceiver(to string, amount uint64) Receiver

func NewLiquidReceiver

func NewLiquidReceiver(to string, amount uint64) Receiver

type Transaction

type Transaction struct {
	BoardingTxid    string
	RoundTxid       string
	RedeemTxid      string
	Amount          uint64
	Type            TxType
	IsPending       bool
	IsPendingChange bool
	CreatedAt       time.Time
}

type TxType

type TxType string
const (
	TxSent     TxType = "sent"
	TxReceived TxType = "received"
)

type VtxoDetails

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

Jump to

Keyboard shortcuts

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