@unicitylabs/sphere-sdk 0.4.7 → 0.4.8
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/connect/index.cjs.map +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +441 -177
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +163 -4
- package/dist/core/index.d.ts +163 -4
- package/dist/core/index.js +440 -177
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +40 -2
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +40 -2
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/browser/ipfs.cjs.map +1 -1
- package/dist/impl/browser/ipfs.js.map +1 -1
- package/dist/impl/nodejs/connect/index.cjs.map +1 -1
- package/dist/impl/nodejs/connect/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +40 -2
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +16 -3
- package/dist/impl/nodejs/index.d.ts +16 -3
- package/dist/impl/nodejs/index.js +40 -2
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/index.cjs +497 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +147 -6
- package/dist/index.d.ts +147 -6
- package/dist/index.js +497 -228
- package/dist/index.js.map +1 -1
- package/dist/l1/index.cjs +68 -1
- package/dist/l1/index.cjs.map +1 -1
- package/dist/l1/index.js +68 -1
- package/dist/l1/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1503,6 +1503,14 @@ interface TransportProvider extends BaseProvider {
|
|
|
1503
1503
|
* @returns PeerInfo or null if no binding found
|
|
1504
1504
|
*/
|
|
1505
1505
|
resolveTransportPubkeyInfo?(transportPubkey: string): Promise<PeerInfo | null>;
|
|
1506
|
+
/**
|
|
1507
|
+
* Batch-resolve multiple transport pubkeys to peer info.
|
|
1508
|
+
* Used for HD address discovery: derives transport pubkeys for indices 0..N
|
|
1509
|
+
* and queries binding events in a single batch.
|
|
1510
|
+
* @param transportPubkeys - Array of transport-specific pubkeys to look up
|
|
1511
|
+
* @returns Array of PeerInfo for pubkeys that have binding events (may be shorter than input)
|
|
1512
|
+
*/
|
|
1513
|
+
discoverAddresses?(transportPubkeys: string[]): Promise<PeerInfo[]>;
|
|
1506
1514
|
/**
|
|
1507
1515
|
* Recover nametag for current identity by decrypting stored encrypted nametag
|
|
1508
1516
|
* Used after wallet import to recover associated nametag
|
|
@@ -3872,9 +3880,9 @@ declare const COIN_TYPES: {
|
|
|
3872
3880
|
readonly TEST: "TEST";
|
|
3873
3881
|
};
|
|
3874
3882
|
/** Default Fulcrum electrum server for mainnet */
|
|
3875
|
-
declare const DEFAULT_ELECTRUM_URL: "wss://fulcrum.
|
|
3883
|
+
declare const DEFAULT_ELECTRUM_URL: "wss://fulcrum.unicity.network:50004";
|
|
3876
3884
|
/** Testnet Fulcrum electrum server */
|
|
3877
|
-
declare const TEST_ELECTRUM_URL: "wss://fulcrum.
|
|
3885
|
+
declare const TEST_ELECTRUM_URL: "wss://fulcrum.unicity.network:50004";
|
|
3878
3886
|
/** Testnet Nostr relays */
|
|
3879
3887
|
declare const TEST_NOSTR_RELAYS: readonly ["wss://nostr-relay.testnet.unicity.network"];
|
|
3880
3888
|
/** Default group chat relays (NIP-29 Zooid relay) */
|
|
@@ -3886,7 +3894,7 @@ declare const NETWORKS: {
|
|
|
3886
3894
|
readonly aggregatorUrl: "https://aggregator.unicity.network/rpc";
|
|
3887
3895
|
readonly nostrRelays: readonly ["wss://relay.unicity.network", "wss://relay.damus.io", "wss://nos.lol", "wss://relay.nostr.band"];
|
|
3888
3896
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3889
|
-
readonly electrumUrl: "wss://fulcrum.
|
|
3897
|
+
readonly electrumUrl: "wss://fulcrum.unicity.network:50004";
|
|
3890
3898
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3891
3899
|
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3892
3900
|
};
|
|
@@ -3895,7 +3903,7 @@ declare const NETWORKS: {
|
|
|
3895
3903
|
readonly aggregatorUrl: "https://goggregator-test.unicity.network";
|
|
3896
3904
|
readonly nostrRelays: readonly ["wss://nostr-relay.testnet.unicity.network"];
|
|
3897
3905
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3898
|
-
readonly electrumUrl: "wss://fulcrum.
|
|
3906
|
+
readonly electrumUrl: "wss://fulcrum.unicity.network:50004";
|
|
3899
3907
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3900
3908
|
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3901
3909
|
};
|
|
@@ -3904,7 +3912,7 @@ declare const NETWORKS: {
|
|
|
3904
3912
|
readonly aggregatorUrl: "https://dev-aggregator.dyndns.org/rpc";
|
|
3905
3913
|
readonly nostrRelays: readonly ["wss://nostr-relay.testnet.unicity.network"];
|
|
3906
3914
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3907
|
-
readonly electrumUrl: "wss://fulcrum.
|
|
3915
|
+
readonly electrumUrl: "wss://fulcrum.unicity.network:50004";
|
|
3908
3916
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3909
3917
|
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3910
3918
|
};
|
|
@@ -3996,6 +4004,70 @@ interface ScanAddressesResult {
|
|
|
3996
4004
|
scannedCount: number;
|
|
3997
4005
|
}
|
|
3998
4006
|
|
|
4007
|
+
/**
|
|
4008
|
+
* HD Address Discovery — discover previously used addresses via transport binding events.
|
|
4009
|
+
*
|
|
4010
|
+
* Derives transport pubkeys for HD indices and batch-queries the relay.
|
|
4011
|
+
* Complements L1 scan (scan.ts) by finding L3-only addresses.
|
|
4012
|
+
*/
|
|
4013
|
+
|
|
4014
|
+
/** Progress callback for address discovery */
|
|
4015
|
+
interface DiscoverAddressProgress {
|
|
4016
|
+
/** Current batch being queried */
|
|
4017
|
+
currentBatch: number;
|
|
4018
|
+
/** Total batches planned */
|
|
4019
|
+
totalBatches: number;
|
|
4020
|
+
/** Number of addresses discovered so far */
|
|
4021
|
+
discoveredCount: number;
|
|
4022
|
+
/** Current gap count (consecutive empty indices) */
|
|
4023
|
+
currentGap: number;
|
|
4024
|
+
/** Phase: 'transport' or 'l1' */
|
|
4025
|
+
phase: 'transport' | 'l1';
|
|
4026
|
+
}
|
|
4027
|
+
/** Single discovered address result */
|
|
4028
|
+
interface DiscoveredAddress {
|
|
4029
|
+
/** HD derivation index */
|
|
4030
|
+
index: number;
|
|
4031
|
+
/** L1 bech32 address (alpha1...) */
|
|
4032
|
+
l1Address: string;
|
|
4033
|
+
/** L3 DIRECT address */
|
|
4034
|
+
directAddress: string;
|
|
4035
|
+
/** 33-byte compressed chain pubkey */
|
|
4036
|
+
chainPubkey: string;
|
|
4037
|
+
/** Nametag (from binding event) */
|
|
4038
|
+
nametag?: string;
|
|
4039
|
+
/** L1 balance in ALPHA (0 if only discovered via transport) */
|
|
4040
|
+
l1Balance: number;
|
|
4041
|
+
/** Discovery source */
|
|
4042
|
+
source: 'transport' | 'l1' | 'both';
|
|
4043
|
+
}
|
|
4044
|
+
/** Options for address discovery */
|
|
4045
|
+
interface DiscoverAddressesOptions {
|
|
4046
|
+
/** Max HD indices to probe (default: 50) */
|
|
4047
|
+
maxAddresses?: number;
|
|
4048
|
+
/** Stop after N consecutive empty indices (default: 20) */
|
|
4049
|
+
gapLimit?: number;
|
|
4050
|
+
/** Batch size for transport queries (default: 20) */
|
|
4051
|
+
batchSize?: number;
|
|
4052
|
+
/** Also run L1 balance scan (default: true) */
|
|
4053
|
+
includeL1Scan?: boolean;
|
|
4054
|
+
/** Progress callback */
|
|
4055
|
+
onProgress?: (progress: DiscoverAddressProgress) => void;
|
|
4056
|
+
/** Abort signal */
|
|
4057
|
+
signal?: AbortSignal;
|
|
4058
|
+
/** Auto-track discovered addresses (default: true) */
|
|
4059
|
+
autoTrack?: boolean;
|
|
4060
|
+
}
|
|
4061
|
+
/** Result of address discovery */
|
|
4062
|
+
interface DiscoverAddressesResult {
|
|
4063
|
+
/** All discovered addresses */
|
|
4064
|
+
addresses: DiscoveredAddress[];
|
|
4065
|
+
/** Total indices scanned */
|
|
4066
|
+
scannedCount: number;
|
|
4067
|
+
/** Whether scan was aborted */
|
|
4068
|
+
aborted: boolean;
|
|
4069
|
+
}
|
|
4070
|
+
|
|
3999
4071
|
/**
|
|
4000
4072
|
* Legacy File Serialization Types
|
|
4001
4073
|
*/
|
|
@@ -4058,6 +4130,17 @@ interface LegacyFileImportOptions {
|
|
|
4058
4130
|
|
|
4059
4131
|
declare function isValidNametag(nametag: string): boolean;
|
|
4060
4132
|
|
|
4133
|
+
/** Steps reported by the onProgress callback during wallet init/create/load/import */
|
|
4134
|
+
type InitProgressStep = 'clearing' | 'storing_keys' | 'initializing' | 'recovering_nametag' | 'registering_nametag' | 'syncing_identity' | 'syncing_tokens' | 'discovering_addresses' | 'finalizing' | 'complete';
|
|
4135
|
+
/** Progress info passed to onProgress callback */
|
|
4136
|
+
interface InitProgress {
|
|
4137
|
+
/** Current step identifier */
|
|
4138
|
+
readonly step: InitProgressStep;
|
|
4139
|
+
/** Human-readable description of what's happening */
|
|
4140
|
+
readonly message: string;
|
|
4141
|
+
}
|
|
4142
|
+
/** Callback for tracking wallet initialization progress */
|
|
4143
|
+
type InitProgressCallback = (progress: InitProgress) => void;
|
|
4061
4144
|
/** Options for creating a new wallet */
|
|
4062
4145
|
interface SphereCreateOptions {
|
|
4063
4146
|
/** BIP39 mnemonic (12 or 24 words) */
|
|
@@ -4090,6 +4173,15 @@ interface SphereCreateOptions {
|
|
|
4090
4173
|
market?: MarketModuleConfig | boolean;
|
|
4091
4174
|
/** Optional password to encrypt the wallet. If omitted, mnemonic is stored as plaintext. */
|
|
4092
4175
|
password?: string;
|
|
4176
|
+
/**
|
|
4177
|
+
* Auto-discover previously used HD addresses after creation.
|
|
4178
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4179
|
+
* - DiscoverAddressesOptions: custom config
|
|
4180
|
+
* - false/undefined: no auto-discovery (default)
|
|
4181
|
+
*/
|
|
4182
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4183
|
+
/** Optional callback to report initialization progress steps */
|
|
4184
|
+
onProgress?: InitProgressCallback;
|
|
4093
4185
|
}
|
|
4094
4186
|
/** Options for loading existing wallet */
|
|
4095
4187
|
interface SphereLoadOptions {
|
|
@@ -4117,6 +4209,15 @@ interface SphereLoadOptions {
|
|
|
4117
4209
|
market?: MarketModuleConfig | boolean;
|
|
4118
4210
|
/** Optional password to decrypt the wallet. Must match the password used during creation. */
|
|
4119
4211
|
password?: string;
|
|
4212
|
+
/**
|
|
4213
|
+
* Auto-discover previously used HD addresses on load.
|
|
4214
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4215
|
+
* - DiscoverAddressesOptions: custom config
|
|
4216
|
+
* - false/undefined: no auto-discovery (default)
|
|
4217
|
+
*/
|
|
4218
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4219
|
+
/** Optional callback to report initialization progress steps */
|
|
4220
|
+
onProgress?: InitProgressCallback;
|
|
4120
4221
|
}
|
|
4121
4222
|
/** Options for importing a wallet */
|
|
4122
4223
|
interface SphereImportOptions {
|
|
@@ -4152,6 +4253,15 @@ interface SphereImportOptions {
|
|
|
4152
4253
|
market?: MarketModuleConfig | boolean;
|
|
4153
4254
|
/** Optional password to encrypt the wallet. If omitted, mnemonic/key is stored as plaintext. */
|
|
4154
4255
|
password?: string;
|
|
4256
|
+
/**
|
|
4257
|
+
* Auto-discover previously used HD addresses after import.
|
|
4258
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4259
|
+
* - DiscoverAddressesOptions: custom config
|
|
4260
|
+
* - false/undefined: no auto-discovery (default)
|
|
4261
|
+
*/
|
|
4262
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4263
|
+
/** Optional callback to report initialization progress steps */
|
|
4264
|
+
onProgress?: InitProgressCallback;
|
|
4155
4265
|
}
|
|
4156
4266
|
/** L1 (ALPHA blockchain) configuration */
|
|
4157
4267
|
interface L1Config {
|
|
@@ -4201,6 +4311,16 @@ interface SphereInitOptions {
|
|
|
4201
4311
|
market?: MarketModuleConfig | boolean;
|
|
4202
4312
|
/** Optional password to encrypt/decrypt the wallet. If omitted, mnemonic is stored as plaintext. */
|
|
4203
4313
|
password?: string;
|
|
4314
|
+
/**
|
|
4315
|
+
* Auto-discover previously used HD addresses when creating from mnemonic.
|
|
4316
|
+
* Only applies when wallet is newly created (not on load of existing wallet).
|
|
4317
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4318
|
+
* - DiscoverAddressesOptions: custom config
|
|
4319
|
+
* - false/undefined: no auto-discovery (default)
|
|
4320
|
+
*/
|
|
4321
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4322
|
+
/** Optional callback to report initialization progress steps */
|
|
4323
|
+
onProgress?: InitProgressCallback;
|
|
4204
4324
|
}
|
|
4205
4325
|
/** Result of init operation */
|
|
4206
4326
|
interface SphereInitResult {
|
|
@@ -4619,6 +4739,11 @@ declare class Sphere {
|
|
|
4619
4739
|
switchToAddress(index: number, options?: {
|
|
4620
4740
|
nametag?: string;
|
|
4621
4741
|
}): Promise<void>;
|
|
4742
|
+
/**
|
|
4743
|
+
* Background transport sync and nametag operations after address switch.
|
|
4744
|
+
* Runs after switchToAddress returns so L1/L3 queries can start immediately.
|
|
4745
|
+
*/
|
|
4746
|
+
private postSwitchSync;
|
|
4622
4747
|
/**
|
|
4623
4748
|
* Re-initialize modules after address switch
|
|
4624
4749
|
*/
|
|
@@ -4708,6 +4833,22 @@ declare class Sphere {
|
|
|
4708
4833
|
hidden: boolean;
|
|
4709
4834
|
nametag?: string;
|
|
4710
4835
|
}>): Promise<void>;
|
|
4836
|
+
/**
|
|
4837
|
+
* Discover previously used HD addresses.
|
|
4838
|
+
*
|
|
4839
|
+
* Primary: queries Nostr relay for identity binding events (fast, single batch query).
|
|
4840
|
+
* Secondary: runs L1 balance scan to find legacy addresses with no binding event.
|
|
4841
|
+
*
|
|
4842
|
+
* @example
|
|
4843
|
+
* ```ts
|
|
4844
|
+
* const result = await sphere.discoverAddresses();
|
|
4845
|
+
* console.log(`Found ${result.addresses.length} addresses`);
|
|
4846
|
+
*
|
|
4847
|
+
* // With auto-tracking
|
|
4848
|
+
* await sphere.discoverAddresses({ autoTrack: true });
|
|
4849
|
+
* ```
|
|
4850
|
+
*/
|
|
4851
|
+
discoverAddresses(options?: DiscoverAddressesOptions): Promise<DiscoverAddressesResult>;
|
|
4711
4852
|
/**
|
|
4712
4853
|
* Get aggregated status of all providers, grouped by role.
|
|
4713
4854
|
*
|
|
@@ -6429,4 +6570,4 @@ declare function getCoinIdBySymbol(symbol: string): string | undefined;
|
|
|
6429
6570
|
*/
|
|
6430
6571
|
declare function getCoinIdByName(name: string): string | undefined;
|
|
6431
6572
|
|
|
6432
|
-
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 CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, 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 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 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 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, 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 };
|
|
6573
|
+
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 CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, 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 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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1503,6 +1503,14 @@ interface TransportProvider extends BaseProvider {
|
|
|
1503
1503
|
* @returns PeerInfo or null if no binding found
|
|
1504
1504
|
*/
|
|
1505
1505
|
resolveTransportPubkeyInfo?(transportPubkey: string): Promise<PeerInfo | null>;
|
|
1506
|
+
/**
|
|
1507
|
+
* Batch-resolve multiple transport pubkeys to peer info.
|
|
1508
|
+
* Used for HD address discovery: derives transport pubkeys for indices 0..N
|
|
1509
|
+
* and queries binding events in a single batch.
|
|
1510
|
+
* @param transportPubkeys - Array of transport-specific pubkeys to look up
|
|
1511
|
+
* @returns Array of PeerInfo for pubkeys that have binding events (may be shorter than input)
|
|
1512
|
+
*/
|
|
1513
|
+
discoverAddresses?(transportPubkeys: string[]): Promise<PeerInfo[]>;
|
|
1506
1514
|
/**
|
|
1507
1515
|
* Recover nametag for current identity by decrypting stored encrypted nametag
|
|
1508
1516
|
* Used after wallet import to recover associated nametag
|
|
@@ -3872,9 +3880,9 @@ declare const COIN_TYPES: {
|
|
|
3872
3880
|
readonly TEST: "TEST";
|
|
3873
3881
|
};
|
|
3874
3882
|
/** Default Fulcrum electrum server for mainnet */
|
|
3875
|
-
declare const DEFAULT_ELECTRUM_URL: "wss://fulcrum.
|
|
3883
|
+
declare const DEFAULT_ELECTRUM_URL: "wss://fulcrum.unicity.network:50004";
|
|
3876
3884
|
/** Testnet Fulcrum electrum server */
|
|
3877
|
-
declare const TEST_ELECTRUM_URL: "wss://fulcrum.
|
|
3885
|
+
declare const TEST_ELECTRUM_URL: "wss://fulcrum.unicity.network:50004";
|
|
3878
3886
|
/** Testnet Nostr relays */
|
|
3879
3887
|
declare const TEST_NOSTR_RELAYS: readonly ["wss://nostr-relay.testnet.unicity.network"];
|
|
3880
3888
|
/** Default group chat relays (NIP-29 Zooid relay) */
|
|
@@ -3886,7 +3894,7 @@ declare const NETWORKS: {
|
|
|
3886
3894
|
readonly aggregatorUrl: "https://aggregator.unicity.network/rpc";
|
|
3887
3895
|
readonly nostrRelays: readonly ["wss://relay.unicity.network", "wss://relay.damus.io", "wss://nos.lol", "wss://relay.nostr.band"];
|
|
3888
3896
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3889
|
-
readonly electrumUrl: "wss://fulcrum.
|
|
3897
|
+
readonly electrumUrl: "wss://fulcrum.unicity.network:50004";
|
|
3890
3898
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3891
3899
|
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3892
3900
|
};
|
|
@@ -3895,7 +3903,7 @@ declare const NETWORKS: {
|
|
|
3895
3903
|
readonly aggregatorUrl: "https://goggregator-test.unicity.network";
|
|
3896
3904
|
readonly nostrRelays: readonly ["wss://nostr-relay.testnet.unicity.network"];
|
|
3897
3905
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3898
|
-
readonly electrumUrl: "wss://fulcrum.
|
|
3906
|
+
readonly electrumUrl: "wss://fulcrum.unicity.network:50004";
|
|
3899
3907
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3900
3908
|
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3901
3909
|
};
|
|
@@ -3904,7 +3912,7 @@ declare const NETWORKS: {
|
|
|
3904
3912
|
readonly aggregatorUrl: "https://dev-aggregator.dyndns.org/rpc";
|
|
3905
3913
|
readonly nostrRelays: readonly ["wss://nostr-relay.testnet.unicity.network"];
|
|
3906
3914
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3907
|
-
readonly electrumUrl: "wss://fulcrum.
|
|
3915
|
+
readonly electrumUrl: "wss://fulcrum.unicity.network:50004";
|
|
3908
3916
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3909
3917
|
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3910
3918
|
};
|
|
@@ -3996,6 +4004,70 @@ interface ScanAddressesResult {
|
|
|
3996
4004
|
scannedCount: number;
|
|
3997
4005
|
}
|
|
3998
4006
|
|
|
4007
|
+
/**
|
|
4008
|
+
* HD Address Discovery — discover previously used addresses via transport binding events.
|
|
4009
|
+
*
|
|
4010
|
+
* Derives transport pubkeys for HD indices and batch-queries the relay.
|
|
4011
|
+
* Complements L1 scan (scan.ts) by finding L3-only addresses.
|
|
4012
|
+
*/
|
|
4013
|
+
|
|
4014
|
+
/** Progress callback for address discovery */
|
|
4015
|
+
interface DiscoverAddressProgress {
|
|
4016
|
+
/** Current batch being queried */
|
|
4017
|
+
currentBatch: number;
|
|
4018
|
+
/** Total batches planned */
|
|
4019
|
+
totalBatches: number;
|
|
4020
|
+
/** Number of addresses discovered so far */
|
|
4021
|
+
discoveredCount: number;
|
|
4022
|
+
/** Current gap count (consecutive empty indices) */
|
|
4023
|
+
currentGap: number;
|
|
4024
|
+
/** Phase: 'transport' or 'l1' */
|
|
4025
|
+
phase: 'transport' | 'l1';
|
|
4026
|
+
}
|
|
4027
|
+
/** Single discovered address result */
|
|
4028
|
+
interface DiscoveredAddress {
|
|
4029
|
+
/** HD derivation index */
|
|
4030
|
+
index: number;
|
|
4031
|
+
/** L1 bech32 address (alpha1...) */
|
|
4032
|
+
l1Address: string;
|
|
4033
|
+
/** L3 DIRECT address */
|
|
4034
|
+
directAddress: string;
|
|
4035
|
+
/** 33-byte compressed chain pubkey */
|
|
4036
|
+
chainPubkey: string;
|
|
4037
|
+
/** Nametag (from binding event) */
|
|
4038
|
+
nametag?: string;
|
|
4039
|
+
/** L1 balance in ALPHA (0 if only discovered via transport) */
|
|
4040
|
+
l1Balance: number;
|
|
4041
|
+
/** Discovery source */
|
|
4042
|
+
source: 'transport' | 'l1' | 'both';
|
|
4043
|
+
}
|
|
4044
|
+
/** Options for address discovery */
|
|
4045
|
+
interface DiscoverAddressesOptions {
|
|
4046
|
+
/** Max HD indices to probe (default: 50) */
|
|
4047
|
+
maxAddresses?: number;
|
|
4048
|
+
/** Stop after N consecutive empty indices (default: 20) */
|
|
4049
|
+
gapLimit?: number;
|
|
4050
|
+
/** Batch size for transport queries (default: 20) */
|
|
4051
|
+
batchSize?: number;
|
|
4052
|
+
/** Also run L1 balance scan (default: true) */
|
|
4053
|
+
includeL1Scan?: boolean;
|
|
4054
|
+
/** Progress callback */
|
|
4055
|
+
onProgress?: (progress: DiscoverAddressProgress) => void;
|
|
4056
|
+
/** Abort signal */
|
|
4057
|
+
signal?: AbortSignal;
|
|
4058
|
+
/** Auto-track discovered addresses (default: true) */
|
|
4059
|
+
autoTrack?: boolean;
|
|
4060
|
+
}
|
|
4061
|
+
/** Result of address discovery */
|
|
4062
|
+
interface DiscoverAddressesResult {
|
|
4063
|
+
/** All discovered addresses */
|
|
4064
|
+
addresses: DiscoveredAddress[];
|
|
4065
|
+
/** Total indices scanned */
|
|
4066
|
+
scannedCount: number;
|
|
4067
|
+
/** Whether scan was aborted */
|
|
4068
|
+
aborted: boolean;
|
|
4069
|
+
}
|
|
4070
|
+
|
|
3999
4071
|
/**
|
|
4000
4072
|
* Legacy File Serialization Types
|
|
4001
4073
|
*/
|
|
@@ -4058,6 +4130,17 @@ interface LegacyFileImportOptions {
|
|
|
4058
4130
|
|
|
4059
4131
|
declare function isValidNametag(nametag: string): boolean;
|
|
4060
4132
|
|
|
4133
|
+
/** Steps reported by the onProgress callback during wallet init/create/load/import */
|
|
4134
|
+
type InitProgressStep = 'clearing' | 'storing_keys' | 'initializing' | 'recovering_nametag' | 'registering_nametag' | 'syncing_identity' | 'syncing_tokens' | 'discovering_addresses' | 'finalizing' | 'complete';
|
|
4135
|
+
/** Progress info passed to onProgress callback */
|
|
4136
|
+
interface InitProgress {
|
|
4137
|
+
/** Current step identifier */
|
|
4138
|
+
readonly step: InitProgressStep;
|
|
4139
|
+
/** Human-readable description of what's happening */
|
|
4140
|
+
readonly message: string;
|
|
4141
|
+
}
|
|
4142
|
+
/** Callback for tracking wallet initialization progress */
|
|
4143
|
+
type InitProgressCallback = (progress: InitProgress) => void;
|
|
4061
4144
|
/** Options for creating a new wallet */
|
|
4062
4145
|
interface SphereCreateOptions {
|
|
4063
4146
|
/** BIP39 mnemonic (12 or 24 words) */
|
|
@@ -4090,6 +4173,15 @@ interface SphereCreateOptions {
|
|
|
4090
4173
|
market?: MarketModuleConfig | boolean;
|
|
4091
4174
|
/** Optional password to encrypt the wallet. If omitted, mnemonic is stored as plaintext. */
|
|
4092
4175
|
password?: string;
|
|
4176
|
+
/**
|
|
4177
|
+
* Auto-discover previously used HD addresses after creation.
|
|
4178
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4179
|
+
* - DiscoverAddressesOptions: custom config
|
|
4180
|
+
* - false/undefined: no auto-discovery (default)
|
|
4181
|
+
*/
|
|
4182
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4183
|
+
/** Optional callback to report initialization progress steps */
|
|
4184
|
+
onProgress?: InitProgressCallback;
|
|
4093
4185
|
}
|
|
4094
4186
|
/** Options for loading existing wallet */
|
|
4095
4187
|
interface SphereLoadOptions {
|
|
@@ -4117,6 +4209,15 @@ interface SphereLoadOptions {
|
|
|
4117
4209
|
market?: MarketModuleConfig | boolean;
|
|
4118
4210
|
/** Optional password to decrypt the wallet. Must match the password used during creation. */
|
|
4119
4211
|
password?: string;
|
|
4212
|
+
/**
|
|
4213
|
+
* Auto-discover previously used HD addresses on load.
|
|
4214
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4215
|
+
* - DiscoverAddressesOptions: custom config
|
|
4216
|
+
* - false/undefined: no auto-discovery (default)
|
|
4217
|
+
*/
|
|
4218
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4219
|
+
/** Optional callback to report initialization progress steps */
|
|
4220
|
+
onProgress?: InitProgressCallback;
|
|
4120
4221
|
}
|
|
4121
4222
|
/** Options for importing a wallet */
|
|
4122
4223
|
interface SphereImportOptions {
|
|
@@ -4152,6 +4253,15 @@ interface SphereImportOptions {
|
|
|
4152
4253
|
market?: MarketModuleConfig | boolean;
|
|
4153
4254
|
/** Optional password to encrypt the wallet. If omitted, mnemonic/key is stored as plaintext. */
|
|
4154
4255
|
password?: string;
|
|
4256
|
+
/**
|
|
4257
|
+
* Auto-discover previously used HD addresses after import.
|
|
4258
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4259
|
+
* - DiscoverAddressesOptions: custom config
|
|
4260
|
+
* - false/undefined: no auto-discovery (default)
|
|
4261
|
+
*/
|
|
4262
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4263
|
+
/** Optional callback to report initialization progress steps */
|
|
4264
|
+
onProgress?: InitProgressCallback;
|
|
4155
4265
|
}
|
|
4156
4266
|
/** L1 (ALPHA blockchain) configuration */
|
|
4157
4267
|
interface L1Config {
|
|
@@ -4201,6 +4311,16 @@ interface SphereInitOptions {
|
|
|
4201
4311
|
market?: MarketModuleConfig | boolean;
|
|
4202
4312
|
/** Optional password to encrypt/decrypt the wallet. If omitted, mnemonic is stored as plaintext. */
|
|
4203
4313
|
password?: string;
|
|
4314
|
+
/**
|
|
4315
|
+
* Auto-discover previously used HD addresses when creating from mnemonic.
|
|
4316
|
+
* Only applies when wallet is newly created (not on load of existing wallet).
|
|
4317
|
+
* - true: discover with defaults (Nostr + L1 scan, autoTrack: true)
|
|
4318
|
+
* - DiscoverAddressesOptions: custom config
|
|
4319
|
+
* - false/undefined: no auto-discovery (default)
|
|
4320
|
+
*/
|
|
4321
|
+
discoverAddresses?: boolean | DiscoverAddressesOptions;
|
|
4322
|
+
/** Optional callback to report initialization progress steps */
|
|
4323
|
+
onProgress?: InitProgressCallback;
|
|
4204
4324
|
}
|
|
4205
4325
|
/** Result of init operation */
|
|
4206
4326
|
interface SphereInitResult {
|
|
@@ -4619,6 +4739,11 @@ declare class Sphere {
|
|
|
4619
4739
|
switchToAddress(index: number, options?: {
|
|
4620
4740
|
nametag?: string;
|
|
4621
4741
|
}): Promise<void>;
|
|
4742
|
+
/**
|
|
4743
|
+
* Background transport sync and nametag operations after address switch.
|
|
4744
|
+
* Runs after switchToAddress returns so L1/L3 queries can start immediately.
|
|
4745
|
+
*/
|
|
4746
|
+
private postSwitchSync;
|
|
4622
4747
|
/**
|
|
4623
4748
|
* Re-initialize modules after address switch
|
|
4624
4749
|
*/
|
|
@@ -4708,6 +4833,22 @@ declare class Sphere {
|
|
|
4708
4833
|
hidden: boolean;
|
|
4709
4834
|
nametag?: string;
|
|
4710
4835
|
}>): Promise<void>;
|
|
4836
|
+
/**
|
|
4837
|
+
* Discover previously used HD addresses.
|
|
4838
|
+
*
|
|
4839
|
+
* Primary: queries Nostr relay for identity binding events (fast, single batch query).
|
|
4840
|
+
* Secondary: runs L1 balance scan to find legacy addresses with no binding event.
|
|
4841
|
+
*
|
|
4842
|
+
* @example
|
|
4843
|
+
* ```ts
|
|
4844
|
+
* const result = await sphere.discoverAddresses();
|
|
4845
|
+
* console.log(`Found ${result.addresses.length} addresses`);
|
|
4846
|
+
*
|
|
4847
|
+
* // With auto-tracking
|
|
4848
|
+
* await sphere.discoverAddresses({ autoTrack: true });
|
|
4849
|
+
* ```
|
|
4850
|
+
*/
|
|
4851
|
+
discoverAddresses(options?: DiscoverAddressesOptions): Promise<DiscoverAddressesResult>;
|
|
4711
4852
|
/**
|
|
4712
4853
|
* Get aggregated status of all providers, grouped by role.
|
|
4713
4854
|
*
|
|
@@ -6429,4 +6570,4 @@ declare function getCoinIdBySymbol(symbol: string): string | undefined;
|
|
|
6429
6570
|
*/
|
|
6430
6571
|
declare function getCoinIdByName(name: string): string | undefined;
|
|
6431
6572
|
|
|
6432
|
-
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 CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, 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 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 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 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, 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 };
|
|
6573
|
+
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 CMasterKeyData, COIN_TYPES, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, 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 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, 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 };
|