@unicitylabs/sphere-sdk 0.7.2 → 0.8.0-dev.0
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 +1127 -767
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +3383 -3147
- package/dist/core/index.d.ts +3383 -3147
- package/dist/core/index.js +1115 -755
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +17 -19
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +17 -19
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +17 -19
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +10 -5
- package/dist/impl/nodejs/index.d.ts +10 -5
- package/dist/impl/nodejs/index.js +17 -19
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/index.cjs +1181 -1041
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3906 -3728
- package/dist/index.d.ts +3906 -3728
- package/dist/index.js +1159 -1019
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -2295,26 +2295,14 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2295
2295
|
}
|
|
2296
2296
|
/**
|
|
2297
2297
|
* Convert a BindingInfo (from nostr-js-sdk) to PeerInfo (sphere-sdk type).
|
|
2298
|
-
* Computes PROXY address from nametag if available.
|
|
2299
2298
|
*/
|
|
2300
2299
|
async bindingInfoToPeerInfo(binding, nametag) {
|
|
2301
|
-
const nametagValue = nametag || binding.nametag;
|
|
2302
|
-
let proxyAddress = binding.proxyAddress;
|
|
2303
|
-
if (nametagValue && !proxyAddress) {
|
|
2304
|
-
try {
|
|
2305
|
-
const { ProxyAddress } = await import("@unicitylabs/state-transition-sdk/lib/address/ProxyAddress");
|
|
2306
|
-
const proxyAddr = await ProxyAddress.fromNameTag(nametagValue);
|
|
2307
|
-
proxyAddress = proxyAddr.toString();
|
|
2308
|
-
} catch {
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
2300
|
return {
|
|
2312
|
-
nametag:
|
|
2301
|
+
nametag: nametag || binding.nametag,
|
|
2313
2302
|
transportPubkey: binding.transportPubkey,
|
|
2314
2303
|
chainPubkey: binding.publicKey || "",
|
|
2315
2304
|
l1Address: binding.l1Address || "",
|
|
2316
2305
|
directAddress: binding.directAddress || "",
|
|
2317
|
-
proxyAddress,
|
|
2318
2306
|
timestamp: binding.timestamp
|
|
2319
2307
|
};
|
|
2320
2308
|
}
|
|
@@ -2340,7 +2328,6 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2340
2328
|
chainPubkey: content.public_key || "",
|
|
2341
2329
|
l1Address: content.l1_address || "",
|
|
2342
2330
|
directAddress: content.direct_address || "",
|
|
2343
|
-
proxyAddress: content.proxy_address || void 0,
|
|
2344
2331
|
timestamp: bindingEvent.created_at * 1e3
|
|
2345
2332
|
};
|
|
2346
2333
|
} catch {
|
|
@@ -2383,7 +2370,6 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2383
2370
|
chainPubkey: content.public_key || "",
|
|
2384
2371
|
l1Address: content.l1_address || "",
|
|
2385
2372
|
directAddress: content.direct_address || "",
|
|
2386
|
-
proxyAddress: content.proxy_address || void 0,
|
|
2387
2373
|
timestamp: event.created_at * 1e3
|
|
2388
2374
|
});
|
|
2389
2375
|
} catch {
|
|
@@ -2453,8 +2439,6 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2453
2439
|
}
|
|
2454
2440
|
const nostrPubkey = this.getNostrPubkey();
|
|
2455
2441
|
if (nametag) {
|
|
2456
|
-
const { ProxyAddress } = await import("@unicitylabs/state-transition-sdk/lib/address/ProxyAddress");
|
|
2457
|
-
const proxyAddr = await ProxyAddress.fromNameTag(nametag);
|
|
2458
2442
|
try {
|
|
2459
2443
|
const success2 = await this.nostrClient.publishNametagBinding(
|
|
2460
2444
|
nametag,
|
|
@@ -2462,8 +2446,7 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2462
2446
|
{
|
|
2463
2447
|
publicKey: chainPubkey,
|
|
2464
2448
|
l1Address,
|
|
2465
|
-
directAddress
|
|
2466
|
-
proxyAddress: proxyAddr.toString()
|
|
2449
|
+
directAddress
|
|
2467
2450
|
}
|
|
2468
2451
|
);
|
|
2469
2452
|
if (success2) {
|
|
@@ -3426,10 +3409,24 @@ var UnicityAggregatorProvider = class {
|
|
|
3426
3409
|
aggregatorClient = null;
|
|
3427
3410
|
stateTransitionClient = null;
|
|
3428
3411
|
trustBase = null;
|
|
3412
|
+
/** Raw trust-base JSON as loaded (kept so the v2 token engine can re-parse it). */
|
|
3413
|
+
trustBaseJson = null;
|
|
3429
3414
|
/** Get the current trust base */
|
|
3430
3415
|
getTrustBase() {
|
|
3431
3416
|
return this.trustBase;
|
|
3432
3417
|
}
|
|
3418
|
+
/** Raw trust-base JSON (for constructing the v2 token engine); null if loaded as an object. */
|
|
3419
|
+
getTrustBaseJson() {
|
|
3420
|
+
return this.trustBaseJson;
|
|
3421
|
+
}
|
|
3422
|
+
/** The aggregator URL this provider is configured against. */
|
|
3423
|
+
getAggregatorUrl() {
|
|
3424
|
+
return this.config.url;
|
|
3425
|
+
}
|
|
3426
|
+
/** The gateway API key (for the v2 token engine); undefined when none is configured. */
|
|
3427
|
+
getApiKey() {
|
|
3428
|
+
return this.config.apiKey || void 0;
|
|
3429
|
+
}
|
|
3433
3430
|
/** Get the state transition client */
|
|
3434
3431
|
getStateTransitionClient() {
|
|
3435
3432
|
return this.stateTransitionClient;
|
|
@@ -3486,6 +3483,7 @@ var UnicityAggregatorProvider = class {
|
|
|
3486
3483
|
try {
|
|
3487
3484
|
const trustBaseJson = await this.config.trustBaseLoader.load();
|
|
3488
3485
|
if (trustBaseJson) {
|
|
3486
|
+
this.trustBaseJson = trustBaseJson;
|
|
3489
3487
|
this.trustBase = import_RootTrustBase.RootTrustBase.fromJSON(trustBaseJson);
|
|
3490
3488
|
}
|
|
3491
3489
|
} catch (error) {
|