@unicitylabs/sphere-sdk 0.5.3 → 0.5.5

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.
Files changed (50) hide show
  1. package/README.md +2 -0
  2. package/dist/connect/index.cjs +145 -23
  3. package/dist/connect/index.cjs.map +1 -1
  4. package/dist/connect/index.d.cts +15 -2
  5. package/dist/connect/index.d.ts +15 -2
  6. package/dist/connect/index.js +145 -23
  7. package/dist/connect/index.js.map +1 -1
  8. package/dist/core/index.cjs +670 -473
  9. package/dist/core/index.cjs.map +1 -1
  10. package/dist/core/index.d.cts +123 -2
  11. package/dist/core/index.d.ts +123 -2
  12. package/dist/core/index.js +667 -473
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/impl/browser/connect/index.cjs +119 -1
  15. package/dist/impl/browser/connect/index.cjs.map +1 -1
  16. package/dist/impl/browser/connect/index.d.cts +53 -1
  17. package/dist/impl/browser/connect/index.d.ts +53 -1
  18. package/dist/impl/browser/connect/index.js +119 -1
  19. package/dist/impl/browser/connect/index.js.map +1 -1
  20. package/dist/impl/browser/index.cjs +306 -193
  21. package/dist/impl/browser/index.cjs.map +1 -1
  22. package/dist/impl/browser/index.js +306 -193
  23. package/dist/impl/browser/index.js.map +1 -1
  24. package/dist/impl/browser/ipfs.cjs +134 -19
  25. package/dist/impl/browser/ipfs.cjs.map +1 -1
  26. package/dist/impl/browser/ipfs.js +134 -19
  27. package/dist/impl/browser/ipfs.js.map +1 -1
  28. package/dist/impl/nodejs/connect/index.cjs +101 -6
  29. package/dist/impl/nodejs/connect/index.cjs.map +1 -1
  30. package/dist/impl/nodejs/connect/index.d.cts +2 -0
  31. package/dist/impl/nodejs/connect/index.d.ts +2 -0
  32. package/dist/impl/nodejs/connect/index.js +101 -6
  33. package/dist/impl/nodejs/connect/index.js.map +1 -1
  34. package/dist/impl/nodejs/index.cjs +267 -152
  35. package/dist/impl/nodejs/index.cjs.map +1 -1
  36. package/dist/impl/nodejs/index.d.cts +2 -1
  37. package/dist/impl/nodejs/index.d.ts +2 -1
  38. package/dist/impl/nodejs/index.js +267 -152
  39. package/dist/impl/nodejs/index.js.map +1 -1
  40. package/dist/index.cjs +682 -493
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +124 -8
  43. package/dist/index.d.ts +124 -8
  44. package/dist/index.js +680 -493
  45. package/dist/index.js.map +1 -1
  46. package/dist/l1/index.cjs +139 -32
  47. package/dist/l1/index.cjs.map +1 -1
  48. package/dist/l1/index.js +139 -32
  49. package/dist/l1/index.js.map +1 -1
  50. package/package.json +1 -16
package/dist/index.d.cts CHANGED
@@ -69,6 +69,42 @@ interface CreateGroupOptions {
69
69
  visibility?: GroupVisibility;
70
70
  }
71
71
 
72
+ /**
73
+ * SDK Error Types
74
+ *
75
+ * Structured error codes for programmatic error handling in UI.
76
+ * UI can switch on error.code to show appropriate user-facing messages.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * import { SphereError } from '@unicitylabs/sphere-sdk';
81
+ *
82
+ * try {
83
+ * await sphere.payments.send({ ... });
84
+ * } catch (err) {
85
+ * if (err instanceof SphereError) {
86
+ * switch (err.code) {
87
+ * case 'INSUFFICIENT_BALANCE': showToast('Not enough funds'); break;
88
+ * case 'INVALID_RECIPIENT': showToast('Recipient not found'); break;
89
+ * case 'TRANSPORT_ERROR': showToast('Network connection issue'); break;
90
+ * case 'TIMEOUT': showToast('Request timed out, try again'); break;
91
+ * default: showToast(err.message);
92
+ * }
93
+ * }
94
+ * }
95
+ * ```
96
+ */
97
+ type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE';
98
+ declare class SphereError extends Error {
99
+ readonly code: SphereErrorCode;
100
+ readonly cause?: unknown;
101
+ constructor(message: string, code: SphereErrorCode, cause?: unknown);
102
+ }
103
+ /**
104
+ * Type guard to check if an error is a SphereError
105
+ */
106
+ declare function isSphereError(err: unknown): err is SphereError;
107
+
72
108
  /**
73
109
  * Cryptographic utilities for SDK2
74
110
  *
@@ -1374,12 +1410,7 @@ interface LoggingConfig {
1374
1410
  level: 'debug' | 'info' | 'warn' | 'error' | 'silent';
1375
1411
  logger?: (level: string, message: string, data?: unknown) => void;
1376
1412
  }
1377
- type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT';
1378
- declare class SphereError extends Error {
1379
- readonly code: SphereErrorCode;
1380
- readonly cause?: unknown;
1381
- constructor(message: string, code: SphereErrorCode, cause?: unknown);
1382
- }
1413
+
1383
1414
  /**
1384
1415
  * Derivation mode determines how child keys are derived:
1385
1416
  * - "bip32": Standard BIP32 with chain code (IL + parentKey) mod n
@@ -2665,7 +2696,6 @@ declare class PaymentsModule {
2665
2696
  getConfig(): Omit<Required<PaymentsModuleConfig>, 'l1'>;
2666
2697
  /** Price provider (optional) */
2667
2698
  private priceProvider;
2668
- private log;
2669
2699
  /**
2670
2700
  * Initialize module with dependencies
2671
2701
  */
@@ -4357,6 +4387,8 @@ interface SphereCreateOptions {
4357
4387
  * - false/undefined: no auto-discovery (default)
4358
4388
  */
4359
4389
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4390
+ /** Enable debug logging (default: false) */
4391
+ debug?: boolean;
4360
4392
  /** Optional callback to report initialization progress steps */
4361
4393
  onProgress?: InitProgressCallback;
4362
4394
  }
@@ -4393,6 +4425,8 @@ interface SphereLoadOptions {
4393
4425
  * - false/undefined: no auto-discovery (default)
4394
4426
  */
4395
4427
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4428
+ /** Enable debug logging (default: false) */
4429
+ debug?: boolean;
4396
4430
  /** Optional callback to report initialization progress steps */
4397
4431
  onProgress?: InitProgressCallback;
4398
4432
  }
@@ -4437,6 +4471,8 @@ interface SphereImportOptions {
4437
4471
  * - false/undefined: no auto-discovery (default)
4438
4472
  */
4439
4473
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4474
+ /** Enable debug logging (default: false) */
4475
+ debug?: boolean;
4440
4476
  /** Optional callback to report initialization progress steps */
4441
4477
  onProgress?: InitProgressCallback;
4442
4478
  }
@@ -4496,6 +4532,8 @@ interface SphereInitOptions {
4496
4532
  * - false/undefined: no auto-discovery (default)
4497
4533
  */
4498
4534
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4535
+ /** Enable debug logging (default: false) */
4536
+ debug?: boolean;
4499
4537
  /** Optional callback to report initialization progress steps */
4500
4538
  onProgress?: InitProgressCallback;
4501
4539
  }
@@ -5376,6 +5414,84 @@ declare function randomHex(byteLength: number): string;
5376
5414
  */
5377
5415
  declare function randomUUID(): string;
5378
5416
 
5417
+ /**
5418
+ * Centralized SDK Logger
5419
+ *
5420
+ * A lightweight singleton logger that works across all tsup bundles
5421
+ * by storing state on globalThis. Supports three log levels:
5422
+ * - debug: detailed messages (only shown when debug=true)
5423
+ * - warn: important warnings (ALWAYS shown regardless of debug flag)
5424
+ * - error: critical errors (ALWAYS shown regardless of debug flag)
5425
+ *
5426
+ * Global debug flag enables all logging. Per-tag overrides allow
5427
+ * granular control (e.g., only transport debug).
5428
+ *
5429
+ * @example
5430
+ * ```ts
5431
+ * import { logger } from '@unicitylabs/sphere-sdk';
5432
+ *
5433
+ * // Enable all debug logging
5434
+ * logger.configure({ debug: true });
5435
+ *
5436
+ * // Enable only specific tags
5437
+ * logger.setTagDebug('Nostr', true);
5438
+ *
5439
+ * // Usage in SDK classes
5440
+ * logger.debug('Payments', 'Transfer started', { amount, recipient });
5441
+ * logger.warn('Nostr', 'queryEvents timed out after 5s');
5442
+ * logger.error('Sphere', 'Critical failure', error);
5443
+ * ```
5444
+ */
5445
+ type LogLevel = 'debug' | 'warn' | 'error';
5446
+ type LogHandler = (level: LogLevel, tag: string, message: string, ...args: unknown[]) => void;
5447
+ interface LoggerConfig {
5448
+ /** Enable debug logging globally (default: false). When false, only warn and error messages are shown. */
5449
+ debug?: boolean;
5450
+ /** Custom log handler. If provided, replaces console output. Useful for tests or custom log sinks. */
5451
+ handler?: LogHandler | null;
5452
+ }
5453
+ declare const logger: {
5454
+ /**
5455
+ * Configure the logger. Can be called multiple times (last write wins).
5456
+ * Typically called by createBrowserProviders(), createNodeProviders(), or Sphere.init().
5457
+ */
5458
+ configure(config: LoggerConfig): void;
5459
+ /**
5460
+ * Enable/disable debug logging for a specific tag.
5461
+ * Per-tag setting overrides the global debug flag.
5462
+ *
5463
+ * @example
5464
+ * ```ts
5465
+ * logger.setTagDebug('Nostr', true); // enable only Nostr logs
5466
+ * logger.setTagDebug('Nostr', false); // disable Nostr logs even if global debug=true
5467
+ * ```
5468
+ */
5469
+ setTagDebug(tag: string, enabled: boolean): void;
5470
+ /**
5471
+ * Clear per-tag override, falling back to global debug flag.
5472
+ */
5473
+ clearTagDebug(tag: string): void;
5474
+ /** Returns true if debug mode is enabled for the given tag (or globally). */
5475
+ isDebugEnabled(tag?: string): boolean;
5476
+ /**
5477
+ * Debug-level log. Only shown when debug is enabled (globally or for this tag).
5478
+ * Use for detailed operational information.
5479
+ */
5480
+ debug(tag: string, message: string, ...args: unknown[]): void;
5481
+ /**
5482
+ * Warning-level log. ALWAYS shown regardless of debug flag.
5483
+ * Use for important but non-critical issues (timeouts, retries, degraded state).
5484
+ */
5485
+ warn(tag: string, message: string, ...args: unknown[]): void;
5486
+ /**
5487
+ * Error-level log. ALWAYS shown regardless of debug flag.
5488
+ * Use for critical failures that should never be silenced.
5489
+ */
5490
+ error(tag: string, message: string, ...args: unknown[]): void;
5491
+ /** Reset all logger state (debug flag, tags, handler). Primarily for tests. */
5492
+ reset(): void;
5493
+ };
5494
+
5379
5495
  /**
5380
5496
  * Network Health Check
5381
5497
  *
@@ -6749,4 +6865,4 @@ declare function getCoinIdBySymbol(symbol: string): string | undefined;
6749
6865
  */
6750
6866
  declare function getCoinIdByName(name: string): string | undefined;
6751
6867
 
6752
- export { type AddressInfo, type AddressMode, 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, 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$1 as 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 LoggingConfig, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedStorageData, type PaymentRequest, type PaymentRequestHandler$1 as PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler$1 as PaymentRequestResponseHandler, type PaymentRequestResponseType$1 as 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, 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 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, archivedKeyFromTokenId, base58Decode, base58Encode, buildTxfStorageData, bytesToHex, checkNetworkHealth, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, 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, hexToBytes, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isTextWalletEncrypted, isTokenKey, isValidBech32, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, mnemonicToSeedSync, normalizeSdkTokenToStorage, objectToTxf, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, ripemd160, sha256, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateMnemonic };
6868
+ export { type AddressInfo, type AddressMode, 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, 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$1 as 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 MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedStorageData, type PaymentRequest, type PaymentRequestHandler$1 as PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler$1 as PaymentRequestResponseHandler, type PaymentRequestResponseType$1 as 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, 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 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, archivedKeyFromTokenId, base58Decode, base58Encode, buildTxfStorageData, bytesToHex, checkNetworkHealth, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, 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, hexToBytes, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isSphereError, isTextWalletEncrypted, isTokenKey, isValidBech32, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeSdkTokenToStorage, objectToTxf, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, ripemd160, sha256, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateMnemonic };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,42 @@ interface CreateGroupOptions {
69
69
  visibility?: GroupVisibility;
70
70
  }
71
71
 
72
+ /**
73
+ * SDK Error Types
74
+ *
75
+ * Structured error codes for programmatic error handling in UI.
76
+ * UI can switch on error.code to show appropriate user-facing messages.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * import { SphereError } from '@unicitylabs/sphere-sdk';
81
+ *
82
+ * try {
83
+ * await sphere.payments.send({ ... });
84
+ * } catch (err) {
85
+ * if (err instanceof SphereError) {
86
+ * switch (err.code) {
87
+ * case 'INSUFFICIENT_BALANCE': showToast('Not enough funds'); break;
88
+ * case 'INVALID_RECIPIENT': showToast('Recipient not found'); break;
89
+ * case 'TRANSPORT_ERROR': showToast('Network connection issue'); break;
90
+ * case 'TIMEOUT': showToast('Request timed out, try again'); break;
91
+ * default: showToast(err.message);
92
+ * }
93
+ * }
94
+ * }
95
+ * ```
96
+ */
97
+ type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE';
98
+ declare class SphereError extends Error {
99
+ readonly code: SphereErrorCode;
100
+ readonly cause?: unknown;
101
+ constructor(message: string, code: SphereErrorCode, cause?: unknown);
102
+ }
103
+ /**
104
+ * Type guard to check if an error is a SphereError
105
+ */
106
+ declare function isSphereError(err: unknown): err is SphereError;
107
+
72
108
  /**
73
109
  * Cryptographic utilities for SDK2
74
110
  *
@@ -1374,12 +1410,7 @@ interface LoggingConfig {
1374
1410
  level: 'debug' | 'info' | 'warn' | 'error' | 'silent';
1375
1411
  logger?: (level: string, message: string, data?: unknown) => void;
1376
1412
  }
1377
- type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'STORAGE_ERROR' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT';
1378
- declare class SphereError extends Error {
1379
- readonly code: SphereErrorCode;
1380
- readonly cause?: unknown;
1381
- constructor(message: string, code: SphereErrorCode, cause?: unknown);
1382
- }
1413
+
1383
1414
  /**
1384
1415
  * Derivation mode determines how child keys are derived:
1385
1416
  * - "bip32": Standard BIP32 with chain code (IL + parentKey) mod n
@@ -2665,7 +2696,6 @@ declare class PaymentsModule {
2665
2696
  getConfig(): Omit<Required<PaymentsModuleConfig>, 'l1'>;
2666
2697
  /** Price provider (optional) */
2667
2698
  private priceProvider;
2668
- private log;
2669
2699
  /**
2670
2700
  * Initialize module with dependencies
2671
2701
  */
@@ -4357,6 +4387,8 @@ interface SphereCreateOptions {
4357
4387
  * - false/undefined: no auto-discovery (default)
4358
4388
  */
4359
4389
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4390
+ /** Enable debug logging (default: false) */
4391
+ debug?: boolean;
4360
4392
  /** Optional callback to report initialization progress steps */
4361
4393
  onProgress?: InitProgressCallback;
4362
4394
  }
@@ -4393,6 +4425,8 @@ interface SphereLoadOptions {
4393
4425
  * - false/undefined: no auto-discovery (default)
4394
4426
  */
4395
4427
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4428
+ /** Enable debug logging (default: false) */
4429
+ debug?: boolean;
4396
4430
  /** Optional callback to report initialization progress steps */
4397
4431
  onProgress?: InitProgressCallback;
4398
4432
  }
@@ -4437,6 +4471,8 @@ interface SphereImportOptions {
4437
4471
  * - false/undefined: no auto-discovery (default)
4438
4472
  */
4439
4473
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4474
+ /** Enable debug logging (default: false) */
4475
+ debug?: boolean;
4440
4476
  /** Optional callback to report initialization progress steps */
4441
4477
  onProgress?: InitProgressCallback;
4442
4478
  }
@@ -4496,6 +4532,8 @@ interface SphereInitOptions {
4496
4532
  * - false/undefined: no auto-discovery (default)
4497
4533
  */
4498
4534
  discoverAddresses?: boolean | DiscoverAddressesOptions;
4535
+ /** Enable debug logging (default: false) */
4536
+ debug?: boolean;
4499
4537
  /** Optional callback to report initialization progress steps */
4500
4538
  onProgress?: InitProgressCallback;
4501
4539
  }
@@ -5376,6 +5414,84 @@ declare function randomHex(byteLength: number): string;
5376
5414
  */
5377
5415
  declare function randomUUID(): string;
5378
5416
 
5417
+ /**
5418
+ * Centralized SDK Logger
5419
+ *
5420
+ * A lightweight singleton logger that works across all tsup bundles
5421
+ * by storing state on globalThis. Supports three log levels:
5422
+ * - debug: detailed messages (only shown when debug=true)
5423
+ * - warn: important warnings (ALWAYS shown regardless of debug flag)
5424
+ * - error: critical errors (ALWAYS shown regardless of debug flag)
5425
+ *
5426
+ * Global debug flag enables all logging. Per-tag overrides allow
5427
+ * granular control (e.g., only transport debug).
5428
+ *
5429
+ * @example
5430
+ * ```ts
5431
+ * import { logger } from '@unicitylabs/sphere-sdk';
5432
+ *
5433
+ * // Enable all debug logging
5434
+ * logger.configure({ debug: true });
5435
+ *
5436
+ * // Enable only specific tags
5437
+ * logger.setTagDebug('Nostr', true);
5438
+ *
5439
+ * // Usage in SDK classes
5440
+ * logger.debug('Payments', 'Transfer started', { amount, recipient });
5441
+ * logger.warn('Nostr', 'queryEvents timed out after 5s');
5442
+ * logger.error('Sphere', 'Critical failure', error);
5443
+ * ```
5444
+ */
5445
+ type LogLevel = 'debug' | 'warn' | 'error';
5446
+ type LogHandler = (level: LogLevel, tag: string, message: string, ...args: unknown[]) => void;
5447
+ interface LoggerConfig {
5448
+ /** Enable debug logging globally (default: false). When false, only warn and error messages are shown. */
5449
+ debug?: boolean;
5450
+ /** Custom log handler. If provided, replaces console output. Useful for tests or custom log sinks. */
5451
+ handler?: LogHandler | null;
5452
+ }
5453
+ declare const logger: {
5454
+ /**
5455
+ * Configure the logger. Can be called multiple times (last write wins).
5456
+ * Typically called by createBrowserProviders(), createNodeProviders(), or Sphere.init().
5457
+ */
5458
+ configure(config: LoggerConfig): void;
5459
+ /**
5460
+ * Enable/disable debug logging for a specific tag.
5461
+ * Per-tag setting overrides the global debug flag.
5462
+ *
5463
+ * @example
5464
+ * ```ts
5465
+ * logger.setTagDebug('Nostr', true); // enable only Nostr logs
5466
+ * logger.setTagDebug('Nostr', false); // disable Nostr logs even if global debug=true
5467
+ * ```
5468
+ */
5469
+ setTagDebug(tag: string, enabled: boolean): void;
5470
+ /**
5471
+ * Clear per-tag override, falling back to global debug flag.
5472
+ */
5473
+ clearTagDebug(tag: string): void;
5474
+ /** Returns true if debug mode is enabled for the given tag (or globally). */
5475
+ isDebugEnabled(tag?: string): boolean;
5476
+ /**
5477
+ * Debug-level log. Only shown when debug is enabled (globally or for this tag).
5478
+ * Use for detailed operational information.
5479
+ */
5480
+ debug(tag: string, message: string, ...args: unknown[]): void;
5481
+ /**
5482
+ * Warning-level log. ALWAYS shown regardless of debug flag.
5483
+ * Use for important but non-critical issues (timeouts, retries, degraded state).
5484
+ */
5485
+ warn(tag: string, message: string, ...args: unknown[]): void;
5486
+ /**
5487
+ * Error-level log. ALWAYS shown regardless of debug flag.
5488
+ * Use for critical failures that should never be silenced.
5489
+ */
5490
+ error(tag: string, message: string, ...args: unknown[]): void;
5491
+ /** Reset all logger state (debug flag, tags, handler). Primarily for tests. */
5492
+ reset(): void;
5493
+ };
5494
+
5379
5495
  /**
5380
5496
  * Network Health Check
5381
5497
  *
@@ -6749,4 +6865,4 @@ declare function getCoinIdBySymbol(symbol: string): string | undefined;
6749
6865
  */
6750
6866
  declare function getCoinIdByName(name: string): string | undefined;
6751
6867
 
6752
- export { type AddressInfo, type AddressMode, 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, 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$1 as 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 LoggingConfig, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedStorageData, type PaymentRequest, type PaymentRequestHandler$1 as PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler$1 as PaymentRequestResponseHandler, type PaymentRequestResponseType$1 as 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, 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 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, archivedKeyFromTokenId, base58Decode, base58Encode, buildTxfStorageData, bytesToHex, checkNetworkHealth, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, 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, hexToBytes, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isTextWalletEncrypted, isTokenKey, isValidBech32, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, mnemonicToSeedSync, normalizeSdkTokenToStorage, objectToTxf, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, ripemd160, sha256, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateMnemonic };
6868
+ export { type AddressInfo, type AddressMode, 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, 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$1 as 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 MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, type MintParams, type MintResult, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutboxEntry, type OutgoingPaymentRequest, type ParsedStorageData, type PaymentRequest, type PaymentRequestHandler$1 as PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler$1 as PaymentRequestResponseHandler, type PaymentRequestResponseType$1 as 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, 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 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, archivedKeyFromTokenId, base58Decode, base58Encode, buildTxfStorageData, bytesToHex, checkNetworkHealth, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createL1PaymentsModule, createMarketModule, createPaymentSession, createPaymentSessionError, createPaymentsModule, createPriceProvider, createSphere, createSplitPaymentSession, 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, hexToBytes, identityFromMnemonicSync, initSphere, isArchivedKey, isCombinedTransferBundleV6, isForkedKey, isInstantSplitBundle, isInstantSplitBundleV4, isInstantSplitBundleV5, isKnownToken, isPaymentSessionTerminal, isPaymentSessionTimedOut, isSQLiteDatabase, isSphereError, isTextWalletEncrypted, isTokenKey, isValidBech32, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeSdkTokenToStorage, objectToTxf, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, ripemd160, sha256, sleep, sphereExists, toHumanReadable, toSmallestUnit, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateMnemonic };