@unicitylabs/sphere-sdk 0.3.4 → 0.3.6
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/core/index.cjs +2722 -153
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +169 -0
- package/dist/core/index.d.ts +169 -0
- package/dist/core/index.js +2718 -149
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +385 -4
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +385 -4
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/browser/ipfs.cjs +5 -1
- package/dist/impl/browser/ipfs.cjs.map +1 -1
- package/dist/impl/browser/ipfs.js +5 -1
- package/dist/impl/browser/ipfs.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +385 -4
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +23 -0
- package/dist/impl/nodejs/index.d.ts +23 -0
- package/dist/impl/nodejs/index.js +385 -4
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/index.cjs +2728 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +270 -6
- package/dist/index.d.ts +270 -6
- package/dist/index.js +2721 -149
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3320,6 +3320,155 @@ declare class GroupChatModule {
|
|
|
3320
3320
|
}
|
|
3321
3321
|
declare function createGroupChatModule(config?: GroupChatModuleConfig): GroupChatModule;
|
|
3322
3322
|
|
|
3323
|
+
/**
|
|
3324
|
+
* Market Module Types
|
|
3325
|
+
* Intent bulletin board for posting and discovering intents,
|
|
3326
|
+
* plus real-time feed subscription.
|
|
3327
|
+
*/
|
|
3328
|
+
type IntentType = 'buy' | 'sell' | 'service' | 'announcement' | 'other' | (string & {});
|
|
3329
|
+
type IntentStatus = 'active' | 'closed' | 'expired';
|
|
3330
|
+
interface MarketModuleConfig {
|
|
3331
|
+
/** Market API base URL (default: https://market-api.unicity.network) */
|
|
3332
|
+
apiUrl?: string;
|
|
3333
|
+
/** Request timeout in ms (default: 30000) */
|
|
3334
|
+
timeout?: number;
|
|
3335
|
+
}
|
|
3336
|
+
interface MarketModuleDependencies {
|
|
3337
|
+
identity: FullIdentity;
|
|
3338
|
+
emitEvent: <T extends SphereEventType>(type: T, data: SphereEventMap[T]) => void;
|
|
3339
|
+
}
|
|
3340
|
+
interface PostIntentRequest {
|
|
3341
|
+
description: string;
|
|
3342
|
+
intentType: IntentType;
|
|
3343
|
+
category?: string;
|
|
3344
|
+
price?: number;
|
|
3345
|
+
currency?: string;
|
|
3346
|
+
location?: string;
|
|
3347
|
+
contactHandle?: string;
|
|
3348
|
+
expiresInDays?: number;
|
|
3349
|
+
}
|
|
3350
|
+
interface PostIntentResult {
|
|
3351
|
+
intentId: string;
|
|
3352
|
+
message: string;
|
|
3353
|
+
expiresAt: string;
|
|
3354
|
+
}
|
|
3355
|
+
interface MarketIntent {
|
|
3356
|
+
id: string;
|
|
3357
|
+
intentType: IntentType;
|
|
3358
|
+
category?: string;
|
|
3359
|
+
price?: string;
|
|
3360
|
+
currency: string;
|
|
3361
|
+
location?: string;
|
|
3362
|
+
status: IntentStatus;
|
|
3363
|
+
createdAt: string;
|
|
3364
|
+
expiresAt: string;
|
|
3365
|
+
}
|
|
3366
|
+
interface SearchIntentResult {
|
|
3367
|
+
id: string;
|
|
3368
|
+
score: number;
|
|
3369
|
+
agentNametag?: string;
|
|
3370
|
+
agentPublicKey: string;
|
|
3371
|
+
description: string;
|
|
3372
|
+
intentType: IntentType;
|
|
3373
|
+
category?: string;
|
|
3374
|
+
price?: number;
|
|
3375
|
+
currency: string;
|
|
3376
|
+
location?: string;
|
|
3377
|
+
contactMethod: string;
|
|
3378
|
+
contactHandle?: string;
|
|
3379
|
+
createdAt: string;
|
|
3380
|
+
expiresAt: string;
|
|
3381
|
+
}
|
|
3382
|
+
interface SearchFilters {
|
|
3383
|
+
intentType?: IntentType;
|
|
3384
|
+
category?: string;
|
|
3385
|
+
minPrice?: number;
|
|
3386
|
+
maxPrice?: number;
|
|
3387
|
+
location?: string;
|
|
3388
|
+
/** Minimum similarity score (0–1). Results below this threshold are excluded (client-side). */
|
|
3389
|
+
minScore?: number;
|
|
3390
|
+
}
|
|
3391
|
+
interface SearchOptions {
|
|
3392
|
+
filters?: SearchFilters;
|
|
3393
|
+
limit?: number;
|
|
3394
|
+
}
|
|
3395
|
+
interface SearchResult {
|
|
3396
|
+
intents: SearchIntentResult[];
|
|
3397
|
+
count: number;
|
|
3398
|
+
}
|
|
3399
|
+
/** A listing broadcast on the live feed */
|
|
3400
|
+
interface FeedListing {
|
|
3401
|
+
id: string;
|
|
3402
|
+
title: string;
|
|
3403
|
+
descriptionPreview: string;
|
|
3404
|
+
agentName: string;
|
|
3405
|
+
agentId: number;
|
|
3406
|
+
type: IntentType;
|
|
3407
|
+
createdAt: string;
|
|
3408
|
+
}
|
|
3409
|
+
/** WebSocket message: initial batch of recent listings */
|
|
3410
|
+
interface FeedInitialMessage {
|
|
3411
|
+
type: 'initial';
|
|
3412
|
+
listings: FeedListing[];
|
|
3413
|
+
}
|
|
3414
|
+
/** WebSocket message: single new listing */
|
|
3415
|
+
interface FeedNewMessage {
|
|
3416
|
+
type: 'new';
|
|
3417
|
+
listing: FeedListing;
|
|
3418
|
+
}
|
|
3419
|
+
type FeedMessage = FeedInitialMessage | FeedNewMessage;
|
|
3420
|
+
/** Callback for live feed events */
|
|
3421
|
+
type FeedListener = (message: FeedMessage) => void;
|
|
3422
|
+
|
|
3423
|
+
/**
|
|
3424
|
+
* Market Module
|
|
3425
|
+
*
|
|
3426
|
+
* Intent bulletin board — post and discover intents (buy, sell,
|
|
3427
|
+
* service, announcement, other) with secp256k1-signed requests
|
|
3428
|
+
* tied to the wallet identity. Includes real-time feed via WebSocket.
|
|
3429
|
+
*/
|
|
3430
|
+
|
|
3431
|
+
declare class MarketModule {
|
|
3432
|
+
private readonly apiUrl;
|
|
3433
|
+
private readonly timeout;
|
|
3434
|
+
private identity;
|
|
3435
|
+
private registered;
|
|
3436
|
+
constructor(config?: MarketModuleConfig);
|
|
3437
|
+
/** Called by Sphere after construction */
|
|
3438
|
+
initialize(deps: MarketModuleDependencies): void;
|
|
3439
|
+
/** No-op — stateless module */
|
|
3440
|
+
load(): Promise<void>;
|
|
3441
|
+
/** No-op — stateless module */
|
|
3442
|
+
destroy(): void;
|
|
3443
|
+
/** Post a new intent (agent is auto-registered on first post) */
|
|
3444
|
+
postIntent(intent: PostIntentRequest): Promise<PostIntentResult>;
|
|
3445
|
+
/** Semantic search for intents (public — no auth required) */
|
|
3446
|
+
search(query: string, opts?: SearchOptions): Promise<SearchResult>;
|
|
3447
|
+
/** List own intents (authenticated) */
|
|
3448
|
+
getMyIntents(): Promise<MarketIntent[]>;
|
|
3449
|
+
/** Close (delete) an intent */
|
|
3450
|
+
closeIntent(intentId: string): Promise<void>;
|
|
3451
|
+
/** Fetch the most recent listings via REST (public — no auth required) */
|
|
3452
|
+
getRecentListings(): Promise<FeedListing[]>;
|
|
3453
|
+
/**
|
|
3454
|
+
* Subscribe to the live listing feed via WebSocket.
|
|
3455
|
+
* Returns an unsubscribe function that closes the connection.
|
|
3456
|
+
*
|
|
3457
|
+
* Requires a WebSocket implementation — works natively in browsers
|
|
3458
|
+
* and in Node.js 21+ (or with the `ws` package).
|
|
3459
|
+
*/
|
|
3460
|
+
subscribeFeed(listener: FeedListener): () => void;
|
|
3461
|
+
private ensureIdentity;
|
|
3462
|
+
/** Register the agent's public key with the server (idempotent) */
|
|
3463
|
+
private ensureRegistered;
|
|
3464
|
+
private parseResponse;
|
|
3465
|
+
private apiPost;
|
|
3466
|
+
private apiGet;
|
|
3467
|
+
private apiDelete;
|
|
3468
|
+
private apiPublicPost;
|
|
3469
|
+
}
|
|
3470
|
+
declare function createMarketModule(config?: MarketModuleConfig): MarketModule;
|
|
3471
|
+
|
|
3323
3472
|
/**
|
|
3324
3473
|
* SDK2 Constants
|
|
3325
3474
|
* Default configuration values and storage keys
|
|
@@ -3374,6 +3523,10 @@ declare const STORAGE_KEYS: {
|
|
|
3374
3523
|
readonly GROUP_CHAT_PROCESSED_EVENTS: "group_chat_processed_events";
|
|
3375
3524
|
/** Group chat: last used relay URL (stale data detection) */
|
|
3376
3525
|
readonly GROUP_CHAT_RELAY_URL: "group_chat_relay_url";
|
|
3526
|
+
/** Cached token registry JSON (fetched from remote) */
|
|
3527
|
+
readonly TOKEN_REGISTRY_CACHE: "token_registry_cache";
|
|
3528
|
+
/** Timestamp of last token registry cache update (ms since epoch) */
|
|
3529
|
+
readonly TOKEN_REGISTRY_CACHE_TS: "token_registry_cache_ts";
|
|
3377
3530
|
};
|
|
3378
3531
|
/** Default Nostr relays */
|
|
3379
3532
|
declare const DEFAULT_NOSTR_RELAYS: readonly ["wss://relay.unicity.network", "wss://relay.damus.io", "wss://nos.lol", "wss://relay.nostr.band"];
|
|
@@ -3472,6 +3625,7 @@ declare const NETWORKS: {
|
|
|
3472
3625
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3473
3626
|
readonly electrumUrl: "wss://fulcrum.alpha.unicity.network:50004";
|
|
3474
3627
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3628
|
+
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3475
3629
|
};
|
|
3476
3630
|
readonly testnet: {
|
|
3477
3631
|
readonly name: "Testnet";
|
|
@@ -3480,6 +3634,7 @@ declare const NETWORKS: {
|
|
|
3480
3634
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3481
3635
|
readonly electrumUrl: "wss://fulcrum.alpha.testnet.unicity.network:50004";
|
|
3482
3636
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3637
|
+
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3483
3638
|
};
|
|
3484
3639
|
readonly dev: {
|
|
3485
3640
|
readonly name: "Development";
|
|
@@ -3488,6 +3643,7 @@ declare const NETWORKS: {
|
|
|
3488
3643
|
readonly ipfsGateways: readonly ["https://unicity-ipfs1.dyndns.org"];
|
|
3489
3644
|
readonly electrumUrl: "wss://fulcrum.alpha.testnet.unicity.network:50004";
|
|
3490
3645
|
readonly groupRelays: readonly ["wss://sphere-relay.unicity.network"];
|
|
3646
|
+
readonly tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
3491
3647
|
};
|
|
3492
3648
|
};
|
|
3493
3649
|
type NetworkType = keyof typeof NETWORKS;
|
|
@@ -3504,6 +3660,8 @@ declare const TIMEOUTS: {
|
|
|
3504
3660
|
/** Sync interval */
|
|
3505
3661
|
readonly SYNC_INTERVAL: 60000;
|
|
3506
3662
|
};
|
|
3663
|
+
/** Default Market API URL (intent bulletin board) */
|
|
3664
|
+
declare const DEFAULT_MARKET_API_URL: "https://market-api.unicity.network";
|
|
3507
3665
|
/** Validation limits */
|
|
3508
3666
|
declare const LIMITS: {
|
|
3509
3667
|
/** Min nametag length */
|
|
@@ -3669,6 +3827,8 @@ interface SphereCreateOptions {
|
|
|
3669
3827
|
groupChat?: GroupChatModuleConfig | boolean;
|
|
3670
3828
|
/** Optional password to encrypt the wallet. If omitted, mnemonic is stored as plaintext. */
|
|
3671
3829
|
password?: string;
|
|
3830
|
+
/** Market module configuration. true = enable with defaults, object = custom config. */
|
|
3831
|
+
market?: MarketModuleConfig | boolean;
|
|
3672
3832
|
}
|
|
3673
3833
|
/** Options for loading existing wallet */
|
|
3674
3834
|
interface SphereLoadOptions {
|
|
@@ -3694,6 +3854,8 @@ interface SphereLoadOptions {
|
|
|
3694
3854
|
groupChat?: GroupChatModuleConfig | boolean;
|
|
3695
3855
|
/** Optional password to decrypt the wallet. Must match the password used during creation. */
|
|
3696
3856
|
password?: string;
|
|
3857
|
+
/** Market module configuration. true = enable with defaults, object = custom config. */
|
|
3858
|
+
market?: MarketModuleConfig | boolean;
|
|
3697
3859
|
}
|
|
3698
3860
|
/** Options for importing a wallet */
|
|
3699
3861
|
interface SphereImportOptions {
|
|
@@ -3727,6 +3889,8 @@ interface SphereImportOptions {
|
|
|
3727
3889
|
groupChat?: GroupChatModuleConfig | boolean;
|
|
3728
3890
|
/** Optional password to encrypt the wallet. If omitted, mnemonic/key is stored as plaintext. */
|
|
3729
3891
|
password?: string;
|
|
3892
|
+
/** Market module configuration. true = enable with defaults, object = custom config. */
|
|
3893
|
+
market?: MarketModuleConfig | boolean;
|
|
3730
3894
|
}
|
|
3731
3895
|
/** L1 (ALPHA blockchain) configuration */
|
|
3732
3896
|
interface L1Config {
|
|
@@ -3774,6 +3938,8 @@ interface SphereInitOptions {
|
|
|
3774
3938
|
groupChat?: GroupChatModuleConfig | boolean;
|
|
3775
3939
|
/** Optional password to encrypt/decrypt the wallet. If omitted, mnemonic is stored as plaintext. */
|
|
3776
3940
|
password?: string;
|
|
3941
|
+
/** Market module configuration. true = enable with defaults, object = custom config. */
|
|
3942
|
+
market?: MarketModuleConfig | boolean;
|
|
3777
3943
|
}
|
|
3778
3944
|
/** Result of init operation */
|
|
3779
3945
|
interface SphereInitResult {
|
|
@@ -3811,6 +3977,7 @@ declare class Sphere {
|
|
|
3811
3977
|
private _payments;
|
|
3812
3978
|
private _communications;
|
|
3813
3979
|
private _groupChat;
|
|
3980
|
+
private _market;
|
|
3814
3981
|
private eventHandlers;
|
|
3815
3982
|
private _disabledProviders;
|
|
3816
3983
|
private _providerEventCleanups;
|
|
@@ -3858,6 +4025,13 @@ declare class Sphere {
|
|
|
3858
4025
|
* (different input shape: { enabled?, relays? }). Both fill relay URLs from network defaults.
|
|
3859
4026
|
*/
|
|
3860
4027
|
private static resolveGroupChatConfig;
|
|
4028
|
+
/**
|
|
4029
|
+
* Resolve market module config from Sphere.init() options.
|
|
4030
|
+
* - `true` → enable with default API URL
|
|
4031
|
+
* - `MarketModuleConfig` → pass through with defaults
|
|
4032
|
+
* - `undefined` → no market module
|
|
4033
|
+
*/
|
|
4034
|
+
private static resolveMarketConfig;
|
|
3861
4035
|
/**
|
|
3862
4036
|
* Create new wallet with mnemonic
|
|
3863
4037
|
*/
|
|
@@ -3916,6 +4090,8 @@ declare class Sphere {
|
|
|
3916
4090
|
get communications(): CommunicationsModule;
|
|
3917
4091
|
/** Group chat module (NIP-29). Null if not configured. */
|
|
3918
4092
|
get groupChat(): GroupChatModule | null;
|
|
4093
|
+
/** Market module (intent bulletin board). Null if not configured. */
|
|
4094
|
+
get market(): MarketModule | null;
|
|
3919
4095
|
/** Current identity (public info only) */
|
|
3920
4096
|
get identity(): Identity | null;
|
|
3921
4097
|
/** Is ready */
|
|
@@ -5704,8 +5880,9 @@ declare namespace index {
|
|
|
5704
5880
|
* Token Registry
|
|
5705
5881
|
*
|
|
5706
5882
|
* Provides token definitions (metadata) for known tokens on the Unicity network.
|
|
5707
|
-
*
|
|
5883
|
+
* Fetches from a remote URL, caches in StorageProvider, and refreshes periodically.
|
|
5708
5884
|
*/
|
|
5885
|
+
|
|
5709
5886
|
/**
|
|
5710
5887
|
* Icon entry for token
|
|
5711
5888
|
*/
|
|
@@ -5737,18 +5914,45 @@ interface TokenDefinition {
|
|
|
5737
5914
|
* Network type for registry lookup
|
|
5738
5915
|
*/
|
|
5739
5916
|
type RegistryNetwork = 'testnet' | 'mainnet' | 'dev';
|
|
5917
|
+
/**
|
|
5918
|
+
* Configuration options for remote registry refresh
|
|
5919
|
+
*/
|
|
5920
|
+
interface TokenRegistryConfig {
|
|
5921
|
+
/** Remote URL to fetch token definitions from */
|
|
5922
|
+
remoteUrl?: string;
|
|
5923
|
+
/** StorageProvider for persistent caching */
|
|
5924
|
+
storage?: StorageProvider;
|
|
5925
|
+
/** Refresh interval in ms (default: 1 hour) */
|
|
5926
|
+
refreshIntervalMs?: number;
|
|
5927
|
+
/** Start auto-refresh immediately (default: true) */
|
|
5928
|
+
autoRefresh?: boolean;
|
|
5929
|
+
}
|
|
5740
5930
|
/**
|
|
5741
5931
|
* Token Registry service
|
|
5742
5932
|
*
|
|
5743
5933
|
* Provides lookup functionality for token definitions by coin ID.
|
|
5744
5934
|
* Uses singleton pattern for efficient memory usage.
|
|
5745
5935
|
*
|
|
5936
|
+
* Data flow:
|
|
5937
|
+
* 1. On `configure()`: load cached definitions from StorageProvider (if fresh)
|
|
5938
|
+
* 2. Fetch from remote URL in background
|
|
5939
|
+
* 3. On successful fetch: update in-memory maps + persist to StorageProvider
|
|
5940
|
+
* 4. Repeat every `refreshIntervalMs` (default 1 hour)
|
|
5941
|
+
*
|
|
5942
|
+
* If no cache and no network — registry is empty (lookup methods return fallbacks).
|
|
5943
|
+
*
|
|
5746
5944
|
* @example
|
|
5747
5945
|
* ```ts
|
|
5748
5946
|
* import { TokenRegistry } from '@unicitylabs/sphere-sdk';
|
|
5749
5947
|
*
|
|
5948
|
+
* // Usually called automatically by createBrowserProviders / createNodeProviders
|
|
5949
|
+
* TokenRegistry.configure({
|
|
5950
|
+
* remoteUrl: 'https://raw.githubusercontent.com/.../unicity-ids.testnet.json',
|
|
5951
|
+
* storage: myStorageProvider,
|
|
5952
|
+
* });
|
|
5953
|
+
*
|
|
5750
5954
|
* const registry = TokenRegistry.getInstance();
|
|
5751
|
-
* const def = registry.getDefinition('
|
|
5955
|
+
* const def = registry.getDefinition('455ad87...');
|
|
5752
5956
|
* console.log(def?.symbol); // 'UCT'
|
|
5753
5957
|
* ```
|
|
5754
5958
|
*/
|
|
@@ -5757,19 +5961,79 @@ declare class TokenRegistry {
|
|
|
5757
5961
|
private readonly definitionsById;
|
|
5758
5962
|
private readonly definitionsBySymbol;
|
|
5759
5963
|
private readonly definitionsByName;
|
|
5964
|
+
private remoteUrl;
|
|
5965
|
+
private storage;
|
|
5966
|
+
private refreshIntervalMs;
|
|
5967
|
+
private refreshTimer;
|
|
5968
|
+
private lastRefreshAt;
|
|
5969
|
+
private refreshPromise;
|
|
5760
5970
|
private constructor();
|
|
5761
5971
|
/**
|
|
5762
5972
|
* Get singleton instance of TokenRegistry
|
|
5763
5973
|
*/
|
|
5764
5974
|
static getInstance(): TokenRegistry;
|
|
5765
5975
|
/**
|
|
5766
|
-
*
|
|
5976
|
+
* Configure remote registry refresh with persistent caching.
|
|
5977
|
+
*
|
|
5978
|
+
* On first call:
|
|
5979
|
+
* 1. Loads cached data from StorageProvider (if available and fresh)
|
|
5980
|
+
* 2. Starts periodic remote fetch (if autoRefresh is true, which is default)
|
|
5981
|
+
*
|
|
5982
|
+
* @param options - Configuration options
|
|
5983
|
+
* @param options.remoteUrl - Remote URL to fetch definitions from
|
|
5984
|
+
* @param options.storage - StorageProvider for persistent caching
|
|
5985
|
+
* @param options.refreshIntervalMs - Refresh interval in ms (default: 1 hour)
|
|
5986
|
+
* @param options.autoRefresh - Start auto-refresh immediately (default: true)
|
|
5987
|
+
*/
|
|
5988
|
+
static configure(options: TokenRegistryConfig): void;
|
|
5989
|
+
/**
|
|
5990
|
+
* Reset the singleton instance (useful for testing).
|
|
5991
|
+
* Stops auto-refresh if running.
|
|
5767
5992
|
*/
|
|
5768
5993
|
static resetInstance(): void;
|
|
5769
5994
|
/**
|
|
5770
|
-
*
|
|
5995
|
+
* Destroy the singleton: stop auto-refresh and reset.
|
|
5996
|
+
*/
|
|
5997
|
+
static destroy(): void;
|
|
5998
|
+
/**
|
|
5999
|
+
* Load definitions from StorageProvider cache.
|
|
6000
|
+
* Only applies if cache exists and is fresh (within refreshIntervalMs).
|
|
6001
|
+
*/
|
|
6002
|
+
private loadFromCache;
|
|
6003
|
+
/**
|
|
6004
|
+
* Save definitions to StorageProvider cache.
|
|
6005
|
+
*/
|
|
6006
|
+
private saveToCache;
|
|
6007
|
+
/**
|
|
6008
|
+
* Apply an array of token definitions to the internal maps.
|
|
6009
|
+
* Clears existing data before applying.
|
|
6010
|
+
*/
|
|
6011
|
+
private applyDefinitions;
|
|
6012
|
+
/**
|
|
6013
|
+
* Validate that data is an array of objects with 'id' field
|
|
6014
|
+
*/
|
|
6015
|
+
private isValidDefinitionsArray;
|
|
6016
|
+
/**
|
|
6017
|
+
* Fetch token definitions from the remote URL and update the registry.
|
|
6018
|
+
* On success, also persists to StorageProvider cache.
|
|
6019
|
+
* Returns true on success, false on failure. On failure, existing data is preserved.
|
|
6020
|
+
* Concurrent calls are deduplicated — only one fetch runs at a time.
|
|
6021
|
+
*/
|
|
6022
|
+
refreshFromRemote(): Promise<boolean>;
|
|
6023
|
+
private doRefresh;
|
|
6024
|
+
/**
|
|
6025
|
+
* Start periodic auto-refresh from the remote URL.
|
|
6026
|
+
* Does an immediate fetch, then repeats at the configured interval.
|
|
6027
|
+
*/
|
|
6028
|
+
startAutoRefresh(intervalMs?: number): void;
|
|
6029
|
+
/**
|
|
6030
|
+
* Stop periodic auto-refresh
|
|
6031
|
+
*/
|
|
6032
|
+
stopAutoRefresh(): void;
|
|
6033
|
+
/**
|
|
6034
|
+
* Timestamp of the last successful remote refresh (0 if never refreshed)
|
|
5771
6035
|
*/
|
|
5772
|
-
|
|
6036
|
+
getLastRefreshAt(): number;
|
|
5773
6037
|
/**
|
|
5774
6038
|
* Get token definition by hex coin ID
|
|
5775
6039
|
* @param coinId - 64-character hex string
|
|
@@ -5897,4 +6161,4 @@ declare function getCoinIdBySymbol(symbol: string): string | undefined;
|
|
|
5897
6161
|
*/
|
|
5898
6162
|
declare function getCoinIdByName(name: string): string | undefined;
|
|
5899
6163
|
|
|
5900
|
-
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 CreateGroupOptions, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_AGGREGATOR_URL, DEFAULT_DERIVATION_PATH, DEFAULT_ELECTRUM_URL, DEFAULT_GROUP_RELAYS, DEFAULT_IPFS_BOOTSTRAP_PEERS, DEFAULT_IPFS_GATEWAYS, DEFAULT_NOSTR_RELAYS, DEV_AGGREGATOR_URL, type DecryptionProgressCallback, type DerivationMode, type DirectMessage, type ExtendedValidationResult, type FullIdentity, 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 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 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 PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type ReceiveOptions, type ReceiveResult, type RegistryNetwork, STORAGE_KEYS, STORAGE_PREFIX, type SaveResult, type ScanAddressProgress, type ScanAddressesOptions, type ScanAddressesResult, type ScannedAddressResult, 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, 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, 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 };
|
|
6164
|
+
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 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, 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_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, 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 };
|