@xyo-network/os-runtime 8.0.0 → 8.0.2
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 +2 -2
- package/dist/neutral/Caller.d.ts.map +1 -1
- package/dist/neutral/XyOsBase.d.ts +16 -16
- package/dist/neutral/adapter/Base.d.ts.map +1 -1
- package/dist/neutral/adapter/Network.d.ts +1 -1
- package/dist/neutral/adapter/Network.d.ts.map +1 -1
- package/dist/neutral/classes/settings/Caller.d.ts.map +1 -1
- package/dist/neutral/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/neutral/dapp/context/creator/Creator.d.ts.map +1 -1
- package/dist/neutral/dapp/context/creator/ExternalModulePermissions/ExternalModulePermissions.d.ts.map +1 -1
- package/dist/neutral/event/bus/Connection.d.ts +2 -1
- package/dist/neutral/event/bus/Connection.d.ts.map +1 -1
- package/dist/neutral/event/bus/EventBus.d.ts.map +1 -1
- package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
- package/dist/neutral/index.mjs +93 -88
- package/dist/neutral/index.mjs.map +2 -2
- package/dist/neutral/lib/PayloadStore.d.ts.map +1 -1
- package/dist/neutral/profileModuleEvents.d.ts +1 -2
- package/dist/neutral/profileModuleEvents.d.ts.map +1 -1
- package/dist/neutral/registration/DappRegistrationService.d.ts.map +1 -1
- package/dist/neutral/registration/DappRegistry.d.ts.map +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
- package/dist/neutral/stack/OsPubSubNetworkStack.d.ts.map +1 -1
- package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/neutral/wallet/DappSeedPhraseRepository.d.ts +1 -1
- package/dist/neutral/wallet/DappSeedPhraseRepository.d.ts.map +1 -1
- package/dist/node/Caller.d.ts.map +1 -1
- package/dist/node/XyOsBase.d.ts +16 -16
- package/dist/node/adapter/Base.d.ts.map +1 -1
- package/dist/node/adapter/Network.d.ts +1 -1
- package/dist/node/adapter/Network.d.ts.map +1 -1
- package/dist/node/classes/settings/Caller.d.ts.map +1 -1
- package/dist/node/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/node/dapp/context/creator/Creator.d.ts.map +1 -1
- package/dist/node/dapp/context/creator/ExternalModulePermissions/ExternalModulePermissions.d.ts.map +1 -1
- package/dist/node/event/bus/Connection.d.ts +2 -1
- package/dist/node/event/bus/Connection.d.ts.map +1 -1
- package/dist/node/event/bus/EventBus.d.ts.map +1 -1
- package/dist/node/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
- package/dist/node/index.mjs +93 -88
- package/dist/node/index.mjs.map +2 -2
- package/dist/node/lib/PayloadStore.d.ts.map +1 -1
- package/dist/node/profileModuleEvents.d.ts +1 -2
- package/dist/node/profileModuleEvents.d.ts.map +1 -1
- package/dist/node/registration/DappRegistrationService.d.ts.map +1 -1
- package/dist/node/registration/DappRegistry.d.ts.map +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
- package/dist/node/scripts/xyos/index.mjs +76 -72
- package/dist/node/scripts/xyos/index.mjs.map +2 -2
- package/dist/node/stack/OsPubSubNetworkStack.d.ts.map +1 -1
- package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/node/wallet/DappSeedPhraseRepository.d.ts +1 -1
- package/dist/node/wallet/DappSeedPhraseRepository.d.ts.map +1 -1
- package/package.json +48 -83
- package/dist/neutral/scripts/xyos/command/index.d.ts +0 -6
- package/dist/neutral/scripts/xyos/command/index.d.ts.map +0 -1
- package/dist/node/scripts/xyos/command/index.d.ts +0 -6
- package/dist/node/scripts/xyos/command/index.d.ts.map +0 -1
package/dist/node/index.mjs
CHANGED
|
@@ -126,7 +126,7 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
|
|
|
126
126
|
schemas: [DappWalletSeedPhraseSchema]
|
|
127
127
|
};
|
|
128
128
|
const results = await diviner.divine([query]);
|
|
129
|
-
return results
|
|
129
|
+
return results[0];
|
|
130
130
|
}
|
|
131
131
|
async checkWalletId(walletId) {
|
|
132
132
|
const diviner = await this.getDappsArchivistPayloadDiviner();
|
|
@@ -138,7 +138,7 @@ var DappSeedPhraseRepository = class extends OsCallerBase {
|
|
|
138
138
|
walletId
|
|
139
139
|
};
|
|
140
140
|
const results = await diviner.divine([query]);
|
|
141
|
-
return results
|
|
141
|
+
return results[0];
|
|
142
142
|
}
|
|
143
143
|
newPhrase() {
|
|
144
144
|
return HDWallet.generateMnemonic();
|
|
@@ -355,11 +355,12 @@ var DappAccessPayloads = class {
|
|
|
355
355
|
async payloads() {
|
|
356
356
|
const osCaller = new OsCallerBase(this.context);
|
|
357
357
|
const archivist = await osCaller.getRegisteredDappInterfacesArchivist();
|
|
358
|
-
return await archivist.
|
|
358
|
+
return await archivist.next();
|
|
359
359
|
}
|
|
360
360
|
};
|
|
361
361
|
|
|
362
362
|
// src/dapp/context/creator/DefaultPayloads/NodeInfoPayload.ts
|
|
363
|
+
import { ZERO_ADDRESS } from "@xylabs/sdk-js";
|
|
363
364
|
import { NodeOsInfoSchema } from "@xyo-network/os-model";
|
|
364
365
|
var NodeInfoPayload = class {
|
|
365
366
|
_context;
|
|
@@ -375,7 +376,7 @@ var NodeInfoPayload = class {
|
|
|
375
376
|
}
|
|
376
377
|
await Promise.resolve();
|
|
377
378
|
const nodeOsInfo = {
|
|
378
|
-
publicAddress: exposedNode?.address ??
|
|
379
|
+
publicAddress: exposedNode?.address ?? ZERO_ADDRESS,
|
|
379
380
|
schema: NodeOsInfoSchema
|
|
380
381
|
};
|
|
381
382
|
return [nodeOsInfo];
|
|
@@ -439,10 +440,11 @@ var ExternalModulePermissions = class {
|
|
|
439
440
|
}
|
|
440
441
|
}
|
|
441
442
|
async registerAndAttachModule(mod) {
|
|
442
|
-
if (mod) {
|
|
443
|
-
|
|
444
|
-
await this.dappWindowNode.attach(mod.address, true);
|
|
443
|
+
if (!mod) {
|
|
444
|
+
return;
|
|
445
445
|
}
|
|
446
|
+
await this.dappWindowNode.register?.(mod);
|
|
447
|
+
await this.dappWindowNode.attach(mod.address, true);
|
|
446
448
|
}
|
|
447
449
|
async resolveExternalModule(id) {
|
|
448
450
|
return await this.context.root.resolve(id);
|
|
@@ -482,7 +484,7 @@ var DappContextCreator = class _DappContextCreator {
|
|
|
482
484
|
} = config;
|
|
483
485
|
const { external, manifestPayload } = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork);
|
|
484
486
|
console.debug("[DEBUG] dApp manifest", manifestPayload);
|
|
485
|
-
const dappWallet = await wallet.derivePath(
|
|
487
|
+
const dappWallet = await wallet.derivePath(this.DAPP_WINDOW_WALLET_PATH);
|
|
486
488
|
const targetDappManifestParams = [
|
|
487
489
|
manifestPayload,
|
|
488
490
|
dappWallet,
|
|
@@ -582,19 +584,22 @@ import { ModuleFactoryLocator as ModuleFactoryLocator8 } from "@xyo-network/sdk-
|
|
|
582
584
|
// src/event/bus/Connection.ts
|
|
583
585
|
import { assertEx as assertEx4, BaseEmitter } from "@xylabs/sdk-js";
|
|
584
586
|
var EventBusConnection = class extends BaseEmitter {
|
|
585
|
-
_id;
|
|
586
587
|
description;
|
|
587
588
|
type;
|
|
589
|
+
#id;
|
|
588
590
|
constructor(request) {
|
|
589
591
|
super({});
|
|
590
592
|
this.description = request.description;
|
|
591
593
|
this.type = request.type;
|
|
592
594
|
}
|
|
595
|
+
get hasId() {
|
|
596
|
+
return this.#id !== void 0;
|
|
597
|
+
}
|
|
593
598
|
get id() {
|
|
594
|
-
return assertEx4(this
|
|
599
|
+
return assertEx4(this.#id, () => "Connection ID not set. Did you forget to call buildConnection()?");
|
|
595
600
|
}
|
|
596
601
|
buildConnection(id) {
|
|
597
|
-
this
|
|
602
|
+
this.#id = id;
|
|
598
603
|
}
|
|
599
604
|
};
|
|
600
605
|
|
|
@@ -660,15 +665,18 @@ var EventBus = class {
|
|
|
660
665
|
this.archivist.on("inserted", ({ payloads }) => {
|
|
661
666
|
const eventBusEvent = findAs(payloads, asOptionalEventBusEvent);
|
|
662
667
|
if (!eventBusEvent) return;
|
|
668
|
+
const notifySubscribableEvent = ([eventName, callback]) => {
|
|
669
|
+
if (eventName !== eventBusEvent.name) return;
|
|
670
|
+
if (callback) {
|
|
671
|
+
const forgettable = async () => await callback({ payloads });
|
|
672
|
+
forget(forgettable());
|
|
673
|
+
}
|
|
674
|
+
};
|
|
663
675
|
for (const connectionId in this.connections) {
|
|
664
676
|
const connection = this.connections[connectionId];
|
|
665
677
|
if (isPubSubConnections(connection) && connection.subscribableEvents) {
|
|
666
|
-
for (const
|
|
667
|
-
|
|
668
|
-
if (callback) {
|
|
669
|
-
const forgettable = async () => await callback({ payloads });
|
|
670
|
-
forget(forgettable());
|
|
671
|
-
}
|
|
678
|
+
for (const subscribableEvent of connection.subscribableEvents) {
|
|
679
|
+
notifySubscribableEvent(subscribableEvent);
|
|
672
680
|
}
|
|
673
681
|
}
|
|
674
682
|
}
|
|
@@ -904,12 +912,11 @@ var PayloadStore = class {
|
|
|
904
912
|
}) {
|
|
905
913
|
const instance = new this(archivist);
|
|
906
914
|
const insertListener = async ({ payloads }) => {
|
|
907
|
-
if (payloads.some(idFunction))
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
}
|
|
915
|
+
if (!payloads.some(idFunction)) return;
|
|
916
|
+
const latest = await getLatest();
|
|
917
|
+
if (isEqual(latest, instance.latest)) return;
|
|
918
|
+
instance.latest = latest;
|
|
919
|
+
instance.emitChange();
|
|
913
920
|
};
|
|
914
921
|
const deleteListener = async () => {
|
|
915
922
|
instance.latest = await getLatest();
|
|
@@ -1059,12 +1066,12 @@ var DappIntentCaller = class _DappIntentCaller extends DappCallerBase {
|
|
|
1059
1066
|
// Get all intents
|
|
1060
1067
|
async allIntents() {
|
|
1061
1068
|
const archivist = await this.getDappIntentArchivist();
|
|
1062
|
-
return await archivist.
|
|
1069
|
+
return await archivist.next();
|
|
1063
1070
|
}
|
|
1064
1071
|
// Get the latest intent saved to the archivist
|
|
1065
1072
|
async latestIntent() {
|
|
1066
1073
|
const archivist = await this.getDappIntentArchivist();
|
|
1067
|
-
return (await archivist.
|
|
1074
|
+
return (await archivist.next()).at(-1);
|
|
1068
1075
|
}
|
|
1069
1076
|
// Get the latest intent for a dapp
|
|
1070
1077
|
async latestIntentForDappName(dappName) {
|
|
@@ -1115,13 +1122,13 @@ var DappIntentResource = class extends DappCallerBase {
|
|
|
1115
1122
|
const archivist = await this.getDappIntentArchivist();
|
|
1116
1123
|
this._allDappIntents = await PayloadStore.create({
|
|
1117
1124
|
archivist,
|
|
1118
|
-
getLatest: async () => await archivist.
|
|
1125
|
+
getLatest: async () => await archivist.next(),
|
|
1119
1126
|
idFunction: isDappIntent
|
|
1120
1127
|
});
|
|
1121
1128
|
this._latestDappIntent = await PayloadStore.create({
|
|
1122
1129
|
archivist,
|
|
1123
1130
|
getLatest: async () => {
|
|
1124
|
-
const all = await archivist.
|
|
1131
|
+
const all = await archivist.next();
|
|
1125
1132
|
const result = all.length > 0 ? [all.at(-1)] : NO_RESULTS;
|
|
1126
1133
|
return result;
|
|
1127
1134
|
},
|
|
@@ -1230,7 +1237,7 @@ var ManageSystemDapps = class extends OsCallerBase {
|
|
|
1230
1237
|
async insertPayloads() {
|
|
1231
1238
|
const archivist = this.developmentMode ? await this.getDappsArchivistDevelopment() : await this.getDappsArchivist();
|
|
1232
1239
|
try {
|
|
1233
|
-
const allPayloads = await archivist.
|
|
1240
|
+
const allPayloads = await archivist.next();
|
|
1234
1241
|
if (allPayloads.length === 0) {
|
|
1235
1242
|
await this.freshInstall(archivist);
|
|
1236
1243
|
return true;
|
|
@@ -1530,14 +1537,14 @@ var ValidateDappAccessDiviner = class extends AbstractDiviner {
|
|
|
1530
1537
|
static configSchemas = [ValidateDappAccessDivinerConfigSchema];
|
|
1531
1538
|
async divineHandler(payloads) {
|
|
1532
1539
|
const dappManifest = payloads?.filter(isDappPackageManifestPayload) ?? [];
|
|
1533
|
-
const accessors = payloads?.filter(isUnregisteredDappAccess) ?? [];
|
|
1534
|
-
const dappParams = this.params.dappParams;
|
|
1535
1540
|
if (dappManifest.length > 1) {
|
|
1536
1541
|
throw new Error("Only one dapp manifest payload is allowed");
|
|
1537
1542
|
}
|
|
1543
|
+
const accessors = payloads?.filter(isUnregisteredDappAccess) ?? [];
|
|
1538
1544
|
if (dappManifest.length === 0 || accessors.length === 0) {
|
|
1539
1545
|
return [];
|
|
1540
1546
|
}
|
|
1547
|
+
const dappParams = this.params.dappParams;
|
|
1541
1548
|
const registeredAccessors = [];
|
|
1542
1549
|
const failedAccessors = [];
|
|
1543
1550
|
for (const access of accessors) {
|
|
@@ -1635,6 +1642,10 @@ var DappRegistry = class {
|
|
|
1635
1642
|
} = this.extractDappProperties(dapp);
|
|
1636
1643
|
try {
|
|
1637
1644
|
const walletId = await this.dappSeedPhraseRepository.findOrCreate(name);
|
|
1645
|
+
if (this.dappRegistry.get(name)) {
|
|
1646
|
+
console.warn("tried to register two dapps with the same name", name);
|
|
1647
|
+
return null;
|
|
1648
|
+
}
|
|
1638
1649
|
const registeredAccessors = await this.validateDappAccessPayloads(manifest, dapp.accessors, params);
|
|
1639
1650
|
const registeredDapp = {
|
|
1640
1651
|
accessors: registeredAccessors,
|
|
@@ -1652,10 +1663,6 @@ var DappRegistry = class {
|
|
|
1652
1663
|
params,
|
|
1653
1664
|
widgetConfigs
|
|
1654
1665
|
};
|
|
1655
|
-
if (this.dappRegistry.get(name)) {
|
|
1656
|
-
console.warn("tried to register two dapps with the same name", name);
|
|
1657
|
-
return null;
|
|
1658
|
-
}
|
|
1659
1666
|
this.dappRegistry.set(name, registeredDapp);
|
|
1660
1667
|
return registeredDapp;
|
|
1661
1668
|
} catch (e) {
|
|
@@ -1807,21 +1814,22 @@ var DappRegistrationService = class {
|
|
|
1807
1814
|
return this.context.user;
|
|
1808
1815
|
}
|
|
1809
1816
|
async postRegistrationHandlers(registeredDapp) {
|
|
1810
|
-
if (registeredDapp.dapp) {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1817
|
+
if (!registeredDapp.dapp) {
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
if (isRegisteredDappExposedDappSet(registeredDapp)) {
|
|
1821
|
+
this.registeredExposedDappSets.add(registeredDapp);
|
|
1822
|
+
const exposeIntent = DappIntentCaller.buildIntent(
|
|
1823
|
+
DappIntentCaller.OsDappName,
|
|
1824
|
+
DappIntentTypes.Launch,
|
|
1825
|
+
registeredDapp.dapp.config.name,
|
|
1826
|
+
DappMode2.Exposed
|
|
1827
|
+
);
|
|
1828
|
+
await this.exposeDappRequestConnection.emit(ExposeDappRequestEvent, { payloads: [registeredDapp.dapp.config, exposeIntent] });
|
|
1829
|
+
}
|
|
1830
|
+
if (isRegisteredDappAccessDappSet(registeredDapp)) {
|
|
1831
|
+
this.registeredAccessDappSets.add(registeredDapp);
|
|
1832
|
+
await this.dappAccessRequestConnection.emit(DappAccessRequestEvent, { payloads: registeredDapp.dapp.accessors });
|
|
1825
1833
|
}
|
|
1826
1834
|
}
|
|
1827
1835
|
};
|
|
@@ -1855,7 +1863,7 @@ var Signers = class {
|
|
|
1855
1863
|
}
|
|
1856
1864
|
async initialize() {
|
|
1857
1865
|
for (const [walletKindName, signerPaths] of this.paths) {
|
|
1858
|
-
for (const [signerName, walletPath] of signerPaths
|
|
1866
|
+
for (const [signerName, walletPath] of signerPaths) {
|
|
1859
1867
|
await this.initializeSigners(walletKindName, signerName, walletPath);
|
|
1860
1868
|
}
|
|
1861
1869
|
}
|
|
@@ -2001,7 +2009,7 @@ var StackManager = class {
|
|
|
2001
2009
|
this.stackMap = stackMap;
|
|
2002
2010
|
}
|
|
2003
2011
|
get stacks() {
|
|
2004
|
-
return
|
|
2012
|
+
return this.initializedStacksMap.keys().toArray();
|
|
2005
2013
|
}
|
|
2006
2014
|
get initializedStacks() {
|
|
2007
2015
|
return this.initializedStacksMap;
|
|
@@ -2099,21 +2107,21 @@ var NodeAdapterBase = class extends BaseEmitter4 {
|
|
|
2099
2107
|
|
|
2100
2108
|
// src/adapter/Network.ts
|
|
2101
2109
|
var NetworkAdapter = class extends NodeAdapterBase {
|
|
2102
|
-
|
|
2110
|
+
#connection;
|
|
2103
2111
|
constructor(kernel, driverName) {
|
|
2104
2112
|
super(kernel, driverName);
|
|
2105
2113
|
this.on("driverReady", ({ node }) => {
|
|
2106
|
-
this
|
|
2114
|
+
this.#connection = node;
|
|
2107
2115
|
});
|
|
2108
2116
|
}
|
|
2109
2117
|
get connection() {
|
|
2110
|
-
return this
|
|
2118
|
+
return this.#connection;
|
|
2111
2119
|
}
|
|
2112
2120
|
get hasConnection() {
|
|
2113
2121
|
return !!this.connection;
|
|
2114
2122
|
}
|
|
2115
2123
|
removeConnection() {
|
|
2116
|
-
this
|
|
2124
|
+
this.#connection = void 0;
|
|
2117
2125
|
}
|
|
2118
2126
|
};
|
|
2119
2127
|
|
|
@@ -2175,24 +2183,22 @@ var OsPubSubNetworkStack = class extends StackBase {
|
|
|
2175
2183
|
this.context.eventBus.addConnection(this.busConnection);
|
|
2176
2184
|
this.on("initialized", () => this.busConnection.emit(OsPubSubNetworkReadyEvent, {}));
|
|
2177
2185
|
super.on("driverReady", async ({ node }) => {
|
|
2178
|
-
if (node.id
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
}
|
|
2186
|
+
if (node.id !== PubSubBridgeNodeNodeName2) return;
|
|
2187
|
+
const httpBridge = assertEx13(await node.resolve("NsHttpBridge"), () => "HttpBridge not found");
|
|
2188
|
+
const xnsNode = asNodeInstance(await httpBridge.resolve("XNS"));
|
|
2189
|
+
if (xnsNode) {
|
|
2190
|
+
const initializedXns = await initializeXns(xnsNode);
|
|
2191
|
+
console.log(`Xns: ${initializedXns}`);
|
|
2192
|
+
} else {
|
|
2193
|
+
console.log("Xns: Failed to contact Xns Node");
|
|
2187
2194
|
}
|
|
2188
2195
|
});
|
|
2189
2196
|
super.on("driverReady", async ({ node }) => {
|
|
2190
|
-
if (node.id
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
}
|
|
2197
|
+
if (node.id !== ExposedNodeOuterNodeName2) return;
|
|
2198
|
+
this._exposedNodeOuter = node;
|
|
2199
|
+
const mod = assertEx13(await node.resolve("ExposedNode"), () => "ExposedNode not found");
|
|
2200
|
+
const exposedNode = asAttachableNodeInstance3(mod, () => "ExposedNode is not a node");
|
|
2201
|
+
this._exposedNode = exposedNode;
|
|
2196
2202
|
});
|
|
2197
2203
|
super.on("driverError", (error) => console.error("Unable to assign exposed node(s) to context", error));
|
|
2198
2204
|
}
|
|
@@ -2200,7 +2206,7 @@ var OsPubSubNetworkStack = class extends StackBase {
|
|
|
2200
2206
|
super.stop();
|
|
2201
2207
|
this._exposedNode = void 0;
|
|
2202
2208
|
this._exposedNodeOuter = void 0;
|
|
2203
|
-
if (this.busConnection.
|
|
2209
|
+
if (this.busConnection.hasId)
|
|
2204
2210
|
this.context.eventBus.removeConnection(this.busConnection.id);
|
|
2205
2211
|
}
|
|
2206
2212
|
};
|
|
@@ -2369,13 +2375,13 @@ var XyOs = class _XyOs extends XyOsContextBase {
|
|
|
2369
2375
|
|
|
2370
2376
|
// src/RunningDappCache.ts
|
|
2371
2377
|
var findOrCreateMutex = new Mutex3();
|
|
2372
|
-
var RunningDappCache = class
|
|
2378
|
+
var RunningDappCache = class {
|
|
2373
2379
|
static _cache = {};
|
|
2374
2380
|
static async findOrCreate(dapp, xyOs, allowedNames, xnsNodeUrl, xnsNetwork) {
|
|
2375
2381
|
const dappId = dapp.config.name;
|
|
2376
2382
|
return await XyOs.monitor(
|
|
2377
2383
|
async () => await findOrCreateMutex.runExclusive(async () => {
|
|
2378
|
-
const existingWindowDappSet =
|
|
2384
|
+
const existingWindowDappSet = this.get(dappId);
|
|
2379
2385
|
if (existingWindowDappSet) {
|
|
2380
2386
|
console.debug("[DEBUG]", `RunningDappCache, using existing node for ${dappId}`);
|
|
2381
2387
|
const existingDappContext = assertEx15(existingWindowDappSet.context, () => "No context found in existing dapp node");
|
|
@@ -2384,7 +2390,7 @@ var RunningDappCache = class _RunningDappCache {
|
|
|
2384
2390
|
}
|
|
2385
2391
|
console.debug("[DEBUG]", "RunningDappCache:creating", dappId);
|
|
2386
2392
|
const windowDappSet = await createDappContext(dapp, xyOs, allowedNames, xnsNodeUrl, xnsNetwork);
|
|
2387
|
-
|
|
2393
|
+
this.set(dappId, windowDappSet);
|
|
2388
2394
|
return windowDappSet;
|
|
2389
2395
|
}),
|
|
2390
2396
|
{ additionalProperties: { dappId }, name: "Loading dApp" }
|
|
@@ -2394,7 +2400,7 @@ var RunningDappCache = class _RunningDappCache {
|
|
|
2394
2400
|
return this._cache[key];
|
|
2395
2401
|
}
|
|
2396
2402
|
static has(key) {
|
|
2397
|
-
return key ?
|
|
2403
|
+
return key ? Object.hasOwn(this._cache, key) : false;
|
|
2398
2404
|
}
|
|
2399
2405
|
static set(key, value) {
|
|
2400
2406
|
this._cache[key] = value;
|
|
@@ -2408,7 +2414,7 @@ var RunningDappAccessCache = class {
|
|
|
2408
2414
|
return this._cache[key];
|
|
2409
2415
|
}
|
|
2410
2416
|
static has(key) {
|
|
2411
|
-
return key ?
|
|
2417
|
+
return key ? Object.hasOwn(this._cache, key) : false;
|
|
2412
2418
|
}
|
|
2413
2419
|
static set(key, value) {
|
|
2414
2420
|
this._cache[key] = value;
|
|
@@ -2496,7 +2502,7 @@ var AccessNodeQueries = class {
|
|
|
2496
2502
|
}
|
|
2497
2503
|
async getPayloadsFromAccessNode() {
|
|
2498
2504
|
const archivistFromAccessNode = await this.resolveArchivistFromAccessNode();
|
|
2499
|
-
return await archivistFromAccessNode.
|
|
2505
|
+
return await archivistFromAccessNode.next();
|
|
2500
2506
|
}
|
|
2501
2507
|
async insertAccessNodePayloadsIntoDappNodeArchivist(payloads) {
|
|
2502
2508
|
const archivist = await this.getArchivistFromDappNode();
|
|
@@ -2568,7 +2574,7 @@ var XnsRegistrationsResourceQueries = {
|
|
|
2568
2574
|
return await diviner.divine([query]);
|
|
2569
2575
|
},
|
|
2570
2576
|
getRecentRegistrations: async (archivist) => {
|
|
2571
|
-
return (await archivist.
|
|
2577
|
+
return (await archivist.next()).toReversed();
|
|
2572
2578
|
}
|
|
2573
2579
|
};
|
|
2574
2580
|
|
|
@@ -2801,9 +2807,8 @@ var DappCaller = class extends DappCallerBase {
|
|
|
2801
2807
|
const account = this.context.user.signers?.get(dappName);
|
|
2802
2808
|
if (account) {
|
|
2803
2809
|
return account;
|
|
2804
|
-
} else {
|
|
2805
|
-
throw new Error("Unable to find user wallet");
|
|
2806
2810
|
}
|
|
2811
|
+
throw new Error("Unable to find user wallet");
|
|
2807
2812
|
}
|
|
2808
2813
|
/**
|
|
2809
2814
|
* Get all wallets for the user
|
|
@@ -2849,10 +2854,7 @@ var DappCaller = class extends DappCallerBase {
|
|
|
2849
2854
|
*/
|
|
2850
2855
|
async setDappInjectableRouteParams(searchParams = new URLSearchParams(), pathname) {
|
|
2851
2856
|
const dappArchivist = await this.getDappArchivist();
|
|
2852
|
-
const params =
|
|
2853
|
-
for (const [key, value] of searchParams.entries()) {
|
|
2854
|
-
params[key] = value;
|
|
2855
|
-
}
|
|
2857
|
+
const params = Object.fromEntries(searchParams);
|
|
2856
2858
|
const payload = {
|
|
2857
2859
|
params,
|
|
2858
2860
|
path: pathname,
|
|
@@ -3224,7 +3226,8 @@ var buildWalletSeedPhrasePayload = async (mnemonic, $label) => {
|
|
|
3224
3226
|
$label,
|
|
3225
3227
|
$timestamp: Date.now()
|
|
3226
3228
|
};
|
|
3227
|
-
const
|
|
3229
|
+
const builder = new PayloadBuilder8({ schema: WalletSeedPhraseSchema });
|
|
3230
|
+
const payload = builder.fields(fields).build();
|
|
3228
3231
|
const rootHash = await PayloadBuilder8.hash(payload);
|
|
3229
3232
|
return { payload, rootHash };
|
|
3230
3233
|
};
|
|
@@ -3287,7 +3290,8 @@ var OsSettingsQueries = {
|
|
|
3287
3290
|
$label: legacyMeta?.label,
|
|
3288
3291
|
$timestamp: legacyMeta?.$timestamp
|
|
3289
3292
|
};
|
|
3290
|
-
const
|
|
3293
|
+
const builder = new PayloadBuilder9({ schema: WalletSeedPhraseSchema2 });
|
|
3294
|
+
const payload = builder.fields(newWalletPayloadFields).build();
|
|
3291
3295
|
await archivist.insert([payload]);
|
|
3292
3296
|
return [payload];
|
|
3293
3297
|
}
|
|
@@ -3348,12 +3352,13 @@ var OsSettingsCaller = class extends OsSettingsCallerBase {
|
|
|
3348
3352
|
const archivist = await this.getOsSettingsArchivist();
|
|
3349
3353
|
const storedSeedPhrasePayload = (await OsSettingsQueries.getLatestUserWallet(diviner, archivist)).pop();
|
|
3350
3354
|
const biosWalletSeedPhrase = assertEx26(await this.context.kernel?.bios?.seedPhraseStore.get("user"), () => "No user seed phrase found from BIOS");
|
|
3351
|
-
const biosWalletSeedPhraseParts = biosWalletSeedPhrase.split(" ");
|
|
3352
3355
|
if (!storedSeedPhrasePayload?.mnemonic?.mnemonic) {
|
|
3353
3356
|
const { payload: biosSeedPhrasePayload } = await buildUserWalletSeedPhrasePayload(biosWalletSeedPhrase);
|
|
3354
3357
|
await this.addWalletSeedPhrase(biosSeedPhrasePayload);
|
|
3355
3358
|
return biosSeedPhrasePayload;
|
|
3356
|
-
}
|
|
3359
|
+
}
|
|
3360
|
+
const biosWalletSeedPhraseParts = biosWalletSeedPhrase.split(" ");
|
|
3361
|
+
if (!isEqual(storedSeedPhrasePayload.mnemonic.mnemonic, biosWalletSeedPhraseParts)) {
|
|
3357
3362
|
const updatedBiosSeedPhrase = storedSeedPhrasePayload.mnemonic.mnemonic.join(" ");
|
|
3358
3363
|
await this.context.kernel?.bios?.seedPhraseStore.set("user", updatedBiosSeedPhrase);
|
|
3359
3364
|
}
|