Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyListVtxosOptions(opts ...ListVtxosOption) (*listVtxosOptions, error)
- func NetVtxoAssets(gross, subtract []clientlib.Vtxo) []clientlib.Asset
- type BurnAssetRes
- type CollaborativeExitRes
- type InitArgs
- type IssueAssetRes
- type ListVtxosOption
- type RedeemNotesRes
- type ReissueAssetRes
- type SendOffChainRes
- type SettleRes
- type UnrollOption
- type UnrollRes
- type Wallet
- type WalletOption
Constants ¶
View Source
const ( // identity SingleKeyIdentity = clientlib.SingleKeyIdentity // store InMemoryStore = types.InMemoryStore FileStore = types.FileStore )
Variables ¶
View Source
var ( ErrAlreadyInitialized = fmt.Errorf("wallet already initialized") ErrNotInitialized = fmt.Errorf("wallet not initialized") ErrIsLocked = fmt.Errorf("wallet is locked") )
View Source
var Version string
Functions ¶
func ApplyListVtxosOptions ¶
func ApplyListVtxosOptions(opts ...ListVtxosOption) (*listVtxosOptions, 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 BurnAssetRes ¶
type BurnAssetRes = offchaintx.OffchainTxRes
type CollaborativeExitRes ¶
type CollaborativeExitRes = batchsession.BatchTxRes
type IssueAssetRes ¶
type IssueAssetRes = offchaintx.IssueAssetRes
type ListVtxosOption ¶
type ListVtxosOption func(options *listVtxosOptions) error
func WithTimeRange ¶
func WithTimeRange(before, after int64) ListVtxosOption
type RedeemNotesRes ¶
type RedeemNotesRes = batchsession.BatchTxRes
type ReissueAssetRes ¶
type ReissueAssetRes = offchaintx.OffchainTxRes
type SendOffChainRes ¶
type SendOffChainRes = offchaintx.OffchainTxRes
type SettleRes ¶
type SettleRes = batchsession.BatchTxRes
type UnrollOption ¶
type UnrollOption interface {
// contains filtered or unexported methods
}
func WithReceiver ¶
func WithReceiver(receiver string) UnrollOption
func WithVtxos ¶
func WithVtxos(vtxos []clientlib.Vtxo) UnrollOption
type Wallet ¶
type Wallet interface {
Identity() clientlib.Identity
Client() clientlib.Client
Indexer() clientlib.Indexer
Explorer() clientlib.Explorer
GetVersion() string
GetConfigData(ctx context.Context) (*clientlib.ServerParams, error)
Init(ctx context.Context, args InitArgs) 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 *clientlib.Address, err error)
GetAddresses(ctx context.Context) (
onchainAddresses []string,
offchainAddresses, boardingAddresses, redemptionAddresses []clientlib.Address, err error,
)
Balance(ctx context.Context) (*types.Balance, error)
ListVtxos(
ctx context.Context, opts ...ListVtxosOption,
) (spendable, spent []clientlib.Vtxo, err error)
GetTransactionHistory(ctx context.Context) ([]clientlib.Transaction, error)
NotifyIncomingFunds(ctx context.Context, address string) ([]clientlib.Vtxo, error)
// ** Assets **
IssueAsset(
ctx context.Context, amount uint64, controlAsset clientlib.ControlAsset,
metadata []asset.Metadata, opts ...offchaintx.Option,
) (*IssueAssetRes, error)
ReissueAsset(
ctx context.Context, assetId string, amount uint64, opts ...offchaintx.Option,
) (*ReissueAssetRes, error)
BurnAsset(
ctx context.Context, assetId string, amount uint64, opts ...offchaintx.Option,
) (*BurnAssetRes, error)
// ** Offchain txs **
SendOffChain(
ctx context.Context, receivers []clientlib.Receiver, opts ...offchaintx.Option,
) (*SendOffChainRes, error)
FinalizePendingTxs(ctx context.Context, createdAfter *time.Time) ([]string, error)
// ** Batch session **
Settle(ctx context.Context, opts ...batchsession.Option) (*SettleRes, error)
CollaborativeExit(
ctx context.Context, addr string, amount uint64, opts ...batchsession.Option,
) (*CollaborativeExitRes, error)
RedeemNotes(
ctx context.Context, notes []string, opts ...batchsession.Option,
) (*RedeemNotesRes, error)
RegisterIntent(
ctx context.Context, vtxos []clientlib.Vtxo, boardingUtxos []clientlib.Utxo, notes []string,
outputs []clientlib.Receiver, cosignersPublicKeys []string,
) (intentID string, err error)
DeleteIntent(
ctx context.Context, vtxos []clientlib.Vtxo, boardingUtxos []clientlib.Utxo, notes []string,
) error
// ** Unroll **
Unroll(ctx context.Context, opts ...UnrollOption) ([]UnrollRes, error)
CompleteUnroll(ctx context.Context, opts ...UnrollOption) (string, error)
OnboardAgainAllExpiredBoardings(ctx context.Context) (string, error)
WithdrawFromAllExpiredBoardings(ctx context.Context, opts ...UnrollOption) (string, error)
}
func LoadWallet ¶
func LoadWallet(storeSvc types.Store, opts ...WalletOption) (Wallet, error)
type WalletOption ¶
type WalletOption func(*wallet)
func WithClientVersion ¶
func WithClientVersion(version string) WalletOption
func WithExplorer ¶
func WithExplorer(explorer clientlib.Explorer) WalletOption
func WithIdentity ¶
func WithIdentity(identitySvc clientlib.Identity) WalletOption
func WithVerbose ¶
func WithVerbose() WalletOption
func WithoutFinalizePendingTxs ¶
func WithoutFinalizePendingTxs() WalletOption
Source Files
¶
Click to show internal directories.
Click to hide internal directories.