@unicitylabs/sphere-sdk 0.3.7 → 0.3.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/core/index.cjs +97 -2589
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +11 -222
- package/dist/core/index.d.ts +11 -222
- package/dist/core/index.js +93 -2585
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +233 -195
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +234 -198
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/browser/ipfs.cjs +6 -1
- package/dist/impl/browser/ipfs.cjs.map +1 -1
- package/dist/impl/browser/ipfs.js +6 -1
- package/dist/impl/browser/ipfs.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +205 -142
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +2 -70
- package/dist/impl/nodejs/index.d.ts +2 -70
- package/dist/impl/nodejs/index.js +206 -145
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/index.cjs +239 -2600
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -226
- package/dist/index.d.ts +60 -226
- package/dist/index.js +235 -2593
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -422,27 +422,6 @@ interface TransportProvider extends BaseProvider {
|
|
|
422
422
|
* @returns Unsubscribe function
|
|
423
423
|
*/
|
|
424
424
|
onPaymentRequestResponse?(handler: PaymentRequestResponseHandler): () => void;
|
|
425
|
-
/**
|
|
426
|
-
* Send a read receipt for a message
|
|
427
|
-
* @param recipientTransportPubkey - Transport pubkey of the message sender
|
|
428
|
-
* @param messageEventId - Event ID of the message being acknowledged
|
|
429
|
-
*/
|
|
430
|
-
sendReadReceipt?(recipientTransportPubkey: string, messageEventId: string): Promise<void>;
|
|
431
|
-
/**
|
|
432
|
-
* Subscribe to incoming read receipts
|
|
433
|
-
* @returns Unsubscribe function
|
|
434
|
-
*/
|
|
435
|
-
onReadReceipt?(handler: ReadReceiptHandler): () => void;
|
|
436
|
-
/**
|
|
437
|
-
* Send typing indicator to a recipient
|
|
438
|
-
* @param recipientTransportPubkey - Transport pubkey of the conversation partner
|
|
439
|
-
*/
|
|
440
|
-
sendTypingIndicator?(recipientTransportPubkey: string): Promise<void>;
|
|
441
|
-
/**
|
|
442
|
-
* Subscribe to incoming typing indicators
|
|
443
|
-
* @returns Unsubscribe function
|
|
444
|
-
*/
|
|
445
|
-
onTypingIndicator?(handler: TypingIndicatorHandler): () => void;
|
|
446
425
|
/**
|
|
447
426
|
* Get list of configured relay URLs
|
|
448
427
|
*/
|
|
@@ -532,10 +511,6 @@ interface IncomingMessage {
|
|
|
532
511
|
content: string;
|
|
533
512
|
timestamp: number;
|
|
534
513
|
encrypted: boolean;
|
|
535
|
-
/** Set when this is a self-wrap replay (sent message recovered from relay) */
|
|
536
|
-
isSelfWrap?: boolean;
|
|
537
|
-
/** Recipient pubkey — only present on self-wrap replays */
|
|
538
|
-
recipientTransportPubkey?: string;
|
|
539
514
|
}
|
|
540
515
|
type MessageHandler = (message: IncomingMessage) => void;
|
|
541
516
|
interface TokenTransferPayload {
|
|
@@ -657,24 +632,6 @@ interface PeerInfo {
|
|
|
657
632
|
/** Event timestamp */
|
|
658
633
|
timestamp: number;
|
|
659
634
|
}
|
|
660
|
-
interface IncomingReadReceipt {
|
|
661
|
-
/** Transport-specific pubkey of the sender who read the message */
|
|
662
|
-
senderTransportPubkey: string;
|
|
663
|
-
/** Event ID of the message that was read */
|
|
664
|
-
messageEventId: string;
|
|
665
|
-
/** Timestamp */
|
|
666
|
-
timestamp: number;
|
|
667
|
-
}
|
|
668
|
-
type ReadReceiptHandler = (receipt: IncomingReadReceipt) => void;
|
|
669
|
-
interface IncomingTypingIndicator {
|
|
670
|
-
/** Transport-specific pubkey of the sender who is typing */
|
|
671
|
-
senderTransportPubkey: string;
|
|
672
|
-
/** Sender's nametag (if known) */
|
|
673
|
-
senderNametag?: string;
|
|
674
|
-
/** Timestamp */
|
|
675
|
-
timestamp: number;
|
|
676
|
-
}
|
|
677
|
-
type TypingIndicatorHandler = (indicator: IncomingTypingIndicator) => void;
|
|
678
635
|
|
|
679
636
|
/**
|
|
680
637
|
* WebSocket Abstraction
|
|
@@ -767,8 +724,6 @@ declare class NostrTransportProvider implements TransportProvider {
|
|
|
767
724
|
private transferHandlers;
|
|
768
725
|
private paymentRequestHandlers;
|
|
769
726
|
private paymentRequestResponseHandlers;
|
|
770
|
-
private readReceiptHandlers;
|
|
771
|
-
private typingIndicatorHandlers;
|
|
772
727
|
private broadcastHandlers;
|
|
773
728
|
private eventCallbacks;
|
|
774
729
|
constructor(config: NostrTransportProviderConfig);
|
|
@@ -818,10 +773,6 @@ declare class NostrTransportProvider implements TransportProvider {
|
|
|
818
773
|
onPaymentRequest(handler: PaymentRequestHandler): () => void;
|
|
819
774
|
sendPaymentRequestResponse(recipientPubkey: string, payload: PaymentRequestResponsePayload): Promise<string>;
|
|
820
775
|
onPaymentRequestResponse(handler: PaymentRequestResponseHandler): () => void;
|
|
821
|
-
sendReadReceipt(recipientTransportPubkey: string, messageEventId: string): Promise<void>;
|
|
822
|
-
onReadReceipt(handler: ReadReceiptHandler): () => void;
|
|
823
|
-
sendTypingIndicator(recipientTransportPubkey: string): Promise<void>;
|
|
824
|
-
onTypingIndicator(handler: TypingIndicatorHandler): () => void;
|
|
825
776
|
/**
|
|
826
777
|
* Resolve any identifier to full peer information.
|
|
827
778
|
* Routes to the appropriate specific resolve method based on identifier format.
|
|
@@ -1239,6 +1190,7 @@ declare const createUnicityOracleProvider: typeof createUnicityAggregatorProvide
|
|
|
1239
1190
|
* Platform-independent abstraction for fetching token market prices.
|
|
1240
1191
|
* Does not extend BaseProvider — stateless HTTP client with internal caching.
|
|
1241
1192
|
*/
|
|
1193
|
+
|
|
1242
1194
|
/**
|
|
1243
1195
|
* Supported price provider platforms
|
|
1244
1196
|
*/
|
|
@@ -1283,7 +1235,7 @@ interface PriceProvider {
|
|
|
1283
1235
|
/**
|
|
1284
1236
|
* Get price for a single token
|
|
1285
1237
|
* @param tokenName - Token name (e.g., 'bitcoin')
|
|
1286
|
-
* @returns Token price or null
|
|
1238
|
+
* @returns Token price (zero-price entry for tokens not listed on the platform), or null on network error with no cache
|
|
1287
1239
|
*/
|
|
1288
1240
|
getPrice(tokenName: string): Promise<TokenPrice | null>;
|
|
1289
1241
|
/**
|
|
@@ -1364,15 +1316,6 @@ interface BasePriceConfig {
|
|
|
1364
1316
|
/** Enable debug logging */
|
|
1365
1317
|
debug?: boolean;
|
|
1366
1318
|
}
|
|
1367
|
-
/**
|
|
1368
|
-
* Base market module configuration
|
|
1369
|
-
*/
|
|
1370
|
-
interface BaseMarketConfig {
|
|
1371
|
-
/** Market API base URL (default: https://market-api.unicity.network) */
|
|
1372
|
-
apiUrl?: string;
|
|
1373
|
-
/** Request timeout in ms (default: 30000) */
|
|
1374
|
-
timeout?: number;
|
|
1375
|
-
}
|
|
1376
1319
|
/**
|
|
1377
1320
|
* Base providers result
|
|
1378
1321
|
* Common structure for all platforms
|
|
@@ -1388,13 +1331,6 @@ interface BaseProviders {
|
|
|
1388
1331
|
price?: PriceProvider;
|
|
1389
1332
|
}
|
|
1390
1333
|
|
|
1391
|
-
interface MarketModuleConfig {
|
|
1392
|
-
/** Market API base URL (default: https://market-api.unicity.network) */
|
|
1393
|
-
apiUrl?: string;
|
|
1394
|
-
/** Request timeout in ms (default: 30000) */
|
|
1395
|
-
timeout?: number;
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
1334
|
/** IPFS storage provider configuration */
|
|
1399
1335
|
interface IpfsStorageConfig {
|
|
1400
1336
|
/** Gateway URLs for HTTP API (defaults to Unicity dedicated nodes) */
|
|
@@ -1487,8 +1423,6 @@ interface NodeProvidersConfig {
|
|
|
1487
1423
|
enabled?: boolean;
|
|
1488
1424
|
relays?: string[];
|
|
1489
1425
|
} | boolean;
|
|
1490
|
-
/** Market module configuration. true = enable with defaults, object = custom config */
|
|
1491
|
-
market?: BaseMarketConfig | boolean;
|
|
1492
1426
|
}
|
|
1493
1427
|
interface NodeProviders {
|
|
1494
1428
|
storage: StorageProvider;
|
|
@@ -1503,8 +1437,6 @@ interface NodeProviders {
|
|
|
1503
1437
|
ipfsTokenStorage?: TokenStorageProvider<TxfStorageDataBase>;
|
|
1504
1438
|
/** Group chat config (resolved, for passing to Sphere.init) */
|
|
1505
1439
|
groupChat?: GroupChatModuleConfig | boolean;
|
|
1506
|
-
/** Market module config (resolved, for passing to Sphere.init) */
|
|
1507
|
-
market?: MarketModuleConfig | boolean;
|
|
1508
1440
|
}
|
|
1509
1441
|
/**
|
|
1510
1442
|
* Create all Node.js providers with default configuration
|
|
@@ -422,27 +422,6 @@ interface TransportProvider extends BaseProvider {
|
|
|
422
422
|
* @returns Unsubscribe function
|
|
423
423
|
*/
|
|
424
424
|
onPaymentRequestResponse?(handler: PaymentRequestResponseHandler): () => void;
|
|
425
|
-
/**
|
|
426
|
-
* Send a read receipt for a message
|
|
427
|
-
* @param recipientTransportPubkey - Transport pubkey of the message sender
|
|
428
|
-
* @param messageEventId - Event ID of the message being acknowledged
|
|
429
|
-
*/
|
|
430
|
-
sendReadReceipt?(recipientTransportPubkey: string, messageEventId: string): Promise<void>;
|
|
431
|
-
/**
|
|
432
|
-
* Subscribe to incoming read receipts
|
|
433
|
-
* @returns Unsubscribe function
|
|
434
|
-
*/
|
|
435
|
-
onReadReceipt?(handler: ReadReceiptHandler): () => void;
|
|
436
|
-
/**
|
|
437
|
-
* Send typing indicator to a recipient
|
|
438
|
-
* @param recipientTransportPubkey - Transport pubkey of the conversation partner
|
|
439
|
-
*/
|
|
440
|
-
sendTypingIndicator?(recipientTransportPubkey: string): Promise<void>;
|
|
441
|
-
/**
|
|
442
|
-
* Subscribe to incoming typing indicators
|
|
443
|
-
* @returns Unsubscribe function
|
|
444
|
-
*/
|
|
445
|
-
onTypingIndicator?(handler: TypingIndicatorHandler): () => void;
|
|
446
425
|
/**
|
|
447
426
|
* Get list of configured relay URLs
|
|
448
427
|
*/
|
|
@@ -532,10 +511,6 @@ interface IncomingMessage {
|
|
|
532
511
|
content: string;
|
|
533
512
|
timestamp: number;
|
|
534
513
|
encrypted: boolean;
|
|
535
|
-
/** Set when this is a self-wrap replay (sent message recovered from relay) */
|
|
536
|
-
isSelfWrap?: boolean;
|
|
537
|
-
/** Recipient pubkey — only present on self-wrap replays */
|
|
538
|
-
recipientTransportPubkey?: string;
|
|
539
514
|
}
|
|
540
515
|
type MessageHandler = (message: IncomingMessage) => void;
|
|
541
516
|
interface TokenTransferPayload {
|
|
@@ -657,24 +632,6 @@ interface PeerInfo {
|
|
|
657
632
|
/** Event timestamp */
|
|
658
633
|
timestamp: number;
|
|
659
634
|
}
|
|
660
|
-
interface IncomingReadReceipt {
|
|
661
|
-
/** Transport-specific pubkey of the sender who read the message */
|
|
662
|
-
senderTransportPubkey: string;
|
|
663
|
-
/** Event ID of the message that was read */
|
|
664
|
-
messageEventId: string;
|
|
665
|
-
/** Timestamp */
|
|
666
|
-
timestamp: number;
|
|
667
|
-
}
|
|
668
|
-
type ReadReceiptHandler = (receipt: IncomingReadReceipt) => void;
|
|
669
|
-
interface IncomingTypingIndicator {
|
|
670
|
-
/** Transport-specific pubkey of the sender who is typing */
|
|
671
|
-
senderTransportPubkey: string;
|
|
672
|
-
/** Sender's nametag (if known) */
|
|
673
|
-
senderNametag?: string;
|
|
674
|
-
/** Timestamp */
|
|
675
|
-
timestamp: number;
|
|
676
|
-
}
|
|
677
|
-
type TypingIndicatorHandler = (indicator: IncomingTypingIndicator) => void;
|
|
678
635
|
|
|
679
636
|
/**
|
|
680
637
|
* WebSocket Abstraction
|
|
@@ -767,8 +724,6 @@ declare class NostrTransportProvider implements TransportProvider {
|
|
|
767
724
|
private transferHandlers;
|
|
768
725
|
private paymentRequestHandlers;
|
|
769
726
|
private paymentRequestResponseHandlers;
|
|
770
|
-
private readReceiptHandlers;
|
|
771
|
-
private typingIndicatorHandlers;
|
|
772
727
|
private broadcastHandlers;
|
|
773
728
|
private eventCallbacks;
|
|
774
729
|
constructor(config: NostrTransportProviderConfig);
|
|
@@ -818,10 +773,6 @@ declare class NostrTransportProvider implements TransportProvider {
|
|
|
818
773
|
onPaymentRequest(handler: PaymentRequestHandler): () => void;
|
|
819
774
|
sendPaymentRequestResponse(recipientPubkey: string, payload: PaymentRequestResponsePayload): Promise<string>;
|
|
820
775
|
onPaymentRequestResponse(handler: PaymentRequestResponseHandler): () => void;
|
|
821
|
-
sendReadReceipt(recipientTransportPubkey: string, messageEventId: string): Promise<void>;
|
|
822
|
-
onReadReceipt(handler: ReadReceiptHandler): () => void;
|
|
823
|
-
sendTypingIndicator(recipientTransportPubkey: string): Promise<void>;
|
|
824
|
-
onTypingIndicator(handler: TypingIndicatorHandler): () => void;
|
|
825
776
|
/**
|
|
826
777
|
* Resolve any identifier to full peer information.
|
|
827
778
|
* Routes to the appropriate specific resolve method based on identifier format.
|
|
@@ -1239,6 +1190,7 @@ declare const createUnicityOracleProvider: typeof createUnicityAggregatorProvide
|
|
|
1239
1190
|
* Platform-independent abstraction for fetching token market prices.
|
|
1240
1191
|
* Does not extend BaseProvider — stateless HTTP client with internal caching.
|
|
1241
1192
|
*/
|
|
1193
|
+
|
|
1242
1194
|
/**
|
|
1243
1195
|
* Supported price provider platforms
|
|
1244
1196
|
*/
|
|
@@ -1283,7 +1235,7 @@ interface PriceProvider {
|
|
|
1283
1235
|
/**
|
|
1284
1236
|
* Get price for a single token
|
|
1285
1237
|
* @param tokenName - Token name (e.g., 'bitcoin')
|
|
1286
|
-
* @returns Token price or null
|
|
1238
|
+
* @returns Token price (zero-price entry for tokens not listed on the platform), or null on network error with no cache
|
|
1287
1239
|
*/
|
|
1288
1240
|
getPrice(tokenName: string): Promise<TokenPrice | null>;
|
|
1289
1241
|
/**
|
|
@@ -1364,15 +1316,6 @@ interface BasePriceConfig {
|
|
|
1364
1316
|
/** Enable debug logging */
|
|
1365
1317
|
debug?: boolean;
|
|
1366
1318
|
}
|
|
1367
|
-
/**
|
|
1368
|
-
* Base market module configuration
|
|
1369
|
-
*/
|
|
1370
|
-
interface BaseMarketConfig {
|
|
1371
|
-
/** Market API base URL (default: https://market-api.unicity.network) */
|
|
1372
|
-
apiUrl?: string;
|
|
1373
|
-
/** Request timeout in ms (default: 30000) */
|
|
1374
|
-
timeout?: number;
|
|
1375
|
-
}
|
|
1376
1319
|
/**
|
|
1377
1320
|
* Base providers result
|
|
1378
1321
|
* Common structure for all platforms
|
|
@@ -1388,13 +1331,6 @@ interface BaseProviders {
|
|
|
1388
1331
|
price?: PriceProvider;
|
|
1389
1332
|
}
|
|
1390
1333
|
|
|
1391
|
-
interface MarketModuleConfig {
|
|
1392
|
-
/** Market API base URL (default: https://market-api.unicity.network) */
|
|
1393
|
-
apiUrl?: string;
|
|
1394
|
-
/** Request timeout in ms (default: 30000) */
|
|
1395
|
-
timeout?: number;
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
1334
|
/** IPFS storage provider configuration */
|
|
1399
1335
|
interface IpfsStorageConfig {
|
|
1400
1336
|
/** Gateway URLs for HTTP API (defaults to Unicity dedicated nodes) */
|
|
@@ -1487,8 +1423,6 @@ interface NodeProvidersConfig {
|
|
|
1487
1423
|
enabled?: boolean;
|
|
1488
1424
|
relays?: string[];
|
|
1489
1425
|
} | boolean;
|
|
1490
|
-
/** Market module configuration. true = enable with defaults, object = custom config */
|
|
1491
|
-
market?: BaseMarketConfig | boolean;
|
|
1492
1426
|
}
|
|
1493
1427
|
interface NodeProviders {
|
|
1494
1428
|
storage: StorageProvider;
|
|
@@ -1503,8 +1437,6 @@ interface NodeProviders {
|
|
|
1503
1437
|
ipfsTokenStorage?: TokenStorageProvider<TxfStorageDataBase>;
|
|
1504
1438
|
/** Group chat config (resolved, for passing to Sphere.init) */
|
|
1505
1439
|
groupChat?: GroupChatModuleConfig | boolean;
|
|
1506
|
-
/** Market module config (resolved, for passing to Sphere.init) */
|
|
1507
|
-
market?: MarketModuleConfig | boolean;
|
|
1508
1440
|
}
|
|
1509
1441
|
/**
|
|
1510
1442
|
* Create all Node.js providers with default configuration
|