@unicitylabs/sphere-sdk 0.7.1-dev.3 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2094,6 +2094,20 @@ declare function signMessage(privateKeyHex: string, message: string): string;
2094
2094
  * @returns `true` if the signature is valid and matches the expected public key
2095
2095
  */
2096
2096
  declare function verifySignedMessage(message: string, signature: string, expectedPubkey: string): boolean;
2097
+ /**
2098
+ * Recover the compressed secp256k1 public key from a signed message.
2099
+ *
2100
+ * Use this when the server needs to identify the signer (not just verify
2101
+ * a signature against a known pubkey). Combined with `sphere.resolve(pubkey)`
2102
+ * it gives a fully cryptographically-attributable identity for backend auth,
2103
+ * without trusting any client-supplied identifier claim.
2104
+ *
2105
+ * @param message - The plaintext that was signed
2106
+ * @param signature - 130-char hex (v + r + s) as produced by `signMessage`
2107
+ * @returns - Compressed 66-char hex pubkey
2108
+ * @throws - On malformed signature length or out-of-range recovery byte
2109
+ */
2110
+ declare function recoverPubkeyFromSignature(message: string, signature: string): string;
2097
2111
 
2098
2112
  /**
2099
2113
  * INSTANT_SPLIT V5 Types
@@ -4623,6 +4637,42 @@ declare class PaymentsModule {
4623
4637
  * @returns MintNametagResult with success status and token if successful
4624
4638
  */
4625
4639
  mintNametag(nametag: string): Promise<MintNametagResult>;
4640
+ /**
4641
+ * Mint a fungible token directly to this wallet (genesis mint).
4642
+ *
4643
+ * Useful for test setups that need to seed a wallet with specific token
4644
+ * balances WITHOUT depending on the testnet faucet HTTP service. The
4645
+ * resulting token has the canonical CoinId bytes (passed in `coinIdHex`)
4646
+ * — when those bytes match a registered symbol in the TokenRegistry,
4647
+ * the token shows up under the symbol's name (e.g. "UCT"). There is no
4648
+ * cryptographic restriction on which key may issue a given CoinId; the
4649
+ * aggregator records the mint regardless of issuer identity.
4650
+ *
4651
+ * The flow:
4652
+ * 1. Generate a random TokenId.
4653
+ * 2. Build TokenCoinData with [(coinId, amount)].
4654
+ * 3. Build MintTransactionData with recipient = self (UnmaskedPredicate
4655
+ * from this wallet's signing service).
4656
+ * 4. Submit MintCommitment to the aggregator.
4657
+ * 5. Wait for the inclusion proof.
4658
+ * 6. Construct an SDK Token via Token.mint().
4659
+ * 7. Convert to wallet Token format and call addToken().
4660
+ *
4661
+ * @param coinIdHex - 64-char lowercase hex CoinId. Must match the bytes
4662
+ * used by the registered symbol if you want the wallet to recognize
4663
+ * the token as that symbol (e.g. UCT's coinId from the public registry).
4664
+ * @param amount - Amount in smallest units (multiply by 10^decimals
4665
+ * when converting from human values).
4666
+ * @returns Result with the resulting wallet Token and its on-chain id.
4667
+ */
4668
+ mintFungibleToken(coinIdHex: string, amount: bigint): Promise<{
4669
+ success: true;
4670
+ token: Token;
4671
+ tokenId: string;
4672
+ } | {
4673
+ success: false;
4674
+ error: string;
4675
+ }>;
4626
4676
  /**
4627
4677
  * Check if a nametag is available for minting
4628
4678
  * @param nametag - The nametag to check (e.g., "alice" or "@alice")
@@ -5115,6 +5165,24 @@ declare class AccountingModule {
5115
5165
  private dirtyLedgerEntries;
5116
5166
  /** Count of unknown (not in invoiceTermsCache) invoice IDs in the ledger. */
5117
5167
  private unknownLedgerCount;
5168
+ /**
5169
+ * Per-unknown-invoice first-seen timestamp for TTL eviction.
5170
+ *
5171
+ * W1 (steelman round-4): without TTL, an attacker who can deliver 500
5172
+ * inbound transfers with synthesized memo invoiceIds permanently exhausts
5173
+ * the unknown-ledger cap, after which legitimate orphan transfers (out-of-
5174
+ * order delivery for real swaps) are silently dropped at the cap-check.
5175
+ *
5176
+ * Round-5 perf: gated by `unknownLedgerNextSweepMs` to amortize the
5177
+ * sweep cost. The naive every-call sweep is O(N) where N=cap=500;
5178
+ * combined with the per-token cleanup loop inside the sweep it became
5179
+ * O(N×M) on every transfer under flood. Now we sweep at most every
5180
+ * `UNKNOWN_LEDGER_SWEEP_INTERVAL_MS` (60s) UNLESS the cap is currently
5181
+ * full, in which case we sweep on each call (the only path that can
5182
+ * actually drop a legitimate orphan).
5183
+ */
5184
+ private unknownLedgerFirstSeen;
5185
+ private unknownLedgerNextSweepMs;
5118
5186
  /** W17: Tracks whether tokenScanState has been mutated since last flush. */
5119
5187
  private tokenScanDirty;
5120
5188
  /** W2 fix: Serialization guard for _flushDirtyLedgerEntries. */
@@ -5299,6 +5367,21 @@ declare class AccountingModule {
5299
5367
  * @throws {SphereError} `NOT_INITIALIZED` — module not initialized.
5300
5368
  */
5301
5369
  getInvoice(invoiceId: string): InvoiceRef | null;
5370
+ /**
5371
+ * Return the set of token IDs that are currently linked to the given
5372
+ * invoice. Populated by both the on-chain `_processTokenTransactions`
5373
+ * path (tokens with `inv:` references) and the transport-memo orphan
5374
+ * buffering path in `_handleIncomingTransfer`.
5375
+ *
5376
+ * Used by callers that want to scope per-invoice operations (e.g.
5377
+ * SwapModule.verifyPayout's L3 validation) to only the tokens that
5378
+ * cover this invoice — avoiding false negatives when the wallet
5379
+ * contains unrelated tokens of the same currency in unconfirmed or
5380
+ * spent state.
5381
+ *
5382
+ * Returns an empty set if no tokens are currently linked.
5383
+ */
5384
+ getTokenIdsForInvoice(invoiceId: string): Set<string>;
5302
5385
  /**
5303
5386
  * Explicitly close an invoice. Only target parties may close (§8.3).
5304
5387
  *
@@ -5646,6 +5729,35 @@ declare class AccountingModule {
5646
5729
  * await and the null assignment, so we loop until the field is null.
5647
5730
  */
5648
5731
  private _drainFlushPromise;
5732
+ /**
5733
+ * Synchronously persist any pending provisional ledger entry for `invoiceId`
5734
+ * before returning to the caller. Used by `payInvoice` and
5735
+ * `returnInvoicePayment` to make the in-memory provisional entry durable
5736
+ * inside the same per-invoice gate that wrote it, closing the
5737
+ * crash-mid-conclude race that produces over-coverage on receivers.
5738
+ *
5739
+ * Implementation:
5740
+ * 1. Schedule a flush via the existing `_flushPromise` chain (so
5741
+ * concurrent `_handleTokenChange` callers waiting on the chain
5742
+ * observe ours as part of the sequence).
5743
+ * 2. Await OUR flush directly — NOT `_drainFlushPromise()`, which would
5744
+ * spin while concurrent token changes keep extending the chain and
5745
+ * hold the per-invoice gate for an unbounded number of additional
5746
+ * flushes. We only need OUR provisional entry durable.
5747
+ * 3. `_flushDirtyLedgerEntries` swallows per-invoice `storage.set`
5748
+ * rejections internally (sets a local `step1Failed` flag), leaving
5749
+ * the dirty entry on the set without re-throwing. So we post-check
5750
+ * `dirtyLedgerEntries.has(invoiceId)` and throw a `STORAGE_ERROR`
5751
+ * `SphereError` if our entry is still dirty — propagating to the
5752
+ * caller so they learn about the durability failure rather than
5753
+ * receiving a silent "success" return that lies on disk.
5754
+ *
5755
+ * @param invoiceId The invoice whose provisional entry must be durable.
5756
+ * @param callContext Used in the error message so the caller is named
5757
+ * ('payInvoice' / 'returnInvoicePayment') without
5758
+ * forcing a stack-trace inspection.
5759
+ */
5760
+ private _persistProvisionalAndVerify;
5649
5761
  /**
5650
5762
  * Handle an incoming transfer event from PaymentsModule (§6.2).
5651
5763
  *
@@ -8221,6 +8333,81 @@ declare const initSphere: typeof Sphere.init;
8221
8333
  declare const getSphere: typeof Sphere.getInstance;
8222
8334
  declare const sphereExists: typeof Sphere.exists;
8223
8335
 
8336
+ /**
8337
+ * Encryption utilities for SDK2
8338
+ *
8339
+ * Provides AES-256 encryption for sensitive wallet data.
8340
+ * Uses crypto-js for cross-platform compatibility.
8341
+ */
8342
+ interface EncryptedData {
8343
+ /** Encrypted ciphertext (base64) */
8344
+ ciphertext: string;
8345
+ /** Initialization vector (hex) */
8346
+ iv: string;
8347
+ /** Salt used for key derivation (hex) */
8348
+ salt: string;
8349
+ /** Algorithm identifier */
8350
+ algorithm: 'aes-256-cbc';
8351
+ /** Key derivation function */
8352
+ kdf: 'pbkdf2';
8353
+ /** Number of PBKDF2 iterations */
8354
+ iterations: number;
8355
+ }
8356
+ interface EncryptionOptions {
8357
+ /** Number of PBKDF2 iterations (default: 100000) */
8358
+ iterations?: number;
8359
+ }
8360
+ /**
8361
+ * Encrypt data with AES-256-CBC
8362
+ * @param plaintext - Data to encrypt (string or object)
8363
+ * @param password - Encryption password
8364
+ * @param options - Encryption options
8365
+ */
8366
+ declare function encrypt$1(plaintext: string | object, password: string, options?: EncryptionOptions): EncryptedData;
8367
+ /**
8368
+ * Decrypt AES-256-CBC encrypted data
8369
+ * @param encryptedData - Encrypted data object
8370
+ * @param password - Decryption password
8371
+ */
8372
+ declare function decrypt$1(encryptedData: EncryptedData, password: string): string;
8373
+ /**
8374
+ * Decrypt and parse JSON data
8375
+ * @param encryptedData - Encrypted data object
8376
+ * @param password - Decryption password
8377
+ */
8378
+ declare function decryptJson<T = unknown>(encryptedData: EncryptedData, password: string): T;
8379
+ /**
8380
+ * Simple encryption using CryptoJS built-in password-based encryption
8381
+ * Suitable for localStorage where we don't need full EncryptedData metadata
8382
+ * @param plaintext - Data to encrypt
8383
+ * @param password - Encryption password
8384
+ */
8385
+ declare function encryptSimple(plaintext: string, password: string): string;
8386
+ /**
8387
+ * Simple decryption
8388
+ * @param ciphertext - Encrypted string
8389
+ * @param password - Decryption password
8390
+ */
8391
+ declare function decryptSimple(ciphertext: string, password: string): string;
8392
+ /**
8393
+ * Decrypt data encrypted with PBKDF2-derived key (legacy JSON wallet format).
8394
+ * Compatible with webwallet's encryptWithPassword/decryptWithPassword.
8395
+ */
8396
+ declare function decryptWithSalt(ciphertext: string, password: string, salt: string): string | null;
8397
+ /**
8398
+ * Encrypt mnemonic phrase for storage
8399
+ * Uses simple AES encryption compatible with existing wallet format
8400
+ * @param mnemonic - BIP39 mnemonic phrase
8401
+ * @param password - Encryption password
8402
+ */
8403
+ declare function encryptMnemonic(mnemonic: string, password: string): string;
8404
+ /**
8405
+ * Decrypt mnemonic phrase from storage
8406
+ * @param encryptedMnemonic - Encrypted mnemonic string
8407
+ * @param password - Decryption password
8408
+ */
8409
+ declare function decryptMnemonic(encryptedMnemonic: string, password: string): string;
8410
+
8224
8411
  /**
8225
8412
  * Convert human-readable amount to smallest unit (bigint)
8226
8413
  *
@@ -9822,6 +10009,51 @@ declare function getCoinIdBySymbol(symbol: string): string | undefined;
9822
10009
  * @returns Coin ID or undefined
9823
10010
  */
9824
10011
  declare function getCoinIdByName(name: string): string | undefined;
10012
+ /**
10013
+ * Normalize a coin identifier to its canonical hash coinId.
10014
+ *
10015
+ * Accepts both symbolic names ("BTC", "ETH") and hash coinIds (64-char hex).
10016
+ * If the input is a short symbol, resolves it via the TokenRegistry.
10017
+ * Returns the input unchanged if it's already a hash coinId or unknown.
10018
+ *
10019
+ * @public
10020
+ *
10021
+ * @remarks
10022
+ * Heuristic: inputs matching `length <= 20 && /^[A-Za-z0-9]+$/` are treated
10023
+ * as symbolic names and looked up in the registry. Long inputs, hyphenated
10024
+ * inputs ("TOKEN-123"), or dotted inputs ("BTC.CASH") pass through unchanged.
10025
+ *
10026
+ * **Stability:** This function depends on `TokenRegistry` content. Adding a
10027
+ * new symbol that shadows a previously-unknown short alphanumeric coinId
10028
+ * changes normalization semantics retroactively. Consumers building stable
10029
+ * keys against this output should be aware that registry growth is a
10030
+ * non-breaking change *for unknown inputs* but a breaking change *for inputs
10031
+ * that newly resolve*.
10032
+ *
10033
+ * @param coinId - A symbolic name or hash coinId.
10034
+ * @returns The canonical hash coinId, or the original string if not resolvable.
10035
+ */
10036
+ declare function normalizeCoinId(coinId: string): string;
10037
+ /**
10038
+ * Compare two coin identifiers for equality, normalizing both sides.
10039
+ *
10040
+ * Handles mixed-format comparisons: "BTC" vs hash coinId, or two hash coinIds.
10041
+ * Both values are normalized to hash coinIds via the TokenRegistry before comparison.
10042
+ *
10043
+ * @public
10044
+ *
10045
+ * @remarks
10046
+ * Reflexive byte-equality short-circuit comes first; otherwise both sides
10047
+ * are normalized via {@link normalizeCoinId} and compared. Inherits the
10048
+ * registry-dependence caveat from `normalizeCoinId`. Two distinct symbols
10049
+ * that both fail to resolve will compare unequal even if they're semantic
10050
+ * aliases — register them as aliases in `TokenRegistry` for matching.
10051
+ *
10052
+ * @param a - First coin identifier (symbol or hash coinId).
10053
+ * @param b - Second coin identifier (symbol or hash coinId).
10054
+ * @returns true if both resolve to the same canonical coinId.
10055
+ */
10056
+ declare function coinIdsMatch(a: string, b: string): boolean;
9825
10057
 
9826
10058
  /**
9827
10059
  * Standard address parsing, validation, and normalization for Unicity addresses.
@@ -9889,4 +10121,4 @@ declare function normalizeAddress(address: string): string;
9889
10121
  */
9890
10122
  declare function addressesMatch(a: string, b: string): boolean;
9891
10123
 
9892
- export { type AddressInfo, type AddressMode, type AddressType, type AggregatorClient, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type AggregatorProviderConfig, type Asset, type BackgroundProgressStatus, type BaseProvider, type BroadcastHandler, type BroadcastMessage, type BuildSplitBundleResult, type CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, type CombinedTransferBundleV6, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_AGGREGATOR_URL, DEFAULT_DERIVATION_PATH, DEFAULT_ELECTRUM_URL, DEFAULT_GROUP_RELAYS, DEFAULT_IPFS_BOOTSTRAP_PEERS, DEFAULT_IPFS_GATEWAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, DEV_AGGREGATOR_URL, type DecryptionProgressCallback, type DerivationMode, type DirectMessage, type DirectTokenEntry, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type ExtendedValidationResult, type FullIdentity, type GetConversationPageOptions, type GetSwapsFilter, GroupChatModule, type GroupChatModuleConfig, type GroupChatModuleDependencies, type GroupData, type GroupMemberData, type GroupMessageData, GroupRole, GroupVisibility, type HealthCheckFn, type Identity, type IdentityConfig, type InclusionProof, type IncomingBroadcast, type IncomingMessage, type IncomingPaymentRequest, type IncomingTokenTransfer, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type InstantSplitBundle, type InstantSplitBundleV4, type InstantSplitBundleV5, type InstantSplitOptions, type InstantSplitProcessResult, type InstantSplitResult, type InstantSplitV5RecoveryMetadata, type IntentStatus, type IntentType, type InvalidatedNametagEntry, index as L1, type L1Balance, L1PaymentsModule, type L1PaymentsModuleConfig, type L1PaymentsModuleDependencies, type L1SendRequest, type L1SendResult, type L1Transaction, type L1Utxo, LIMITS, type LegacyFileImportOptions, type LegacyFileInfo, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LoadResult, type LogHandler, type LogLevel, type LoggerConfig, type LoggingConfig, type ManifestAuxiliary, type ManifestFields, type ManifestSignatures, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagBindingProof, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedAddress, type ParsedStorageData, type PaymentRequest, type PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler, type PaymentRequestResponseType, type PaymentRequestResult, type PaymentRequestStatus, type PaymentSession, type PaymentSessionDirection, type PaymentSessionError, type PaymentSessionErrorCode, type PaymentSessionStatus, PaymentsModule, type PaymentsModuleConfig, type PaymentsModuleDependencies, type PeerInfo, type PendingV5Finalization, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type ReceiveOptions, type ReceiveResult, type RegistryNetwork, SIGN_MESSAGE_PREFIX, STORAGE_KEYS, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SaveResult, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, type SpentTokenInfo, type SpentTokenResult, Sphere, type SphereConfig, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type SplitPaymentSession, type SplitRecoveryResult, type StorageEvent, type StorageEventCallback, type StorageEventType, type StorageProvider, type StorageProviderConfig, type SubmitResult, type SwapDeal, type SwapManifest, SwapModule, type SwapModuleConfig, type SwapProgress, type SwapProposalResult, type SwapRef, type SwapRole, type SyncResult, TEST_AGGREGATOR_URL, TEST_ELECTRUM_URL, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPrice, TokenRegistry, type TokenState, type TokenStatus, type TokenStorageProvider, type TokenTransferDetail, type TokenTransferHandler, type TokenTransferPayload, type ValidationResult as TokenValidationResult, TokenValidator, type TombstoneEntry, type TrackedAddress, type TrackedAddressEntry, type TransactionHistoryEntry, type TransferCommitment, type TransferMode, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type TransportProviderConfig, type TrustBaseLoader, type TxfAuthenticator, type TxfGenesis, type TxfGenesisData, type TxfInclusionProof, type TxfIntegrity, type TxfInvalidEntry, type TxfMerkleStep, type TxfMerkleTreePath, type TxfMeta, type TxfOutboxEntry, type TxfSentEntry, type TxfState, type TxfStorageData, type TxfStorageDataBase, type TxfToken, type TxfTombstone, type TxfTransaction, type UnconfirmedResolutionResult, type V5FinalizationStage, type ValidationAction, type ValidationIssue, type ValidationResult$1 as ValidationResult, type WaitOptions, type WalletDatInfo, type WalletInfo, type WalletJSON$1 as WalletJSON, type WalletJSONExportOptions$1 as WalletJSONExportOptions, type WalletSource, addressesMatch, archivedKeyFromTokenId, base58Decode, base58Encode, buildManifest, buildTxfStorageData, bytesToHex, checkNetworkHealth, computeSwapId, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createNametagBinding, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, createSwapModule, createTokenValidator, decodeBech32, decryptCMasterKey, decryptPrivateKey, decryptTextFormatKey, deriveAddressInfo, deriveChildKey$1 as deriveChildKey, deriveKeyAtPath$1 as deriveKeyAtPath, doubleSha256, encodeBech32, extractFromText, findPattern, forkedKeyFromTokenIdAndState, formatAmount, generateMasterKey, generateMnemonic, getAddressHrp, getAddressId, getAddressStorageKey, getCoinIdByName, getCoinIdBySymbol, getCurrentStateHash, getPublicKey, getSphere, getTokenDecimals, getTokenDefinition, getTokenIconUrl, getTokenId, getTokenName, getTokenSymbol, hasMissingNewStateHash, hasUncommittedTransactions, hasValidTxfData, hash160, hashSignMessage, hexToBytes, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isSphereError, isTextWalletEncrypted, isTokenKey, isValidAddress, isValidBech32, isValidDirectAddress, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeSdkTokenToStorage, objectToTxf, parseAddress, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, ripemd160, sha256, signMessage, signSwapManifest, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateManifest, validateMnemonic, verifyManifestIntegrity, verifyNametagBinding, verifySignedMessage, verifySwapSignature };
10124
+ export { type AddressInfo, type AddressMode, type AddressType, type AggregatorClient, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type AggregatorProviderConfig, type Asset, type BackgroundProgressStatus, type BaseProvider, type BroadcastHandler, type BroadcastMessage, type BuildSplitBundleResult, type CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, type CombinedTransferBundleV6, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, type CreateInvoiceRequest, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_AGGREGATOR_URL, DEFAULT_DERIVATION_PATH, DEFAULT_ELECTRUM_URL, DEFAULT_GROUP_RELAYS, DEFAULT_IPFS_BOOTSTRAP_PEERS, DEFAULT_IPFS_GATEWAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, DEV_AGGREGATOR_URL, type DecryptionProgressCallback, type DerivationMode, type DirectMessage, type DirectTokenEntry, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type ExtendedValidationResult, type FullIdentity, type GetConversationPageOptions, type GetInvoicesOptions, type GetSwapsFilter, GroupChatModule, type GroupChatModuleConfig, type GroupChatModuleDependencies, type GroupData, type GroupMemberData, type GroupMessageData, GroupRole, GroupVisibility, type HealthCheckFn, type Identity, type IdentityConfig, type InclusionProof, type IncomingBroadcast, type IncomingMessage, type IncomingPaymentRequest, type IncomingTokenTransfer, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type InstantSplitBundle, type InstantSplitBundleV4, type InstantSplitBundleV5, type InstantSplitOptions, type InstantSplitProcessResult, type InstantSplitResult, type InstantSplitV5RecoveryMetadata, type IntentStatus, type IntentType, type InvalidatedNametagEntry, type InvoiceRequestedAsset, index as L1, type L1Balance, L1PaymentsModule, type L1PaymentsModuleConfig, type L1PaymentsModuleDependencies, type L1SendRequest, type L1SendResult, type L1Transaction, type L1Utxo, LIMITS, type LegacyFileImportOptions, type LegacyFileInfo, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LoadResult, type LogHandler, type LogLevel, type LoggerConfig, type LoggingConfig, type ManifestAuxiliary, type ManifestFields, type ManifestSignatures, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagBindingProof, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedAddress, type ParsedStorageData, type PayInvoiceParams, type PaymentRequest, type PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler, type PaymentRequestResponseType, type PaymentRequestResult, type PaymentRequestStatus, type PaymentSession, type PaymentSessionDirection, type PaymentSessionError, type PaymentSessionErrorCode, type PaymentSessionStatus, PaymentsModule, type PaymentsModuleConfig, type PaymentsModuleDependencies, type PeerInfo, type PendingV5Finalization, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type ReceiveOptions, type ReceiveResult, type RegistryNetwork, type ReturnPaymentParams, SIGN_MESSAGE_PREFIX, STORAGE_KEYS, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SaveResult, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, type SpentTokenInfo, type SpentTokenResult, Sphere, type SphereConfig, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type SplitPaymentSession, type SplitRecoveryResult, type StorageEvent, type StorageEventCallback, type StorageEventType, type StorageProvider, type StorageProviderConfig, type SubmitResult, type SwapDeal, type SwapManifest, SwapModule, type SwapModuleConfig, type SwapProgress, type SwapProposalResult, type SwapRef, type SwapRole, type SyncResult, TEST_AGGREGATOR_URL, TEST_ELECTRUM_URL, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPrice, TokenRegistry, type TokenState, type TokenStatus, type TokenStorageProvider, type TokenTransferDetail, type TokenTransferHandler, type TokenTransferPayload, type ValidationResult as TokenValidationResult, TokenValidator, type TombstoneEntry, type TrackedAddress, type TrackedAddressEntry, type TransactionHistoryEntry, type TransferCommitment, type TransferMode, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type TransportProviderConfig, type TrustBaseLoader, type TxfAuthenticator, type TxfGenesis, type TxfGenesisData, type TxfInclusionProof, type TxfIntegrity, type TxfInvalidEntry, type TxfMerkleStep, type TxfMerkleTreePath, type TxfMeta, type TxfOutboxEntry, type TxfSentEntry, type TxfState, type TxfStorageData, type TxfStorageDataBase, type TxfToken, type TxfTombstone, type TxfTransaction, type UnconfirmedResolutionResult, type V5FinalizationStage, type ValidationAction, type ValidationIssue, type ValidationResult$1 as ValidationResult, type WaitOptions, type WalletDatInfo, type WalletInfo, type WalletJSON$1 as WalletJSON, type WalletJSONExportOptions$1 as WalletJSONExportOptions, type WalletSource, addressesMatch, archivedKeyFromTokenId, base58Decode, base58Encode, buildManifest, buildTxfStorageData, bytesToHex, checkNetworkHealth, coinIdsMatch, computeSwapId, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createNametagBinding, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, createSwapModule, createTokenValidator, decodeBech32, decrypt$1 as decrypt, decryptCMasterKey, decryptJson, decryptMnemonic, decryptPrivateKey, decryptSimple, decryptTextFormatKey, decryptWallet, decryptWithSalt, deriveAddressInfo, deriveChildKey$1 as deriveChildKey, deriveKeyAtPath$1 as deriveKeyAtPath, doubleSha256, encodeBech32, encrypt$1 as encrypt, encryptMnemonic, encryptSimple, encryptWallet, extractFromText, findPattern, forkedKeyFromTokenIdAndState, formatAmount, generateAddressFromMasterKey, generateMasterKey, generateMnemonic, generatePrivateKey, getAddressHrp, getAddressId, getAddressStorageKey, getCoinIdByName, getCoinIdBySymbol, getCurrentStateHash, getPublicKey, getSphere, getTokenDecimals, getTokenDefinition, getTokenIconUrl, getTokenId, getTokenName, getTokenSymbol, hasMissingNewStateHash, hasUncommittedTransactions, hasValidTxfData, hash160, hashSignMessage, hexToBytes, hexToWIF, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isSphereError, isTextWalletEncrypted, isTokenKey, isValidAddress, isValidBech32, isValidDirectAddress, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeCoinId, normalizeSdkTokenToStorage, objectToTxf, parseAddress, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, sha256, signMessage, signSwapManifest, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateManifest, validateMnemonic, verifyManifestIntegrity, verifyNametagBinding, verifySignedMessage, verifySwapSignature };
package/dist/index.d.ts CHANGED
@@ -2094,6 +2094,20 @@ declare function signMessage(privateKeyHex: string, message: string): string;
2094
2094
  * @returns `true` if the signature is valid and matches the expected public key
2095
2095
  */
2096
2096
  declare function verifySignedMessage(message: string, signature: string, expectedPubkey: string): boolean;
2097
+ /**
2098
+ * Recover the compressed secp256k1 public key from a signed message.
2099
+ *
2100
+ * Use this when the server needs to identify the signer (not just verify
2101
+ * a signature against a known pubkey). Combined with `sphere.resolve(pubkey)`
2102
+ * it gives a fully cryptographically-attributable identity for backend auth,
2103
+ * without trusting any client-supplied identifier claim.
2104
+ *
2105
+ * @param message - The plaintext that was signed
2106
+ * @param signature - 130-char hex (v + r + s) as produced by `signMessage`
2107
+ * @returns - Compressed 66-char hex pubkey
2108
+ * @throws - On malformed signature length or out-of-range recovery byte
2109
+ */
2110
+ declare function recoverPubkeyFromSignature(message: string, signature: string): string;
2097
2111
 
2098
2112
  /**
2099
2113
  * INSTANT_SPLIT V5 Types
@@ -4623,6 +4637,42 @@ declare class PaymentsModule {
4623
4637
  * @returns MintNametagResult with success status and token if successful
4624
4638
  */
4625
4639
  mintNametag(nametag: string): Promise<MintNametagResult>;
4640
+ /**
4641
+ * Mint a fungible token directly to this wallet (genesis mint).
4642
+ *
4643
+ * Useful for test setups that need to seed a wallet with specific token
4644
+ * balances WITHOUT depending on the testnet faucet HTTP service. The
4645
+ * resulting token has the canonical CoinId bytes (passed in `coinIdHex`)
4646
+ * — when those bytes match a registered symbol in the TokenRegistry,
4647
+ * the token shows up under the symbol's name (e.g. "UCT"). There is no
4648
+ * cryptographic restriction on which key may issue a given CoinId; the
4649
+ * aggregator records the mint regardless of issuer identity.
4650
+ *
4651
+ * The flow:
4652
+ * 1. Generate a random TokenId.
4653
+ * 2. Build TokenCoinData with [(coinId, amount)].
4654
+ * 3. Build MintTransactionData with recipient = self (UnmaskedPredicate
4655
+ * from this wallet's signing service).
4656
+ * 4. Submit MintCommitment to the aggregator.
4657
+ * 5. Wait for the inclusion proof.
4658
+ * 6. Construct an SDK Token via Token.mint().
4659
+ * 7. Convert to wallet Token format and call addToken().
4660
+ *
4661
+ * @param coinIdHex - 64-char lowercase hex CoinId. Must match the bytes
4662
+ * used by the registered symbol if you want the wallet to recognize
4663
+ * the token as that symbol (e.g. UCT's coinId from the public registry).
4664
+ * @param amount - Amount in smallest units (multiply by 10^decimals
4665
+ * when converting from human values).
4666
+ * @returns Result with the resulting wallet Token and its on-chain id.
4667
+ */
4668
+ mintFungibleToken(coinIdHex: string, amount: bigint): Promise<{
4669
+ success: true;
4670
+ token: Token;
4671
+ tokenId: string;
4672
+ } | {
4673
+ success: false;
4674
+ error: string;
4675
+ }>;
4626
4676
  /**
4627
4677
  * Check if a nametag is available for minting
4628
4678
  * @param nametag - The nametag to check (e.g., "alice" or "@alice")
@@ -5115,6 +5165,24 @@ declare class AccountingModule {
5115
5165
  private dirtyLedgerEntries;
5116
5166
  /** Count of unknown (not in invoiceTermsCache) invoice IDs in the ledger. */
5117
5167
  private unknownLedgerCount;
5168
+ /**
5169
+ * Per-unknown-invoice first-seen timestamp for TTL eviction.
5170
+ *
5171
+ * W1 (steelman round-4): without TTL, an attacker who can deliver 500
5172
+ * inbound transfers with synthesized memo invoiceIds permanently exhausts
5173
+ * the unknown-ledger cap, after which legitimate orphan transfers (out-of-
5174
+ * order delivery for real swaps) are silently dropped at the cap-check.
5175
+ *
5176
+ * Round-5 perf: gated by `unknownLedgerNextSweepMs` to amortize the
5177
+ * sweep cost. The naive every-call sweep is O(N) where N=cap=500;
5178
+ * combined with the per-token cleanup loop inside the sweep it became
5179
+ * O(N×M) on every transfer under flood. Now we sweep at most every
5180
+ * `UNKNOWN_LEDGER_SWEEP_INTERVAL_MS` (60s) UNLESS the cap is currently
5181
+ * full, in which case we sweep on each call (the only path that can
5182
+ * actually drop a legitimate orphan).
5183
+ */
5184
+ private unknownLedgerFirstSeen;
5185
+ private unknownLedgerNextSweepMs;
5118
5186
  /** W17: Tracks whether tokenScanState has been mutated since last flush. */
5119
5187
  private tokenScanDirty;
5120
5188
  /** W2 fix: Serialization guard for _flushDirtyLedgerEntries. */
@@ -5299,6 +5367,21 @@ declare class AccountingModule {
5299
5367
  * @throws {SphereError} `NOT_INITIALIZED` — module not initialized.
5300
5368
  */
5301
5369
  getInvoice(invoiceId: string): InvoiceRef | null;
5370
+ /**
5371
+ * Return the set of token IDs that are currently linked to the given
5372
+ * invoice. Populated by both the on-chain `_processTokenTransactions`
5373
+ * path (tokens with `inv:` references) and the transport-memo orphan
5374
+ * buffering path in `_handleIncomingTransfer`.
5375
+ *
5376
+ * Used by callers that want to scope per-invoice operations (e.g.
5377
+ * SwapModule.verifyPayout's L3 validation) to only the tokens that
5378
+ * cover this invoice — avoiding false negatives when the wallet
5379
+ * contains unrelated tokens of the same currency in unconfirmed or
5380
+ * spent state.
5381
+ *
5382
+ * Returns an empty set if no tokens are currently linked.
5383
+ */
5384
+ getTokenIdsForInvoice(invoiceId: string): Set<string>;
5302
5385
  /**
5303
5386
  * Explicitly close an invoice. Only target parties may close (§8.3).
5304
5387
  *
@@ -5646,6 +5729,35 @@ declare class AccountingModule {
5646
5729
  * await and the null assignment, so we loop until the field is null.
5647
5730
  */
5648
5731
  private _drainFlushPromise;
5732
+ /**
5733
+ * Synchronously persist any pending provisional ledger entry for `invoiceId`
5734
+ * before returning to the caller. Used by `payInvoice` and
5735
+ * `returnInvoicePayment` to make the in-memory provisional entry durable
5736
+ * inside the same per-invoice gate that wrote it, closing the
5737
+ * crash-mid-conclude race that produces over-coverage on receivers.
5738
+ *
5739
+ * Implementation:
5740
+ * 1. Schedule a flush via the existing `_flushPromise` chain (so
5741
+ * concurrent `_handleTokenChange` callers waiting on the chain
5742
+ * observe ours as part of the sequence).
5743
+ * 2. Await OUR flush directly — NOT `_drainFlushPromise()`, which would
5744
+ * spin while concurrent token changes keep extending the chain and
5745
+ * hold the per-invoice gate for an unbounded number of additional
5746
+ * flushes. We only need OUR provisional entry durable.
5747
+ * 3. `_flushDirtyLedgerEntries` swallows per-invoice `storage.set`
5748
+ * rejections internally (sets a local `step1Failed` flag), leaving
5749
+ * the dirty entry on the set without re-throwing. So we post-check
5750
+ * `dirtyLedgerEntries.has(invoiceId)` and throw a `STORAGE_ERROR`
5751
+ * `SphereError` if our entry is still dirty — propagating to the
5752
+ * caller so they learn about the durability failure rather than
5753
+ * receiving a silent "success" return that lies on disk.
5754
+ *
5755
+ * @param invoiceId The invoice whose provisional entry must be durable.
5756
+ * @param callContext Used in the error message so the caller is named
5757
+ * ('payInvoice' / 'returnInvoicePayment') without
5758
+ * forcing a stack-trace inspection.
5759
+ */
5760
+ private _persistProvisionalAndVerify;
5649
5761
  /**
5650
5762
  * Handle an incoming transfer event from PaymentsModule (§6.2).
5651
5763
  *
@@ -8221,6 +8333,81 @@ declare const initSphere: typeof Sphere.init;
8221
8333
  declare const getSphere: typeof Sphere.getInstance;
8222
8334
  declare const sphereExists: typeof Sphere.exists;
8223
8335
 
8336
+ /**
8337
+ * Encryption utilities for SDK2
8338
+ *
8339
+ * Provides AES-256 encryption for sensitive wallet data.
8340
+ * Uses crypto-js for cross-platform compatibility.
8341
+ */
8342
+ interface EncryptedData {
8343
+ /** Encrypted ciphertext (base64) */
8344
+ ciphertext: string;
8345
+ /** Initialization vector (hex) */
8346
+ iv: string;
8347
+ /** Salt used for key derivation (hex) */
8348
+ salt: string;
8349
+ /** Algorithm identifier */
8350
+ algorithm: 'aes-256-cbc';
8351
+ /** Key derivation function */
8352
+ kdf: 'pbkdf2';
8353
+ /** Number of PBKDF2 iterations */
8354
+ iterations: number;
8355
+ }
8356
+ interface EncryptionOptions {
8357
+ /** Number of PBKDF2 iterations (default: 100000) */
8358
+ iterations?: number;
8359
+ }
8360
+ /**
8361
+ * Encrypt data with AES-256-CBC
8362
+ * @param plaintext - Data to encrypt (string or object)
8363
+ * @param password - Encryption password
8364
+ * @param options - Encryption options
8365
+ */
8366
+ declare function encrypt$1(plaintext: string | object, password: string, options?: EncryptionOptions): EncryptedData;
8367
+ /**
8368
+ * Decrypt AES-256-CBC encrypted data
8369
+ * @param encryptedData - Encrypted data object
8370
+ * @param password - Decryption password
8371
+ */
8372
+ declare function decrypt$1(encryptedData: EncryptedData, password: string): string;
8373
+ /**
8374
+ * Decrypt and parse JSON data
8375
+ * @param encryptedData - Encrypted data object
8376
+ * @param password - Decryption password
8377
+ */
8378
+ declare function decryptJson<T = unknown>(encryptedData: EncryptedData, password: string): T;
8379
+ /**
8380
+ * Simple encryption using CryptoJS built-in password-based encryption
8381
+ * Suitable for localStorage where we don't need full EncryptedData metadata
8382
+ * @param plaintext - Data to encrypt
8383
+ * @param password - Encryption password
8384
+ */
8385
+ declare function encryptSimple(plaintext: string, password: string): string;
8386
+ /**
8387
+ * Simple decryption
8388
+ * @param ciphertext - Encrypted string
8389
+ * @param password - Decryption password
8390
+ */
8391
+ declare function decryptSimple(ciphertext: string, password: string): string;
8392
+ /**
8393
+ * Decrypt data encrypted with PBKDF2-derived key (legacy JSON wallet format).
8394
+ * Compatible with webwallet's encryptWithPassword/decryptWithPassword.
8395
+ */
8396
+ declare function decryptWithSalt(ciphertext: string, password: string, salt: string): string | null;
8397
+ /**
8398
+ * Encrypt mnemonic phrase for storage
8399
+ * Uses simple AES encryption compatible with existing wallet format
8400
+ * @param mnemonic - BIP39 mnemonic phrase
8401
+ * @param password - Encryption password
8402
+ */
8403
+ declare function encryptMnemonic(mnemonic: string, password: string): string;
8404
+ /**
8405
+ * Decrypt mnemonic phrase from storage
8406
+ * @param encryptedMnemonic - Encrypted mnemonic string
8407
+ * @param password - Decryption password
8408
+ */
8409
+ declare function decryptMnemonic(encryptedMnemonic: string, password: string): string;
8410
+
8224
8411
  /**
8225
8412
  * Convert human-readable amount to smallest unit (bigint)
8226
8413
  *
@@ -9822,6 +10009,51 @@ declare function getCoinIdBySymbol(symbol: string): string | undefined;
9822
10009
  * @returns Coin ID or undefined
9823
10010
  */
9824
10011
  declare function getCoinIdByName(name: string): string | undefined;
10012
+ /**
10013
+ * Normalize a coin identifier to its canonical hash coinId.
10014
+ *
10015
+ * Accepts both symbolic names ("BTC", "ETH") and hash coinIds (64-char hex).
10016
+ * If the input is a short symbol, resolves it via the TokenRegistry.
10017
+ * Returns the input unchanged if it's already a hash coinId or unknown.
10018
+ *
10019
+ * @public
10020
+ *
10021
+ * @remarks
10022
+ * Heuristic: inputs matching `length <= 20 && /^[A-Za-z0-9]+$/` are treated
10023
+ * as symbolic names and looked up in the registry. Long inputs, hyphenated
10024
+ * inputs ("TOKEN-123"), or dotted inputs ("BTC.CASH") pass through unchanged.
10025
+ *
10026
+ * **Stability:** This function depends on `TokenRegistry` content. Adding a
10027
+ * new symbol that shadows a previously-unknown short alphanumeric coinId
10028
+ * changes normalization semantics retroactively. Consumers building stable
10029
+ * keys against this output should be aware that registry growth is a
10030
+ * non-breaking change *for unknown inputs* but a breaking change *for inputs
10031
+ * that newly resolve*.
10032
+ *
10033
+ * @param coinId - A symbolic name or hash coinId.
10034
+ * @returns The canonical hash coinId, or the original string if not resolvable.
10035
+ */
10036
+ declare function normalizeCoinId(coinId: string): string;
10037
+ /**
10038
+ * Compare two coin identifiers for equality, normalizing both sides.
10039
+ *
10040
+ * Handles mixed-format comparisons: "BTC" vs hash coinId, or two hash coinIds.
10041
+ * Both values are normalized to hash coinIds via the TokenRegistry before comparison.
10042
+ *
10043
+ * @public
10044
+ *
10045
+ * @remarks
10046
+ * Reflexive byte-equality short-circuit comes first; otherwise both sides
10047
+ * are normalized via {@link normalizeCoinId} and compared. Inherits the
10048
+ * registry-dependence caveat from `normalizeCoinId`. Two distinct symbols
10049
+ * that both fail to resolve will compare unequal even if they're semantic
10050
+ * aliases — register them as aliases in `TokenRegistry` for matching.
10051
+ *
10052
+ * @param a - First coin identifier (symbol or hash coinId).
10053
+ * @param b - Second coin identifier (symbol or hash coinId).
10054
+ * @returns true if both resolve to the same canonical coinId.
10055
+ */
10056
+ declare function coinIdsMatch(a: string, b: string): boolean;
9825
10057
 
9826
10058
  /**
9827
10059
  * Standard address parsing, validation, and normalization for Unicity addresses.
@@ -9889,4 +10121,4 @@ declare function normalizeAddress(address: string): string;
9889
10121
  */
9890
10122
  declare function addressesMatch(a: string, b: string): boolean;
9891
10123
 
9892
- export { type AddressInfo, type AddressMode, type AddressType, type AggregatorClient, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type AggregatorProviderConfig, type Asset, type BackgroundProgressStatus, type BaseProvider, type BroadcastHandler, type BroadcastMessage, type BuildSplitBundleResult, type CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, type CombinedTransferBundleV6, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_AGGREGATOR_URL, DEFAULT_DERIVATION_PATH, DEFAULT_ELECTRUM_URL, DEFAULT_GROUP_RELAYS, DEFAULT_IPFS_BOOTSTRAP_PEERS, DEFAULT_IPFS_GATEWAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, DEV_AGGREGATOR_URL, type DecryptionProgressCallback, type DerivationMode, type DirectMessage, type DirectTokenEntry, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type ExtendedValidationResult, type FullIdentity, type GetConversationPageOptions, type GetSwapsFilter, GroupChatModule, type GroupChatModuleConfig, type GroupChatModuleDependencies, type GroupData, type GroupMemberData, type GroupMessageData, GroupRole, GroupVisibility, type HealthCheckFn, type Identity, type IdentityConfig, type InclusionProof, type IncomingBroadcast, type IncomingMessage, type IncomingPaymentRequest, type IncomingTokenTransfer, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type InstantSplitBundle, type InstantSplitBundleV4, type InstantSplitBundleV5, type InstantSplitOptions, type InstantSplitProcessResult, type InstantSplitResult, type InstantSplitV5RecoveryMetadata, type IntentStatus, type IntentType, type InvalidatedNametagEntry, index as L1, type L1Balance, L1PaymentsModule, type L1PaymentsModuleConfig, type L1PaymentsModuleDependencies, type L1SendRequest, type L1SendResult, type L1Transaction, type L1Utxo, LIMITS, type LegacyFileImportOptions, type LegacyFileInfo, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LoadResult, type LogHandler, type LogLevel, type LoggerConfig, type LoggingConfig, type ManifestAuxiliary, type ManifestFields, type ManifestSignatures, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagBindingProof, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedAddress, type ParsedStorageData, type PaymentRequest, type PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler, type PaymentRequestResponseType, type PaymentRequestResult, type PaymentRequestStatus, type PaymentSession, type PaymentSessionDirection, type PaymentSessionError, type PaymentSessionErrorCode, type PaymentSessionStatus, PaymentsModule, type PaymentsModuleConfig, type PaymentsModuleDependencies, type PeerInfo, type PendingV5Finalization, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type ReceiveOptions, type ReceiveResult, type RegistryNetwork, SIGN_MESSAGE_PREFIX, STORAGE_KEYS, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SaveResult, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, type SpentTokenInfo, type SpentTokenResult, Sphere, type SphereConfig, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type SplitPaymentSession, type SplitRecoveryResult, type StorageEvent, type StorageEventCallback, type StorageEventType, type StorageProvider, type StorageProviderConfig, type SubmitResult, type SwapDeal, type SwapManifest, SwapModule, type SwapModuleConfig, type SwapProgress, type SwapProposalResult, type SwapRef, type SwapRole, type SyncResult, TEST_AGGREGATOR_URL, TEST_ELECTRUM_URL, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPrice, TokenRegistry, type TokenState, type TokenStatus, type TokenStorageProvider, type TokenTransferDetail, type TokenTransferHandler, type TokenTransferPayload, type ValidationResult as TokenValidationResult, TokenValidator, type TombstoneEntry, type TrackedAddress, type TrackedAddressEntry, type TransactionHistoryEntry, type TransferCommitment, type TransferMode, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type TransportProviderConfig, type TrustBaseLoader, type TxfAuthenticator, type TxfGenesis, type TxfGenesisData, type TxfInclusionProof, type TxfIntegrity, type TxfInvalidEntry, type TxfMerkleStep, type TxfMerkleTreePath, type TxfMeta, type TxfOutboxEntry, type TxfSentEntry, type TxfState, type TxfStorageData, type TxfStorageDataBase, type TxfToken, type TxfTombstone, type TxfTransaction, type UnconfirmedResolutionResult, type V5FinalizationStage, type ValidationAction, type ValidationIssue, type ValidationResult$1 as ValidationResult, type WaitOptions, type WalletDatInfo, type WalletInfo, type WalletJSON$1 as WalletJSON, type WalletJSONExportOptions$1 as WalletJSONExportOptions, type WalletSource, addressesMatch, archivedKeyFromTokenId, base58Decode, base58Encode, buildManifest, buildTxfStorageData, bytesToHex, checkNetworkHealth, computeSwapId, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createNametagBinding, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, createSwapModule, createTokenValidator, decodeBech32, decryptCMasterKey, decryptPrivateKey, decryptTextFormatKey, deriveAddressInfo, deriveChildKey$1 as deriveChildKey, deriveKeyAtPath$1 as deriveKeyAtPath, doubleSha256, encodeBech32, extractFromText, findPattern, forkedKeyFromTokenIdAndState, formatAmount, generateMasterKey, generateMnemonic, getAddressHrp, getAddressId, getAddressStorageKey, getCoinIdByName, getCoinIdBySymbol, getCurrentStateHash, getPublicKey, getSphere, getTokenDecimals, getTokenDefinition, getTokenIconUrl, getTokenId, getTokenName, getTokenSymbol, hasMissingNewStateHash, hasUncommittedTransactions, hasValidTxfData, hash160, hashSignMessage, hexToBytes, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isSphereError, isTextWalletEncrypted, isTokenKey, isValidAddress, isValidBech32, isValidDirectAddress, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeSdkTokenToStorage, objectToTxf, parseAddress, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, ripemd160, sha256, signMessage, signSwapManifest, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateManifest, validateMnemonic, verifyManifestIntegrity, verifyNametagBinding, verifySignedMessage, verifySwapSignature };
10124
+ export { type AddressInfo, type AddressMode, type AddressType, type AggregatorClient, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type AggregatorProviderConfig, type Asset, type BackgroundProgressStatus, type BaseProvider, type BroadcastHandler, type BroadcastMessage, type BuildSplitBundleResult, type CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, type CombinedTransferBundleV6, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, type CreateInvoiceRequest, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_AGGREGATOR_URL, DEFAULT_DERIVATION_PATH, DEFAULT_ELECTRUM_URL, DEFAULT_GROUP_RELAYS, DEFAULT_IPFS_BOOTSTRAP_PEERS, DEFAULT_IPFS_GATEWAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, DEV_AGGREGATOR_URL, type DecryptionProgressCallback, type DerivationMode, type DirectMessage, type DirectTokenEntry, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type ExtendedValidationResult, type FullIdentity, type GetConversationPageOptions, type GetInvoicesOptions, type GetSwapsFilter, GroupChatModule, type GroupChatModuleConfig, type GroupChatModuleDependencies, type GroupData, type GroupMemberData, type GroupMessageData, GroupRole, GroupVisibility, type HealthCheckFn, type Identity, type IdentityConfig, type InclusionProof, type IncomingBroadcast, type IncomingMessage, type IncomingPaymentRequest, type IncomingTokenTransfer, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type InstantSplitBundle, type InstantSplitBundleV4, type InstantSplitBundleV5, type InstantSplitOptions, type InstantSplitProcessResult, type InstantSplitResult, type InstantSplitV5RecoveryMetadata, type IntentStatus, type IntentType, type InvalidatedNametagEntry, type InvoiceRequestedAsset, index as L1, type L1Balance, L1PaymentsModule, type L1PaymentsModuleConfig, type L1PaymentsModuleDependencies, type L1SendRequest, type L1SendResult, type L1Transaction, type L1Utxo, LIMITS, type LegacyFileImportOptions, type LegacyFileInfo, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LoadResult, type LogHandler, type LogLevel, type LoggerConfig, type LoggingConfig, type ManifestAuxiliary, type ManifestFields, type ManifestSignatures, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagBindingProof, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedAddress, type ParsedStorageData, type PayInvoiceParams, type PaymentRequest, type PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler, type PaymentRequestResponseType, type PaymentRequestResult, type PaymentRequestStatus, type PaymentSession, type PaymentSessionDirection, type PaymentSessionError, type PaymentSessionErrorCode, type PaymentSessionStatus, PaymentsModule, type PaymentsModuleConfig, type PaymentsModuleDependencies, type PeerInfo, type PendingV5Finalization, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type ReceiveOptions, type ReceiveResult, type RegistryNetwork, type ReturnPaymentParams, SIGN_MESSAGE_PREFIX, STORAGE_KEYS, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SaveResult, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, type SpentTokenInfo, type SpentTokenResult, Sphere, type SphereConfig, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type SplitPaymentSession, type SplitRecoveryResult, type StorageEvent, type StorageEventCallback, type StorageEventType, type StorageProvider, type StorageProviderConfig, type SubmitResult, type SwapDeal, type SwapManifest, SwapModule, type SwapModuleConfig, type SwapProgress, type SwapProposalResult, type SwapRef, type SwapRole, type SyncResult, TEST_AGGREGATOR_URL, TEST_ELECTRUM_URL, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPrice, TokenRegistry, type TokenState, type TokenStatus, type TokenStorageProvider, type TokenTransferDetail, type TokenTransferHandler, type TokenTransferPayload, type ValidationResult as TokenValidationResult, TokenValidator, type TombstoneEntry, type TrackedAddress, type TrackedAddressEntry, type TransactionHistoryEntry, type TransferCommitment, type TransferMode, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type TransportProviderConfig, type TrustBaseLoader, type TxfAuthenticator, type TxfGenesis, type TxfGenesisData, type TxfInclusionProof, type TxfIntegrity, type TxfInvalidEntry, type TxfMerkleStep, type TxfMerkleTreePath, type TxfMeta, type TxfOutboxEntry, type TxfSentEntry, type TxfState, type TxfStorageData, type TxfStorageDataBase, type TxfToken, type TxfTombstone, type TxfTransaction, type UnconfirmedResolutionResult, type V5FinalizationStage, type ValidationAction, type ValidationIssue, type ValidationResult$1 as ValidationResult, type WaitOptions, type WalletDatInfo, type WalletInfo, type WalletJSON$1 as WalletJSON, type WalletJSONExportOptions$1 as WalletJSONExportOptions, type WalletSource, addressesMatch, archivedKeyFromTokenId, base58Decode, base58Encode, buildManifest, buildTxfStorageData, bytesToHex, checkNetworkHealth, coinIdsMatch, computeSwapId, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createNametagBinding, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, createSwapModule, createTokenValidator, decodeBech32, decrypt$1 as decrypt, decryptCMasterKey, decryptJson, decryptMnemonic, decryptPrivateKey, decryptSimple, decryptTextFormatKey, decryptWallet, decryptWithSalt, deriveAddressInfo, deriveChildKey$1 as deriveChildKey, deriveKeyAtPath$1 as deriveKeyAtPath, doubleSha256, encodeBech32, encrypt$1 as encrypt, encryptMnemonic, encryptSimple, encryptWallet, extractFromText, findPattern, forkedKeyFromTokenIdAndState, formatAmount, generateAddressFromMasterKey, generateMasterKey, generateMnemonic, generatePrivateKey, getAddressHrp, getAddressId, getAddressStorageKey, getCoinIdByName, getCoinIdBySymbol, getCurrentStateHash, getPublicKey, getSphere, getTokenDecimals, getTokenDefinition, getTokenIconUrl, getTokenId, getTokenName, getTokenSymbol, hasMissingNewStateHash, hasUncommittedTransactions, hasValidTxfData, hash160, hashSignMessage, hexToBytes, hexToWIF, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isSphereError, isTextWalletEncrypted, isTokenKey, isValidAddress, isValidBech32, isValidDirectAddress, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeCoinId, normalizeSdkTokenToStorage, objectToTxf, parseAddress, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, sha256, signMessage, signSwapManifest, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateManifest, validateMnemonic, verifyManifestIntegrity, verifyNametagBinding, verifySignedMessage, verifySwapSignature };