@xyo-network/os-runtime 4.0.4 → 4.0.6
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 +20 -10
- package/dist/neutral/Caller.d.ts.map +1 -1
- package/dist/neutral/DappCallerBase.d.ts +276 -72
- package/dist/neutral/DappCallerBase.d.ts.map +1 -1
- package/dist/neutral/DefaultsQueries.d.ts +12 -12
- package/dist/neutral/DefaultsQueries.d.ts.map +1 -1
- package/dist/neutral/OsCallerBase.d.ts +332 -86
- package/dist/neutral/OsCallerBase.d.ts.map +1 -1
- package/dist/neutral/XyOs.d.ts +72 -14
- package/dist/neutral/XyOs.d.ts.map +1 -1
- package/dist/neutral/XyOsDapp.d.ts +72 -14
- package/dist/neutral/XyOsDapp.d.ts.map +1 -1
- package/dist/neutral/access-interfaces/registered-names/helpers/AccessNodeQueries.d.ts +40 -12
- package/dist/neutral/access-interfaces/registered-names/helpers/AccessNodeQueries.d.ts.map +1 -1
- package/dist/neutral/access-interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +194 -50
- package/dist/neutral/access-interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts.map +1 -1
- package/dist/neutral/access-interfaces/registered-names/helpers/resource/RegistrationsResource.d.ts +4 -4
- package/dist/neutral/access-interfaces/registered-names/helpers/resource/RegistrationsResource.d.ts.map +1 -1
- package/dist/neutral/access-interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.d.ts +3 -2
- package/dist/neutral/access-interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.d.ts.map +1 -1
- package/dist/neutral/adapter/Base.d.ts +36 -7
- package/dist/neutral/adapter/Base.d.ts.map +1 -1
- package/dist/neutral/adapter/Network.d.ts +36 -7
- package/dist/neutral/adapter/Network.d.ts.map +1 -1
- package/dist/neutral/adapter/Settings.d.ts +36 -7
- package/dist/neutral/adapter/Settings.d.ts.map +1 -1
- package/dist/neutral/classes/cache/RunningAccessDappCache.d.ts +36 -7
- package/dist/neutral/classes/cache/RunningAccessDappCache.d.ts.map +1 -1
- package/dist/neutral/classes/dapp/DefaultsResource.d.ts +20 -20
- package/dist/neutral/classes/dapp/DefaultsResource.d.ts.map +1 -1
- package/dist/neutral/classes/dapp/access/Queries.d.ts +15 -5
- package/dist/neutral/classes/dapp/access/Queries.d.ts.map +1 -1
- package/dist/neutral/classes/dapp/access/Resource.d.ts +26 -6
- package/dist/neutral/classes/dapp/access/Resource.d.ts.map +1 -1
- package/dist/neutral/classes/lib/Insertable.d.ts +2 -0
- package/dist/neutral/classes/lib/Insertable.d.ts.map +1 -1
- package/dist/neutral/classes/menu/Caller.d.ts.map +1 -1
- package/dist/neutral/classes/menu/Queries.d.ts +30 -6
- package/dist/neutral/classes/menu/Queries.d.ts.map +1 -1
- package/dist/neutral/classes/menu/Resource.d.ts +67 -11
- package/dist/neutral/classes/menu/Resource.d.ts.map +1 -1
- package/dist/neutral/classes/node/DefaultPayloads/DappAccessPayloads.d.ts +3 -3
- package/dist/neutral/classes/node/DefaultPayloads/DappAccessPayloads.d.ts.map +1 -1
- package/dist/neutral/classes/node/DefaultPayloads/NodeInfoPayload.d.ts +4 -5
- package/dist/neutral/classes/node/DefaultPayloads/NodeInfoPayload.d.ts.map +1 -1
- package/dist/neutral/classes/registration/DappRegistry.d.ts.map +1 -1
- package/dist/neutral/classes/registration/ValidateDappAccessDiviner/Config.d.ts +11 -6
- package/dist/neutral/classes/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/neutral/classes/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
- package/dist/neutral/classes/settings/Caller.d.ts +2 -3
- package/dist/neutral/classes/settings/Caller.d.ts.map +1 -1
- package/dist/neutral/classes/settings/CallerBase.d.ts +138 -36
- package/dist/neutral/classes/settings/CallerBase.d.ts.map +1 -1
- package/dist/neutral/classes/settings/Resource.d.ts +17 -37
- package/dist/neutral/classes/settings/Resource.d.ts.map +1 -1
- package/dist/neutral/classes/settings/SettingsQueries.d.ts +10 -19
- package/dist/neutral/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/neutral/classes/settings/badge/Caller.d.ts +13 -4
- package/dist/neutral/classes/settings/badge/Caller.d.ts.map +1 -1
- package/dist/neutral/classes/settings/badge/Queries.d.ts +11 -2
- package/dist/neutral/classes/settings/badge/Queries.d.ts.map +1 -1
- package/dist/neutral/classes/settings/badge/Resource.d.ts +21 -3
- package/dist/neutral/classes/settings/badge/Resource.d.ts.map +1 -1
- package/dist/neutral/classes/system/Queries.d.ts +115 -13
- package/dist/neutral/classes/system/Queries.d.ts.map +1 -1
- package/dist/neutral/event/bus/EventBus.d.ts +56 -14
- package/dist/neutral/event/bus/EventBus.d.ts.map +1 -1
- package/dist/neutral/index.mjs +7 -12
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/intent/Caller.d.ts +14 -16
- package/dist/neutral/intent/Caller.d.ts.map +1 -1
- package/dist/neutral/intent/Resource.d.ts +22 -26
- package/dist/neutral/intent/Resource.d.ts.map +1 -1
- package/dist/neutral/lib/PayloadStore.d.ts +4 -4
- package/dist/neutral/lib/PayloadStore.d.ts.map +1 -1
- package/dist/neutral/lib/isPayload.d.ts.map +1 -1
- package/dist/neutral/stack/OsPubSubNetworkStack.d.ts +72 -14
- package/dist/neutral/stack/OsPubSubNetworkStack.d.ts.map +1 -1
- package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts +2 -2
- package/dist/neutral/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/neutral/wallet/DappSeedPhraseRepository.d.ts.map +1 -1
- package/dist/node/Caller.d.ts +20 -10
- package/dist/node/Caller.d.ts.map +1 -1
- package/dist/node/DappCallerBase.d.ts +276 -72
- package/dist/node/DappCallerBase.d.ts.map +1 -1
- package/dist/node/DefaultsQueries.d.ts +12 -12
- package/dist/node/DefaultsQueries.d.ts.map +1 -1
- package/dist/node/OsCallerBase.d.ts +332 -86
- package/dist/node/OsCallerBase.d.ts.map +1 -1
- package/dist/node/XyOs.d.ts +72 -14
- package/dist/node/XyOs.d.ts.map +1 -1
- package/dist/node/XyOsDapp.d.ts +72 -14
- package/dist/node/XyOsDapp.d.ts.map +1 -1
- package/dist/node/access-interfaces/registered-names/helpers/AccessNodeQueries.d.ts +40 -12
- package/dist/node/access-interfaces/registered-names/helpers/AccessNodeQueries.d.ts.map +1 -1
- package/dist/node/access-interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts +194 -50
- package/dist/node/access-interfaces/registered-names/helpers/resource/AbstractXnsCaller.d.ts.map +1 -1
- package/dist/node/access-interfaces/registered-names/helpers/resource/RegistrationsResource.d.ts +4 -4
- package/dist/node/access-interfaces/registered-names/helpers/resource/RegistrationsResource.d.ts.map +1 -1
- package/dist/node/access-interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.d.ts +3 -2
- package/dist/node/access-interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.d.ts.map +1 -1
- package/dist/node/adapter/Base.d.ts +36 -7
- package/dist/node/adapter/Base.d.ts.map +1 -1
- package/dist/node/adapter/Network.d.ts +36 -7
- package/dist/node/adapter/Network.d.ts.map +1 -1
- package/dist/node/adapter/Settings.d.ts +36 -7
- package/dist/node/adapter/Settings.d.ts.map +1 -1
- package/dist/node/classes/cache/RunningAccessDappCache.d.ts +36 -7
- package/dist/node/classes/cache/RunningAccessDappCache.d.ts.map +1 -1
- package/dist/node/classes/dapp/DefaultsResource.d.ts +20 -20
- package/dist/node/classes/dapp/DefaultsResource.d.ts.map +1 -1
- package/dist/node/classes/dapp/access/Queries.d.ts +15 -5
- package/dist/node/classes/dapp/access/Queries.d.ts.map +1 -1
- package/dist/node/classes/dapp/access/Resource.d.ts +26 -6
- package/dist/node/classes/dapp/access/Resource.d.ts.map +1 -1
- package/dist/node/classes/lib/Insertable.d.ts +2 -0
- package/dist/node/classes/lib/Insertable.d.ts.map +1 -1
- package/dist/node/classes/menu/Caller.d.ts.map +1 -1
- package/dist/node/classes/menu/Queries.d.ts +30 -6
- package/dist/node/classes/menu/Queries.d.ts.map +1 -1
- package/dist/node/classes/menu/Resource.d.ts +67 -11
- package/dist/node/classes/menu/Resource.d.ts.map +1 -1
- package/dist/node/classes/node/DefaultPayloads/DappAccessPayloads.d.ts +3 -3
- package/dist/node/classes/node/DefaultPayloads/DappAccessPayloads.d.ts.map +1 -1
- package/dist/node/classes/node/DefaultPayloads/NodeInfoPayload.d.ts +4 -5
- package/dist/node/classes/node/DefaultPayloads/NodeInfoPayload.d.ts.map +1 -1
- package/dist/node/classes/registration/DappRegistry.d.ts.map +1 -1
- package/dist/node/classes/registration/ValidateDappAccessDiviner/Config.d.ts +11 -6
- package/dist/node/classes/registration/ValidateDappAccessDiviner/Config.d.ts.map +1 -1
- package/dist/node/classes/registration/ValidateDappAccessDiviner/Diviner.d.ts.map +1 -1
- package/dist/node/classes/settings/Caller.d.ts +2 -3
- package/dist/node/classes/settings/Caller.d.ts.map +1 -1
- package/dist/node/classes/settings/CallerBase.d.ts +138 -36
- package/dist/node/classes/settings/CallerBase.d.ts.map +1 -1
- package/dist/node/classes/settings/Resource.d.ts +17 -37
- package/dist/node/classes/settings/Resource.d.ts.map +1 -1
- package/dist/node/classes/settings/SettingsQueries.d.ts +10 -19
- package/dist/node/classes/settings/SettingsQueries.d.ts.map +1 -1
- package/dist/node/classes/settings/badge/Caller.d.ts +13 -4
- package/dist/node/classes/settings/badge/Caller.d.ts.map +1 -1
- package/dist/node/classes/settings/badge/Queries.d.ts +11 -2
- package/dist/node/classes/settings/badge/Queries.d.ts.map +1 -1
- package/dist/node/classes/settings/badge/Resource.d.ts +21 -3
- package/dist/node/classes/settings/badge/Resource.d.ts.map +1 -1
- package/dist/node/classes/system/Queries.d.ts +115 -13
- package/dist/node/classes/system/Queries.d.ts.map +1 -1
- package/dist/node/event/bus/EventBus.d.ts +56 -14
- package/dist/node/event/bus/EventBus.d.ts.map +1 -1
- package/dist/node/index.mjs +7 -12
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/intent/Caller.d.ts +14 -16
- package/dist/node/intent/Caller.d.ts.map +1 -1
- package/dist/node/intent/Resource.d.ts +22 -26
- package/dist/node/intent/Resource.d.ts.map +1 -1
- package/dist/node/lib/PayloadStore.d.ts +4 -4
- package/dist/node/lib/PayloadStore.d.ts.map +1 -1
- package/dist/node/lib/isPayload.d.ts.map +1 -1
- package/dist/node/scripts/xyos/command/index.mjs +2 -2
- package/dist/node/scripts/xyos/command/index.mjs.map +1 -1
- package/dist/node/scripts/xyos/index.mjs +2 -2
- package/dist/node/scripts/xyos/index.mjs.map +1 -1
- package/dist/node/scripts/xyos/lib/index.mjs +2 -2
- package/dist/node/scripts/xyos/lib/index.mjs.map +1 -1
- package/dist/node/stack/OsPubSubNetworkStack.d.ts +72 -14
- package/dist/node/stack/OsPubSubNetworkStack.d.ts.map +1 -1
- package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts +2 -2
- package/dist/node/utils/buildWalletSeedPhrasePayload.d.ts.map +1 -1
- package/dist/node/wallet/DappSeedPhraseRepository.d.ts.map +1 -1
- package/package.json +45 -43
- package/src/Caller.ts +2 -2
- package/src/DefaultsQueries.ts +3 -3
- package/src/access-interfaces/registered-names/helpers/AccessNodeQueries.ts +4 -6
- package/src/access-interfaces/registered-names/helpers/resource/RegistrationsResource.ts +3 -3
- package/src/access-interfaces/registered-names/helpers/resource/RegistrationsResourceQueries.ts +3 -2
- package/src/adapter/Base.ts +4 -4
- package/src/classes/dapp/access/Queries.ts +5 -5
- package/src/classes/menu/Caller.ts +2 -2
- package/src/classes/menu/Queries.ts +8 -8
- package/src/classes/menu/Resource.ts +2 -4
- package/src/classes/registration/DappRegistry.ts +2 -3
- package/src/classes/registration/ValidateDappAccessDiviner/Config.ts +4 -4
- package/src/classes/registration/ValidateDappAccessDiviner/Diviner.ts +2 -3
- package/src/classes/settings/Caller.ts +3 -4
- package/src/classes/settings/SettingsQueries.ts +7 -7
- package/src/classes/settings/badge/Queries.ts +2 -1
- package/src/classes/system/ManageSystemDapps.ts +2 -2
- package/src/classes/system/Queries.ts +6 -7
- package/src/intent/Caller.ts +3 -3
- package/src/intent/Resource.ts +3 -3
- package/src/lib/PayloadStore.ts +4 -6
- package/src/utils/buildWalletSeedPhrasePayload.ts +4 -7
- package/src/wallet/DappSeedPhraseRepository.ts +2 -3
|
@@ -2,20 +2,20 @@ import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
|
2
2
|
import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
|
|
3
3
|
import type { NodeBackground, WalletSeedPhrase } from '@xyo-network/os-model'
|
|
4
4
|
import { NodeBackgroundSchema, WalletSeedPhraseSchema } from '@xyo-network/os-model'
|
|
5
|
-
import type {
|
|
5
|
+
import type { WithSources } from '@xyo-network/payload-model'
|
|
6
6
|
|
|
7
|
-
const NO_RESULTS:
|
|
7
|
+
const NO_RESULTS: WithSources<WalletSeedPhrase>[] = []
|
|
8
8
|
|
|
9
9
|
export const OsSettingsQueries = {
|
|
10
|
-
async getLatestUserWallet(diviner: DivinerInstance) {
|
|
10
|
+
async getLatestUserWallet(diviner: DivinerInstance): Promise<WithSources<WalletSeedPhrase>[]> {
|
|
11
11
|
const query = {
|
|
12
12
|
limit: 1,
|
|
13
13
|
order: 'desc',
|
|
14
14
|
schema: PayloadDivinerQuerySchema,
|
|
15
15
|
schemas: [WalletSeedPhraseSchema],
|
|
16
16
|
}
|
|
17
|
-
const results = (await diviner.divine([query])) as
|
|
18
|
-
const wallet = results.find(payload => payload.$
|
|
17
|
+
const results = (await diviner.divine([query])) as WithSources<WalletSeedPhrase>[]
|
|
18
|
+
const wallet = results.find(payload => payload.$label === 'userWallet')
|
|
19
19
|
return wallet ? [wallet] : NO_RESULTS
|
|
20
20
|
},
|
|
21
21
|
async getNodeBackground(diviner: DivinerInstance) {
|
|
@@ -25,7 +25,7 @@ export const OsSettingsQueries = {
|
|
|
25
25
|
schema: PayloadDivinerQuerySchema,
|
|
26
26
|
schemas: [NodeBackgroundSchema],
|
|
27
27
|
}
|
|
28
|
-
return (await diviner.divine([query])) as
|
|
28
|
+
return (await diviner.divine([query])) as WithSources<NodeBackground>[]
|
|
29
29
|
},
|
|
30
30
|
async getWallets(diviner: DivinerInstance) {
|
|
31
31
|
const query = {
|
|
@@ -33,6 +33,6 @@ export const OsSettingsQueries = {
|
|
|
33
33
|
schema: PayloadDivinerQuerySchema,
|
|
34
34
|
schemas: [WalletSeedPhraseSchema],
|
|
35
35
|
}
|
|
36
|
-
return (await diviner.divine([query])) as
|
|
36
|
+
return (await diviner.divine([query])) as WithSources<WalletSeedPhrase>[]
|
|
37
37
|
},
|
|
38
38
|
}
|
|
@@ -2,6 +2,7 @@ import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
|
2
2
|
import { PayloadDivinerQuerySchema } from '@xyo-network/diviner-payload-model'
|
|
3
3
|
import type { OsBadge } from '@xyo-network/os-model'
|
|
4
4
|
import { OsBadgeSchema } from '@xyo-network/os-model'
|
|
5
|
+
import type { WithSources } from '@xyo-network/payload-model'
|
|
5
6
|
|
|
6
7
|
export const OsBadgeQueries = {
|
|
7
8
|
getBadge: async (achievement: string, diviner: DivinerInstance) => {
|
|
@@ -13,6 +14,6 @@ export const OsBadgeQueries = {
|
|
|
13
14
|
schemas: [OsBadgeSchema],
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
return (await diviner.divine([query])) as OsBadge[]
|
|
17
|
+
return (await diviner.divine([query])) as WithSources<OsBadge>[]
|
|
17
18
|
},
|
|
18
19
|
}
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
DappConfig, DappIcon, DappParams, DappSet, PayloadWithVersion, XyOsContext,
|
|
5
5
|
} from '@xyo-network/os-model'
|
|
6
6
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
7
|
-
import type {
|
|
7
|
+
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
8
8
|
import semver from 'semver'
|
|
9
9
|
|
|
10
10
|
import { OsCallerBase } from '../../OsCallerBase.ts'
|
|
@@ -56,7 +56,7 @@ export class ManageSystemDapps extends OsCallerBase {
|
|
|
56
56
|
private async insertPayloads(): Promise<boolean> {
|
|
57
57
|
const archivist = this.developmentMode ? await this.getDappsArchivistDevelopment() : await this.getDappsArchivist()
|
|
58
58
|
try {
|
|
59
|
-
const allPayloads = (await archivist.all()) as
|
|
59
|
+
const allPayloads = (await archivist.all()) as WithStorageMeta<(DappIcon | DappConfig)>[]
|
|
60
60
|
if (allPayloads.length === 0) {
|
|
61
61
|
await this.freshInstall(archivist)
|
|
62
62
|
return true
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
UnregisteredDappAccessSchema,
|
|
15
15
|
} from '@xyo-network/os-model'
|
|
16
16
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
17
|
-
import type { WithMeta } from '@xyo-network/payload-model'
|
|
18
17
|
|
|
19
18
|
export const SystemDappQueries = {
|
|
20
19
|
async getDappAccess(diviner: DivinerInstance, name: string, version: string) {
|
|
@@ -25,7 +24,7 @@ export const SystemDappQueries = {
|
|
|
25
24
|
schemas: [UnregisteredDappAccessSchema],
|
|
26
25
|
version: version,
|
|
27
26
|
}
|
|
28
|
-
return (await diviner.divine([accessQuery])) as
|
|
27
|
+
return (await diviner.divine([accessQuery])) as UnregisteredDappAccess[]
|
|
29
28
|
},
|
|
30
29
|
async getLatestConfig(diviner: DivinerInstance, name: string) {
|
|
31
30
|
const configQuery = {
|
|
@@ -35,7 +34,7 @@ export const SystemDappQueries = {
|
|
|
35
34
|
schema: PayloadDivinerQuerySchema,
|
|
36
35
|
schemas: [DappConfigSchema],
|
|
37
36
|
}
|
|
38
|
-
const [dappConfig] = (await diviner.divine([configQuery])) as
|
|
37
|
+
const [dappConfig] = (await diviner.divine([configQuery])) as DappConfig[]
|
|
39
38
|
return dappConfig
|
|
40
39
|
},
|
|
41
40
|
async getLatestIcon(diviner: DivinerInstance, name: string, version: string) {
|
|
@@ -46,10 +45,10 @@ export const SystemDappQueries = {
|
|
|
46
45
|
schemas: [DappIconSchema],
|
|
47
46
|
version,
|
|
48
47
|
}
|
|
49
|
-
const [dappIcon] = (await diviner.divine([iconQuery])) as
|
|
48
|
+
const [dappIcon] = (await diviner.divine([iconQuery])) as DappIcon[]
|
|
50
49
|
return dappIcon
|
|
51
50
|
},
|
|
52
|
-
async getWidgetConfigs(diviner: DivinerInstance, name: DappId, version: string): Promise<
|
|
51
|
+
async getWidgetConfigs(diviner: DivinerInstance, name: DappId, version: string): Promise<DappWidgetConfig[]> {
|
|
53
52
|
const widgetConfigQuery = {
|
|
54
53
|
dappId: name,
|
|
55
54
|
order: 'desc',
|
|
@@ -57,9 +56,9 @@ export const SystemDappQueries = {
|
|
|
57
56
|
schemas: [DappWidgetConfigSchema],
|
|
58
57
|
version,
|
|
59
58
|
}
|
|
60
|
-
const widgetConfigs = (await diviner.divine([widgetConfigQuery])) as
|
|
59
|
+
const widgetConfigs = (await diviner.divine([widgetConfigQuery])) as DappWidgetConfig[]
|
|
61
60
|
|
|
62
|
-
const uniqueConfigs: Record<string,
|
|
61
|
+
const uniqueConfigs: Record<string, DappWidgetConfig> = {}
|
|
63
62
|
for (const widgetConfig of widgetConfigs) {
|
|
64
63
|
const hash = await PayloadBuilder.dataHash(widgetConfig)
|
|
65
64
|
uniqueConfigs[widgetConfig.mode ?? hash] = widgetConfig
|
package/src/intent/Caller.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
DappId, DappIntent, DappIntentTypes, XyOsContext,
|
|
4
4
|
} from '@xyo-network/os-model'
|
|
5
5
|
import { DappIntentSchema, DappMode } from '@xyo-network/os-model'
|
|
6
|
-
import type {
|
|
6
|
+
import type { WithStorageMeta } from '@xyo-network/payload-model'
|
|
7
7
|
|
|
8
8
|
import { DappCallerBase } from '../DappCallerBase.ts'
|
|
9
9
|
|
|
@@ -56,7 +56,7 @@ export class DappIntentCaller extends DappCallerBase {
|
|
|
56
56
|
// Get the latest intent saved to the archivist
|
|
57
57
|
async latestIntent() {
|
|
58
58
|
const archivist = await this.getDappIntentArchivist()
|
|
59
|
-
return (await archivist.all()).at(-1) as
|
|
59
|
+
return (await archivist.all()).at(-1) as WithStorageMeta<DappIntent>
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Get the latest intent for a dapp
|
|
@@ -69,6 +69,6 @@ export class DappIntentCaller extends DappCallerBase {
|
|
|
69
69
|
sourceDappId: dappName,
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
return (await diviner.divine([query])) as
|
|
72
|
+
return (await diviner.divine([query])) as DappIntent[]
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/intent/Resource.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import type { DappIntent, XyOsContext } from '@xyo-network/os-model'
|
|
3
3
|
import { isDappIntent } from '@xyo-network/os-model'
|
|
4
|
-
import type {
|
|
4
|
+
import type { WithSources, WithStorageMeta } from '@xyo-network/payload-model'
|
|
5
5
|
|
|
6
6
|
import { DappCallerBase } from '../DappCallerBase.ts'
|
|
7
7
|
import type { Listener, ResourceStore } from '../lib/index.ts'
|
|
@@ -50,7 +50,7 @@ export class DappIntentResource extends DappCallerBase implements ResourceStore<
|
|
|
50
50
|
|
|
51
51
|
this._allDappIntents = await PayloadStore.create<DappIntent>({
|
|
52
52
|
archivist,
|
|
53
|
-
getLatest: async () => (await archivist.all()) as
|
|
53
|
+
getLatest: async () => (await archivist.all()) as WithStorageMeta<WithSources<DappIntent>>[],
|
|
54
54
|
idFunction: isDappIntent,
|
|
55
55
|
})
|
|
56
56
|
this._latestDappIntent = await PayloadStore.create<DappIntent>({
|
|
@@ -58,7 +58,7 @@ export class DappIntentResource extends DappCallerBase implements ResourceStore<
|
|
|
58
58
|
getLatest: async () => {
|
|
59
59
|
const all = await archivist.all()
|
|
60
60
|
const result = all.length > 0 ? [all.at(-1)] : NO_RESULTS
|
|
61
|
-
return result as
|
|
61
|
+
return result as WithStorageMeta<WithSources<DappIntent>>[]
|
|
62
62
|
},
|
|
63
63
|
idFunction: isDappIntent,
|
|
64
64
|
})
|
package/src/lib/PayloadStore.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import type { ArchivistInstance, ArchivistModuleEventData } from '@xyo-network/archivist'
|
|
2
|
-
import type {
|
|
3
|
-
Payload, WithMeta, WithSources,
|
|
4
|
-
} from '@xyo-network/payload-model'
|
|
2
|
+
import type { Payload, WithSources } from '@xyo-network/payload-model'
|
|
5
3
|
|
|
6
4
|
import type { ExternalStore } from './ExternalStore.ts'
|
|
7
5
|
import type { Listener } from './Listener.ts'
|
|
8
6
|
|
|
9
7
|
export interface PayloadStoreConfig<T extends Payload = Payload> {
|
|
10
8
|
archivist: ArchivistInstance
|
|
11
|
-
getLatest: () => Promise<
|
|
9
|
+
getLatest: () => Promise<WithSources<T>[]>
|
|
12
10
|
idFunction: (schema: Payload) => boolean
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export class PayloadStore<T extends Payload = Payload> implements ExternalStore {
|
|
16
|
-
latest:
|
|
14
|
+
latest: WithSources<T>[] = []
|
|
17
15
|
private deleteListeners: WeakRef<(args: ArchivistModuleEventData['deleted']) => void>[] = []
|
|
18
16
|
private insertListeners: WeakRef<(args: ArchivistModuleEventData['inserted']) => void>[] = []
|
|
19
17
|
private listeners: Listener[] = []
|
|
@@ -70,7 +68,7 @@ export class PayloadStore<T extends Payload = Payload> implements ExternalStore
|
|
|
70
68
|
/**
|
|
71
69
|
* Get the current value of the store
|
|
72
70
|
*/
|
|
73
|
-
getSnapshot():
|
|
71
|
+
getSnapshot(): WithSources<T>[] {
|
|
74
72
|
return this.latest
|
|
75
73
|
}
|
|
76
74
|
|
|
@@ -19,10 +19,10 @@ export type WalletLabel = typeof userWalletLabel // TODO: More wallet types 'osW
|
|
|
19
19
|
/**
|
|
20
20
|
* Builds a WalletSeedPhrase payload from the supplied mnemonic seed phrase and label
|
|
21
21
|
* @param mnemonic The mnemonic seed phrase
|
|
22
|
-
* @param label The wallet label
|
|
22
|
+
* @param $label The wallet label
|
|
23
23
|
* @returns A WalletSeedPhrase payload and its root hash
|
|
24
24
|
*/
|
|
25
|
-
export const buildWalletSeedPhrasePayload = async (mnemonic: string, label: WalletLabel): Promise<{
|
|
25
|
+
export const buildWalletSeedPhrasePayload = async (mnemonic: string, $label: WalletLabel): Promise<{
|
|
26
26
|
payload: WalletSeedPhrase
|
|
27
27
|
rootHash: Hash
|
|
28
28
|
}> => {
|
|
@@ -31,11 +31,8 @@ export const buildWalletSeedPhrasePayload = async (mnemonic: string, label: Wall
|
|
|
31
31
|
language, mnemonic: mnemonic.split(' '), standard,
|
|
32
32
|
},
|
|
33
33
|
}
|
|
34
|
-
const meta = { label, timestamp: Date.now() }
|
|
35
|
-
const
|
|
36
|
-
fields, meta, schema: WalletSeedPhraseSchema,
|
|
37
|
-
})
|
|
38
|
-
const payload = await builder.build()
|
|
34
|
+
const meta = { $label, $timestamp: Date.now() }
|
|
35
|
+
const payload = new PayloadBuilder<WalletSeedPhrase>({ schema: WalletSeedPhraseSchema }).fields(fields).meta(meta).build()
|
|
39
36
|
const rootHash = await PayloadBuilder.hash(payload)
|
|
40
37
|
return { payload, rootHash }
|
|
41
38
|
}
|
|
@@ -4,7 +4,6 @@ import type {
|
|
|
4
4
|
DappId, DappWalletSeedPhrase, WalletId, XyOsContext,
|
|
5
5
|
} from '@xyo-network/os-model'
|
|
6
6
|
import { DappWalletSeedPhraseSchema } from '@xyo-network/os-model'
|
|
7
|
-
import type { WithMeta } from '@xyo-network/payload-model'
|
|
8
7
|
import { v4 as uuid } from 'uuid'
|
|
9
8
|
|
|
10
9
|
import { OsCallerBase } from '../OsCallerBase.ts'
|
|
@@ -73,7 +72,7 @@ export class DappSeedPhraseRepository extends OsCallerBase implements SeedPhrase
|
|
|
73
72
|
schemas: [DappWalletSeedPhraseSchema],
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
const results = (await diviner.divine([query])) as
|
|
75
|
+
const results = (await diviner.divine([query])) as DappWalletSeedPhrase[]
|
|
77
76
|
return results.length > 0 ? results[0] : undefined
|
|
78
77
|
}
|
|
79
78
|
|
|
@@ -87,7 +86,7 @@ export class DappSeedPhraseRepository extends OsCallerBase implements SeedPhrase
|
|
|
87
86
|
walletId,
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
const results = (await diviner.divine([query])) as
|
|
89
|
+
const results = (await diviner.divine([query])) as DappWalletSeedPhrase[]
|
|
91
90
|
return results.length > 0 ? results[0] : undefined
|
|
92
91
|
}
|
|
93
92
|
|