@unicitylabs/sphere-sdk 0.15.0-dev.1 → 0.16.0-dev.1
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/README.md +15 -5
- package/dist/connect/index.cjs +23 -25
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.cts +4 -0
- package/dist/connect/index.d.ts +4 -0
- package/dist/connect/index.js +23 -25
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +726 -225
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +172 -21
- package/dist/core/index.d.ts +172 -21
- package/dist/core/index.js +726 -224
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +23 -25
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +23 -25
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +331 -504
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +331 -504
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/connect/index.cjs +22 -24
- package/dist/impl/nodejs/connect/index.cjs.map +1 -1
- package/dist/impl/nodejs/connect/index.js +22 -24
- package/dist/impl/nodejs/connect/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +298 -569
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +90 -13
- package/dist/impl/nodejs/index.d.ts +90 -13
- package/dist/impl/nodejs/index.js +298 -569
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/impl/shared/wallet-api/index.d.cts +54 -2
- package/dist/impl/shared/wallet-api/index.d.ts +54 -2
- package/dist/index.cjs +728 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -108
- package/dist/index.d.ts +227 -108
- package/dist/index.js +728 -224
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +11 -7
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +56 -3
- package/dist/modules/payments-v2/index.d.ts +56 -3
- package/dist/modules/payments-v2/index.js +11 -7
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/dist/token-engine/index.cjs +46 -0
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.js +46 -0
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -167,17 +167,8 @@ var NETWORK_SCOPED_ADDRESS_PREFIXES = [
|
|
|
167
167
|
"inv_ledger:"
|
|
168
168
|
// AccountingModule INV_LEDGER_PREFIX
|
|
169
169
|
];
|
|
170
|
-
var DEFAULT_NOSTR_RELAYS = [
|
|
171
|
-
"wss://relay.unicity.network",
|
|
172
|
-
"wss://relay.damus.io",
|
|
173
|
-
"wss://nos.lol",
|
|
174
|
-
"wss://relay.nostr.band"
|
|
175
|
-
];
|
|
176
|
-
var DEFAULT_AGGREGATOR_URL = "https://aggregator.unicity.network/rpc";
|
|
177
|
-
var DEV_AGGREGATOR_URL = "https://dev-aggregator.dyndns.org/rpc";
|
|
178
170
|
var DEFAULT_BASE_PATH = "m/44'/0'/0'";
|
|
179
171
|
var DEFAULT_DERIVATION_PATH = `${DEFAULT_BASE_PATH}/0/0`;
|
|
180
|
-
var TOKEN_REGISTRY_URL = "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet.json";
|
|
181
172
|
var TEST_NOSTR_RELAYS = [
|
|
182
173
|
"wss://nostr-relay.testnet.unicity.network"
|
|
183
174
|
];
|
|
@@ -187,10 +178,19 @@ var DEFAULT_GROUP_RELAYS = [
|
|
|
187
178
|
var NETWORKS = {
|
|
188
179
|
mainnet: {
|
|
189
180
|
name: "Mainnet",
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
networkId: 1,
|
|
182
|
+
// v3 state-transition gateway (networkId 1 comes from the trust base). apiKey is env-injected;
|
|
183
|
+
// unlike testnet2's, a mainnet gateway key is a SECRET — never commit one.
|
|
184
|
+
aggregatorUrl: "https://gateway.mainnet.unicity.network",
|
|
185
|
+
// Mainnet has no relay of its own yet — it shares the testnet relay until one is stood up.
|
|
186
|
+
// Consequence while shared: nametag bindings for both networks live in ONE namespace, and
|
|
187
|
+
// since bindings carry no network the cross-network recipient guard can only signal (#734).
|
|
188
|
+
nostrRelays: TEST_NOSTR_RELAYS,
|
|
192
189
|
groupRelays: DEFAULT_GROUP_RELAYS,
|
|
193
|
-
|
|
190
|
+
// Published, but currently only the non-fungible base token type — no fungible
|
|
191
|
+
// coins yet, so those still miss the registry (decimals 0, symbol falls back to
|
|
192
|
+
// six hex chars). Presentation only: the money path treats coinId as opaque bytes.
|
|
193
|
+
tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.mainnet.json"
|
|
194
194
|
},
|
|
195
195
|
// v1 cutover: 'testnet' now POINTS AT TESTNET2 (the v2 gateway network). The
|
|
196
196
|
// old goggregator testnet spoke the removed v1 protocol — a v2 engine cannot
|
|
@@ -214,19 +214,10 @@ var NETWORKS = {
|
|
|
214
214
|
// reuse testnet infra (shared relays/ipfs)
|
|
215
215
|
groupRelays: DEFAULT_GROUP_RELAYS,
|
|
216
216
|
tokenRegistryUrl: "https://raw.githubusercontent.com/unicitynetwork/unicity-ids/refs/heads/main/unicity-ids.testnet2.json"
|
|
217
|
-
},
|
|
218
|
-
// NOTE: mainnet/dev still point at v1-era aggregators. The v2 engine cannot
|
|
219
|
-
// operate against them until their gateways are cut over to the v2 protocol —
|
|
220
|
-
// wallet operations on these networks fail loudly (AGGREGATOR_ERROR) until then.
|
|
221
|
-
dev: {
|
|
222
|
-
name: "Development",
|
|
223
|
-
aggregatorUrl: DEV_AGGREGATOR_URL,
|
|
224
|
-
nostrRelays: TEST_NOSTR_RELAYS,
|
|
225
|
-
groupRelays: DEFAULT_GROUP_RELAYS,
|
|
226
|
-
tokenRegistryUrl: TOKEN_REGISTRY_URL
|
|
227
217
|
}
|
|
228
218
|
};
|
|
229
219
|
var SPHERE_NETWORKS = {
|
|
220
|
+
mainnet: { id: NETWORKS.mainnet.networkId, name: "mainnet" },
|
|
230
221
|
testnet2: { id: NETWORKS.testnet2.networkId, name: "testnet2" }
|
|
231
222
|
};
|
|
232
223
|
|
|
@@ -393,8 +384,15 @@ var REALTIME_STATUS = {
|
|
|
393
384
|
function toLegacyRequest(view, status) {
|
|
394
385
|
return { ...view, symbol: view.symbol ?? "", status };
|
|
395
386
|
}
|
|
387
|
+
function paymentsOrNull(sphere) {
|
|
388
|
+
try {
|
|
389
|
+
return sphere.payments;
|
|
390
|
+
} catch {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
396
394
|
function legacyRequestPayload(sphere, update) {
|
|
397
|
-
const view = sphere
|
|
395
|
+
const view = paymentsOrNull(sphere)?.requests.list().find((request) => request.id === update.id);
|
|
398
396
|
if (!view) {
|
|
399
397
|
return {
|
|
400
398
|
id: update.id,
|
|
@@ -473,7 +471,7 @@ var COMPAT_ATTACHERS = /* @__PURE__ */ new Map([
|
|
|
473
471
|
forward({ providerId: "wallet-api", error: "wallet-api connection degraded" });
|
|
474
472
|
})],
|
|
475
473
|
["sync:completed", (sphere, forward) => sphere.on("inventory:updated", () => {
|
|
476
|
-
forward({ source: "payments", count: sphere
|
|
474
|
+
forward({ source: "payments", count: paymentsOrNull(sphere)?.tokens().length ?? 0 });
|
|
477
475
|
})],
|
|
478
476
|
["sync:remote-update", remoteUpdateAttacher]
|
|
479
477
|
]);
|