@xyo-network/diviner-huri 5.3.20 → 5.3.24
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/package.json +28 -14
- package/src/Config.ts +0 -13
- package/src/Diviner.ts +0 -48
- package/src/HuriPayload.ts +0 -9
- package/src/index.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-huri",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.24",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -30,31 +30,45 @@
|
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"src",
|
|
34
33
|
"!**/*.bench.*",
|
|
35
34
|
"!**/*.spec.*",
|
|
36
|
-
"!**/*.test.*"
|
|
35
|
+
"!**/*.test.*",
|
|
36
|
+
"README.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xyo-network/diviner-abstract": "~5.3.
|
|
40
|
-
"@xyo-network/diviner-model": "~5.3.
|
|
41
|
-
"@xyo-network/huri": "~5.3.
|
|
42
|
-
"@xyo-network/
|
|
43
|
-
"@xyo-network/
|
|
39
|
+
"@xyo-network/diviner-abstract": "~5.3.24",
|
|
40
|
+
"@xyo-network/diviner-model": "~5.3.24",
|
|
41
|
+
"@xyo-network/huri": "~5.3.24",
|
|
42
|
+
"@xyo-network/payload-model": "~5.3.24",
|
|
43
|
+
"@xyo-network/module-model": "~5.3.24"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@xylabs/
|
|
49
|
-
"@xylabs/
|
|
46
|
+
"@opentelemetry/api": "^1.9.1",
|
|
47
|
+
"@types/node": "^25.5.0",
|
|
48
|
+
"@xylabs/sdk-js": "^5.0.93",
|
|
49
|
+
"@xylabs/ts-scripts-common": "~7.6.16",
|
|
50
|
+
"@xylabs/ts-scripts-pnpm": "~7.6.16",
|
|
51
|
+
"@xylabs/tsconfig": "~7.6.16",
|
|
52
|
+
"acorn": "^8.16.0",
|
|
53
|
+
"axios": "^1.14.0",
|
|
54
|
+
"esbuild": "^0.28.0",
|
|
55
|
+
"ethers": "^6.16.0",
|
|
56
|
+
"tslib": "^2.8.1",
|
|
50
57
|
"typescript": "~5.9.3",
|
|
51
|
-
"zod": "^4.3.6"
|
|
58
|
+
"zod": "^4.3.6",
|
|
59
|
+
"@xyo-network/diviner-abstract": "~5.3.24",
|
|
60
|
+
"@xyo-network/huri": "~5.3.24",
|
|
61
|
+
"@xyo-network/diviner-model": "~5.3.24",
|
|
62
|
+
"@xyo-network/module-model": "~5.3.24",
|
|
63
|
+
"@xyo-network/payload-model": "~5.3.24"
|
|
52
64
|
},
|
|
53
65
|
"peerDependencies": {
|
|
54
66
|
"@xylabs/sdk-js": "^5",
|
|
67
|
+
"ethers": "^6",
|
|
68
|
+
"tslib": "^2.8.1",
|
|
55
69
|
"zod": "^4"
|
|
56
70
|
},
|
|
57
71
|
"publishConfig": {
|
|
58
72
|
"access": "public"
|
|
59
73
|
}
|
|
60
|
-
}
|
|
74
|
+
}
|
package/src/Config.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DivinerConfig } from '@xyo-network/diviner-model'
|
|
2
|
-
import type { HuriOptions } from '@xyo-network/huri'
|
|
3
|
-
import { asSchema, type Payload } from '@xyo-network/payload-model'
|
|
4
|
-
|
|
5
|
-
export const HuriPayloadDivinerConfigSchema = asSchema('network.xyo.diviner.payload.huri.config', true)
|
|
6
|
-
export type HuriPayloadDivinerConfigSchema = typeof HuriPayloadDivinerConfigSchema
|
|
7
|
-
|
|
8
|
-
export type HuriPayloadDivinerConfig<T extends Payload = Payload> = DivinerConfig<
|
|
9
|
-
T & {
|
|
10
|
-
options?: HuriOptions
|
|
11
|
-
schema: HuriPayloadDivinerConfigSchema
|
|
12
|
-
}
|
|
13
|
-
>
|
package/src/Diviner.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertEx, exists, fulfilled,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import { AbstractDiviner } from '@xyo-network/diviner-abstract'
|
|
5
|
-
import type {
|
|
6
|
-
DivinerInstance, DivinerModuleEventData, DivinerParams,
|
|
7
|
-
} from '@xyo-network/diviner-model'
|
|
8
|
-
import { Huri } from '@xyo-network/huri'
|
|
9
|
-
import type { AnyConfigSchema } from '@xyo-network/module-model'
|
|
10
|
-
import type { Payload, Schema } from '@xyo-network/payload-model'
|
|
11
|
-
|
|
12
|
-
import type { HuriPayloadDivinerConfig } from './Config.ts'
|
|
13
|
-
import { HuriPayloadDivinerConfigSchema } from './Config.ts'
|
|
14
|
-
import type { HuriPayload } from './HuriPayload.ts'
|
|
15
|
-
import { HuriSchema } from './HuriPayload.ts'
|
|
16
|
-
|
|
17
|
-
export type HuriPayloadDivinerParams<TConfig extends AnyConfigSchema<HuriPayloadDivinerConfig> = AnyConfigSchema<HuriPayloadDivinerConfig>>
|
|
18
|
-
= DivinerParams<TConfig>
|
|
19
|
-
|
|
20
|
-
export class HuriPayloadDiviner<
|
|
21
|
-
TParams extends HuriPayloadDivinerParams = HuriPayloadDivinerParams,
|
|
22
|
-
TIn extends HuriPayload = HuriPayload,
|
|
23
|
-
TOut extends Payload = Payload,
|
|
24
|
-
TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<
|
|
25
|
-
DivinerInstance<TParams, TIn, TOut>,
|
|
26
|
-
TIn,
|
|
27
|
-
TOut
|
|
28
|
-
>,
|
|
29
|
-
> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {
|
|
30
|
-
static override readonly configSchemas: Schema[] = [...super.configSchemas, HuriPayloadDivinerConfigSchema]
|
|
31
|
-
static override readonly defaultConfigSchema: Schema = HuriPayloadDivinerConfigSchema
|
|
32
|
-
|
|
33
|
-
protected get options() {
|
|
34
|
-
return this.config?.options
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {
|
|
38
|
-
const huriPayloads = assertEx(
|
|
39
|
-
payloads?.filter((payload): payload is TIn => payload?.schema === HuriSchema),
|
|
40
|
-
() => `no huri payloads provided: ${JSON.stringify(payloads, null, 2)}`,
|
|
41
|
-
)
|
|
42
|
-
const huriList = huriPayloads.flatMap((huriPayload, index) =>
|
|
43
|
-
huriPayload.huri.map(huri => new Huri(huri, { token: huriPayload.tokens?.[index] })))
|
|
44
|
-
|
|
45
|
-
const settled = await Promise.allSettled(huriList.map(huri => huri.fetch()))
|
|
46
|
-
return (settled.filter(fulfilled).map(settle => settle.value)).filter(exists) as TOut[]
|
|
47
|
-
}
|
|
48
|
-
}
|
package/src/HuriPayload.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { asSchema, type Payload } from '@xyo-network/payload-model'
|
|
2
|
-
|
|
3
|
-
export const HuriSchema = asSchema('network.xyo.huri', true)
|
|
4
|
-
export type HuriSchema = typeof HuriSchema
|
|
5
|
-
|
|
6
|
-
export type HuriPayload = Payload<{
|
|
7
|
-
huri: string[]
|
|
8
|
-
tokens?: string[]
|
|
9
|
-
}, HuriSchema>
|
package/src/index.ts
DELETED