@xyo-network/xl1-rpc 1.15.24 → 1.15.26
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.mjs +28 -4
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/gateway/Abstract.d.ts +2 -2
- package/dist/neutral/provider/gateway/Abstract.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +2 -2
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/types/NetworkStakeViewerRpc.d.ts +7 -0
- package/dist/neutral/types/NetworkStakeViewerRpc.d.ts.map +1 -0
- package/dist/neutral/types/StepViewerRpc.d.ts +7 -0
- package/dist/neutral/types/StepViewerRpc.d.ts.map +1 -0
- package/dist/neutral/types/index.d.ts +1 -0
- package/dist/neutral/types/index.d.ts.map +1 -1
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts +4 -4
- package/dist/neutral/types/schema/NetworkStakeViewerRpcSchemas.d.ts +20 -0
- package/dist/neutral/types/schema/NetworkStakeViewerRpcSchemas.d.ts.map +1 -0
- package/dist/neutral/types/schema/StepViewerRpcSchemas.d.ts +254 -0
- package/dist/neutral/types/schema/StepViewerRpcSchemas.d.ts.map +1 -0
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts +4 -4
- package/dist/neutral/types/schema/common/Stake.d.ts +2 -1
- package/dist/neutral/types/schema/common/Stake.d.ts.map +1 -1
- package/dist/neutral/types/schema/index.d.ts +1 -0
- package/dist/neutral/types/schema/index.d.ts.map +1 -1
- package/dist/node/index-node.mjs +28 -4
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/gateway/Abstract.d.ts +2 -2
- package/dist/node/provider/gateway/Abstract.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +2 -2
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/types/NetworkStakeViewerRpc.d.ts +7 -0
- package/dist/node/types/NetworkStakeViewerRpc.d.ts.map +1 -0
- package/dist/node/types/StepViewerRpc.d.ts +7 -0
- package/dist/node/types/StepViewerRpc.d.ts.map +1 -0
- package/dist/node/types/index.d.ts +1 -0
- package/dist/node/types/index.d.ts.map +1 -1
- package/dist/node/types/schema/AllRpcSchemas.d.ts +4 -4
- package/dist/node/types/schema/NetworkStakeViewerRpcSchemas.d.ts +20 -0
- package/dist/node/types/schema/NetworkStakeViewerRpcSchemas.d.ts.map +1 -0
- package/dist/node/types/schema/StepViewerRpcSchemas.d.ts +254 -0
- package/dist/node/types/schema/StepViewerRpcSchemas.d.ts.map +1 -0
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts +4 -4
- package/dist/node/types/schema/common/Stake.d.ts +2 -1
- package/dist/node/types/schema/common/Stake.d.ts.map +1 -1
- package/dist/node/types/schema/index.d.ts +1 -0
- package/dist/node/types/schema/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/provider/gateway/Abstract.ts +15 -4
- package/src/provider/gateway/spec/MemoryXyoGateway.spec.ts +46 -4
- package/src/provider/viewer/JsonRpcXyoViewer.ts +2 -2
- package/src/types/NetworkStakeViewerRpc.ts +12 -0
- package/src/types/StepViewerRpc.ts +12 -0
- package/src/types/index.ts +1 -0
- package/src/types/schema/NetworkStakeViewerRpcSchemas.ts +19 -0
- package/src/types/schema/StepViewerRpcSchemas.ts +83 -0
- package/src/types/schema/common/Stake.ts +2 -1
- package/src/types/schema/index.ts +1 -0
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
AttoXL1,
|
|
4
4
|
ChainId,
|
|
5
5
|
ForkHistory,
|
|
6
|
-
HydratedBlock, SignedHydratedTransaction,
|
|
6
|
+
HydratedBlock, Position, SignedHydratedTransaction,
|
|
7
7
|
Stake,
|
|
8
8
|
StepIdentity,
|
|
9
9
|
StepIdentityString,
|
|
@@ -139,7 +139,7 @@ export class JsonRpcXyoViewer implements XyoViewer {
|
|
|
139
139
|
return (await this.transport.sendRequest('xyoViewer_networkStakeStepRewardsForStepLevel', [stepLevel, range]))
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
async stakeById(id: number): Promise<
|
|
142
|
+
async stakeById(id: number): Promise<Position> {
|
|
143
143
|
return (await this.transport.sendRequest('xyoViewer_stakeById', [id]))
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NetworkStakeViewerMethods } from '@xyo-network/xl1-protocol'
|
|
2
|
+
|
|
3
|
+
export type NetworkStakeViewerMethodName = keyof NetworkStakeViewerMethods
|
|
4
|
+
|
|
5
|
+
export type NetworkStakeViewerRpcMethodName = `networkStakeViewer_${NetworkStakeViewerMethodName}`
|
|
6
|
+
|
|
7
|
+
// Map each Network Stake RPC method string to the corresponding function type from NetworkStakeViewer
|
|
8
|
+
export type NetworkStakeViewerRpcMethodHandlers = {
|
|
9
|
+
[K in NetworkStakeViewerMethodName as `networkStakeViewer_${K}`]: (
|
|
10
|
+
params: Parameters<NetworkStakeViewerMethods[K]>
|
|
11
|
+
) => ReturnType<NetworkStakeViewerMethods[K]>
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StepViewerMethods } from '@xyo-network/xl1-protocol'
|
|
2
|
+
|
|
3
|
+
export type StepViewerMethodName = keyof StepViewerMethods
|
|
4
|
+
|
|
5
|
+
export type StepViewerRpcMethodName = `stepViewer_${StepViewerMethodName}`
|
|
6
|
+
|
|
7
|
+
// Map each Network Stake RPC method string to the corresponding function type from StepViewer
|
|
8
|
+
export type StepViewerRpcMethodHandlers = {
|
|
9
|
+
[K in StepViewerMethodName as `stepViewer_${K}`]: (
|
|
10
|
+
params: Parameters<StepViewerMethods[K]>
|
|
11
|
+
) => ReturnType<StepViewerMethods[K]>
|
|
12
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BigIntToJsonZod, JsonToBigIntZod } from '@xylabs/hex'
|
|
2
|
+
import * as z from 'zod'
|
|
3
|
+
|
|
4
|
+
import type { NetworkStakeViewerMethodName } from '../NetworkStakeViewerRpc.ts'
|
|
5
|
+
import { BlockNumberZod } from './common/index.ts'
|
|
6
|
+
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
7
|
+
|
|
8
|
+
export const NetworkStakeViewerRpcSchemas = {
|
|
9
|
+
stake: {
|
|
10
|
+
params: {
|
|
11
|
+
from: z.tuple([BlockNumberZod.optional()]),
|
|
12
|
+
to: z.tuple([BlockNumberZod.optional()]),
|
|
13
|
+
},
|
|
14
|
+
result: {
|
|
15
|
+
from: BigIntToJsonZod,
|
|
16
|
+
to: JsonToBigIntZod,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
} satisfies RpcSchemaMap<NetworkStakeViewerMethodName>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddressZod, BigIntToJsonZod, JsonToBigIntZod,
|
|
3
|
+
} from '@xylabs/hex'
|
|
4
|
+
import z from 'zod'
|
|
5
|
+
|
|
6
|
+
import type { StepViewerMethodName } from '../StepViewerRpc.ts'
|
|
7
|
+
import {
|
|
8
|
+
JsonToStakeZod, StakeToJsonZod, StepIdentityZod,
|
|
9
|
+
} from './common/index.ts'
|
|
10
|
+
import type { RpcSchemaMap } from './RpcSchemaMap.ts'
|
|
11
|
+
|
|
12
|
+
export const StepViewerRpcSchemas = {
|
|
13
|
+
randomizer: {
|
|
14
|
+
params: {
|
|
15
|
+
from: z.tuple([StepIdentityZod]),
|
|
16
|
+
to: z.tuple([StepIdentityZod]),
|
|
17
|
+
},
|
|
18
|
+
result: {
|
|
19
|
+
from: BigIntToJsonZod,
|
|
20
|
+
to: JsonToBigIntZod,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
stake: {
|
|
24
|
+
params: {
|
|
25
|
+
from: z.tuple([StepIdentityZod]),
|
|
26
|
+
to: z.tuple([StepIdentityZod]),
|
|
27
|
+
},
|
|
28
|
+
result: {
|
|
29
|
+
from: BigIntToJsonZod,
|
|
30
|
+
to: JsonToBigIntZod,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
stakers: {
|
|
34
|
+
params: {
|
|
35
|
+
from: z.tuple([StepIdentityZod]),
|
|
36
|
+
to: z.tuple([StepIdentityZod]),
|
|
37
|
+
},
|
|
38
|
+
result: {
|
|
39
|
+
from: z.array(AddressZod),
|
|
40
|
+
to: z.array(AddressZod),
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
weight: {
|
|
44
|
+
params: {
|
|
45
|
+
from: z.tuple([StepIdentityZod]),
|
|
46
|
+
to: z.tuple([StepIdentityZod]),
|
|
47
|
+
},
|
|
48
|
+
result: {
|
|
49
|
+
from: BigIntToJsonZod,
|
|
50
|
+
to: JsonToBigIntZod,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
positionCount: {
|
|
54
|
+
params: {
|
|
55
|
+
from: z.tuple([StepIdentityZod]),
|
|
56
|
+
to: z.tuple([StepIdentityZod]),
|
|
57
|
+
},
|
|
58
|
+
result: {
|
|
59
|
+
from: z.number(),
|
|
60
|
+
to: z.number(),
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
positions: {
|
|
64
|
+
params: {
|
|
65
|
+
from: z.tuple([StepIdentityZod]),
|
|
66
|
+
to: z.tuple([StepIdentityZod]),
|
|
67
|
+
},
|
|
68
|
+
result: {
|
|
69
|
+
from: z.array(StakeToJsonZod),
|
|
70
|
+
to: z.array(JsonToStakeZod),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
stakerCount: {
|
|
74
|
+
params: {
|
|
75
|
+
from: z.tuple([StepIdentityZod]),
|
|
76
|
+
to: z.tuple([StepIdentityZod]),
|
|
77
|
+
},
|
|
78
|
+
result: {
|
|
79
|
+
from: z.number(),
|
|
80
|
+
to: z.number(),
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
} satisfies RpcSchemaMap<StepViewerMethodName>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HexZod } from '@xylabs/hex'
|
|
2
|
+
import type { PositionId } from '@xyo-network/xl1-protocol'
|
|
2
3
|
import * as z from 'zod'
|
|
3
4
|
|
|
4
5
|
import { AddressZod } from './Address.ts'
|
|
@@ -35,7 +36,7 @@ export const StakeToJsonZod = StakeZod.transform(val => ({
|
|
|
35
36
|
export const JsonToStakeZod = StakeZod.extend({ amount: HexZod }).transform(val => ({
|
|
36
37
|
addBlock: val.addBlock,
|
|
37
38
|
amount: JsonToAttoZod.parse(val.amount),
|
|
38
|
-
id: val.id,
|
|
39
|
+
id: val.id as PositionId,
|
|
39
40
|
removeBlock: val.removeBlock,
|
|
40
41
|
staked: val.staked,
|
|
41
42
|
staker: val.staker,
|
|
@@ -2,6 +2,7 @@ export * from './AllRpcSchemas.ts'
|
|
|
2
2
|
export * from './common/index.ts'
|
|
3
3
|
export * from './createRequestSchema.ts'
|
|
4
4
|
export * from './createResponseSchema.ts'
|
|
5
|
+
export * from './NetworkStakeViewerRpcSchemas.ts'
|
|
5
6
|
export * from './RpcSchemaMap.ts'
|
|
6
7
|
export * from './XyoPermissionsRpcSchemas.ts'
|
|
7
8
|
export * from './XyoProviderRpcSchemas.ts'
|