@xyo-network/xl1-rpc 1.18.3 → 1.18.4
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/engine/rpcMethodHandlersFromBlockViewer.d.ts.map +1 -1
- package/dist/neutral/engine/rpcMethodHandlersFromViewer.d.ts.map +1 -1
- package/dist/neutral/index.mjs +78 -3
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewer.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewerMethods.d.ts +69 -1
- package/dist/neutral/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewerMethods.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts +69 -1
- package/dist/neutral/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts +132 -0
- package/dist/neutral/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/BlockViewerRpcSchemas.d.ts +66 -0
- package/dist/neutral/types/schema/BlockViewerRpcSchemas.d.ts.map +1 -1
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts +66 -0
- package/dist/neutral/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/engine/rpcMethodHandlersFromBlockViewer.d.ts.map +1 -1
- package/dist/node/engine/rpcMethodHandlersFromViewer.d.ts.map +1 -1
- package/dist/node/index-node.mjs +78 -3
- package/dist/node/index-node.mjs.map +1 -1
- package/dist/node/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewer.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewerMethods.d.ts +69 -1
- package/dist/node/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewerMethods.d.ts.map +1 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts +69 -1
- package/dist/node/provider/viewer/JsonRpcXyoViewer.d.ts.map +1 -1
- package/dist/node/types/schema/AllRpcSchemas.d.ts +132 -0
- package/dist/node/types/schema/AllRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/BlockViewerRpcSchemas.d.ts +66 -0
- package/dist/node/types/schema/BlockViewerRpcSchemas.d.ts.map +1 -1
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts +66 -0
- package/dist/node/types/schema/XyoViewerRpcSchemas.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/engine/rpcMethodHandlersFromBlockViewer.ts +2 -0
- package/src/engine/rpcMethodHandlersFromViewer.ts +2 -0
- package/src/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewer.ts +3 -1
- package/src/provider/viewer/JsonRpcBlockViewer/JsonRpcBlockViewerMethods.ts +17 -1
- package/src/provider/viewer/JsonRpcXyoViewer.ts +14 -1
- package/src/types/schema/BlockViewerRpcSchemas.ts +24 -1
- package/src/types/schema/XyoViewerRpcSchemas.ts +25 -0
|
@@ -3,7 +3,9 @@ import {
|
|
|
3
3
|
asAnyPayload,
|
|
4
4
|
asHashMeta, type Payload, type WithHashMeta,
|
|
5
5
|
} from '@xyo-network/payload-model'
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
BlockRate, Count, SignedHydratedBlockWithHashMeta, StepIndex, TimeDurations, XL1BlockNumber, XL1BlockRange,
|
|
8
|
+
} from '@xyo-network/xl1-protocol'
|
|
7
9
|
import { type BlockViewerMethods, BlockViewerMoniker } from '@xyo-network/xl1-protocol-sdk'
|
|
8
10
|
|
|
9
11
|
import { BlockViewerRpcSchemas } from '../../../types/index.ts'
|
|
@@ -43,6 +45,20 @@ export class JsonRpcBlockViewerMethods extends AbstractJsonRpcViewer<BlockViewer
|
|
|
43
45
|
return result.map(p => asHashMeta(p, true)).map(p => asAnyPayload(p, { required: true }))
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
async rate(range: XL1BlockRange, timeUnit?: keyof TimeDurations): Promise<BlockRate> {
|
|
49
|
+
return await this.transport.sendRequest(
|
|
50
|
+
'blockViewer_rate',
|
|
51
|
+
[range, timeUnit],
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async stepSizeRate(start: XL1BlockNumber, stepSizeIndex: StepIndex, count?: Count, timeUnit?: keyof TimeDurations): Promise<BlockRate> {
|
|
56
|
+
return await this.transport.sendRequest(
|
|
57
|
+
'blockViewer_stepSizeRate',
|
|
58
|
+
[start, stepSizeIndex, count, timeUnit],
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
46
62
|
protected schemas() {
|
|
47
63
|
return BlockViewerRpcSchemas
|
|
48
64
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Address, Hash, Promisable,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
2
4
|
import { Signed } from '@xyo-network/boundwitness-model'
|
|
3
5
|
import type {
|
|
4
6
|
AttoXL1,
|
|
5
7
|
BlockBoundWitnessWithHashMeta,
|
|
8
|
+
BlockRate,
|
|
6
9
|
ChainId,
|
|
7
10
|
HydratedBlock,
|
|
8
11
|
SignedHydratedBlockWithHashMeta,
|
|
9
12
|
SignedHydratedTransaction,
|
|
10
13
|
StepIdentity,
|
|
11
14
|
StepIdentityString,
|
|
15
|
+
TimeDurations,
|
|
12
16
|
XL1BlockNumber,
|
|
17
|
+
XL1BlockRange,
|
|
13
18
|
} from '@xyo-network/xl1-protocol'
|
|
14
19
|
import {
|
|
15
20
|
isSignedHydratedBlock, isSignedHydratedBlockWithHashMeta,
|
|
@@ -248,6 +253,10 @@ export class JsonRpcXyoViewer extends AbstractJsonRpcViewer<XyoViewerRpcSchemas,
|
|
|
248
253
|
)).map(p => toWithHashMeta(p, true)))
|
|
249
254
|
}
|
|
250
255
|
|
|
256
|
+
async rate(range: XL1BlockRange, timeUnit?: keyof TimeDurations): Promise<BlockRate> {
|
|
257
|
+
return await this.block.rate(range, timeUnit)
|
|
258
|
+
}
|
|
259
|
+
|
|
251
260
|
async stakeById(id: number): Promise<Position> {
|
|
252
261
|
return (await this.transport.sendRequest('xyoViewer_stakeById', [id]))
|
|
253
262
|
}
|
|
@@ -264,6 +273,10 @@ export class JsonRpcXyoViewer extends AbstractJsonRpcViewer<XyoViewerRpcSchemas,
|
|
|
264
273
|
return (await this.transport.sendRequest('xyoViewer_stakesByStaker', [staker]))
|
|
265
274
|
}
|
|
266
275
|
|
|
276
|
+
async stepSizeRate(start: XL1BlockNumber, stepIndex: number, count?: number, timeUnit?: keyof TimeDurations): Promise<BlockRate> {
|
|
277
|
+
return await this.block.stepSizeRate(start, stepIndex, count, timeUnit)
|
|
278
|
+
}
|
|
279
|
+
|
|
267
280
|
async transactionByBlockHashAndIndex(blockHash: Hash, transactionIndex: number): Promise<SignedHydratedTransaction | null> {
|
|
268
281
|
return (await this.transport.sendRequest('xyoViewer_transactionByBlockHashAndIndex', [blockHash, transactionIndex])) as SignedHydratedTransaction | null
|
|
269
282
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { HashZod } from '@xylabs/sdk-js'
|
|
2
2
|
import { PayloadZodLoose } from '@xyo-network/payload-model'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
BlockRangeZod,
|
|
5
|
+
BlockRateZod, CountZod, SignedHydratedBlockWithHashMetaZod, StepIndexZod, TimeDurationsZod, XL1BlockNumberZod,
|
|
6
|
+
} from '@xyo-network/xl1-protocol'
|
|
4
7
|
import { z } from 'zod'
|
|
5
8
|
|
|
6
9
|
import type { BlockViewerRpcMethodName } from '../BlockViewerRpc.ts'
|
|
@@ -47,6 +50,26 @@ export const BlockViewerRpcSchemas = {
|
|
|
47
50
|
from: z.array(PayloadZodLoose),
|
|
48
51
|
},
|
|
49
52
|
},
|
|
53
|
+
blockViewer_rate: {
|
|
54
|
+
params: {
|
|
55
|
+
to: z.tuple([BlockRangeZod, TimeDurationsZod.keyof().optional()]),
|
|
56
|
+
from: z.tuple([BlockRangeZod, TimeDurationsZod.keyof().optional()]),
|
|
57
|
+
},
|
|
58
|
+
result: {
|
|
59
|
+
to: BlockRateZod,
|
|
60
|
+
from: BlockRateZod,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
blockViewer_stepSizeRate: {
|
|
64
|
+
params: {
|
|
65
|
+
to: z.tuple([XL1BlockNumberZod, StepIndexZod, CountZod.optional(), TimeDurationsZod.keyof().optional()]),
|
|
66
|
+
from: z.tuple([BlockRateZod]),
|
|
67
|
+
},
|
|
68
|
+
result: {
|
|
69
|
+
to: BlockRateZod,
|
|
70
|
+
from: BlockRateZod,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
50
73
|
} satisfies RpcSchemaMap<BlockViewerRpcMethodName>
|
|
51
74
|
|
|
52
75
|
export type BlockViewerRpcSchemas = typeof BlockViewerRpcSchemas
|
|
@@ -4,8 +4,13 @@ import {
|
|
|
4
4
|
} from '@xylabs/sdk-js'
|
|
5
5
|
import { PayloadZodLoose } from '@xyo-network/payload-model'
|
|
6
6
|
import {
|
|
7
|
+
BlockRangeZod,
|
|
8
|
+
BlockRateZod,
|
|
9
|
+
CountZod,
|
|
7
10
|
JsonToStakeZod, SignedHydratedBlockWithHashMetaZod,
|
|
8
11
|
SignedHydratedTransactionZod, StakeToJsonZod, StepIdentityZod,
|
|
12
|
+
StepIndexZod,
|
|
13
|
+
TimeDurationsZod,
|
|
9
14
|
XL1BlockNumberZod, XL1BlockRangeZod,
|
|
10
15
|
} from '@xyo-network/xl1-protocol'
|
|
11
16
|
import { AccountBalanceHistoryItemZod } from '@xyo-network/xl1-protocol-sdk'
|
|
@@ -335,6 +340,26 @@ export const XyoViewerRpcSchemas = {
|
|
|
335
340
|
from: z.array(PayloadZodLoose),
|
|
336
341
|
},
|
|
337
342
|
},
|
|
343
|
+
xyoViewer_rate: {
|
|
344
|
+
params: {
|
|
345
|
+
to: z.tuple([BlockRangeZod, TimeDurationsZod.keyof().optional()]),
|
|
346
|
+
from: z.tuple([BlockRangeZod, TimeDurationsZod.keyof().optional()]),
|
|
347
|
+
},
|
|
348
|
+
result: {
|
|
349
|
+
to: BlockRateZod,
|
|
350
|
+
from: BlockRateZod,
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
xyoViewer_stepSizeRate: {
|
|
354
|
+
params: {
|
|
355
|
+
to: z.tuple([XL1BlockNumberZod, StepIndexZod, CountZod.optional(), TimeDurationsZod.keyof().optional()]),
|
|
356
|
+
from: z.tuple([BlockRateZod]),
|
|
357
|
+
},
|
|
358
|
+
result: {
|
|
359
|
+
to: BlockRateZod,
|
|
360
|
+
from: BlockRateZod,
|
|
361
|
+
},
|
|
362
|
+
},
|
|
338
363
|
} satisfies RpcSchemaMap<XyoViewerRpcMethodName>
|
|
339
364
|
|
|
340
365
|
export type XyoViewerRpcSchemas = typeof XyoViewerRpcSchemas
|