Table of Contents

Class WalletFactory

Namespace
NArk.Core.Wallet
Assembly
NArk.Core.dll

Factory for creating wallet info records from secrets (nsec or mnemonic), and watch-only wallets from an account descriptor.

public static class WalletFactory
Inheritance
WalletFactory
Inherited Members

Methods

CreateWallet(string, string?, ArkServerInfo, CancellationToken)

public static Task<ArkWalletInfo> CreateWallet(string walletSecret, string? destination, ArkServerInfo serverInfo, CancellationToken cancellationToken = default)

Parameters

walletSecret string
destination string
serverInfo ArkServerInfo
cancellationToken CancellationToken

Returns

Task<ArkWalletInfo>

CreateWatchOnlyWallet(string, string?, ArkServerInfo, IReadOnlyDictionary<string, string>?, CancellationToken)

Creates a watch-only wallet from an account descriptor. The wallet can derive addresses and observe VTXOs but holds no signing material — GetSignerAsync(string, CancellationToken) will return null for it, and signing-dependent operations (batch participation, unilateral exits) will throw with a descriptive error.

public static Task<ArkWalletInfo> CreateWatchOnlyWallet(string accountDescriptor, string? destination, ArkServerInfo serverInfo, IReadOnlyDictionary<string, string>? metadata = null, CancellationToken cancellationToken = default)

Parameters

accountDescriptor string

The account descriptor to observe. May be a bare tr(pubkey) for single-key style, or a tr([fingerprint/path]xpub/0/*) for hierarchical-deterministic style; the wallet's address provider is picked accordingly.

destination string

Optional sweep destination address (must be addressed to the same Arkade server as serverInfo).

serverInfo ArkServerInfo

The Arkade server the wallet is bound to.

metadata IReadOnlyDictionary<string, string>

Optional initial metadata to attach to the wallet.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<ArkWalletInfo>

GetAlternateWalletIdsFromNsec(string)

public static string[] GetAlternateWalletIdsFromNsec(string nsec)

Parameters

nsec string

Returns

string[]

GetOutputDescriptorFromNsec(string)

public static string GetOutputDescriptorFromNsec(string nsec)

Parameters

nsec string

Returns

string

ValidateDestination(string, ArkServerInfo)

public static void ValidateDestination(string destination, ArkServerInfo serverInfo)

Parameters

destination string
serverInfo ArkServerInfo