Interface IWalletStorage
- Namespace
- NArk.Abstractions.Wallets
- Assembly
- NArk.Abstractions.dll
Persistence for wallet records.
public interface IWalletStorage
Methods
DeleteWallet(string, CancellationToken)
Deletes the wallet. Returns true if it existed.
Task<bool> DeleteWallet(string walletId, CancellationToken ct = default)
Parameters
walletIdstringctCancellationToken
Returns
GetWalletById(string, CancellationToken)
Returns the wallet with the given ID, or null.
Task<ArkWalletInfo?> GetWalletById(string walletId, CancellationToken ct = default)
Parameters
walletIdstringctCancellationToken
Returns
GetWalletsByIds(IEnumerable<string>, CancellationToken)
Returns wallets matching the given IDs; silently omits IDs not found.
Task<IReadOnlyList<ArkWalletInfo>> GetWalletsByIds(IEnumerable<string> walletIds, CancellationToken ct = default)
Parameters
walletIdsIEnumerable<string>ctCancellationToken
Returns
LoadAllWallets(CancellationToken)
Returns all wallets in storage.
Task<IReadOnlySet<ArkWalletInfo>> LoadAllWallets(CancellationToken ct = default)
Parameters
Returns
LoadWallet(string, CancellationToken)
Loads a wallet by ID or public-key fingerprint. Throws if not found.
Task<ArkWalletInfo> LoadWallet(string walletIdentifierOrFingerprint, CancellationToken ct = default)
Parameters
walletIdentifierOrFingerprintstringctCancellationToken
Returns
SaveWallet(ArkWalletInfo, CancellationToken)
Creates or replaces a wallet record.
Task SaveWallet(ArkWalletInfo wallet, CancellationToken ct = default)
Parameters
walletArkWalletInfoctCancellationToken
Returns
SetMetadataValue(string, string, string?, CancellationToken)
Sparse-update one key in the wallet's Metadata
JSON store. Pass value: null to remove the key. Concurrent calls
targeting different keys are safe — the implementation must not clobber
keys it didn't touch.
Task SetMetadataValue(string walletId, string key, string? value, CancellationToken ct = default)
Parameters
walletIdstringkeystringvaluestringctCancellationToken
Returns
Remarks
Designed for per-wallet bookkeeping the SDK accumulates over time (sync cursors, recovery state, etc.) without requiring a schema migration per concern. Throws if the wallet doesn't exist.
UpdateDestination(string, string?, CancellationToken)
Updates the wallet's sweep destination address. Pass null to clear it.
Task UpdateDestination(string walletId, string? destination, CancellationToken ct = default)
Parameters
walletIdstringdestinationstringctCancellationToken
Returns
UpdateLastUsedIndex(string, int, CancellationToken)
Updates the HD derivation high-water mark for the wallet.
Task UpdateLastUsedIndex(string walletId, int lastUsedIndex, CancellationToken ct = default)
Parameters
walletIdstringlastUsedIndexintctCancellationToken
Returns
UpsertWallet(ArkWalletInfo, bool, CancellationToken)
Inserts or optionally updates a wallet. Returns true when a new record was created.
Task<bool> UpsertWallet(ArkWalletInfo wallet, bool updateIfExists = true, CancellationToken ct = default)
Parameters
walletArkWalletInfoupdateIfExistsboolctCancellationToken
Returns
Events
WalletDeleted
Raised after a wallet is deleted, carrying the wallet ID.
event EventHandler<string>? WalletDeleted
Event Type
WalletSaved
Raised after a wallet is created or updated.
event EventHandler<ArkWalletInfo>? WalletSaved