@xyo-network/os-runtime 7.2.0 → 7.3.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/neutral/Caller.d.ts +18 -20
- package/dist/neutral/Caller.d.ts.map +1 -1
- package/dist/neutral/DappCallerBase.d.ts +2 -2
- package/dist/neutral/DappCallerBase.d.ts.map +1 -1
- package/dist/neutral/OsCallerBase.d.ts +2 -2
- package/dist/neutral/PubSubBridgeCaller.d.ts +1 -1
- package/dist/neutral/PubSubBridgeCaller.d.ts.map +1 -1
- package/dist/neutral/RunningDappCache.d.ts.map +1 -1
- package/dist/neutral/XyOs.d.ts +5 -6
- package/dist/neutral/XyOs.d.ts.map +1 -1
- package/dist/neutral/XyOsBase.d.ts +124 -7
- package/dist/neutral/XyOsBase.d.ts.map +1 -1
- package/dist/neutral/XyOsDapp.d.ts +3 -3
- package/dist/neutral/XyOsDapp.d.ts.map +1 -1
- package/dist/neutral/access/Caller.d.ts +2 -2
- package/dist/neutral/access/Caller.d.ts.map +1 -1
- package/dist/neutral/access/RunningAccessDappCache.d.ts.map +1 -1
- package/dist/neutral/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
- package/dist/neutral/adapter/Base.d.ts +2 -2
- package/dist/neutral/adapter/Base.d.ts.map +1 -1
- package/dist/neutral/classes/lib/DappCreatorParams.d.ts +3 -3
- package/dist/neutral/classes/lib/DappCreatorParams.d.ts.map +1 -1
- package/dist/neutral/classes/lib/Insertable.d.ts +1 -3
- package/dist/neutral/classes/lib/Insertable.d.ts.map +1 -1
- package/dist/neutral/classes/menu/Caller.d.ts +1 -2
- package/dist/neutral/classes/menu/Caller.d.ts.map +1 -1
- package/dist/neutral/classes/settings/Caller.d.ts +2 -2
- package/dist/neutral/classes/settings/CallerBase.d.ts +1 -1
- package/dist/neutral/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/neutral/classes/settings/badge/Caller.d.ts +2 -2
- package/dist/neutral/classes/settings/badge/Resource.d.ts +1 -1
- package/dist/neutral/classes/settings/badge/Resource.d.ts.map +1 -1
- package/dist/neutral/dapp/context/creator/Creator.d.ts +1 -1
- package/dist/neutral/dapp/context/creator/Creator.d.ts.map +1 -1
- package/dist/neutral/dapp/context/creator/createDappContext.d.ts.map +1 -1
- package/dist/neutral/event/bus/Connection.d.ts +3 -4
- package/dist/neutral/event/bus/Connection.d.ts.map +1 -1
- package/dist/neutral/event/bus/EventBus.d.ts +1 -1
- package/dist/neutral/event/bus/EventBus.d.ts.map +1 -1
- package/dist/neutral/event/bus/PubSubConnection.d.ts +1 -1
- package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts +2 -2
- package/dist/neutral/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
- package/dist/neutral/helpers/monitor/types.d.ts +3 -3
- package/dist/neutral/helpers/monitor/types.d.ts.map +1 -1
- package/dist/neutral/index.mjs +1042 -694
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/intent/Caller.d.ts +5 -5
- package/dist/neutral/lib/Listener.d.ts +1 -1
- package/dist/neutral/lib/Listener.d.ts.map +1 -1
- package/dist/neutral/lib/PayloadStore.d.ts +1 -2
- package/dist/neutral/lib/PayloadStore.d.ts.map +1 -1
- package/dist/neutral/lib/isPayload.d.ts +1 -1
- package/dist/neutral/loadOsNode.d.ts.map +1 -1
- package/dist/neutral/profileModuleEvents.d.ts +2 -4
- package/dist/neutral/profileModuleEvents.d.ts.map +1 -1
- package/dist/neutral/registration/DappRegistrationService.d.ts +3 -3
- package/dist/neutral/registration/DappRegistrationService.d.ts.map +1 -1
- package/dist/neutral/registration/DappRegistry.d.ts +4 -6
- package/dist/neutral/registration/DappRegistry.d.ts.map +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts +7 -3
- package/dist/neutral/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Diviner.d.ts +3 -1
- package/dist/neutral/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
- package/dist/neutral/scripts/xyos/lib/headless.d.ts.map +1 -1
- package/dist/neutral/signer/Signers.d.ts.map +1 -1
- package/dist/neutral/stack/Base.d.ts +2 -2
- package/dist/neutral/stack/Base.d.ts.map +1 -1
- package/dist/neutral/stack/Manager.d.ts +2 -6
- package/dist/neutral/stack/Manager.d.ts.map +1 -1
- package/dist/neutral/system/ManageSystemDapps.d.ts +3 -3
- package/dist/neutral/system/ManageSystemDapps.d.ts.map +1 -1
- package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts +1 -1
- package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/neutral/wallet/SeedPhraseRepository.d.ts +3 -4
- package/dist/neutral/wallet/SeedPhraseRepository.d.ts.map +1 -1
- package/dist/node/Caller.d.ts +18 -20
- package/dist/node/Caller.d.ts.map +1 -1
- package/dist/node/DappCallerBase.d.ts +2 -2
- package/dist/node/DappCallerBase.d.ts.map +1 -1
- package/dist/node/OsCallerBase.d.ts +2 -2
- package/dist/node/PubSubBridgeCaller.d.ts +1 -1
- package/dist/node/PubSubBridgeCaller.d.ts.map +1 -1
- package/dist/node/RunningDappCache.d.ts.map +1 -1
- package/dist/node/XyOs.d.ts +5 -6
- package/dist/node/XyOs.d.ts.map +1 -1
- package/dist/node/XyOsBase.d.ts +124 -7
- package/dist/node/XyOsBase.d.ts.map +1 -1
- package/dist/node/XyOsDapp.d.ts +3 -3
- package/dist/node/XyOsDapp.d.ts.map +1 -1
- package/dist/node/access/Caller.d.ts +2 -2
- package/dist/node/access/Caller.d.ts.map +1 -1
- package/dist/node/access/RunningAccessDappCache.d.ts.map +1 -1
- package/dist/node/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +1 -1
- package/dist/node/adapter/Base.d.ts +2 -2
- package/dist/node/adapter/Base.d.ts.map +1 -1
- package/dist/node/classes/lib/DappCreatorParams.d.ts +3 -3
- package/dist/node/classes/lib/DappCreatorParams.d.ts.map +1 -1
- package/dist/node/classes/lib/Insertable.d.ts +1 -3
- package/dist/node/classes/lib/Insertable.d.ts.map +1 -1
- package/dist/node/classes/menu/Caller.d.ts +1 -2
- package/dist/node/classes/menu/Caller.d.ts.map +1 -1
- package/dist/node/classes/settings/Caller.d.ts +2 -2
- package/dist/node/classes/settings/CallerBase.d.ts +1 -1
- package/dist/node/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/node/classes/settings/badge/Caller.d.ts +2 -2
- package/dist/node/classes/settings/badge/Resource.d.ts +1 -1
- package/dist/node/classes/settings/badge/Resource.d.ts.map +1 -1
- package/dist/node/dapp/context/creator/Creator.d.ts +1 -1
- package/dist/node/dapp/context/creator/Creator.d.ts.map +1 -1
- package/dist/node/dapp/context/creator/createDappContext.d.ts.map +1 -1
- package/dist/node/event/bus/Connection.d.ts +3 -4
- package/dist/node/event/bus/Connection.d.ts.map +1 -1
- package/dist/node/event/bus/EventBus.d.ts +1 -1
- package/dist/node/event/bus/EventBus.d.ts.map +1 -1
- package/dist/node/event/bus/PubSubConnection.d.ts +1 -1
- package/dist/node/helpers/monitor/XyOsMonitor.d.ts +2 -2
- package/dist/node/helpers/monitor/XyOsMonitor.d.ts.map +1 -1
- package/dist/node/helpers/monitor/types.d.ts +3 -3
- package/dist/node/helpers/monitor/types.d.ts.map +1 -1
- package/dist/node/index.mjs +1042 -694
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/intent/Caller.d.ts +5 -5
- package/dist/node/lib/Listener.d.ts +1 -1
- package/dist/node/lib/Listener.d.ts.map +1 -1
- package/dist/node/lib/PayloadStore.d.ts +1 -2
- package/dist/node/lib/PayloadStore.d.ts.map +1 -1
- package/dist/node/lib/isPayload.d.ts +1 -1
- package/dist/node/loadOsNode.d.ts.map +1 -1
- package/dist/node/profileModuleEvents.d.ts +2 -4
- package/dist/node/profileModuleEvents.d.ts.map +1 -1
- package/dist/node/registration/DappRegistrationService.d.ts +3 -3
- package/dist/node/registration/DappRegistrationService.d.ts.map +1 -1
- package/dist/node/registration/DappRegistry.d.ts +4 -6
- package/dist/node/registration/DappRegistry.d.ts.map +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts +7 -3
- package/dist/node/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Diviner.d.ts +3 -1
- package/dist/node/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
- package/dist/node/scripts/xyos/index.mjs +520 -384
- package/dist/node/scripts/xyos/index.mjs.map +1 -1
- package/dist/node/scripts/xyos/lib/headless.d.ts.map +1 -1
- package/dist/node/signer/Signers.d.ts.map +1 -1
- package/dist/node/stack/Base.d.ts +2 -2
- package/dist/node/stack/Base.d.ts.map +1 -1
- package/dist/node/stack/Manager.d.ts +2 -6
- package/dist/node/stack/Manager.d.ts.map +1 -1
- package/dist/node/system/ManageSystemDapps.d.ts +3 -3
- package/dist/node/system/ManageSystemDapps.d.ts.map +1 -1
- package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts +1 -1
- package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/node/wallet/SeedPhraseRepository.d.ts +3 -4
- package/dist/node/wallet/SeedPhraseRepository.d.ts.map +1 -1
- package/package.json +165 -55
- package/dist/neutral/signer/Signer.spec.d.ts +0 -2
- package/dist/neutral/signer/Signer.spec.d.ts.map +0 -1
- package/dist/neutral/spec/boot.spec.d.ts +0 -2
- package/dist/neutral/spec/boot.spec.d.ts.map +0 -1
- package/dist/node/signer/Signer.spec.d.ts +0 -2
- package/dist/node/signer/Signer.spec.d.ts.map +0 -1
- package/dist/node/spec/boot.spec.d.ts +0 -2
- package/dist/node/spec/boot.spec.d.ts.map +0 -1
- package/src/Caller.ts +0 -202
- package/src/DappCallerBase.ts +0 -56
- package/src/DefaultsQueries.ts +0 -27
- package/src/OsCallerBase.ts +0 -59
- package/src/PubSubBridgeCaller.ts +0 -33
- package/src/RunningDappCache.ts +0 -58
- package/src/XyOs.ts +0 -166
- package/src/XyOsBase.ts +0 -136
- package/src/XyOsDapp.ts +0 -103
- package/src/access/Caller.ts +0 -85
- package/src/access/Queries.ts +0 -38
- package/src/access/Resource.ts +0 -65
- package/src/access/RunningAccessDappCache.ts +0 -21
- package/src/access/index.ts +0 -4
- package/src/access/interfaces/index.ts +0 -1
- package/src/access/interfaces/registered-names/helpers/AccessNodeQueries.ts +0 -68
- package/src/access/interfaces/registered-names/helpers/index.ts +0 -2
- package/src/access/interfaces/registered-names/helpers/resource/AbstractXnsCaller.ts +0 -42
- package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResource.ts +0 -52
- package/src/access/interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.ts +0 -23
- package/src/access/interfaces/registered-names/helpers/resource/index.ts +0 -3
- package/src/access/interfaces/registered-names/index.ts +0 -1
- package/src/adapter/Base.ts +0 -104
- package/src/adapter/Network.ts +0 -31
- package/src/adapter/Settings.ts +0 -30
- package/src/adapter/index.ts +0 -2
- package/src/adapters/OsPubSubBridgeNetwork.ts +0 -10
- package/src/adapters/OsSettings.ts +0 -7
- package/src/adapters/OsXyoPublicNetwork.ts +0 -9
- package/src/adapters/index.ts +0 -3
- package/src/classes/dapp/DefaultsResource.ts +0 -67
- package/src/classes/dapp/index.ts +0 -1
- package/src/classes/index.ts +0 -4
- package/src/classes/lib/DappCreatorParams.ts +0 -18
- package/src/classes/lib/Insertable.ts +0 -10
- package/src/classes/lib/index.ts +0 -2
- package/src/classes/menu/Caller.ts +0 -77
- package/src/classes/menu/Queries.ts +0 -60
- package/src/classes/menu/Resource.ts +0 -105
- package/src/classes/menu/index.ts +0 -2
- package/src/classes/settings/Caller.ts +0 -78
- package/src/classes/settings/CallerBase.ts +0 -27
- package/src/classes/settings/Resource.ts +0 -81
- package/src/classes/settings/SettingsQueries.ts +0 -56
- package/src/classes/settings/badge/Caller.ts +0 -30
- package/src/classes/settings/badge/Queries.ts +0 -19
- package/src/classes/settings/badge/Resource.ts +0 -50
- package/src/classes/settings/badge/index.ts +0 -2
- package/src/classes/settings/index.ts +0 -5
- package/src/dapp/context/creator/Creator.ts +0 -122
- package/src/dapp/context/creator/DefaultPayloads/DappAccessPayloads.ts +0 -20
- package/src/dapp/context/creator/DefaultPayloads/DefaultPayloads.ts +0 -40
- package/src/dapp/context/creator/DefaultPayloads/NodeInfoPayload.ts +0 -33
- package/src/dapp/context/creator/DefaultPayloads/index.ts +0 -1
- package/src/dapp/context/creator/ExternalModulePermissions/ExternalModulePermissions.ts +0 -59
- package/src/dapp/context/creator/ExternalModulePermissions/index.ts +0 -1
- package/src/dapp/context/creator/createDappContext.ts +0 -61
- package/src/dapp/context/creator/index.ts +0 -3
- package/src/dapp/context/index.ts +0 -1
- package/src/dapp/index.ts +0 -1
- package/src/event/bus/Connection.ts +0 -33
- package/src/event/bus/EventBus.ts +0 -159
- package/src/event/bus/PubSubConnection.ts +0 -28
- package/src/event/bus/index.ts +0 -3
- package/src/event/connections/DappAccessRequest.ts +0 -11
- package/src/event/connections/DappsReady.ts +0 -9
- package/src/event/connections/ExposeDappRequest.ts +0 -11
- package/src/event/connections/OsPubSubNetworkReady.ts +0 -12
- package/src/event/connections/OsSettingsReady.ts +0 -12
- package/src/event/connections/OsXyoPublicReady.ts +0 -12
- package/src/event/connections/index.ts +0 -6
- package/src/event/index.ts +0 -2
- package/src/helpers/index.ts +0 -1
- package/src/helpers/monitor/XyOsMonitor.ts +0 -52
- package/src/helpers/monitor/index.ts +0 -2
- package/src/helpers/monitor/types.ts +0 -8
- package/src/index.ts +0 -29
- package/src/initializer/DappInitializer.ts +0 -57
- package/src/initializer/index.ts +0 -1
- package/src/intent/Caller.ts +0 -74
- package/src/intent/Resource.ts +0 -66
- package/src/intent/index.ts +0 -2
- package/src/lib/ExternalStore.ts +0 -7
- package/src/lib/Listener.ts +0 -1
- package/src/lib/ModuleAccountPaths.ts +0 -23
- package/src/lib/ModuleNames.ts +0 -3
- package/src/lib/NameTransforms.ts +0 -34
- package/src/lib/PayloadStore.ts +0 -106
- package/src/lib/ResourceStores.ts +0 -7
- package/src/lib/index.ts +0 -11
- package/src/lib/initializeXns.ts +0 -16
- package/src/lib/isEqual.ts +0 -42
- package/src/lib/isPayload.ts +0 -24
- package/src/lib/tokenPlacesSplit.ts +0 -17
- package/src/loadOsNode.ts +0 -44
- package/src/manifest/index.ts +0 -2
- package/src/manifest/manifestReplacementTokens.ts +0 -6
- package/src/manifest/os-node.manifest.json +0 -132
- package/src/manifests/dapp-window.manifest.json +0 -36
- package/src/manifests/index.ts +0 -1
- package/src/models/access/ValidDappAccessInterfaces.ts +0 -6
- package/src/models/access/index.ts +0 -1
- package/src/models/index.ts +0 -1
- package/src/profileModuleEvents.ts +0 -43
- package/src/registration/DappRegistrationService.ts +0 -179
- package/src/registration/DappRegistry.ts +0 -131
- package/src/registration/ValidateDappAccessDiviner/Config.ts +0 -24
- package/src/registration/ValidateDappAccessDiviner/Diviner.ts +0 -133
- package/src/registration/ValidateDappAccessDiviner/index.ts +0 -2
- package/src/registration/index.ts +0 -2
- package/src/scripts/xyos/command/config.ts +0 -19
- package/src/scripts/xyos/command/create.ts +0 -22
- package/src/scripts/xyos/command/index.ts +0 -7
- package/src/scripts/xyos/command/manifest.ts +0 -19
- package/src/scripts/xyos/command/start.ts +0 -35
- package/src/scripts/xyos/index.ts +0 -32
- package/src/scripts/xyos/lib/createFromTemplate.ts +0 -11
- package/src/scripts/xyos/lib/headless.ts +0 -68
- package/src/scripts/xyos/lib/index.ts +0 -2
- package/src/signer/Signer.spec.ts +0 -65
- package/src/signer/Signers.ts +0 -74
- package/src/signer/index.ts +0 -1
- package/src/spec/boot.spec.ts +0 -89
- package/src/stack/Base.ts +0 -166
- package/src/stack/Manager.ts +0 -51
- package/src/stack/Map.ts +0 -22
- package/src/stack/OsPubSubNetworkStack.ts +0 -70
- package/src/stack/OsSettingsStack.ts +0 -24
- package/src/stack/XyoPublicNetworkStack.ts +0 -32
- package/src/stack/index.ts +0 -6
- package/src/system/ManageSystemDapps.ts +0 -148
- package/src/system/Queries.ts +0 -69
- package/src/system/index.ts +0 -1
- package/src/types/global.d.ts +0 -9
- package/src/types/images.d.ts +0 -5
- package/src/utils/buildWalletSeedPhrasePayload.ts +0 -51
- package/src/utils/getApiDomain.ts +0 -14
- package/src/utils/index.ts +0 -3
- package/src/utils/renameObjKey.ts +0 -22
- package/src/wallet/DappSeedPhraseRepository.ts +0 -99
- package/src/wallet/SeedPhraseRepository.ts +0 -32
- package/src/wallet/index.ts +0 -2
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import type { Address } from '@xylabs/hex'
|
|
2
|
-
import { AbstractDiviner } from '@xyo-network/diviner-abstract'
|
|
3
|
-
import type { NodeManifestPayload, PackageManifestPayload } from '@xyo-network/manifest'
|
|
4
|
-
import { ManifestWrapper, PackageManifestPayloadSchema } from '@xyo-network/manifest'
|
|
5
|
-
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
6
|
-
import type { NodeInstance } from '@xyo-network/node-model'
|
|
7
|
-
import type {
|
|
8
|
-
DappPackageManifestPayload,
|
|
9
|
-
DappParams,
|
|
10
|
-
RegisteredDappAccess,
|
|
11
|
-
UnregisteredDappAccess,
|
|
12
|
-
} from '@xyo-network/os-model'
|
|
13
|
-
import {
|
|
14
|
-
isDappPackageManifestPayload,
|
|
15
|
-
isUnregisteredDappAccess,
|
|
16
|
-
RegisteredDappAccessSchema,
|
|
17
|
-
} from '@xyo-network/os-model'
|
|
18
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
19
|
-
|
|
20
|
-
import { ValidDappAccessInterfaces } from '../../models/index.ts'
|
|
21
|
-
import type {
|
|
22
|
-
FailedAccessor,
|
|
23
|
-
ValidateDappAccessDivinerIn,
|
|
24
|
-
ValidateDappAccessDivinerOut,
|
|
25
|
-
ValidateDappAccessDivinerParams,
|
|
26
|
-
} from './Config.ts'
|
|
27
|
-
import {
|
|
28
|
-
FailedAccessorSchema,
|
|
29
|
-
ValidateDappAccessDivinerConfigSchema,
|
|
30
|
-
} from './Config.ts'
|
|
31
|
-
|
|
32
|
-
// Validate the accessors of a dapp against the dapp access interfaces
|
|
33
|
-
export class ValidateDappAccessDiviner<TParams extends ValidateDappAccessDivinerParams = ValidateDappAccessDivinerParams> extends AbstractDiviner<
|
|
34
|
-
TParams,
|
|
35
|
-
ValidateDappAccessDivinerIn,
|
|
36
|
-
ValidateDappAccessDivinerOut
|
|
37
|
-
> {
|
|
38
|
-
static override configSchemas = [ValidateDappAccessDivinerConfigSchema]
|
|
39
|
-
|
|
40
|
-
protected override async divineHandler(payloads?: ValidateDappAccessDivinerIn[]): Promise<ValidateDappAccessDivinerOut[]> {
|
|
41
|
-
const dappManifest = payloads?.filter(isDappPackageManifestPayload) as DappPackageManifestPayload[]
|
|
42
|
-
const accessors = payloads?.filter(isUnregisteredDappAccess) as UnregisteredDappAccess[]
|
|
43
|
-
const dappParams = this.params.dappParams
|
|
44
|
-
|
|
45
|
-
if (dappManifest.length > 1) {
|
|
46
|
-
throw new Error('Only one dapp manifest payload is allowed')
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!dappManifest || dappManifest.length === 0 || accessors?.length === 0) {
|
|
50
|
-
return []
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const registeredAccessors: RegisteredDappAccess[] = []
|
|
54
|
-
const failedAccessors: FailedAccessor[] = []
|
|
55
|
-
|
|
56
|
-
for (const access of accessors) {
|
|
57
|
-
try {
|
|
58
|
-
if (access) {
|
|
59
|
-
const dappAccessInterface = ValidDappAccessInterfaces[access.name]
|
|
60
|
-
if (!dappAccessInterface) {
|
|
61
|
-
console.warn('Invalid dapp access interface', access.name)
|
|
62
|
-
continue
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const dappManifestToTest = dappPackageManifestToPackageManifest(dappManifest[0])
|
|
66
|
-
const dappChildren = await getNodeChildren(dappManifestToTest, dappParams)
|
|
67
|
-
const interfaceChildren = await getNodeChildren(dappAccessInterface.manifest, dappParams)
|
|
68
|
-
const valid = compareChildren(interfaceChildren, dappChildren)
|
|
69
|
-
if (valid) {
|
|
70
|
-
const payload: RegisteredDappAccess = {
|
|
71
|
-
...access,
|
|
72
|
-
schema: RegisteredDappAccessSchema,
|
|
73
|
-
timestamp: Date.now(),
|
|
74
|
-
}
|
|
75
|
-
registeredAccessors.push(payload)
|
|
76
|
-
} else {
|
|
77
|
-
const failedRegistration: FailedAccessor = {
|
|
78
|
-
accessor: access,
|
|
79
|
-
errorMessage: 'Invalid dapp access interface',
|
|
80
|
-
schema: FailedAccessorSchema,
|
|
81
|
-
}
|
|
82
|
-
failedAccessors.push(failedRegistration)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch (e) {
|
|
86
|
-
failedAccessors.push(
|
|
87
|
-
{
|
|
88
|
-
accessor: access, errorMessage: (e as Error).message, schema: FailedAccessorSchema,
|
|
89
|
-
} as FailedAccessor,
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return [...registeredAccessors, ...failedAccessors]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const compareChildren = (interfaceChildren: Record<Address, string | null>[], dappChildren: Record<Address, string | null>[]) => {
|
|
99
|
-
return interfaceChildren.every(interfaceChild =>
|
|
100
|
-
Object.values(interfaceChild).every(interfaceChildName =>
|
|
101
|
-
dappChildren.some(dappChild => Object.values(dappChild).includes(interfaceChildName))))
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const dappPackageManifestToPackageManifest = (dappPackageManifest: DappPackageManifestPayload): PackageManifestPayload => {
|
|
105
|
-
return {
|
|
106
|
-
...dappPackageManifest,
|
|
107
|
-
schema: PackageManifestPayloadSchema,
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const getChildrenFromNode = async (node: NodeInstance) => {
|
|
112
|
-
const nodeManifest = (await node.state())?.[0] as NodeManifestPayload
|
|
113
|
-
return nodeManifest.status?.children
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const getNodeChildren = async (manifestToTest: PackageManifestPayload, dappParams: DappParams) => {
|
|
117
|
-
const testNodes = await getNodeToTest(manifestToTest, dappParams)
|
|
118
|
-
|
|
119
|
-
const children: Record<Address, string | null>[] = []
|
|
120
|
-
for (const node of testNodes) {
|
|
121
|
-
const nodeChildren = await getChildrenFromNode(node)
|
|
122
|
-
if (nodeChildren) {
|
|
123
|
-
children.push(nodeChildren)
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return children
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const getNodeToTest = async (manifestToTest: PackageManifestPayload, dappParams: DappParams) => {
|
|
131
|
-
const dappManifestWrapper = new ManifestWrapper(manifestToTest, await HDWallet.random(), dappParams.locator ?? new ModuleFactoryLocator())
|
|
132
|
-
return await dappManifestWrapper.loadNodes()
|
|
133
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Argv } from 'yargs'
|
|
2
|
-
|
|
3
|
-
export const commandConfig = (argv: Argv) => {
|
|
4
|
-
return argv.command('config [action] <target>', 'Create an xyos project', (yargs) => {
|
|
5
|
-
return yargs
|
|
6
|
-
.positional('action', {
|
|
7
|
-
choices: ['create', 'validate', 'display'],
|
|
8
|
-
description: 'Action to take on config',
|
|
9
|
-
type: 'string',
|
|
10
|
-
})
|
|
11
|
-
.positional('target', {
|
|
12
|
-
description: 'Location of config file',
|
|
13
|
-
type: 'string',
|
|
14
|
-
})
|
|
15
|
-
}, async ({ action, target }) => {
|
|
16
|
-
console.log(`Taking action [${action}] on manifest at ${target}`)
|
|
17
|
-
return await Promise.resolve()
|
|
18
|
-
})
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Argv } from 'yargs'
|
|
2
|
-
|
|
3
|
-
import type { TemplateName } from '../lib/index.ts'
|
|
4
|
-
import { createFromTemplate } from '../lib/index.ts'
|
|
5
|
-
|
|
6
|
-
export const commandCreate = (argv: Argv) => {
|
|
7
|
-
return argv.command('create [template] <target>', 'Create an xyos project', (yargs) => {
|
|
8
|
-
return yargs
|
|
9
|
-
.positional('template', {
|
|
10
|
-
choices: ['react', 'headless', 'dapp', 'diviner', 'witness'] as TemplateName[],
|
|
11
|
-
description: 'Template to use',
|
|
12
|
-
type: 'string',
|
|
13
|
-
})
|
|
14
|
-
.positional('target', {
|
|
15
|
-
description: 'Location into which to create the template project',
|
|
16
|
-
type: 'string',
|
|
17
|
-
})
|
|
18
|
-
}, async ({ template, target }) => {
|
|
19
|
-
console.log(`Using template ${template} at location ${target}`)
|
|
20
|
-
return await createFromTemplate({ target, template })
|
|
21
|
-
})
|
|
22
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Argv } from 'yargs'
|
|
2
|
-
|
|
3
|
-
export const commandManifest = (argv: Argv) => {
|
|
4
|
-
return argv.command('manifest [action] <target>', 'Create an xyos project', (yargs) => {
|
|
5
|
-
return yargs
|
|
6
|
-
.positional('action', {
|
|
7
|
-
choices: ['create', 'validate', 'display'],
|
|
8
|
-
description: 'Action to take on manifest',
|
|
9
|
-
type: 'string',
|
|
10
|
-
})
|
|
11
|
-
.positional('target', {
|
|
12
|
-
description: 'Location of manifest file',
|
|
13
|
-
type: 'string',
|
|
14
|
-
})
|
|
15
|
-
}, async ({ action, target }) => {
|
|
16
|
-
console.log(`Taking action [${action}] on manifest at ${target}`)
|
|
17
|
-
return await Promise.resolve()
|
|
18
|
-
})
|
|
19
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { NativeKernelDrivers } from '@xyo-network/kernel-model'
|
|
2
|
-
import type { Argv } from 'yargs'
|
|
3
|
-
|
|
4
|
-
import { headless } from '../lib/index.ts'
|
|
5
|
-
|
|
6
|
-
export const commandStart = (argv: Argv) => {
|
|
7
|
-
return argv.command('start', 'Start xyOS in headless mode', (yargs) => {
|
|
8
|
-
return yargs
|
|
9
|
-
.option('config', {
|
|
10
|
-
alias: 'c',
|
|
11
|
-
description: 'Config file to use',
|
|
12
|
-
type: 'string',
|
|
13
|
-
}).option('manifest', {
|
|
14
|
-
alias: 'm',
|
|
15
|
-
description: 'Manifest file to use',
|
|
16
|
-
type: 'string',
|
|
17
|
-
}).option('kernelDriver', {
|
|
18
|
-
alias: 'k',
|
|
19
|
-
description: 'Kernel driver to load',
|
|
20
|
-
type: 'string',
|
|
21
|
-
})
|
|
22
|
-
}, async ({
|
|
23
|
-
config, manifest, kernelDriver,
|
|
24
|
-
}) => {
|
|
25
|
-
if (config) {
|
|
26
|
-
console.log(`Using config: ${config}`)
|
|
27
|
-
}
|
|
28
|
-
if (config) {
|
|
29
|
-
console.log(`Using manifest: ${manifest}`)
|
|
30
|
-
}
|
|
31
|
-
await headless({
|
|
32
|
-
manifest, config, kernelDrivers: kernelDriver ? [kernelDriver as NativeKernelDrivers] : [],
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import yargs from 'yargs'
|
|
2
|
-
// eslint-disable-next-line import-x/no-internal-modules
|
|
3
|
-
import { hideBin } from 'yargs/helpers'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
commandConfig, commandCreate, commandManifest, commandStart,
|
|
7
|
-
} from './command/index.ts'
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
(
|
|
11
|
-
commandManifest(
|
|
12
|
-
commandConfig(
|
|
13
|
-
commandCreate(
|
|
14
|
-
commandStart(
|
|
15
|
-
yargs(
|
|
16
|
-
hideBin(
|
|
17
|
-
process.argv,
|
|
18
|
-
),
|
|
19
|
-
),
|
|
20
|
-
),
|
|
21
|
-
),
|
|
22
|
-
),
|
|
23
|
-
)
|
|
24
|
-
.usage('Usage: $0 <command> [options]')
|
|
25
|
-
.scriptName('xyos')
|
|
26
|
-
.demandCommand(1)
|
|
27
|
-
.parse()
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
) as Promise<any>
|
|
30
|
-
).catch(
|
|
31
|
-
console.error,
|
|
32
|
-
)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type TemplateName = 'react' | 'headless' | 'dapp' | 'diviner' | 'witness'
|
|
2
|
-
|
|
3
|
-
export interface CreateFromTemplateParams {
|
|
4
|
-
target?: string
|
|
5
|
-
template?: TemplateName
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const createFromTemplate = async ({ target, template }: CreateFromTemplateParams) => {
|
|
9
|
-
console.log('Creating from template', template, 'at', target)
|
|
10
|
-
return await Promise.resolve()
|
|
11
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs'
|
|
2
|
-
|
|
3
|
-
import { boot } from '@xyo-network/bios'
|
|
4
|
-
import { Kernel } from '@xyo-network/kernel'
|
|
5
|
-
import type { NativeKernelDrivers } from '@xyo-network/kernel-model'
|
|
6
|
-
import type { PackageManifest } from '@xyo-network/manifest'
|
|
7
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
8
|
-
import chalk from 'chalk'
|
|
9
|
-
import { cosmiconfig } from 'cosmiconfig'
|
|
10
|
-
import { TypeScriptLoader } from 'cosmiconfig-typescript-loader'
|
|
11
|
-
import tk from 'terminal-kit'
|
|
12
|
-
|
|
13
|
-
const { terminal } = tk
|
|
14
|
-
|
|
15
|
-
import { XyOs } from '../../../XyOs.ts'
|
|
16
|
-
|
|
17
|
-
const terminate = () => {
|
|
18
|
-
terminal.grabInput(false)
|
|
19
|
-
setTimeout(function () {
|
|
20
|
-
// eslint-disable-next-line unicorn/no-process-exit
|
|
21
|
-
process.exit(0)
|
|
22
|
-
}, 100)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface XyOsConfig {
|
|
26
|
-
developmentMode?: boolean
|
|
27
|
-
manifest?: string | PackageManifest
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface HeadlessParams {
|
|
31
|
-
config?: string
|
|
32
|
-
kernelDrivers?: NativeKernelDrivers[]
|
|
33
|
-
manifest?: string
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const headless = async ({
|
|
37
|
-
manifest, config, kernelDrivers,
|
|
38
|
-
}: HeadlessParams = {}) => {
|
|
39
|
-
console.log(chalk.green('Starting Headless xyOS...'))
|
|
40
|
-
const configExplorer = cosmiconfig('xyos', { cache: true, loaders: { '.ts': TypeScriptLoader() } })
|
|
41
|
-
const configResult = await (config ? configExplorer.load(config) : configExplorer.search())
|
|
42
|
-
const xyosConfig: XyOsConfig = (configResult?.config ?? {}) as XyOsConfig
|
|
43
|
-
const manifestToLoad: string | undefined = manifest ?? (typeof xyosConfig.manifest === 'string' ? xyosConfig.manifest : undefined)
|
|
44
|
-
const manifestObject: PackageManifest | undefined = manifestToLoad
|
|
45
|
-
? JSON.parse(fs.readFileSync(manifestToLoad, 'utf8')) as PackageManifest
|
|
46
|
-
: typeof xyosConfig.manifest === 'object' ? xyosConfig.manifest : undefined
|
|
47
|
-
|
|
48
|
-
const osWallet = await HDWallet.random()
|
|
49
|
-
const kernel = new Kernel({ logColor: 'cyan', logger: console })
|
|
50
|
-
await kernel.boot(await boot(), { kernelDrivers })
|
|
51
|
-
const xyOs = new XyOs({
|
|
52
|
-
kernel,
|
|
53
|
-
stackMap: {},
|
|
54
|
-
manifest: manifestObject,
|
|
55
|
-
developmentMode: xyosConfig.developmentMode,
|
|
56
|
-
})
|
|
57
|
-
await xyOs.boot(osWallet)
|
|
58
|
-
console.log(chalk.green('Started Headless xyOS...'))
|
|
59
|
-
|
|
60
|
-
terminal.grabInput({ mouse: 'button' })
|
|
61
|
-
|
|
62
|
-
terminal.on('key', function (name: string) {
|
|
63
|
-
console.log("'key' event:", name)
|
|
64
|
-
if (name === 'CTRL_C') {
|
|
65
|
-
terminate()
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { WalletKindSignerPaths } from '@xyo-network/os-model'
|
|
2
|
-
import type { WalletKind, WalletSeedPhraseStore } from '@xyo-network/storage-model'
|
|
3
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
4
|
-
import {
|
|
5
|
-
beforeEach,
|
|
6
|
-
describe,
|
|
7
|
-
expect,
|
|
8
|
-
it,
|
|
9
|
-
vi,
|
|
10
|
-
} from 'vitest'
|
|
11
|
-
|
|
12
|
-
import { Signers } from './Signers.ts'
|
|
13
|
-
|
|
14
|
-
describe('Signer', () => {
|
|
15
|
-
let osWallet: string
|
|
16
|
-
let userWallet: string
|
|
17
|
-
let seedPhraseStore: WalletSeedPhraseStore
|
|
18
|
-
|
|
19
|
-
const testSigner1Path = '0/0'
|
|
20
|
-
const testSigner2Path = '0/1'
|
|
21
|
-
const testSigner3Path = '0/2'
|
|
22
|
-
const testSigner4Path = '0/3'
|
|
23
|
-
|
|
24
|
-
const osPaths = new Map([['testSigner0', testSigner1Path], ['testSigner1', testSigner2Path]])
|
|
25
|
-
const userPaths = new Map([['testSigner2', testSigner3Path], ['testSigner3', testSigner4Path]])
|
|
26
|
-
const paths: WalletKindSignerPaths = new Map([['os', osPaths], ['user', userPaths]])
|
|
27
|
-
|
|
28
|
-
let signers: Signers
|
|
29
|
-
|
|
30
|
-
beforeEach(async () => {
|
|
31
|
-
osWallet = HDWallet.generateMnemonic()
|
|
32
|
-
userWallet = HDWallet.generateMnemonic()
|
|
33
|
-
seedPhraseStore = {
|
|
34
|
-
get: vi.fn().mockImplementation((key: WalletKind) => {
|
|
35
|
-
if (key === 'os') {
|
|
36
|
-
return osWallet
|
|
37
|
-
}
|
|
38
|
-
if (key === 'user') {
|
|
39
|
-
return userWallet
|
|
40
|
-
}
|
|
41
|
-
return
|
|
42
|
-
}),
|
|
43
|
-
set: vi.fn(),
|
|
44
|
-
delete: vi.fn(),
|
|
45
|
-
}
|
|
46
|
-
signers = new Signers(paths, seedPhraseStore)
|
|
47
|
-
await signers.initialize()
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('should initialize signers', () => {
|
|
51
|
-
expect(signers.getSigner('os', 'testSigner0')).toBeDefined()
|
|
52
|
-
expect(signers.getSigner('os', 'testSigner1')).toBeDefined()
|
|
53
|
-
expect(signers.getSigner('user', 'testSigner2')).toBeDefined()
|
|
54
|
-
expect(signers.getSigner('user', 'testSigner3')).toBeDefined()
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('should return undefined for non-existent signer', () => {
|
|
58
|
-
expect(signers.getSigner('os', 'nonExistentSigner')).toBeUndefined()
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('should use paths correctly', async () => {
|
|
62
|
-
const osWalletAddress = (await (await HDWallet.fromPhrase(osWallet)).derivePath(testSigner1Path)).address
|
|
63
|
-
expect(signers.getSigner('os', 'testSigner0')?.address).toBe(osWalletAddress)
|
|
64
|
-
})
|
|
65
|
-
})
|
package/src/signer/Signers.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import { type AccountInstance } from '@xyo-network/account-model'
|
|
3
|
-
import type {
|
|
4
|
-
SignerAccounts, SignersExternal, WalletKindSignerPaths,
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
import type {
|
|
7
|
-
WalletKind,
|
|
8
|
-
WalletSeedPhraseStore,
|
|
9
|
-
} from '@xyo-network/storage-model'
|
|
10
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
11
|
-
|
|
12
|
-
export class Signers implements SignersExternal {
|
|
13
|
-
private _paths: WalletKindSignerPaths
|
|
14
|
-
private _signerAccounts: Map<WalletKind, SignerAccounts>
|
|
15
|
-
private _walletStore: WalletSeedPhraseStore
|
|
16
|
-
|
|
17
|
-
constructor(paths: WalletKindSignerPaths, walletStore: WalletSeedPhraseStore) {
|
|
18
|
-
this._paths = paths
|
|
19
|
-
this._walletStore = walletStore
|
|
20
|
-
this._signerAccounts = new Map()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
private get paths(): WalletKindSignerPaths {
|
|
24
|
-
return assertEx(this._paths, () => 'Paths not initialized')
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
private get signerAccounts(): Map<WalletKind, SignerAccounts> {
|
|
28
|
-
return assertEx(this._signerAccounts, () => 'Signer accounts not initialized')
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
private get walletStore(): WalletSeedPhraseStore {
|
|
32
|
-
return assertEx(this._walletStore, () => 'Wallet store not initialized')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getSigner(walletKind: WalletKind, signer: string): AccountInstance | undefined {
|
|
36
|
-
return this.signerAccounts.get(walletKind)?.get(signer)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getWalletKindSigner(walletKind: WalletKind): SignerAccounts | undefined {
|
|
40
|
-
return this.signerAccounts.get(walletKind)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async initialize() {
|
|
44
|
-
for (const [walletKindName, signerPaths] of this.paths) {
|
|
45
|
-
for (const [signerName, walletPath] of signerPaths.entries()) {
|
|
46
|
-
await this.initializeSigners(walletKindName, signerName, walletPath)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private async initializeSigners(walletKindName: WalletKind, signerName: string, path: string) {
|
|
52
|
-
// test if the name and path are valid
|
|
53
|
-
assertEx(signerName, () => 'Name not found in signer paths')
|
|
54
|
-
assertEx(path, () => 'Path not found in signer paths')
|
|
55
|
-
|
|
56
|
-
// test if the wallet exists
|
|
57
|
-
const phrase = assertEx(await this.walletStore.get(walletKindName), () => `Wallet not found: ${walletKindName}`)
|
|
58
|
-
|
|
59
|
-
if (path) {
|
|
60
|
-
// get the signer map for the wallet kind or create a new one
|
|
61
|
-
const signerMap = this.signerAccounts.get(walletKindName) ?? new Map()
|
|
62
|
-
|
|
63
|
-
// derive the wallet from the path
|
|
64
|
-
const wallet = await HDWallet.fromPhrase(phrase)
|
|
65
|
-
const derivedWallet = await wallet.derivePath(path)
|
|
66
|
-
|
|
67
|
-
// add the derived wallet to the signer map
|
|
68
|
-
signerMap.set(signerName, derivedWallet)
|
|
69
|
-
|
|
70
|
-
// set the signer map for the wallet kind
|
|
71
|
-
this.signerAccounts.set(walletKindName, signerMap)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
package/src/signer/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Signers.ts'
|
package/src/spec/boot.spec.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { BiosExternalInterface } from '@xyo-network/bios-model'
|
|
2
|
-
import { boot } from '@xyo-network/bios-nodejs'
|
|
3
|
-
import { Kernel } from '@xyo-network/kernel'
|
|
4
|
-
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
5
|
-
import type { WalletKindSignerPaths } from '@xyo-network/os-model'
|
|
6
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
7
|
-
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
8
|
-
import {
|
|
9
|
-
beforeEach,
|
|
10
|
-
describe, expect, test,
|
|
11
|
-
} from 'vitest'
|
|
12
|
-
|
|
13
|
-
import type { DappRegistrationServiceParams } from '../registration/index.ts'
|
|
14
|
-
import { XyOs } from '../XyOs.ts'
|
|
15
|
-
|
|
16
|
-
describe('os', () => {
|
|
17
|
-
let bios: BiosExternalInterface
|
|
18
|
-
let osWallet: WalletInstance
|
|
19
|
-
let kernel: KernelExternal
|
|
20
|
-
|
|
21
|
-
const testSigner0Path = '0/0'
|
|
22
|
-
const testSigner1Path = '0/1'
|
|
23
|
-
const userPaths = new Map([['testSigner0', testSigner0Path], ['testSigner1', testSigner1Path]])
|
|
24
|
-
const paths: WalletKindSignerPaths = new Map([['user', userPaths]])
|
|
25
|
-
|
|
26
|
-
beforeEach(async () => {
|
|
27
|
-
bios = await boot()
|
|
28
|
-
const osWalletSeedPhrase = await bios.seedPhraseStore.get('os')
|
|
29
|
-
osWallet = await HDWallet.fromPhrase(osWalletSeedPhrase as string)
|
|
30
|
-
kernel = new Kernel({ bios })
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
describe('boot', () => {
|
|
34
|
-
test('with default params', async () => {
|
|
35
|
-
const xyOs = new XyOs()
|
|
36
|
-
await xyOs.boot(osWallet)
|
|
37
|
-
expect(xyOs).toBeDefined()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
test('with dapps', async () => {
|
|
41
|
-
const dappsConfiguration: DappRegistrationServiceParams = {
|
|
42
|
-
dappNames: ['testDapp'],
|
|
43
|
-
dappParams: {},
|
|
44
|
-
dappPayloads: [],
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const xyOs = new XyOs({ dappsConfiguration })
|
|
48
|
-
await xyOs.boot(osWallet)
|
|
49
|
-
expect(xyOs).toBeDefined()
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
test('default stacks', async () => {
|
|
53
|
-
const bios = await boot()
|
|
54
|
-
const kernel = new Kernel()
|
|
55
|
-
await kernel.boot(bios)
|
|
56
|
-
const xyOs = new XyOs({ kernel })
|
|
57
|
-
expect(xyOs).toBeDefined()
|
|
58
|
-
if (xyOs) {
|
|
59
|
-
const osWalletSeedPhrase = await bios.seedPhraseStore.get('os')
|
|
60
|
-
expect(osWalletSeedPhrase).toBeDefined()
|
|
61
|
-
const osWallet = await HDWallet.fromPhrase(osWalletSeedPhrase as string)
|
|
62
|
-
expect(osWallet).toBeDefined()
|
|
63
|
-
await xyOs.boot(osWallet)
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
test('no stacks', async () => {
|
|
68
|
-
const xyOs = new XyOs({ stackMap: {} })
|
|
69
|
-
expect(xyOs).toBeDefined()
|
|
70
|
-
if (xyOs) {
|
|
71
|
-
await xyOs.boot(osWallet)
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
test('supports users signing', async () => {
|
|
76
|
-
const params = { kernel, signerPaths: paths }
|
|
77
|
-
|
|
78
|
-
const xyOs = new XyOs(params)
|
|
79
|
-
|
|
80
|
-
expect(xyOs).toBeDefined()
|
|
81
|
-
|
|
82
|
-
if (xyOs) {
|
|
83
|
-
await xyOs.boot(osWallet)
|
|
84
|
-
expect(xyOs.user).toBeDefined()
|
|
85
|
-
expect(xyOs.user.signers).toBeDefined()
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
})
|