@unicitylabs/sphere-sdk 0.13.2 → 0.13.3-dev.1

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.ts CHANGED
@@ -472,9 +472,6 @@ type StorageEventCallback = (event: StorageEvent) => void;
472
472
  interface TxfStorageDataBase {
473
473
  _meta: TxfMeta$1;
474
474
  _tombstones?: TxfTombstone[];
475
- _outbox?: TxfOutboxEntry[];
476
- _sent?: TxfSentEntry[];
477
- _invalid?: TxfInvalidEntry[];
478
475
  _history?: HistoryRecord[];
479
476
  [key: `_${string}`]: unknown;
480
477
  }
@@ -490,25 +487,6 @@ interface TxfTombstone {
490
487
  stateHash: string;
491
488
  timestamp: number;
492
489
  }
493
- interface TxfOutboxEntry {
494
- id: string;
495
- status: string;
496
- tokenId: string;
497
- recipient: string;
498
- createdAt: number;
499
- data: unknown;
500
- }
501
- interface TxfSentEntry {
502
- tokenId: string;
503
- recipient: string;
504
- txHash: string;
505
- sentAt: number;
506
- }
507
- interface TxfInvalidEntry {
508
- tokenId: string;
509
- reason: string;
510
- detectedAt: number;
511
- }
512
490
 
513
491
  /**
514
492
  * Oracle Provider Interface
@@ -1022,49 +1000,6 @@ interface TombstoneEntry {
1022
1000
  stateHash: string;
1023
1001
  timestamp: number;
1024
1002
  }
1025
- /**
1026
- * Invalidated nametag entry
1027
- */
1028
- interface InvalidatedNametagEntry {
1029
- name: string;
1030
- token: object;
1031
- timestamp: number;
1032
- format: string;
1033
- version: string;
1034
- invalidatedAt: number;
1035
- invalidationReason: string;
1036
- }
1037
- /**
1038
- * Outbox entry for pending transfers
1039
- */
1040
- interface OutboxEntry {
1041
- id: string;
1042
- status: 'pending' | 'submitted' | 'confirmed' | 'delivered' | 'failed';
1043
- sourceTokenId: string;
1044
- salt: string;
1045
- commitmentJson: string;
1046
- recipientPubkey: string;
1047
- recipientNametag?: string;
1048
- amount: string;
1049
- createdAt: number;
1050
- updatedAt: number;
1051
- error?: string;
1052
- retryCount?: number;
1053
- }
1054
- /**
1055
- * Mint outbox entry for pending mints
1056
- */
1057
- interface MintOutboxEntry {
1058
- id: string;
1059
- status: 'pending' | 'submitted' | 'confirmed' | 'failed';
1060
- type: 'split' | 'faucet' | 'other';
1061
- salt: string;
1062
- requestIdHex: string;
1063
- mintDataJson: string;
1064
- createdAt: number;
1065
- updatedAt: number;
1066
- error?: string;
1067
- }
1068
1003
  /**
1069
1004
  * Storage metadata
1070
1005
  */
@@ -1084,10 +1019,7 @@ interface TxfStorageData {
1084
1019
  _nametag?: NametagData;
1085
1020
  _nametags?: NametagData[];
1086
1021
  _tombstones?: TombstoneEntry[];
1087
- _invalidatedNametags?: InvalidatedNametagEntry[];
1088
- _outbox?: OutboxEntry[];
1089
- _mintOutbox?: MintOutboxEntry[];
1090
- [key: string]: TxfToken | TxfMeta | NametagData | NametagData[] | TombstoneEntry[] | InvalidatedNametagEntry[] | OutboxEntry[] | MintOutboxEntry[] | undefined;
1022
+ [key: string]: TxfToken | TxfMeta | NametagData | NametagData[] | TombstoneEntry[] | undefined;
1091
1023
  }
1092
1024
  interface ValidationIssue {
1093
1025
  tokenId: string;
@@ -1097,20 +1029,11 @@ interface ValidationIssue {
1097
1029
  interface TokenValidationResult {
1098
1030
  isValid: boolean;
1099
1031
  reason?: string;
1100
- action?: 'ACCEPT' | 'RETRY_LATER' | 'DISCARD_FORK';
1101
1032
  }
1102
1033
  /**
1103
1034
  * Check if a key is an active token key
1104
1035
  */
1105
1036
  declare function isTokenKey(key: string): boolean;
1106
- /**
1107
- * Check if a key is an archived token key
1108
- */
1109
- declare function isArchivedKey(key: string): boolean;
1110
- /**
1111
- * Check if a key is a forked token key
1112
- */
1113
- declare function isForkedKey(key: string): boolean;
1114
1037
  /**
1115
1038
  * Extract token ID from storage key
1116
1039
  */
@@ -1119,25 +1042,6 @@ declare function tokenIdFromKey(key: string): string;
1119
1042
  * Create storage key from token ID
1120
1043
  */
1121
1044
  declare function keyFromTokenId(tokenId: string): string;
1122
- /**
1123
- * Extract token ID from archived key
1124
- */
1125
- declare function tokenIdFromArchivedKey(key: string): string;
1126
- /**
1127
- * Create archived key from token ID
1128
- */
1129
- declare function archivedKeyFromTokenId(tokenId: string): string;
1130
- /**
1131
- * Create forked key from token ID and state hash
1132
- */
1133
- declare function forkedKeyFromTokenIdAndState(tokenId: string, stateHash: string): string;
1134
- /**
1135
- * Parse forked key into tokenId and stateHash
1136
- */
1137
- declare function parseForkedKey(key: string): {
1138
- tokenId: string;
1139
- stateHash: string;
1140
- } | null;
1141
1045
  /**
1142
1046
  * Validate 64-character hex token ID
1143
1047
  */
@@ -3327,6 +3231,21 @@ declare class PaymentsModule {
3327
3231
  * and the SENT history record (dedupKey'd by transferId — idempotent).
3328
3232
  */
3329
3233
  private resumeIntent;
3234
+ /**
3235
+ * A resumed split that produced no output: a lost source means the leg delivered
3236
+ * nothing (returns false), and every checkpoint failure keeps the intent open by
3237
+ * throwing. There is no path here that records the spend.
3238
+ */
3239
+ private classifyResumeSplitFailure;
3240
+ /**
3241
+ * Drop the local records of the sources a resume consumed (present when
3242
+ * resuming on the originating device). M7: each removal carries the LOCAL state
3243
+ * we spent, so a source a concurrent claim reactivated to a NEW state (a
3244
+ * self-send round-trip) is KEPT, not destroyed.
3245
+ */
3246
+ private dropResumedSources;
3247
+ /** §10: the SENT record — same dedupKey as the original attempt, so a resume after the history POST is a server-side no-op. */
3248
+ private recordResumedSentHistory;
3330
3249
  /**
3331
3250
  * Persist the token state to every (non-disabled) token storage provider.
3332
3251
  *
@@ -7833,25 +7752,22 @@ interface DiscoverAddressesResult {
7833
7752
  }
7834
7753
 
7835
7754
  /**
7836
- * Legacy File Serialization Types
7755
+ * Text Wallet Backup Serialization Types
7837
7756
  */
7838
7757
 
7839
- type LegacyFileType = 'dat' | 'txt' | 'json' | 'mnemonic' | 'unknown';
7840
- interface LegacyFileInfo {
7841
- fileType: LegacyFileType;
7842
- isEncrypted: boolean;
7843
- isBIP32: boolean;
7844
- hasMnemonic: boolean;
7845
- }
7846
7758
  /**
7847
- * Result of parsing a legacy wallet file
7759
+ * Result of parsing a text wallet backup file
7848
7760
  */
7761
+ /** Backup file shapes `Sphere.importFromLegacyFile` accepts. Bitcoin Core `.dat` was removed (#604 — L3-only). */
7762
+ type LegacyFileType = 'txt' | 'json' | 'mnemonic' | 'unknown';
7763
+ /** Reports PBKDF2 progress while decrypting a password-protected backup. */
7764
+ type DecryptionProgressCallback = (iteration: number, total: number) => Promise<void> | void;
7849
7765
  interface LegacyFileParsedData {
7850
7766
  /** Master private key (hex) */
7851
7767
  masterKey: string;
7852
7768
  /** Chain code for BIP32 derivation */
7853
7769
  chainCode?: string;
7854
- /** Descriptor path from wallet.dat (e.g., "84'/1'/0'") */
7770
+ /** Descriptor path (e.g., "84'/1'/0'") */
7855
7771
  descriptorPath?: string;
7856
7772
  /** Mnemonic if available */
7857
7773
  mnemonic?: string;
@@ -7866,31 +7782,8 @@ interface LegacyFileParseResult {
7866
7782
  data?: LegacyFileParsedData;
7867
7783
  /** Indicates file needs password for decryption */
7868
7784
  needsPassword?: boolean;
7869
- /** CMasterKey data for .dat decryption */
7870
- encryptionInfo?: {
7871
- iterations: number;
7872
- salt: Uint8Array;
7873
- encryptedKey: Uint8Array;
7874
- };
7875
7785
  error?: string;
7876
7786
  }
7877
- /**
7878
- * Progress callback for decryption operations
7879
- */
7880
- type DecryptionProgressCallback = (iteration: number, total: number) => Promise<void> | void;
7881
- /**
7882
- * Options for importing from legacy file
7883
- */
7884
- interface LegacyFileImportOptions {
7885
- /** Raw file content */
7886
- fileContent: string | Uint8Array;
7887
- /** File name (for type detection) */
7888
- fileName: string;
7889
- /** Password for encrypted files */
7890
- password?: string;
7891
- /** Progress callback for long decryption operations */
7892
- onDecryptProgress?: DecryptionProgressCallback;
7893
- }
7894
7787
 
7895
7788
  /**
7896
7789
  * Sphere - Main SDK Entry Point
@@ -7933,7 +7826,6 @@ interface LegacyFileImportOptions {
7933
7826
  */
7934
7827
 
7935
7828
  declare function isValidNametag(nametag: string): boolean;
7936
-
7937
7829
  /** Steps reported by the onProgress callback during wallet init/create/load/import */
7938
7830
  type InitProgressStep = 'clearing' | 'storing_keys' | 'initializing' | 'recovering_nametag' | 'registering_nametag' | 'syncing_identity' | 'syncing_tokens' | 'discovering_addresses' | 'finalizing' | 'complete';
7939
7831
  /** Progress info passed to onProgress callback */
@@ -8541,6 +8433,43 @@ declare class Sphere {
8541
8433
  * modules fall back to their legacy path, same as init).
8542
8434
  */
8543
8435
  setOracleApiKey(apiKey: string): Promise<void>;
8436
+ /**
8437
+ * Import a wallet from a backup file: a `UNICITY WALLET DETAILS` text backup
8438
+ * (the format `exportToTxt` writes, optionally password-encrypted), a legacy
8439
+ * flat-JSON webwallet export, or a bare mnemonic in a text file.
8440
+ *
8441
+ * @example
8442
+ * const result = await Sphere.importFromLegacyFile({
8443
+ * fileContent: await file.text(),
8444
+ * fileName: file.name,
8445
+ * password, // when the backup is encrypted
8446
+ * ...providers,
8447
+ * });
8448
+ */
8449
+ static importFromLegacyFile(options: Omit<SphereImportOptions, 'mnemonic' | 'masterKey' | 'chainCode' | 'derivationPath' | 'basePath' | 'derivationMode'> & {
8450
+ /** The backup file's text. */
8451
+ fileContent: string;
8452
+ /** File name (used for type detection) */
8453
+ fileName: string;
8454
+ /** Password for encrypted files */
8455
+ password?: string;
8456
+ /** Progress callback for long decryption operations */
8457
+ onDecryptProgress?: DecryptionProgressCallback;
8458
+ }): Promise<{
8459
+ success: boolean;
8460
+ sphere?: Sphere;
8461
+ mnemonic?: string;
8462
+ needsPassword?: boolean;
8463
+ error?: string;
8464
+ }>;
8465
+ /**
8466
+ * Detect legacy file type from filename and content
8467
+ */
8468
+ static detectLegacyFileType(fileName: string, content: string): LegacyFileType;
8469
+ /**
8470
+ * Check if a legacy file is encrypted
8471
+ */
8472
+ static isLegacyFileEncrypted(fileName: string, content: string): boolean;
8544
8473
  /**
8545
8474
  * Check if wallet has BIP32 master key for HD derivation
8546
8475
  */
@@ -8625,60 +8554,6 @@ declare class Sphere {
8625
8554
  mnemonic?: string;
8626
8555
  error?: string;
8627
8556
  }>;
8628
- /**
8629
- * Import wallet from legacy file (.dat, .txt, or mnemonic text)
8630
- *
8631
- * Supports:
8632
- * - Bitcoin Core wallet.dat files (SQLite format, encrypted or unencrypted)
8633
- * - Text backup files (UNICITY WALLET DETAILS format)
8634
- * - Plain mnemonic text (12 or 24 words)
8635
- *
8636
- * @returns Object with success status, created Sphere instance, and optionally recovered mnemonic
8637
- *
8638
- * @example
8639
- * ```ts
8640
- * // Import from .dat file
8641
- * const fileBuffer = await file.arrayBuffer();
8642
- * const result = await Sphere.importFromLegacyFile({
8643
- * fileContent: new Uint8Array(fileBuffer),
8644
- * fileName: 'wallet.dat',
8645
- * password: 'wallet-password', // if encrypted
8646
- * storage, transport, oracle,
8647
- * });
8648
- *
8649
- * // Import from .txt file
8650
- * const textContent = await file.text();
8651
- * const result = await Sphere.importFromLegacyFile({
8652
- * fileContent: textContent,
8653
- * fileName: 'backup.txt',
8654
- * storage, transport, oracle,
8655
- * });
8656
- * ```
8657
- */
8658
- static importFromLegacyFile(options: Omit<SphereImportOptions, 'mnemonic' | 'masterKey' | 'chainCode' | 'derivationPath' | 'basePath' | 'derivationMode'> & {
8659
- /** File content - Uint8Array for .dat, string for .txt */
8660
- fileContent: string | Uint8Array;
8661
- /** File name (used for type detection) */
8662
- fileName: string;
8663
- /** Password for encrypted files */
8664
- password?: string;
8665
- /** Progress callback for long decryption operations */
8666
- onDecryptProgress?: DecryptionProgressCallback;
8667
- }): Promise<{
8668
- success: boolean;
8669
- sphere?: Sphere;
8670
- mnemonic?: string;
8671
- needsPassword?: boolean;
8672
- error?: string;
8673
- }>;
8674
- /**
8675
- * Detect legacy file type from filename and content
8676
- */
8677
- static detectLegacyFileType(fileName: string, content: string | Uint8Array): LegacyFileType;
8678
- /**
8679
- * Check if a legacy file is encrypted
8680
- */
8681
- static isLegacyFileEncrypted(fileName: string, content: string | Uint8Array): boolean;
8682
8557
  /**
8683
8558
  * Get the current active address index
8684
8559
  *
@@ -9325,49 +9200,6 @@ declare function formatAmount(amount: bigint | string, options?: {
9325
9200
  maxFractionDigits?: number;
9326
9201
  }): string;
9327
9202
 
9328
- /**
9329
- * Encode data to bech32 address
9330
- *
9331
- * @example
9332
- * ```ts
9333
- * const address = encodeBech32('bc', 1, pubkeyHash);
9334
- * // 'bc1qw...'
9335
- * ```
9336
- */
9337
- declare function encodeBech32(hrp: string, version: number, program: Uint8Array): string;
9338
- /**
9339
- * Decode bech32 address
9340
- *
9341
- * @example
9342
- * ```ts
9343
- * const result = decodeBech32('bc1qw...');
9344
- * // { hrp: 'bc', witnessVersion: 1, data: Uint8Array }
9345
- * ```
9346
- */
9347
- declare function decodeBech32(addr: string): {
9348
- hrp: string;
9349
- witnessVersion: number;
9350
- data: Uint8Array;
9351
- } | null;
9352
- /**
9353
- * Create address from public key hash
9354
- *
9355
- * @example
9356
- * ```ts
9357
- * const address = createAddress('bc', pubkeyHash);
9358
- * // 'bc1...'
9359
- * ```
9360
- */
9361
- declare function createAddress(hrp: string, pubkeyHash: Uint8Array | string): string;
9362
- /**
9363
- * Validate bech32 address
9364
- */
9365
- declare function isValidBech32(addr: string): boolean;
9366
- /**
9367
- * Get HRP from address
9368
- */
9369
- declare function getAddressHrp(addr: string): string | null;
9370
-
9371
9203
  /**
9372
9204
  * Browser-safe UUID v4 generation.
9373
9205
  *
@@ -10590,100 +10422,27 @@ declare function parseWalletText(content: string): LegacyFileParseResult;
10590
10422
  declare function parseAndDecryptWalletText(content: string, password: string): LegacyFileParseResult;
10591
10423
 
10592
10424
  /**
10593
- * Wallet.dat Parsing
10425
+ * TXF storage-data serializer.
10594
10426
  *
10595
- * Parses Bitcoin Core wallet.dat files (SQLite format)
10596
- * Extracts keys, chain codes, and descriptors
10597
- */
10598
-
10599
- interface CMasterKeyData {
10600
- encryptedKey: Uint8Array;
10601
- salt: Uint8Array;
10602
- derivationMethod: number;
10603
- iterations: number;
10604
- position: number;
10605
- }
10606
- interface WalletDatInfo {
10607
- isSQLite: boolean;
10608
- isEncrypted: boolean;
10609
- isDescriptorWallet: boolean;
10610
- hasHDChain: boolean;
10611
- descriptorKeys: string[];
10612
- legacyKeys: string[];
10613
- chainCode: string | null;
10614
- descriptorPath: string | null;
10615
- cmasterKeys: CMasterKeyData[];
10616
- descriptorId: Uint8Array | null;
10617
- xpubString: string | null;
10618
- }
10619
- /**
10620
- * Check if data is a valid SQLite database
10621
- */
10622
- declare function isSQLiteDatabase(data: Uint8Array): boolean;
10623
- /**
10624
- * Check if wallet.dat is encrypted
10625
- */
10626
- declare function isWalletDatEncrypted(data: Uint8Array): boolean;
10627
- /**
10628
- * Decrypt master key from CMasterKey structure
10629
- */
10630
- declare function decryptCMasterKey(cmk: CMasterKeyData, password: string, onProgress?: DecryptionProgressCallback): Promise<string>;
10631
- /**
10632
- * Decrypt private key using decrypted master key
10633
- */
10634
- declare function decryptPrivateKey(encryptedKey: Uint8Array, pubkey: Uint8Array, masterKeyHex: string): string;
10635
- /**
10636
- * Parse wallet.dat file
10637
- * For encrypted wallets, returns info for decryption
10638
- */
10639
- declare function parseWalletDat(data: Uint8Array): LegacyFileParseResult;
10640
- /**
10641
- * Parse and decrypt wallet.dat file
10642
- */
10643
- declare function parseAndDecryptWalletDat(data: Uint8Array, password: string, onProgress?: DecryptionProgressCallback): Promise<LegacyFileParseResult>;
10644
-
10645
- /**
10646
- * TXF Serializer for SDK2
10647
- * Converts between SDK Token format and TXF storage format
10427
+ * Builds and parses the `TxfStorageData` DOCUMENT — the `_meta` / `_nametags` /
10428
+ * `_tombstones` / `_history` envelope plus the per-token slots. Tokens
10429
+ * themselves are opaque v2 CBOR blobs (hex) in `Token.sdkData`; this file never
10430
+ * decodes one.
10648
10431
  *
10649
- * Platform-independent implementation that works with SDK types directly.
10432
+ * A record that is not a v2 blob is logged and skipped on both the read and the
10433
+ * write path — never reinterpreted.
10650
10434
  */
10651
10435
 
10652
10436
  /**
10653
- * Normalize SDK token JSON to canonical TXF storage format.
10654
- * Converts all bytes objects to hex strings before storage.
10655
- */
10656
- declare function normalizeSdkTokenToStorage(sdkTokenJson: unknown): TxfToken;
10657
- /**
10658
- * Extract TXF token structure from Token.sdkData (jsonData)
10659
- */
10660
- declare function tokenToTxf(token: Token): TxfToken | null;
10661
- /**
10662
- * Convert token interface to simplified Token for parsing
10663
- */
10664
- interface TokenLike {
10665
- id: string;
10666
- sdkData?: string;
10667
- }
10668
- /**
10669
- * Extract TXF from any object with id and sdkData
10670
- */
10671
- declare function objectToTxf(obj: TokenLike): TxfToken | null;
10672
- /**
10673
- * Convert TXF token to Token interface
10674
- */
10675
- declare function txfToToken(tokenId: string, txf: TxfToken): Token;
10676
- /**
10677
- * Build TXF storage data from tokens and metadata
10437
+ * Build TXF storage data from tokens and metadata.
10438
+ *
10439
+ * Only v2 blob tokens are written. Anything else in `sdkData` has no v2
10440
+ * encoding, so it is dropped with a warning rather than written back in a shape
10441
+ * the reader cannot interpret.
10678
10442
  */
10679
10443
  declare function buildTxfStorageData(tokens: Token[], meta: Omit<TxfMeta, 'formatVersion'>, options?: {
10680
10444
  nametags?: NametagData[];
10681
10445
  tombstones?: TombstoneEntry[];
10682
- archivedTokens?: Map<string, TxfToken>;
10683
- forkedTokens?: Map<string, TxfToken>;
10684
- outboxEntries?: OutboxEntry[];
10685
- mintOutboxEntries?: MintOutboxEntry[];
10686
- invalidatedNametags?: InvalidatedNametagEntry[];
10687
10446
  historyEntries?: HistoryRecord[];
10688
10447
  }): Promise<TxfStorageData>;
10689
10448
  interface ParsedStorageData {
@@ -10691,11 +10450,6 @@ interface ParsedStorageData {
10691
10450
  meta: TxfMeta | null;
10692
10451
  nametags: NametagData[];
10693
10452
  tombstones: TombstoneEntry[];
10694
- archivedTokens: Map<string, TxfToken>;
10695
- forkedTokens: Map<string, TxfToken>;
10696
- outboxEntries: OutboxEntry[];
10697
- mintOutboxEntries: MintOutboxEntry[];
10698
- invalidatedNametags: InvalidatedNametagEntry[];
10699
10453
  historyEntries: HistoryRecord[];
10700
10454
  validationErrors: string[];
10701
10455
  }
@@ -10703,35 +10457,6 @@ interface ParsedStorageData {
10703
10457
  * Parse TXF storage data
10704
10458
  */
10705
10459
  declare function parseTxfStorageData(data: unknown): ParsedStorageData;
10706
- /**
10707
- * Get token ID from Token object (prefers genesis.data.tokenId)
10708
- */
10709
- declare function getTokenId(token: Token): string;
10710
- /**
10711
- * Get the current state hash from a TXF token
10712
- * Checks multiple sources in order of preference:
10713
- * 1. Last transaction's newStateHash
10714
- * 2. _integrity.currentStateHash
10715
- * 3. Last transaction's inclusionProof authenticator stateHash
10716
- * 4. Genesis inclusionProof authenticator stateHash (for never-transferred tokens)
10717
- */
10718
- declare function getCurrentStateHash(txf: TxfToken): string | undefined;
10719
- /**
10720
- * Check if token has valid TXF data
10721
- */
10722
- declare function hasValidTxfData(token: Token): boolean;
10723
- /**
10724
- * Check if token has uncommitted transactions
10725
- */
10726
- declare function hasUncommittedTransactions(token: Token): boolean;
10727
- /**
10728
- * Check if a TXF token has missing newStateHash on any transaction
10729
- */
10730
- declare function hasMissingNewStateHash(txf: TxfToken): boolean;
10731
- /**
10732
- * Count committed transactions in a token
10733
- */
10734
- declare function countCommittedTransactions(token: Token): number;
10735
10460
 
10736
10461
  /**
10737
10462
  * Token Validation Service — engine-based (v2).
@@ -11145,9 +10870,8 @@ declare function coinIdsMatch(a: string, b: string): boolean;
11145
10870
  /**
11146
10871
  * Standard address parsing, validation, and normalization for Unicity addresses.
11147
10872
  *
11148
- * Three address formats:
10873
+ * Two address formats:
11149
10874
  * - DIRECT:// — Resolved on-chain address (hex, 64-80 chars after prefix)
11150
- * - PROXY:// — Proxy address derived from nametag hash
11151
10875
  * - @nametag — Human-readable alias resolved via transport
11152
10876
  *
11153
10877
  * This module is the single source of truth for address handling.
@@ -11155,34 +10879,33 @@ declare function coinIdsMatch(a: string, b: string): boolean;
11155
10879
  *
11156
10880
  * @module
11157
10881
  */
11158
- /** The three address format types supported by Unicity. */
11159
- type AddressType = 'DIRECT' | 'PROXY' | 'NAMETAG';
10882
+ /** The address format types supported by Unicity. */
10883
+ type AddressType = 'DIRECT' | 'NAMETAG';
11160
10884
  /** A parsed address with its type and components. */
11161
10885
  interface ParsedAddress {
11162
10886
  /** Address format type */
11163
10887
  readonly type: AddressType;
11164
10888
  /** Original raw address string */
11165
10889
  readonly raw: string;
11166
- /** The value part after the prefix (hex for DIRECT/PROXY, name for NAMETAG) */
10890
+ /** The value part after the prefix (hex for DIRECT, name for NAMETAG) */
11167
10891
  readonly value: string;
11168
10892
  }
11169
10893
  /**
11170
10894
  * Parse a Unicity address string into its components.
11171
10895
  *
11172
- * @param address - A DIRECT://, PROXY://, or @nametag address string.
10896
+ * @param address - A DIRECT:// or @nametag address string.
11173
10897
  * @returns Parsed address or null if invalid/unrecognized format.
11174
10898
  *
11175
10899
  * @example
11176
10900
  * parseAddress('DIRECT://0000ab12...') → { type: 'DIRECT', raw: '...', value: '0000ab12...' }
11177
10901
  * parseAddress('@alice') → { type: 'NAMETAG', raw: '@alice', value: 'alice' }
11178
- * parseAddress('PROXY://abc123...') → { type: 'PROXY', raw: '...', value: 'abc123...' }
11179
10902
  * parseAddress('invalid') → null
11180
10903
  */
11181
10904
  declare function parseAddress(address: string): ParsedAddress | null;
11182
10905
  /**
11183
10906
  * Check if a string is a valid Unicity address (any format).
11184
10907
  *
11185
- * Accepts DIRECT://, PROXY://, or @nametag.
10908
+ * Accepts DIRECT:// or @nametag.
11186
10909
  */
11187
10910
  declare function isValidAddress(address: string): boolean;
11188
10911
  /**
@@ -11193,7 +10916,6 @@ declare function isValidDirectAddress(address: string): boolean;
11193
10916
  * Normalize an address for comparison.
11194
10917
  *
11195
10918
  * - DIRECT:// → lowercase hex
11196
- * - PROXY:// → lowercase hex
11197
10919
  * - @nametag → lowercase name
11198
10920
  *
11199
10921
  * Returns the original string if not a recognized format.
@@ -11208,4 +10930,4 @@ declare function normalizeAddress(address: string): string;
11208
10930
  */
11209
10931
  declare function addressesMatch(a: string, b: string): boolean;
11210
10932
 
11211
- export { AUTH_CHALLENGE_PREFIX, type AddressInfo, type AddressMode, type AddressType, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type ApplyDeltaAdded, type ApplyDeltaOptions, type ApplyDeltaRequest, type Asset, type BaseProvider, type BlobUrlEntry, type BroadcastHandler, type BroadcastMessage, type CMasterKeyData, COIN_TYPES, ChallengeTemplateError, type CheckNetworkHealthOptions, type CoinBalance, CoinGeckoPriceProvider, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, type CreateInvoiceRequest, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_AGGREGATOR_URL, DEFAULT_DERIVATION_PATH, DEFAULT_GROUP_RELAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, DEV_AGGREGATOR_URL, type DecryptionProgressCallback, type DeliverOptions, type DeliveryBlobKeys, type DeliveryCustody, type DeliveryDisposition, type DeliveryProvider, type DeliveryReceipt, type DerivationMode, type DirectMessage, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type ExtendedValidationResult, FIELD_ENCRYPTION_HKDF_INFO, FIELD_ENVELOPE_MAX_BYTES, FIELD_ENVELOPE_NONCE_BYTES, FIELD_ENVELOPE_PREFIX, 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 IncomingBroadcast, type IncomingDelivery, type IncomingMessage, type IncomingPaymentRequest, type IncomingTokenTransfer, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type IntentRecord, type IntentStatus, type IntentType, type InvalidatedNametagEntry, type InventoryAsset, type InventoryItem, type InventoryPage, type InventoryView, type InvoiceRequestedAsset, type KeyValueStore, LIMITS, type LegacyFileImportOptions, type LegacyFileInfo, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LoadResult, type LogHandler, type LogLevel, type LoggerConfig, type ManifestAuxiliary, type ManifestFields, type ManifestSignatures, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintOutboxEntry, 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, PartialSendConflictError, type PayInvoiceParams, type PaymentRequest, type PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler, type PaymentRequestResponseType, type PaymentRequestResult, type PaymentRequestStatus, PaymentsModule, type PaymentsModuleConfig, type PaymentsModuleDependencies, type PaymentsWalletApiPort, type PeerInfo, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type ReceiveOptions, type ReceiveResult, type RecoverRemovedResult, type RegistryNetwork, type ReturnPaymentParams, SIGN_MESSAGE_PREFIX, STORAGE_KEYS, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SaveResult, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, type SpentTokenInfo, type SpentTokenResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type SphereWalletApiSession, type StorageEvent, type StorageEventCallback, type StorageEventType, type StorageProvider, type SwapDeal, type SwapManifest, SwapModule, type SwapModuleConfig, type SwapProgress, type SwapProposalResult, type SwapRef, type SwapRole, type SyncResult, TEST_AGGREGATOR_URL, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPrice, TokenRegistry, type TokenStatus, type TokenStorageProvider, type TokenTransferDetail, type TokenTransferHandler, type TokenTransferPayload, type ValidationResult as TokenValidationResult, TokenValidator, type TombstoneEntry, type TrackedAddress, type TrackedAddressEntry, type TransactionHistoryEntry, type TransferMode, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type TxfAuthenticator, type TxfGenesis, type TxfGenesisData, type TxfInclusionProof, type TxfIntegrity, type TxfInvalidEntry, type TxfMerkleStep, type TxfMerkleTreePath, type TxfMeta$1 as TxfMeta, type TxfOutboxEntry, type TxfSentEntry, type TxfState, type TxfStorageData, type TxfStorageDataBase, type TxfToken, type TxfTombstone, type TxfTransaction, type UploadUrlEntry, type UploadUrlRequest, type ValidationAction, type ValidationIssue, type WakeCallback, type WakeEvent, type WakeSocketHandle, WalletApiClient, type WalletApiClientConfig, WalletApiError, type WalletApiErrorCode, type WalletApiIdentity, type WalletDatInfo, type WalletInfo, type WalletJSON, type WalletJSONExportOptions, type WalletSource, WholeBlobInventoryAdapter, type WholeBlobStore, addressesMatch, archivedKeyFromTokenId, assertFieldEnvelopeShape, base58Decode, base58Encode, buildManifest, buildTxfStorageData, bytesToHex, checkNetworkHealth, coinIdsMatch, composeDeliveryKeys, computeDeliveryId, computeSwapId, countCommittedTransactions, createAddress, createCommunicationsModule, createGroupChatModule, createKeyPair, createMarketModule, createNametagBinding, createPaymentsModule, createPriceProvider, createSphere, createSwapModule, createTokenValidator, decodeBech32, decrypt, decryptCMasterKey, decryptField, decryptFieldBytes, decryptJson, decryptMnemonic, decryptPrivateKey, decryptSimple, decryptTextFormatKey, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveFieldEncryptionKey, deriveKeyAtPath, doubleSha256, encodeBech32, encrypt, encryptField, encryptFieldBytes, encryptMnemonic, encryptSimple, extractFromText, findPattern, forkedKeyFromTokenIdAndState, formatAmount, generateAddressFromMasterKey, 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, isForkedKey, isKnownToken, isPossiblyCommittedSendOutcome, isSQLiteDatabase, isSphereError, isTextWalletEncrypted, isTokenKey, isValidAddress, isValidBech32, isValidDirectAddress, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletDatEncrypted, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeCoinId, normalizeSdkTokenToStorage, objectToTxf, parseAddress, parseAndDecryptWalletDat, parseAndDecryptWalletText, parseForkedKey, parseTokenAmount, parseTxfStorageData, parseWalletDat, parseWalletText, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, safeParseTokenAmount, sha256, signMessage, signSwapManifest, sleep, sphereExists, toHumanReadable, tokenIdFromArchivedKey, tokenIdFromKey, tokenToTxf, txfToToken, validateManifest, validateMnemonic, verifyChallengeTemplate, verifyManifestIntegrity, verifyNametagBinding, verifySignedMessage, verifySwapSignature };
10933
+ export { AUTH_CHALLENGE_PREFIX, type AddressInfo, type AddressMode, type AddressType, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type ApplyDeltaAdded, type ApplyDeltaOptions, type ApplyDeltaRequest, type Asset, type BaseProvider, type BlobUrlEntry, type BroadcastHandler, type BroadcastMessage, COIN_TYPES, ChallengeTemplateError, type CheckNetworkHealthOptions, type CoinBalance, CoinGeckoPriceProvider, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, type CreateInvoiceRequest, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_AGGREGATOR_URL, DEFAULT_DERIVATION_PATH, DEFAULT_GROUP_RELAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, DEV_AGGREGATOR_URL, type DecryptionProgressCallback, type DeliverOptions, type DeliveryBlobKeys, type DeliveryCustody, type DeliveryDisposition, type DeliveryProvider, type DeliveryReceipt, type DerivationMode, type DirectMessage, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, type ExtendedValidationResult, FIELD_ENCRYPTION_HKDF_INFO, FIELD_ENVELOPE_MAX_BYTES, FIELD_ENVELOPE_NONCE_BYTES, FIELD_ENVELOPE_PREFIX, 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 IncomingBroadcast, type IncomingDelivery, type IncomingMessage, type IncomingPaymentRequest, type IncomingTokenTransfer, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type IntentRecord, type IntentStatus, type IntentType, type InventoryAsset, type InventoryItem, type InventoryPage, type InventoryView, type InvoiceRequestedAsset, type KeyValueStore, LIMITS, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LoadResult, type LogHandler, type LogLevel, type LoggerConfig, type ManifestAuxiliary, type ManifestFields, type ManifestSignatures, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, NETWORKS, NIP29_KINDS, NOSTR_EVENT_KINDS, type NametagBindingProof, type NametagData, type NetworkHealthResult, type NetworkType, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type OutgoingPaymentRequest, type ParsedAddress, type ParsedStorageData, PartialSendConflictError, type PayInvoiceParams, type PaymentRequest, type PaymentRequestHandler, type PaymentRequestResponse, type PaymentRequestResponseHandler, type PaymentRequestResponseType, type PaymentRequestResult, type PaymentRequestStatus, PaymentsModule, type PaymentsModuleConfig, type PaymentsModuleDependencies, type PaymentsWalletApiPort, type PeerInfo, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type ReceiveOptions, type ReceiveResult, type RecoverRemovedResult, type RegistryNetwork, type ReturnPaymentParams, SIGN_MESSAGE_PREFIX, STORAGE_KEYS, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SaveResult, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, type SpentTokenInfo, type SpentTokenResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type SphereWalletApiSession, type StorageEvent, type StorageEventCallback, type StorageEventType, type StorageProvider, type SwapDeal, type SwapManifest, SwapModule, type SwapModuleConfig, type SwapProgress, type SwapProposalResult, type SwapRef, type SwapRole, type SyncResult, TEST_AGGREGATOR_URL, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPrice, TokenRegistry, type TokenStatus, type TokenStorageProvider, type TokenTransferDetail, type TokenTransferHandler, type TokenTransferPayload, type ValidationResult as TokenValidationResult, TokenValidator, type TombstoneEntry, type TrackedAddress, type TrackedAddressEntry, type TransactionHistoryEntry, type TransferMode, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type TxfAuthenticator, type TxfGenesis, type TxfGenesisData, type TxfInclusionProof, type TxfIntegrity, type TxfMerkleStep, type TxfMerkleTreePath, type TxfMeta$1 as TxfMeta, type TxfState, type TxfStorageData, type TxfStorageDataBase, type TxfToken, type TxfTombstone, type TxfTransaction, type UploadUrlEntry, type UploadUrlRequest, type ValidationAction, type ValidationIssue, type WakeCallback, type WakeEvent, type WakeSocketHandle, WalletApiClient, type WalletApiClientConfig, WalletApiError, type WalletApiErrorCode, type WalletApiIdentity, type WalletInfo, type WalletJSON, type WalletJSONExportOptions, type WalletSource, WholeBlobInventoryAdapter, type WholeBlobStore, addressesMatch, assertFieldEnvelopeShape, base58Decode, base58Encode, buildManifest, buildTxfStorageData, bytesToHex, checkNetworkHealth, coinIdsMatch, composeDeliveryKeys, computeDeliveryId, computeSwapId, createCommunicationsModule, createGroupChatModule, createKeyPair, createMarketModule, createNametagBinding, createPaymentsModule, createPriceProvider, createSphere, createSwapModule, createTokenValidator, decrypt, decryptField, decryptFieldBytes, decryptJson, decryptMnemonic, decryptSimple, decryptTextFormatKey, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveFieldEncryptionKey, deriveKeyAtPath, doubleSha256, encrypt, encryptField, encryptFieldBytes, encryptMnemonic, encryptSimple, extractFromText, findPattern, formatAmount, generateAddressFromMasterKey, generateMasterKey, generateMnemonic, getAddressId, getAddressStorageKey, getCoinIdByName, getCoinIdBySymbol, getPublicKey, getSphere, getTokenDecimals, getTokenDefinition, getTokenIconUrl, getTokenName, getTokenSymbol, hash160, hashSignMessage, hexToBytes, identityFromMnemonicSync, initSphere, isKnownToken, isPossiblyCommittedSendOutcome, isSphereError, isTextWalletEncrypted, isTokenKey, isValidAddress, isValidDirectAddress, isValidNametag, isValidPrivateKey, isValidTokenId, isWalletTextFormat, keyFromTokenId, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeCoinId, parseAddress, parseAndDecryptWalletText, parseTokenAmount, parseTxfStorageData, parseWalletText, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, safeParseTokenAmount, sha256, signMessage, signSwapManifest, sleep, sphereExists, toHumanReadable, tokenIdFromKey, validateManifest, validateMnemonic, verifyChallengeTemplate, verifyManifestIntegrity, verifyNametagBinding, verifySignedMessage, verifySwapSignature };