@xyo-network/os-runtime 3.0.8 → 3.0.10
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/index.d.ts +88 -70
- package/dist/neutral/index.mjs +99 -152
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +53 -52
- package/src/Caller.ts +1 -3
- package/src/DefaultsQueries.ts +2 -6
- package/src/XyOs.ts +18 -15
- package/src/XyOsBase.ts +1 -3
- package/src/XyOsDapp.ts +6 -6
- package/src/access-interfaces/ValidDappAccessInterfaces.ts +1 -3
- package/src/access-interfaces/registered-names/helpers/AccessNodeQueries.ts +1 -3
- package/src/access-interfaces/registered-names/helpers/resource/RegistrationsResource.ts +2 -6
- package/src/adapter/Base.ts +2 -6
- package/src/adapters/OsPubSubBridgeNetwork.ts +1 -3
- package/src/classes/cache/RunningDappCache.ts +2 -6
- package/src/classes/dapp/DefaultsResource.ts +2 -6
- package/src/classes/dapp/access/Caller.ts +1 -3
- package/src/classes/dapp/access/Queries.ts +2 -6
- package/src/classes/dapp/access/Resource.ts +2 -6
- package/src/classes/index.ts +1 -0
- package/src/classes/lib/Insertable.ts +1 -3
- package/src/classes/menu/Caller.ts +1 -3
- package/src/classes/menu/Queries.ts +1 -3
- package/src/classes/menu/Resource.ts +2 -6
- package/src/classes/node/Creator.ts +4 -10
- package/src/classes/node/DefaultPayloads/DappAccessPayloads.ts +1 -3
- package/src/classes/node/DefaultPayloads/DefaultPayloads.ts +1 -3
- package/src/classes/node/DefaultPayloads/SigningKeyPayloads.ts +2 -6
- package/src/classes/node/ExternalModulePermissions/ExternalModulePermissions.ts +1 -3
- package/src/classes/node/createDappContext.ts +2 -6
- package/src/classes/registration/DappRegistrationService.ts +4 -12
- package/src/classes/registration/ValidateDappAccessDiviner/Config.ts +1 -3
- package/src/classes/registration/ValidateDappAccessDiviner/Diviner.ts +2 -6
- package/src/classes/settings/Resource.ts +2 -6
- package/src/classes/settings/SettingsQueries.ts +2 -6
- package/src/classes/settings/badge/Resource.ts +1 -3
- package/src/classes/signer/Signers.ts +69 -0
- package/src/classes/signer/index.ts +1 -0
- package/src/event/bus/EventBus.ts +2 -8
- package/src/helpers/monitor/XyOsMonitor.ts +1 -3
- package/src/intent/Caller.ts +1 -3
- package/src/intent/Resource.ts +2 -6
- package/src/lib/ModuleAccountPaths.ts +1 -3
- package/src/lib/PayloadStore.ts +1 -3
- package/src/lib/isPayload.ts +1 -3
- package/src/profileModuleEvents.ts +2 -6
- package/src/stack/Manager.ts +9 -6
- package/src/stack/OsPubSubNetworkStack.ts +4 -12
- package/src/stack/OsSettingsStack.ts +2 -6
- package/src/stack/XyoPublicNetworkStack.ts +2 -6
- package/src/utils/buildWalletSeedPhrasePayload.ts +2 -6
- package/src/wallet/DappSeedPhraseRepository.ts +1 -3
package/package.json
CHANGED
|
@@ -1,26 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/os-runtime",
|
|
3
|
+
"version": "3.0.10",
|
|
4
|
+
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
|
+
"homepage": "https://xyo.network",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues",
|
|
8
|
+
"email": "support@xyo.network"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "LGPL-3.0-only",
|
|
3
15
|
"author": {
|
|
4
|
-
"email": "support@xyo.network",
|
|
5
16
|
"name": "XYO Development Team",
|
|
17
|
+
"email": "support@xyo.network",
|
|
6
18
|
"url": "https://xyo.network"
|
|
7
19
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/neutral/index.d.ts",
|
|
25
|
+
"default": "./dist/neutral/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
11
28
|
},
|
|
29
|
+
"module": "dist/neutral/index.mjs",
|
|
30
|
+
"types": "dist/neutral/index.d.ts",
|
|
12
31
|
"dependencies": {
|
|
13
|
-
"@xylabs/assert": "^4.0.
|
|
14
|
-
"@xylabs/forget": "^4.0.
|
|
15
|
-
"@xylabs/hex": "^4.0.
|
|
16
|
-
"@xylabs/lodash": "^4.0.
|
|
17
|
-
"@xylabs/object": "^4.0.
|
|
18
|
-
"@xylabs/promise": "^4.0.
|
|
19
|
-
"@xyo-network/account": "^3.0.
|
|
20
|
-
"@xyo-network/archivist": "^3.0.
|
|
21
|
-
"@xyo-network/archivist-indexeddb": "^3.0.
|
|
22
|
-
"@xyo-network/archivist-model": "^3.0.
|
|
23
|
-
"@xyo-network/bios": "^3.0.
|
|
32
|
+
"@xylabs/assert": "^4.0.3",
|
|
33
|
+
"@xylabs/forget": "^4.0.3",
|
|
34
|
+
"@xylabs/hex": "^4.0.3",
|
|
35
|
+
"@xylabs/lodash": "^4.0.3",
|
|
36
|
+
"@xylabs/object": "^4.0.3",
|
|
37
|
+
"@xylabs/promise": "^4.0.3",
|
|
38
|
+
"@xyo-network/account": "^3.0.7",
|
|
39
|
+
"@xyo-network/archivist": "^3.0.7",
|
|
40
|
+
"@xyo-network/archivist-indexeddb": "^3.0.7",
|
|
41
|
+
"@xyo-network/archivist-model": "^3.0.7",
|
|
42
|
+
"@xyo-network/bios": "^3.0.10",
|
|
43
|
+
"@xyo-network/bios-model": "^3.0.10",
|
|
24
44
|
"@xyo-network/bridge-model": "^3.0.5",
|
|
25
45
|
"@xyo-network/diviner-abstract": "^3.0.5",
|
|
26
46
|
"@xyo-network/diviner-model": "^3.0.5",
|
|
@@ -28,20 +48,20 @@
|
|
|
28
48
|
"@xyo-network/diviner-payload-indexeddb": "^3.0.5",
|
|
29
49
|
"@xyo-network/diviner-payload-model": "^3.0.5",
|
|
30
50
|
"@xyo-network/diviner-temporal-indexing-model": "^3.0.5",
|
|
31
|
-
"@xyo-network/kernel": "^3.0.
|
|
32
|
-
"@xyo-network/kernel-model": "^3.0.
|
|
33
|
-
"@xyo-network/manifest": "^3.0.
|
|
34
|
-
"@xyo-network/manifest-wrapper": "^3.0.
|
|
35
|
-
"@xyo-network/module-abstract": "^3.0.
|
|
36
|
-
"@xyo-network/module-events": "^3.0.
|
|
37
|
-
"@xyo-network/module-factory-locator": "^3.0.
|
|
38
|
-
"@xyo-network/module-model": "^3.0.
|
|
39
|
-
"@xyo-network/module-resolver": "^3.0.
|
|
40
|
-
"@xyo-network/node-model": "^3.0.
|
|
41
|
-
"@xyo-network/os-model": "^3.0.
|
|
42
|
-
"@xyo-network/payload-builder": "^3.0.
|
|
43
|
-
"@xyo-network/payload-model": "^3.0.
|
|
44
|
-
"@xyo-network/wallet-model": "^3.0.
|
|
51
|
+
"@xyo-network/kernel": "^3.0.10",
|
|
52
|
+
"@xyo-network/kernel-model": "^3.0.10",
|
|
53
|
+
"@xyo-network/manifest": "^3.0.7",
|
|
54
|
+
"@xyo-network/manifest-wrapper": "^3.0.7",
|
|
55
|
+
"@xyo-network/module-abstract": "^3.0.7",
|
|
56
|
+
"@xyo-network/module-events": "^3.0.7",
|
|
57
|
+
"@xyo-network/module-factory-locator": "^3.0.7",
|
|
58
|
+
"@xyo-network/module-model": "^3.0.7",
|
|
59
|
+
"@xyo-network/module-resolver": "^3.0.7",
|
|
60
|
+
"@xyo-network/node-model": "^3.0.7",
|
|
61
|
+
"@xyo-network/os-model": "^3.0.10",
|
|
62
|
+
"@xyo-network/payload-builder": "^3.0.7",
|
|
63
|
+
"@xyo-network/payload-model": "^3.0.7",
|
|
64
|
+
"@xyo-network/wallet-model": "^3.0.7",
|
|
45
65
|
"async-mutex": "^0.5.0",
|
|
46
66
|
"ethers": "^6.13.2",
|
|
47
67
|
"semver": "^7.6.3",
|
|
@@ -50,32 +70,13 @@
|
|
|
50
70
|
"devDependencies": {
|
|
51
71
|
"@types/semver": "^7.5.8",
|
|
52
72
|
"@types/uuid": "^10.0.0",
|
|
53
|
-
"@xylabs/ts-scripts-yarn3": "^4.0.0
|
|
54
|
-
"@xylabs/tsconfig": "^4.0.0
|
|
55
|
-
"@xyo-network/bios-nodejs": "^3.0.
|
|
73
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.0",
|
|
74
|
+
"@xylabs/tsconfig": "^4.0.0",
|
|
75
|
+
"@xyo-network/bios-nodejs": "^3.0.10",
|
|
56
76
|
"typescript": "^5.5.4",
|
|
57
77
|
"vitest": "^2.0.5"
|
|
58
78
|
},
|
|
59
|
-
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
60
|
-
"exports": {
|
|
61
|
-
".": {
|
|
62
|
-
"types": "./dist/neutral/index.d.ts",
|
|
63
|
-
"default": "./dist/neutral/index.mjs"
|
|
64
|
-
},
|
|
65
|
-
"./package.json": "./package.json"
|
|
66
|
-
},
|
|
67
|
-
"module": "dist/neutral/index.mjs",
|
|
68
|
-
"types": "dist/neutral/index.d.ts",
|
|
69
|
-
"homepage": "https://xyo.network",
|
|
70
|
-
"license": "LGPL-3.0-only",
|
|
71
79
|
"publishConfig": {
|
|
72
80
|
"access": "public"
|
|
73
|
-
}
|
|
74
|
-
"repository": {
|
|
75
|
-
"type": "git",
|
|
76
|
-
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
77
|
-
},
|
|
78
|
-
"sideEffects": false,
|
|
79
|
-
"version": "3.0.8",
|
|
80
|
-
"type": "module"
|
|
81
|
+
}
|
|
81
82
|
}
|
package/src/Caller.ts
CHANGED
|
@@ -23,9 +23,7 @@ import {
|
|
|
23
23
|
SigningKeySchema,
|
|
24
24
|
} from '@xyo-network/os-model'
|
|
25
25
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
26
|
-
import type {
|
|
27
|
-
Payload, WithMeta,
|
|
28
|
-
} from '@xyo-network/payload-model'
|
|
26
|
+
import type { Payload, WithMeta } from '@xyo-network/payload-model'
|
|
29
27
|
|
|
30
28
|
import { DappCallerBase } from './DappCallerBase.ts'
|
|
31
29
|
import { DappDefaultsResourceQueries } from './DefaultsQueries.ts'
|
package/src/DefaultsQueries.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
2
2
|
import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
import {
|
|
7
|
-
DappInjectableParamsSchema, NodeOsInfoSchema,
|
|
8
|
-
} from '@xyo-network/os-model'
|
|
3
|
+
import type { DappInjectableParams, NodeOsInfo } from '@xyo-network/os-model'
|
|
4
|
+
import { DappInjectableParamsSchema, NodeOsInfoSchema } from '@xyo-network/os-model'
|
|
9
5
|
import type { WithMeta } from '@xyo-network/payload-model'
|
|
10
6
|
|
|
11
7
|
export const DappDefaultsResourceQueries = {
|
package/src/XyOs.ts
CHANGED
|
@@ -20,15 +20,11 @@ import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
|
20
20
|
import type { DappRegistrationServiceParams } from './classes/registration/index.ts'
|
|
21
21
|
import { DappRegistrationService } from './classes/registration/index.ts'
|
|
22
22
|
import { EventBus } from './event/index.ts'
|
|
23
|
-
import type {
|
|
24
|
-
MonitorEventConfig, XyOsMonitor,
|
|
25
|
-
} from './helpers/index.ts'
|
|
23
|
+
import type { MonitorEventConfig, XyOsMonitor } from './helpers/index.ts'
|
|
26
24
|
import { NameTransforms } from './lib/index.ts'
|
|
27
25
|
import { loadOsNode } from './loadOsNode.ts'
|
|
28
|
-
import type { OsPubSubNetworkStack } from './stack/index.ts'
|
|
29
|
-
import {
|
|
30
|
-
OsStackMap, StackManager,
|
|
31
|
-
} from './stack/index.ts'
|
|
26
|
+
import type { OsPubSubNetworkStack, UninitializedStackMap } from './stack/index.ts'
|
|
27
|
+
import { OsStackMap, StackManager } from './stack/index.ts'
|
|
32
28
|
import type { XyOsContextParams } from './XyOsBase.ts'
|
|
33
29
|
import { XyOsContextBase } from './XyOsBase.ts'
|
|
34
30
|
|
|
@@ -36,6 +32,7 @@ export interface XyOsParams<TManifest extends PackageManifest = PackageManifest>
|
|
|
36
32
|
dappsConfiguration?: DappRegistrationServiceParams
|
|
37
33
|
developmentMode?: boolean
|
|
38
34
|
kernel?: XyOsContext['kernel']
|
|
35
|
+
stackMap?: UninitializedStackMap
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
export class XyOs extends XyOsContextBase<XyOsParams> implements XyOsContext {
|
|
@@ -47,14 +44,20 @@ export class XyOs extends XyOsContextBase<XyOsParams> implements XyOsContext {
|
|
|
47
44
|
private stackManager: StackManager
|
|
48
45
|
|
|
49
46
|
constructor({
|
|
50
|
-
eventBus = new EventBus(),
|
|
47
|
+
eventBus = new EventBus(),
|
|
48
|
+
kernel = new Kernel(),
|
|
49
|
+
locator = new ModuleFactoryLocator(),
|
|
50
|
+
dappsConfiguration,
|
|
51
|
+
developmentMode,
|
|
52
|
+
stackMap = OsStackMap,
|
|
53
|
+
...params
|
|
51
54
|
}: XyOsParams = {}) {
|
|
52
55
|
super({
|
|
53
56
|
eventBus, kernel, locator, ...params,
|
|
54
57
|
})
|
|
55
58
|
this._locator = locator
|
|
56
59
|
this._kernel = kernel
|
|
57
|
-
this.stackManager = new StackManager(
|
|
60
|
+
this.stackManager = new StackManager(stackMap)
|
|
58
61
|
this.dappRegistrationService = new DappRegistrationService(this, dappsConfiguration, this.locator, developmentMode)
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -86,16 +89,16 @@ export class XyOs extends XyOsContextBase<XyOsParams> implements XyOsContext {
|
|
|
86
89
|
return this._locator
|
|
87
90
|
}
|
|
88
91
|
|
|
92
|
+
get stacks() {
|
|
93
|
+
return this.stackManager.stacks
|
|
94
|
+
}
|
|
95
|
+
|
|
89
96
|
static async monitor<T>(fn: () => Promise<T>, eventConfig: MonitorEventConfig): Promise<T> {
|
|
90
|
-
const {
|
|
91
|
-
name, additionalProperties,
|
|
92
|
-
} = eventConfig
|
|
97
|
+
const { name, additionalProperties } = eventConfig
|
|
93
98
|
const monitor = this.monitoring
|
|
94
99
|
monitor?.startTimer(name)
|
|
95
100
|
const result = await fn()
|
|
96
|
-
monitor?.stopTimer({
|
|
97
|
-
additionalProperties, name,
|
|
98
|
-
})
|
|
101
|
+
monitor?.stopTimer({ additionalProperties, name })
|
|
99
102
|
|
|
100
103
|
return result
|
|
101
104
|
}
|
package/src/XyOsBase.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import type {
|
|
3
|
-
BaseParams, JsonObject,
|
|
4
|
-
} from '@xylabs/object'
|
|
2
|
+
import type { BaseParams, JsonObject } from '@xylabs/object'
|
|
5
3
|
import type { Promisable } from '@xylabs/promise'
|
|
6
4
|
import type { WalletInstance } from '@xyo-network/account'
|
|
7
5
|
import type { KernelExternal } from '@xyo-network/kernel-model'
|
package/src/XyOsDapp.ts
CHANGED
|
@@ -52,6 +52,10 @@ export class XyOsDapp extends XyOsContextBase<XyOsDappContextParams> implements
|
|
|
52
52
|
return this.params.parent
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
get stacks() {
|
|
56
|
+
return []
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
override async boot(wallet: WalletInstance, locator?: ModuleFactoryLocator): Promise<void> {
|
|
56
60
|
return await this._bootMutex.runExclusive(async () => {
|
|
57
61
|
console.log('XyOsDapp:boot:start', wallet.address, this.dapp.id)
|
|
@@ -62,9 +66,7 @@ export class XyOsDapp extends XyOsContextBase<XyOsDappContextParams> implements
|
|
|
62
66
|
|
|
63
67
|
console.log('XyOsDapp:boot:finalLocator', finalLocator)
|
|
64
68
|
|
|
65
|
-
const dappNodesWrapper = new ManifestWrapper({
|
|
66
|
-
...this.manifest, schema: DappPackageManifestPayloadSchema,
|
|
67
|
-
}, wallet, finalLocator)
|
|
69
|
+
const dappNodesWrapper = new ManifestWrapper({ ...this.manifest, schema: DappPackageManifestPayloadSchema }, wallet, finalLocator)
|
|
68
70
|
const dappNodes = await dappNodesWrapper.loadNodes()
|
|
69
71
|
|
|
70
72
|
// Derive a specific wallet for the dappManifestWrapper.
|
|
@@ -72,9 +74,7 @@ export class XyOsDapp extends XyOsContextBase<XyOsDappContextParams> implements
|
|
|
72
74
|
const dappManifestWallet = await wallet.derivePath('99999')
|
|
73
75
|
DappWindowManifest.nodes[0].config.name = this.dapp.name + 'Root'
|
|
74
76
|
const wrapper = new ManifestWrapper<DappPackageManifestPayload>(
|
|
75
|
-
{
|
|
76
|
-
...DappWindowManifest, schema: DappPackageManifestPayloadSchema,
|
|
77
|
-
},
|
|
77
|
+
{ ...DappWindowManifest, schema: DappPackageManifestPayloadSchema },
|
|
78
78
|
dappManifestWallet,
|
|
79
79
|
finalLocator,
|
|
80
80
|
)
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { DappAccessInterface } from '@xyo-network/os-model'
|
|
2
|
-
import {
|
|
3
|
-
RegisteredNames, RegisteredNamesInterface,
|
|
4
|
-
} from '@xyo-network/os-model'
|
|
2
|
+
import { RegisteredNames, RegisteredNamesInterface } from '@xyo-network/os-model'
|
|
5
3
|
|
|
6
4
|
export type ValidDappAccessInterfaces = typeof RegisteredNames
|
|
7
5
|
|
|
@@ -3,9 +3,7 @@ import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
|
3
3
|
import type {
|
|
4
4
|
DappAccessRequest, RegisteredDappAccess, TemporalIndexRegistrationResults, XyOsContext,
|
|
5
5
|
} from '@xyo-network/os-model'
|
|
6
|
-
import type {
|
|
7
|
-
WithMeta, WithSources,
|
|
8
|
-
} from '@xyo-network/payload-model'
|
|
6
|
+
import type { WithMeta, WithSources } from '@xyo-network/payload-model'
|
|
9
7
|
|
|
10
8
|
import { RunningDappAccessCache } from '../../../classes/cache/index.ts'
|
|
11
9
|
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { isTemporalIndexingDivinerResultIndex } from '@xyo-network/diviner-temporal-indexing-model'
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
import type {
|
|
7
|
-
WithMeta, WithSources,
|
|
8
|
-
} from '@xyo-network/payload-model'
|
|
3
|
+
import type { TemporalIndexRegistrationResults, XyOsContext } from '@xyo-network/os-model'
|
|
4
|
+
import type { WithMeta, WithSources } from '@xyo-network/payload-model'
|
|
9
5
|
import type { Listener } from 'ethers'
|
|
10
6
|
|
|
11
7
|
import type { ResourceStore } from '../../../../lib/index.ts'
|
package/src/adapter/Base.ts
CHANGED
|
@@ -6,12 +6,8 @@ import { asArchivistInstance } from '@xyo-network/archivist'
|
|
|
6
6
|
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
7
7
|
import { BaseEmitter } from '@xyo-network/module-abstract'
|
|
8
8
|
import { asAttachableNodeInstance } from '@xyo-network/node-model'
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
} from '@xyo-network/os-model'
|
|
12
|
-
import type {
|
|
13
|
-
Payload, WithMeta,
|
|
14
|
-
} from '@xyo-network/payload-model'
|
|
9
|
+
import type { NodeAdapter, NodeAdapterBaseEvents } from '@xyo-network/os-model'
|
|
10
|
+
import type { Payload, WithMeta } from '@xyo-network/payload-model'
|
|
15
11
|
import { v4 as uuid } from 'uuid'
|
|
16
12
|
|
|
17
13
|
type ModuleEventPayload = {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { KernelExternal } from '@xyo-network/kernel-model'
|
|
2
2
|
import type { AdapterSetCreator } from '@xyo-network/os-model'
|
|
3
|
-
import {
|
|
4
|
-
ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName,
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
3
|
+
import { ExposedNodeOuterNodeName, PubSubBridgeNodeNodeName } from '@xyo-network/os-model'
|
|
6
4
|
|
|
7
5
|
import { NetworkAdapter } from '../adapter/index.ts'
|
|
8
6
|
|
|
@@ -5,9 +5,7 @@ import type {
|
|
|
5
5
|
import { Mutex } from 'async-mutex'
|
|
6
6
|
|
|
7
7
|
import { XyOs } from '../../XyOs.ts'
|
|
8
|
-
import {
|
|
9
|
-
createDappContext, DappContextCreator,
|
|
10
|
-
} from '../node/index.ts'
|
|
8
|
+
import { createDappContext, DappContextCreator } from '../node/index.ts'
|
|
11
9
|
|
|
12
10
|
const findOrCreateMutex = new Mutex()
|
|
13
11
|
|
|
@@ -42,9 +40,7 @@ export class RunningDappCache {
|
|
|
42
40
|
|
|
43
41
|
return windowDappSet
|
|
44
42
|
}),
|
|
45
|
-
{
|
|
46
|
-
additionalProperties: { dappId }, name: 'Loading dApp',
|
|
47
|
-
},
|
|
43
|
+
{ additionalProperties: { dappId }, name: 'Loading dApp' },
|
|
48
44
|
)
|
|
49
45
|
}
|
|
50
46
|
|
|
@@ -2,15 +2,11 @@ import { assertEx } from '@xylabs/assert'
|
|
|
2
2
|
import type {
|
|
3
3
|
DappInjectableParams, NodeOsInfo, XyOsContext,
|
|
4
4
|
} from '@xyo-network/os-model'
|
|
5
|
-
import {
|
|
6
|
-
isDappInjectableParams, isNodeOsInfo,
|
|
7
|
-
} from '@xyo-network/os-model'
|
|
5
|
+
import { isDappInjectableParams, isNodeOsInfo } from '@xyo-network/os-model'
|
|
8
6
|
|
|
9
7
|
import { DappCallerBase } from '../../DappCallerBase.ts'
|
|
10
8
|
import { DappDefaultsResourceQueries } from '../../DefaultsQueries.ts'
|
|
11
|
-
import type {
|
|
12
|
-
Listener, ResourceStore,
|
|
13
|
-
} from '../../lib/index.ts'
|
|
9
|
+
import type { Listener, ResourceStore } from '../../lib/index.ts'
|
|
14
10
|
import { PayloadStore } from '../../lib/index.ts'
|
|
15
11
|
|
|
16
12
|
export type DappDefaultsResourceViews = 'nodeOsInfo' | 'dappInjectableParamsFromRoute'
|
|
@@ -12,9 +12,7 @@ import { isRegisteredDappAccessDappSet } from '@xyo-network/os-model'
|
|
|
12
12
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
13
13
|
|
|
14
14
|
import { OsCallerBase } from '../../../OsCallerBase.ts'
|
|
15
|
-
import {
|
|
16
|
-
RunningDappAccessCache, RunningDappCache,
|
|
17
|
-
} from '../../cache/index.ts'
|
|
15
|
+
import { RunningDappAccessCache, RunningDappCache } from '../../cache/index.ts'
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* Caller for managing Dapp Access Nodes
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
2
2
|
import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
} from '@xyo-network/os-model'
|
|
6
|
-
import {
|
|
7
|
-
DappAccessRequestSchema, RegisteredDappAccessSchema,
|
|
8
|
-
} from '@xyo-network/os-model'
|
|
3
|
+
import type { DappAccessRequest, RegisteredDappAccess } from '@xyo-network/os-model'
|
|
4
|
+
import { DappAccessRequestSchema, RegisteredDappAccessSchema } from '@xyo-network/os-model'
|
|
9
5
|
import type { WithMeta } from '@xyo-network/payload-model'
|
|
10
6
|
|
|
11
7
|
const noResults: unknown[] = []
|
|
@@ -2,14 +2,10 @@ import { assertEx } from '@xylabs/assert'
|
|
|
2
2
|
import type {
|
|
3
3
|
DappAccessRequest, RegisteredDappAccess, XyOsContext,
|
|
4
4
|
} from '@xyo-network/os-model'
|
|
5
|
-
import {
|
|
6
|
-
isDappAccessRequestWithMeta, isRegisteredDappAccess,
|
|
7
|
-
} from '@xyo-network/os-model'
|
|
5
|
+
import { isDappAccessRequestWithMeta, isRegisteredDappAccess } from '@xyo-network/os-model'
|
|
8
6
|
|
|
9
7
|
import { DappCallerBase } from '../../../DappCallerBase.ts'
|
|
10
|
-
import type {
|
|
11
|
-
Listener, ResourceStore,
|
|
12
|
-
} from '../../../lib/index.ts'
|
|
8
|
+
import type { Listener, ResourceStore } from '../../../lib/index.ts'
|
|
13
9
|
import { PayloadStore } from '../../../lib/index.ts'
|
|
14
10
|
import { DappAccessRequestQueries } from './Queries.ts'
|
|
15
11
|
|
package/src/classes/index.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DappName, XyOsContext,
|
|
3
|
-
} from '@xyo-network/os-model'
|
|
1
|
+
import type { DappName, XyOsContext } from '@xyo-network/os-model'
|
|
4
2
|
import type { Payload } from '@xyo-network/payload-model'
|
|
5
3
|
|
|
6
4
|
export interface InsertableConstructor { new (_xyOs: XyOsContext, dappName: DappName): DefaultPayloadsInsertable }
|
|
@@ -9,9 +9,7 @@ import {
|
|
|
9
9
|
DappNavItemSelectionSchema,
|
|
10
10
|
} from '@xyo-network/os-model'
|
|
11
11
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
12
|
-
import type {
|
|
13
|
-
Payload, WithMeta,
|
|
14
|
-
} from '@xyo-network/payload-model'
|
|
12
|
+
import type { Payload, WithMeta } from '@xyo-network/payload-model'
|
|
15
13
|
|
|
16
14
|
import { DappCaller } from '../../Caller.ts'
|
|
17
15
|
|
|
@@ -11,9 +11,7 @@ import {
|
|
|
11
11
|
DappNavItemSelectionSchema,
|
|
12
12
|
DappNavMenuConfigSchema,
|
|
13
13
|
} from '@xyo-network/os-model'
|
|
14
|
-
import type {
|
|
15
|
-
WithMeta, WithSources,
|
|
16
|
-
} from '@xyo-network/payload-model'
|
|
14
|
+
import type { WithMeta, WithSources } from '@xyo-network/payload-model'
|
|
17
15
|
|
|
18
16
|
const NO_ITEMS: unknown[] = []
|
|
19
17
|
|
|
@@ -2,17 +2,13 @@ import { assertEx } from '@xylabs/assert'
|
|
|
2
2
|
import type {
|
|
3
3
|
DappNavItem, DappNavItemSelection, DappNavMenuConfig, XyOsContext,
|
|
4
4
|
} from '@xyo-network/os-model'
|
|
5
|
-
import {
|
|
6
|
-
isDappNavItemSelection, isDappNavMenuConfig,
|
|
7
|
-
} from '@xyo-network/os-model'
|
|
5
|
+
import { isDappNavItemSelection, isDappNavMenuConfig } from '@xyo-network/os-model'
|
|
8
6
|
import type {
|
|
9
7
|
Payload, WithMeta, WithSources,
|
|
10
8
|
} from '@xyo-network/payload-model'
|
|
11
9
|
|
|
12
10
|
import { DappCaller } from '../../Caller.ts'
|
|
13
|
-
import type {
|
|
14
|
-
Listener, ResourceStore,
|
|
15
|
-
} from '../../lib/index.ts'
|
|
11
|
+
import type { Listener, ResourceStore } from '../../lib/index.ts'
|
|
16
12
|
import { PayloadStore } from '../../lib/index.ts'
|
|
17
13
|
import { DappMenuQueries } from './Queries.ts'
|
|
18
14
|
|
|
@@ -39,9 +39,7 @@ export class DappContextCreator {
|
|
|
39
39
|
payload, dappName, publicChildren, privateChildren,
|
|
40
40
|
} = config
|
|
41
41
|
|
|
42
|
-
const {
|
|
43
|
-
external, manifestPayload,
|
|
44
|
-
} = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork)
|
|
42
|
+
const { external, manifestPayload } = this.parseDappPackageManifestPayload(payload, xnsNodeUrl, xnsNetwork)
|
|
45
43
|
console.debug('[DEBUG] dApp manifest', manifestPayload)
|
|
46
44
|
|
|
47
45
|
// derive a wallet for the dapp to use from the root wallet
|
|
@@ -64,24 +62,20 @@ export class DappContextCreator {
|
|
|
64
62
|
// Reset the dapp archivist to remove all payloads
|
|
65
63
|
static async resetDappArchivist(context: XyOsContext) {
|
|
66
64
|
const dappModule = await context.root.resolve('DappArchivist')
|
|
67
|
-
const dappArchivist = assertEx(asArchivistInstance(dappModule), () => 'DappArchivist not found')
|
|
65
|
+
const dappArchivist = assertEx(asArchivistInstance(dappModule), () => 'resetDappArchivist: DappArchivist not found')
|
|
68
66
|
|
|
69
67
|
await dappArchivist.clear()
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
private static parseDappPackageManifestPayload(payload: DappPackageManifestPayload, xnsNodeUrl: string | undefined, xnsNetwork: string | undefined) {
|
|
73
71
|
// extract external permissions from package manifest payload
|
|
74
|
-
const {
|
|
75
|
-
external, ...manifestWithoutExternals
|
|
76
|
-
} = payload
|
|
72
|
+
const { external, ...manifestWithoutExternals } = payload
|
|
77
73
|
const manifestPayloadRaw: PackageManifestPayload = {
|
|
78
74
|
...manifestWithoutExternals,
|
|
79
75
|
schema: PackageManifestPayloadSchema,
|
|
80
76
|
}
|
|
81
77
|
const manifestPayload = ReplaceManifestTokens(manifestPayloadRaw, xnsNodeUrl, xnsNetwork)
|
|
82
|
-
return {
|
|
83
|
-
external, manifestPayload,
|
|
84
|
-
}
|
|
78
|
+
return { external, manifestPayload }
|
|
85
79
|
}
|
|
86
80
|
|
|
87
81
|
async loadDappContext(context: XyOsContext): Promise<XyOsContext> {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DappName, XyOsContext,
|
|
3
|
-
} from '@xyo-network/os-model'
|
|
1
|
+
import type { DappName, XyOsContext } from '@xyo-network/os-model'
|
|
4
2
|
|
|
5
3
|
import { OsCallerBase } from '../../../OsCallerBase.ts'
|
|
6
4
|
import type { DefaultPayloadsInsertable } from '../../lib/index.ts'
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
2
|
-
import type {
|
|
3
|
-
DappName, XyOsContext,
|
|
4
|
-
} from '@xyo-network/os-model'
|
|
2
|
+
import type { DappName, XyOsContext } from '@xyo-network/os-model'
|
|
5
3
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
6
4
|
import type { Payload } from '@xyo-network/payload-model'
|
|
7
5
|
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { hexFrom } from '@xylabs/hex'
|
|
3
3
|
import { HDWallet } from '@xyo-network/account'
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
} from '@xyo-network/os-model'
|
|
7
|
-
import {
|
|
8
|
-
mnemonicArrayToString, SigningKeySchema,
|
|
9
|
-
} from '@xyo-network/os-model'
|
|
4
|
+
import type { DappName, XyOsContext } from '@xyo-network/os-model'
|
|
5
|
+
import { mnemonicArrayToString, SigningKeySchema } from '@xyo-network/os-model'
|
|
10
6
|
import type { Payload } from '@xyo-network/payload-model'
|
|
11
7
|
import { isAnyPayload } from '@xyo-network/payload-model'
|
|
12
8
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AttachableModuleInstance, ModuleIdentifier,
|
|
3
|
-
} from '@xyo-network/module-model'
|
|
1
|
+
import type { AttachableModuleInstance, ModuleIdentifier } from '@xyo-network/module-model'
|
|
4
2
|
import type { NodeInstance } from '@xyo-network/node-model'
|
|
5
3
|
import type {
|
|
6
4
|
DappName, ExternalModule, XyOsContext,
|
|
@@ -33,16 +33,12 @@ export const createDappContext = async (
|
|
|
33
33
|
}
|
|
34
34
|
const wallet = await HDWallet.fromPhrase(seedPhrase)
|
|
35
35
|
const dappName = dapp.config.name
|
|
36
|
-
const {
|
|
37
|
-
config: dappConfig, params: dappParams,
|
|
38
|
-
} = dapp
|
|
36
|
+
const { config: dappConfig, params: dappParams } = dapp
|
|
39
37
|
|
|
40
38
|
const locator = resolveLocator((dappParams.locator ?? new ModuleFactoryLocator()).merge(context.platformLocator))
|
|
41
39
|
|
|
42
40
|
const params: DappNodesCreatorParams = {
|
|
43
|
-
config: {
|
|
44
|
-
dappName, payload: dappConfig.manifest,
|
|
45
|
-
},
|
|
41
|
+
config: { dappName, payload: dappConfig.manifest },
|
|
46
42
|
context,
|
|
47
43
|
locator,
|
|
48
44
|
wallet,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { forget } from '@xylabs/forget'
|
|
2
2
|
import type { Promisable } from '@xylabs/promise'
|
|
3
|
-
import {
|
|
4
|
-
fulfilled, rejected,
|
|
5
|
-
} from '@xylabs/promise'
|
|
3
|
+
import { fulfilled, rejected } from '@xylabs/promise'
|
|
6
4
|
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
7
5
|
import type {
|
|
8
6
|
DappPackageManifestPayload,
|
|
@@ -84,9 +82,7 @@ export class DappRegistrationService {
|
|
|
84
82
|
name = NameTransforms.moduleName(manifest.nodes[0]?.config.name),
|
|
85
83
|
): Promisable<XyOsDappContext> {
|
|
86
84
|
const dapp = new XyOsDapp({
|
|
87
|
-
dapp: {
|
|
88
|
-
id: dappId, name,
|
|
89
|
-
},
|
|
85
|
+
dapp: { id: dappId, name },
|
|
90
86
|
locator: this.locator,
|
|
91
87
|
manifest,
|
|
92
88
|
parent: this.context,
|
|
@@ -106,9 +102,7 @@ export class DappRegistrationService {
|
|
|
106
102
|
activeDapps.map(async (dappSet) => {
|
|
107
103
|
const { dapp } = dappSet
|
|
108
104
|
const registeredDapp = await this.dappRegistry.registerDapp(dapp)
|
|
109
|
-
const result: RegisteredDappSetResult = {
|
|
110
|
-
dapp: registeredDapp, dappIcon: dapp.icon,
|
|
111
|
-
}
|
|
105
|
+
const result: RegisteredDappSetResult = { dapp: registeredDapp, dappIcon: dapp.icon }
|
|
112
106
|
|
|
113
107
|
// Start post registration process in the background
|
|
114
108
|
const forgetHandlers = async () => {
|
|
@@ -128,9 +122,7 @@ export class DappRegistrationService {
|
|
|
128
122
|
|
|
129
123
|
for (const registeredDapp of succeeded) this.registeredDappSets.add(registeredDapp)
|
|
130
124
|
|
|
131
|
-
return {
|
|
132
|
-
failed, succeeded,
|
|
133
|
-
}
|
|
125
|
+
return { failed, succeeded }
|
|
134
126
|
}
|
|
135
127
|
|
|
136
128
|
private addConnectionRequests() {
|
|
@@ -3,9 +3,7 @@ import type { PackageManifestPayload } from '@xyo-network/manifest'
|
|
|
3
3
|
import type {
|
|
4
4
|
DappPackageManifestPayload, DappParams, RegisteredDappAccess, UnregisteredDappAccess,
|
|
5
5
|
} from '@xyo-network/os-model'
|
|
6
|
-
import type {
|
|
7
|
-
Payload, WithMeta,
|
|
8
|
-
} from '@xyo-network/payload-model'
|
|
6
|
+
import type { Payload, WithMeta } from '@xyo-network/payload-model'
|
|
9
7
|
import { isPayloadOfSchemaTypeWithMeta } from '@xyo-network/payload-model'
|
|
10
8
|
|
|
11
9
|
export const FailedAccessorSchema = 'network.xyo.os.failed.accessor.registration' as const
|