@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
|
@@ -2247,26 +2247,14 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2247
2247
|
}
|
|
2248
2248
|
/**
|
|
2249
2249
|
* Convert a BindingInfo (from nostr-js-sdk) to PeerInfo (sphere-sdk type).
|
|
2250
|
-
* Computes PROXY address from nametag if available.
|
|
2251
2250
|
*/
|
|
2252
2251
|
async bindingInfoToPeerInfo(binding, nametag) {
|
|
2253
|
-
const nametagValue = nametag || binding.nametag;
|
|
2254
|
-
let proxyAddress = binding.proxyAddress;
|
|
2255
|
-
if (nametagValue && !proxyAddress) {
|
|
2256
|
-
try {
|
|
2257
|
-
const { ProxyAddress } = await import("@unicitylabs/state-transition-sdk/lib/address/ProxyAddress");
|
|
2258
|
-
const proxyAddr = await ProxyAddress.fromNameTag(nametagValue);
|
|
2259
|
-
proxyAddress = proxyAddr.toString();
|
|
2260
|
-
} catch {
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
2252
|
return {
|
|
2264
|
-
nametag:
|
|
2253
|
+
nametag: nametag || binding.nametag,
|
|
2265
2254
|
transportPubkey: binding.transportPubkey,
|
|
2266
2255
|
chainPubkey: binding.publicKey || "",
|
|
2267
2256
|
l1Address: binding.l1Address || "",
|
|
2268
2257
|
directAddress: binding.directAddress || "",
|
|
2269
|
-
proxyAddress,
|
|
2270
2258
|
timestamp: binding.timestamp
|
|
2271
2259
|
};
|
|
2272
2260
|
}
|
|
@@ -2292,7 +2280,6 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2292
2280
|
chainPubkey: content.public_key || "",
|
|
2293
2281
|
l1Address: content.l1_address || "",
|
|
2294
2282
|
directAddress: content.direct_address || "",
|
|
2295
|
-
proxyAddress: content.proxy_address || void 0,
|
|
2296
2283
|
timestamp: bindingEvent.created_at * 1e3
|
|
2297
2284
|
};
|
|
2298
2285
|
} catch {
|
|
@@ -2335,7 +2322,6 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2335
2322
|
chainPubkey: content.public_key || "",
|
|
2336
2323
|
l1Address: content.l1_address || "",
|
|
2337
2324
|
directAddress: content.direct_address || "",
|
|
2338
|
-
proxyAddress: content.proxy_address || void 0,
|
|
2339
2325
|
timestamp: event.created_at * 1e3
|
|
2340
2326
|
});
|
|
2341
2327
|
} catch {
|
|
@@ -2405,8 +2391,6 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2405
2391
|
}
|
|
2406
2392
|
const nostrPubkey = this.getNostrPubkey();
|
|
2407
2393
|
if (nametag) {
|
|
2408
|
-
const { ProxyAddress } = await import("@unicitylabs/state-transition-sdk/lib/address/ProxyAddress");
|
|
2409
|
-
const proxyAddr = await ProxyAddress.fromNameTag(nametag);
|
|
2410
2394
|
try {
|
|
2411
2395
|
const success2 = await this.nostrClient.publishNametagBinding(
|
|
2412
2396
|
nametag,
|
|
@@ -2414,8 +2398,7 @@ var NostrTransportProvider = class _NostrTransportProvider {
|
|
|
2414
2398
|
{
|
|
2415
2399
|
publicKey: chainPubkey,
|
|
2416
2400
|
l1Address,
|
|
2417
|
-
directAddress
|
|
2418
|
-
proxyAddress: proxyAddr.toString()
|
|
2401
|
+
directAddress
|
|
2419
2402
|
}
|
|
2420
2403
|
);
|
|
2421
2404
|
if (success2) {
|
|
@@ -3378,10 +3361,24 @@ var UnicityAggregatorProvider = class {
|
|
|
3378
3361
|
aggregatorClient = null;
|
|
3379
3362
|
stateTransitionClient = null;
|
|
3380
3363
|
trustBase = null;
|
|
3364
|
+
/** Raw trust-base JSON as loaded (kept so the v2 token engine can re-parse it). */
|
|
3365
|
+
trustBaseJson = null;
|
|
3381
3366
|
/** Get the current trust base */
|
|
3382
3367
|
getTrustBase() {
|
|
3383
3368
|
return this.trustBase;
|
|
3384
3369
|
}
|
|
3370
|
+
/** Raw trust-base JSON (for constructing the v2 token engine); null if loaded as an object. */
|
|
3371
|
+
getTrustBaseJson() {
|
|
3372
|
+
return this.trustBaseJson;
|
|
3373
|
+
}
|
|
3374
|
+
/** The aggregator URL this provider is configured against. */
|
|
3375
|
+
getAggregatorUrl() {
|
|
3376
|
+
return this.config.url;
|
|
3377
|
+
}
|
|
3378
|
+
/** The gateway API key (for the v2 token engine); undefined when none is configured. */
|
|
3379
|
+
getApiKey() {
|
|
3380
|
+
return this.config.apiKey || void 0;
|
|
3381
|
+
}
|
|
3385
3382
|
/** Get the state transition client */
|
|
3386
3383
|
getStateTransitionClient() {
|
|
3387
3384
|
return this.stateTransitionClient;
|
|
@@ -3438,6 +3435,7 @@ var UnicityAggregatorProvider = class {
|
|
|
3438
3435
|
try {
|
|
3439
3436
|
const trustBaseJson = await this.config.trustBaseLoader.load();
|
|
3440
3437
|
if (trustBaseJson) {
|
|
3438
|
+
this.trustBaseJson = trustBaseJson;
|
|
3441
3439
|
this.trustBase = RootTrustBase.fromJSON(trustBaseJson);
|
|
3442
3440
|
}
|
|
3443
3441
|
} catch (error) {
|