@typeberry/lib 0.10.0 → 0.11.0-411c828
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 +3 -5
- package/packages/configs/index.d.ts +9 -0
- package/packages/configs/index.d.ts.map +1 -1
- package/packages/configs/typeberry-default.json +4 -1
- package/packages/configs/typeberry-dev-full.json +3 -0
- package/packages/configs/typeberry-dev-tiny.json +3 -0
- package/packages/jam/config-node/index.d.ts +1 -0
- package/packages/jam/config-node/index.d.ts.map +1 -1
- package/packages/jam/config-node/index.js +1 -0
- package/packages/jam/config-node/node-config.d.ts +5 -11
- package/packages/jam/config-node/node-config.d.ts.map +1 -1
- package/packages/jam/config-node/node-config.js +9 -25
- package/packages/jam/config-node/node-config.test.js +11 -6
- package/packages/jam/config-node/rpc.d.ts +11 -0
- package/packages/jam/config-node/rpc.d.ts.map +1 -0
- package/packages/jam/config-node/rpc.js +16 -0
- package/packages/jam/database/states.d.ts +1 -8
- package/packages/jam/database/states.d.ts.map +1 -1
- package/packages/jam/database/value-refs.d.ts +4 -5
- package/packages/jam/database/value-refs.d.ts.map +1 -1
- package/packages/jam/database-fjall/blocks.d.ts +1 -0
- package/packages/jam/database-fjall/blocks.d.ts.map +1 -1
- package/packages/jam/database-fjall/blocks.js +8 -3
- package/packages/jam/database-fjall/hybrid-states.d.ts +10 -4
- package/packages/jam/database-fjall/hybrid-states.d.ts.map +1 -1
- package/packages/jam/database-fjall/hybrid-states.js +22 -6
- package/packages/jam/database-fjall/root.d.ts +2 -0
- package/packages/jam/database-fjall/root.d.ts.map +1 -1
- package/packages/jam/database-fjall/root.js +8 -1
- package/packages/jam/database-fjall/root.test.d.ts +2 -0
- package/packages/jam/database-fjall/root.test.d.ts.map +1 -0
- package/packages/jam/database-fjall/root.test.js +23 -0
- package/packages/jam/database-fjall/states.d.ts +1 -0
- package/packages/jam/database-fjall/states.d.ts.map +1 -1
- package/packages/jam/database-fjall/states.js +6 -3
- package/packages/jam/node/export.d.ts.map +1 -1
- package/packages/jam/node/export.js +8 -17
- package/packages/jam/node/jam-config.d.ts +5 -1
- package/packages/jam/node/jam-config.d.ts.map +1 -1
- package/packages/jam/node/jam-config.js +6 -2
- package/packages/jam/node/main-fuzz.d.ts.map +1 -1
- package/packages/jam/node/main-fuzz.js +59 -39
- package/packages/jam/node/main-importer.d.ts +6 -11
- package/packages/jam/node/main-importer.d.ts.map +1 -1
- package/packages/jam/node/main-importer.js +15 -29
- package/packages/jam/node/main.d.ts.map +1 -1
- package/packages/jam/node/main.js +6 -16
- package/packages/jam/rpc/index.d.ts +3 -0
- package/packages/jam/rpc/index.d.ts.map +1 -0
- package/packages/jam/rpc/index.js +2 -0
- package/packages/jam/rpc/src/handlers/best-block.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/best-block.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/best-block.js +15 -0
- package/packages/jam/rpc/src/handlers/finalized-block.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/finalized-block.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/finalized-block.js +7 -0
- package/packages/jam/rpc/src/handlers/list-services.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/list-services.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/list-services.js +15 -0
- package/packages/jam/rpc/src/handlers/not-implemented.d.ts +4 -0
- package/packages/jam/rpc/src/handlers/not-implemented.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/not-implemented.js +4 -0
- package/packages/jam/rpc/src/handlers/parameters.d.ts +7 -0
- package/packages/jam/rpc/src/handlers/parameters.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/parameters.js +53 -0
- package/packages/jam/rpc/src/handlers/parent.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/parent.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/parent.js +25 -0
- package/packages/jam/rpc/src/handlers/service-data.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/service-data.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/service-data.js +21 -0
- package/packages/jam/rpc/src/handlers/service-preimage.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/service-preimage.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/service-preimage.js +23 -0
- package/packages/jam/rpc/src/handlers/service-request.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/service-request.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/service-request.js +23 -0
- package/packages/jam/rpc/src/handlers/service-value.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/service-value.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/service-value.js +23 -0
- package/packages/jam/rpc/src/handlers/state-root.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/state-root.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/state-root.js +14 -0
- package/packages/jam/rpc/src/handlers/statistics.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/statistics.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/statistics.js +16 -0
- package/packages/jam/rpc/src/handlers/subscribe-best-block.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/subscribe-best-block.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/subscribe-best-block.js +8 -0
- package/packages/jam/rpc/src/handlers/subscribe-finalized-block.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/subscribe-finalized-block.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/subscribe-finalized-block.js +8 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-data.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-data.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-data.js +13 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-preimage.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-preimage.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-preimage.js +13 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-request.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-request.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-request.js +13 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-value.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-value.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/subscribe-service-value.js +13 -0
- package/packages/jam/rpc/src/handlers/subscribe-statistics.d.ts +6 -0
- package/packages/jam/rpc/src/handlers/subscribe-statistics.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/subscribe-statistics.js +13 -0
- package/packages/jam/rpc/src/handlers/typeberry/refine-work-package.d.ts +8 -0
- package/packages/jam/rpc/src/handlers/typeberry/refine-work-package.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/typeberry/refine-work-package.js +68 -0
- package/packages/jam/rpc/src/handlers/unsubscribe.d.ts +4 -0
- package/packages/jam/rpc/src/handlers/unsubscribe.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers/unsubscribe.js +3 -0
- package/packages/jam/rpc/src/handlers.d.ts +3 -0
- package/packages/jam/rpc/src/handlers.d.ts.map +1 -0
- package/packages/jam/rpc/src/handlers.js +60 -0
- package/packages/jam/rpc/src/server.d.ts +31 -0
- package/packages/jam/rpc/src/server.d.ts.map +1 -0
- package/packages/jam/rpc/src/server.js +179 -0
- package/packages/jam/rpc/src/subscription-manager.d.ts +20 -0
- package/packages/jam/rpc/src/subscription-manager.d.ts.map +1 -0
- package/packages/jam/rpc/src/subscription-manager.js +74 -0
- package/packages/jam/rpc/test/e2e-server.d.ts +3 -0
- package/packages/jam/rpc/test/e2e-server.d.ts.map +1 -0
- package/packages/jam/rpc/test/e2e-server.js +30 -0
- package/packages/jam/rpc/test/e2e-setup.d.ts +2 -0
- package/packages/jam/rpc/test/e2e-setup.d.ts.map +1 -0
- package/packages/jam/rpc/test/e2e-setup.js +126 -0
- package/packages/jam/rpc/test/e2e.d.ts +2 -0
- package/packages/jam/rpc/test/e2e.d.ts.map +1 -0
- package/packages/jam/rpc/test/e2e.js +326 -0
- package/packages/jam/state-merkleization/index.d.ts +1 -1
- package/packages/jam/state-merkleization/index.js +1 -1
- package/packages/workers/api-node/config.d.ts +14 -46
- package/packages/workers/api-node/config.d.ts.map +1 -1
- package/packages/workers/api-node/config.js +31 -96
- package/packages/workers/api-node/config.test.js +82 -63
- package/packages/workers/importer/main.d.ts +2 -0
- package/packages/workers/importer/main.d.ts.map +1 -1
- package/packages/workers/importer/main.js +1 -1
- package/packages/jam/database-lmdb/blocks.d.ts +0 -24
- package/packages/jam/database-lmdb/blocks.d.ts.map +0 -1
- package/packages/jam/database-lmdb/blocks.js +0 -82
- package/packages/jam/database-lmdb/hybrid-states.d.ts +0 -56
- package/packages/jam/database-lmdb/hybrid-states.d.ts.map +0 -1
- package/packages/jam/database-lmdb/hybrid-states.js +0 -149
- package/packages/jam/database-lmdb/hybrid-states.test.d.ts +0 -2
- package/packages/jam/database-lmdb/hybrid-states.test.d.ts.map +0 -1
- package/packages/jam/database-lmdb/hybrid-states.test.js +0 -180
- package/packages/jam/database-lmdb/index.d.ts +0 -5
- package/packages/jam/database-lmdb/index.d.ts.map +0 -1
- package/packages/jam/database-lmdb/index.js +0 -4
- package/packages/jam/database-lmdb/root.d.ts +0 -26
- package/packages/jam/database-lmdb/root.d.ts.map +0 -1
- package/packages/jam/database-lmdb/root.js +0 -53
- package/packages/jam/database-lmdb/states.d.ts +0 -76
- package/packages/jam/database-lmdb/states.d.ts.map +0 -1
- package/packages/jam/database-lmdb/states.js +0 -145
- package/packages/jam/database-lmdb/states.test.d.ts +0 -2
- package/packages/jam/database-lmdb/states.test.d.ts.map +0 -1
- package/packages/jam/database-lmdb/states.test.js +0 -202
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { bestBlock } from "./best-block.js";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#finalizedblock
|
|
4
|
+
*/
|
|
5
|
+
export const finalizedBlock = async (params, context) => {
|
|
6
|
+
return bestBlock(params, context); // todo [seko] implement finalized block logic once finality is there
|
|
7
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#listservicesheader_hash
|
|
4
|
+
*/
|
|
5
|
+
export declare const listServices: Handler<"listServices">;
|
|
6
|
+
//# sourceMappingURL=list-services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-services.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/list-services.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,2BAA2B,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,cAAc,CAWhD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
2
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
3
|
+
import { RpcError, RpcErrorCode } from "#@typeberry/rpc-validation";
|
|
4
|
+
/**
|
|
5
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#listservicesheader_hash
|
|
6
|
+
*/
|
|
7
|
+
export const listServices = async ([headerHash], { db }) => {
|
|
8
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
9
|
+
const state = db.states.getState(hashOpaque);
|
|
10
|
+
if (state === null) {
|
|
11
|
+
throw new RpcError(RpcErrorCode.Other, `Posterior state not found for block: ${hashOpaque.toString()}`);
|
|
12
|
+
}
|
|
13
|
+
const serviceIds = state.recentServiceIds();
|
|
14
|
+
return [...serviceIds];
|
|
15
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type GenericHandler, type validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import type z from "zod";
|
|
3
|
+
export declare const notImplemented: GenericHandler<z.infer<typeof validation.notImplementedSchema.input>, z.infer<typeof validation.notImplementedSchema.output>>;
|
|
4
|
+
//# sourceMappingURL=not-implemented.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-implemented.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/not-implemented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA0B,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACzG,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,cAAc,EAAE,cAAc,CACzC,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,oBAAoB,CAAC,KAAK,CAAC,EACrD,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAGvD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/77cba2dcc1887233d4b19371c05284ff761a5fa6/JIP-2.md#chain-parameters
|
|
4
|
+
* Returns the parameters of the current node/chain.
|
|
5
|
+
*/
|
|
6
|
+
export declare const parameters: Handler<"parameters">;
|
|
7
|
+
//# sourceMappingURL=parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAUzD;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,YAAY,CA0C5C,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { W_E } from "#@typeberry/block";
|
|
2
|
+
import { G_I, MAX_REPORT_DEPENDENCIES, O, Q, T, W_B, W_C, W_T } from "#@typeberry/block/gp-constants.js";
|
|
3
|
+
import { MAX_NUMBER_OF_WORK_ITEMS } from "#@typeberry/block/work-package.js";
|
|
4
|
+
import { BASE_SERVICE_BALANCE, ELECTIVE_BYTE_BALANCE, ELECTIVE_ITEM_BALANCE, MAX_RECENT_HISTORY, } from "#@typeberry/state";
|
|
5
|
+
import { REPORT_TIMEOUT_GRACE_PERIOD } from "#@typeberry/transition/assurances.js";
|
|
6
|
+
import { G_A } from "#@typeberry/transition/reports/verify-post-signature.js";
|
|
7
|
+
/**
|
|
8
|
+
* https://github.com/polkadot-fellows/JIPs/blob/77cba2dcc1887233d4b19371c05284ff761a5fa6/JIP-2.md#chain-parameters
|
|
9
|
+
* Returns the parameters of the current node/chain.
|
|
10
|
+
*/
|
|
11
|
+
export const parameters = async (_params, { chainSpec }) => {
|
|
12
|
+
return {
|
|
13
|
+
V1: {
|
|
14
|
+
deposit_per_account: Number(BASE_SERVICE_BALANCE),
|
|
15
|
+
deposit_per_item: Number(ELECTIVE_ITEM_BALANCE),
|
|
16
|
+
deposit_per_byte: Number(ELECTIVE_BYTE_BALANCE),
|
|
17
|
+
min_turnaround_period: 32,
|
|
18
|
+
epoch_period: chainSpec.epochLength,
|
|
19
|
+
max_accumulate_gas: G_A,
|
|
20
|
+
max_is_authorized_gas: G_I,
|
|
21
|
+
max_refine_gas: Number(chainSpec.maxRefineGas),
|
|
22
|
+
block_gas_limit: Number(chainSpec.maxBlockGas),
|
|
23
|
+
recent_block_count: MAX_RECENT_HISTORY,
|
|
24
|
+
max_work_items: MAX_NUMBER_OF_WORK_ITEMS,
|
|
25
|
+
max_dependencies: MAX_REPORT_DEPENDENCIES,
|
|
26
|
+
max_tickets_per_block: chainSpec.maxTicketsPerExtrinsic,
|
|
27
|
+
max_lookup_anchor_age: chainSpec.maxLookupAnchorAge,
|
|
28
|
+
tickets_attempts_number: chainSpec.ticketsPerValidator,
|
|
29
|
+
auth_window: O,
|
|
30
|
+
auth_queue_len: Q,
|
|
31
|
+
rotation_period: chainSpec.rotationPeriod,
|
|
32
|
+
max_extrinsics: T,
|
|
33
|
+
availability_timeout: REPORT_TIMEOUT_GRACE_PERIOD,
|
|
34
|
+
val_count: chainSpec.validatorsCount,
|
|
35
|
+
max_input: W_B,
|
|
36
|
+
max_refine_code_size: W_C,
|
|
37
|
+
basic_piece_len: W_E,
|
|
38
|
+
max_imports: 3072,
|
|
39
|
+
max_is_authorized_code_size: 64000,
|
|
40
|
+
max_exports: 3072,
|
|
41
|
+
max_refine_memory: 4096,
|
|
42
|
+
max_is_authorized_memory: 4096,
|
|
43
|
+
segment_piece_count: chainSpec.numberECPiecesPerSegment,
|
|
44
|
+
max_report_elective_data: 49152,
|
|
45
|
+
transfer_memo_size: W_T,
|
|
46
|
+
epoch_tail_start: chainSpec.contestLength,
|
|
47
|
+
core_count: chainSpec.coresCount,
|
|
48
|
+
slot_period_sec: chainSpec.slotDuration,
|
|
49
|
+
max_authorizer_code_size: 64000,
|
|
50
|
+
max_service_code_size: 4000000,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#parentheader_hash
|
|
4
|
+
*/
|
|
5
|
+
export declare const parent: Handler<"parent">;
|
|
6
|
+
//# sourceMappingURL=parent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/parent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAsC,MAAM,2BAA2B,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,OAAO,CAAC,QAAQ,CA6BpC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
2
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
3
|
+
import { RpcError, RpcErrorCode, validation } from "#@typeberry/rpc-validation";
|
|
4
|
+
/**
|
|
5
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#parentheader_hash
|
|
6
|
+
*/
|
|
7
|
+
export const parent = async ([headerHash], { db }) => {
|
|
8
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
9
|
+
const header = db.blocks.getHeader(hashOpaque);
|
|
10
|
+
if (header === null) {
|
|
11
|
+
throw new RpcError(RpcErrorCode.BlockUnavailable, `Block unavailable: ${hashOpaque.toString()}`, validation.hash.encode(hashOpaque.raw));
|
|
12
|
+
}
|
|
13
|
+
const parentHash = header.parentHeaderHash.materialize();
|
|
14
|
+
if (parentHash.isEqualTo(Bytes.zero(HASH_SIZE).asOpaque())) {
|
|
15
|
+
throw new RpcError(RpcErrorCode.Other, `Parent not found for block: ${hashOpaque.toString()}`);
|
|
16
|
+
}
|
|
17
|
+
const parentHeader = db.blocks.getHeader(parentHash);
|
|
18
|
+
if (parentHeader === null) {
|
|
19
|
+
throw new RpcError(RpcErrorCode.Other, `The hash of parent was found (${parentHash}) but its header doesn't exist in the database.`);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
header_hash: parentHash.raw,
|
|
23
|
+
slot: parentHeader.timeSlotIndex.materialize(),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicedataheader_hash-id
|
|
4
|
+
*/
|
|
5
|
+
export declare const serviceData: Handler<"serviceData">;
|
|
6
|
+
//# sourceMappingURL=service-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-data.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/service-data.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,2BAA2B,CAAC;AAGjF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,aAAa,CAe9C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { tryAsServiceId } from "#@typeberry/block";
|
|
2
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
3
|
+
import { Encoder } from "#@typeberry/codec";
|
|
4
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
5
|
+
import { RpcError, RpcErrorCode } from "#@typeberry/rpc-validation";
|
|
6
|
+
import { ServiceAccountInfo } from "#@typeberry/state";
|
|
7
|
+
/**
|
|
8
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicedataheader_hash-id
|
|
9
|
+
*/
|
|
10
|
+
export const serviceData = async ([headerHash, serviceId], { db, chainSpec }) => {
|
|
11
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
12
|
+
const state = db.states.getState(hashOpaque);
|
|
13
|
+
if (state === null) {
|
|
14
|
+
throw new RpcError(RpcErrorCode.Other, `State not found for block: ${hashOpaque.toString()}`);
|
|
15
|
+
}
|
|
16
|
+
const serviceData = state.getService(tryAsServiceId(serviceId));
|
|
17
|
+
if (serviceData === null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return Encoder.encodeObject(ServiceAccountInfo.Codec, serviceData.getInfo(), chainSpec).raw;
|
|
21
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicepreimageheader_hash-id-hash
|
|
4
|
+
*/
|
|
5
|
+
export declare const servicePreimage: Handler<"servicePreimage">;
|
|
6
|
+
//# sourceMappingURL=service-preimage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-preimage.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/service-preimage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,2BAA2B,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,iBAAiB,CAqBtD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tryAsServiceId } from "#@typeberry/block";
|
|
2
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
3
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
4
|
+
import { RpcError, RpcErrorCode } from "#@typeberry/rpc-validation";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicepreimageheader_hash-id-hash
|
|
7
|
+
*/
|
|
8
|
+
export const servicePreimage = async ([headerHash, serviceId, preimageHash], { db }) => {
|
|
9
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
10
|
+
const state = db.states.getState(hashOpaque);
|
|
11
|
+
if (state === null) {
|
|
12
|
+
throw new RpcError(RpcErrorCode.Other, `State not found for block: ${hashOpaque.toString()}`);
|
|
13
|
+
}
|
|
14
|
+
const service = state.getService(tryAsServiceId(serviceId));
|
|
15
|
+
if (service === null) {
|
|
16
|
+
throw new RpcError(RpcErrorCode.Other, `Service not found: ${serviceId.toString()}`);
|
|
17
|
+
}
|
|
18
|
+
const preimage = service.getPreimage(Bytes.fromBlob(preimageHash, HASH_SIZE).asOpaque());
|
|
19
|
+
if (preimage === null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return preimage.raw;
|
|
23
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicerequestheader_hash-id-hash-len
|
|
4
|
+
*/
|
|
5
|
+
export declare const serviceRequest: Handler<"serviceRequest">;
|
|
6
|
+
//# sourceMappingURL=service-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-request.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/service-request.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,gBAAgB,CAqBpD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tryAsServiceId } from "#@typeberry/block";
|
|
2
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
3
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
4
|
+
import { tryAsU32 } from "#@typeberry/numbers";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicerequestheader_hash-id-hash-len
|
|
7
|
+
*/
|
|
8
|
+
export const serviceRequest = async ([headerHash, serviceId, preimageHash, preimageLength], { db }) => {
|
|
9
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
10
|
+
const state = db.states.getState(hashOpaque);
|
|
11
|
+
if (state === null) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const service = state.getService(tryAsServiceId(serviceId));
|
|
15
|
+
if (service === null) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const slots = service.getLookupHistory(Bytes.fromBlob(preimageHash, HASH_SIZE).asOpaque(), tryAsU32(preimageLength));
|
|
19
|
+
if (slots === null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return slots;
|
|
23
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicevalueheader_hash-id-key
|
|
4
|
+
*/
|
|
5
|
+
export declare const serviceValue: Handler<"serviceValue">;
|
|
6
|
+
//# sourceMappingURL=service-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-value.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/service-value.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,2BAA2B,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,cAAc,CAqBhD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tryAsServiceId } from "#@typeberry/block";
|
|
2
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
3
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
4
|
+
import { RpcError, RpcErrorCode } from "#@typeberry/rpc-validation";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#servicevalueheader_hash-id-key
|
|
7
|
+
*/
|
|
8
|
+
export const serviceValue = async ([headerHash, serviceId, key], { db }) => {
|
|
9
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
10
|
+
const state = db.states.getState(hashOpaque);
|
|
11
|
+
if (state === null) {
|
|
12
|
+
throw new RpcError(RpcErrorCode.Other, `State not found for block: ${hashOpaque.toString()}`);
|
|
13
|
+
}
|
|
14
|
+
const service = state.getService(tryAsServiceId(serviceId));
|
|
15
|
+
if (service === null) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const storageValue = service.getStorage(Bytes.fromBlob(key, key.length).asOpaque());
|
|
19
|
+
if (storageValue === null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return storageValue.raw;
|
|
23
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#staterootheader_hash
|
|
4
|
+
*/
|
|
5
|
+
export declare const stateRoot: Handler<"stateRoot">;
|
|
6
|
+
//# sourceMappingURL=state-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-root.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/state-root.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,2BAA2B,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,WAAW,CAU1C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
2
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
3
|
+
import { RpcError, RpcErrorCode } from "#@typeberry/rpc-validation";
|
|
4
|
+
/**
|
|
5
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#staterootheader_hash
|
|
6
|
+
*/
|
|
7
|
+
export const stateRoot = async ([headerHash], { db }) => {
|
|
8
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
9
|
+
const stateRoot = db.blocks.getPostStateRoot(hashOpaque);
|
|
10
|
+
if (stateRoot === null) {
|
|
11
|
+
throw new RpcError(RpcErrorCode.BlockUnavailable, `Block unavailable: ${hashOpaque.toString()}`, hashOpaque.raw);
|
|
12
|
+
}
|
|
13
|
+
return stateRoot.raw;
|
|
14
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#statisticsheader_hash
|
|
4
|
+
*/
|
|
5
|
+
export declare const statistics: Handler<"statistics">;
|
|
6
|
+
//# sourceMappingURL=statistics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/statistics.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,2BAA2B,CAAC;AAGjF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,YAAY,CAS5C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Bytes } from "#@typeberry/bytes";
|
|
2
|
+
import { Encoder } from "#@typeberry/codec";
|
|
3
|
+
import { HASH_SIZE } from "#@typeberry/hash";
|
|
4
|
+
import { RpcError, RpcErrorCode } from "#@typeberry/rpc-validation";
|
|
5
|
+
import { StatisticsData } from "#@typeberry/state";
|
|
6
|
+
/**
|
|
7
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#statisticsheader_hash
|
|
8
|
+
*/
|
|
9
|
+
export const statistics = async ([headerHash], { db, chainSpec }) => {
|
|
10
|
+
const hashOpaque = Bytes.fromBlob(headerHash, HASH_SIZE).asOpaque();
|
|
11
|
+
const state = db.states.getState(hashOpaque);
|
|
12
|
+
if (state === null) {
|
|
13
|
+
throw new RpcError(RpcErrorCode.Other, `State not found for block: ${hashOpaque.toString()}`);
|
|
14
|
+
}
|
|
15
|
+
return Encoder.encodeObject(StatisticsData.Codec, state.statistics, chainSpec).raw;
|
|
16
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribebestblock
|
|
4
|
+
*/
|
|
5
|
+
export declare const subscribeBestBlock: Handler<"subscribeBestBlock">;
|
|
6
|
+
//# sourceMappingURL=subscribe-best-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-best-block.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/subscribe-best-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAGrE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,oBAAoB,CAE5D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import { bestBlock } from "./best-block.js";
|
|
3
|
+
/**
|
|
4
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribebestblock
|
|
5
|
+
*/
|
|
6
|
+
export const subscribeBestBlock = async (params, { subscription }) => {
|
|
7
|
+
return subscription.subscribe("subscribeBestBlock", bestBlock, validation.schemas.bestBlock.output, params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribefinalizedblock
|
|
4
|
+
*/
|
|
5
|
+
export declare const subscribeFinalizedBlock: Handler<"subscribeFinalizedBlock">;
|
|
6
|
+
//# sourceMappingURL=subscribe-finalized-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-finalized-block.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/subscribe-finalized-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAGrE;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,yBAAyB,CAOtE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import { finalizedBlock } from "./finalized-block.js";
|
|
3
|
+
/**
|
|
4
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribefinalizedblock
|
|
5
|
+
*/
|
|
6
|
+
export const subscribeFinalizedBlock = async (params, { subscription }) => {
|
|
7
|
+
return subscription.subscribe("subscribeFinalizedBlock", finalizedBlock, validation.schemas.finalizedBlock.output, params);
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicedataid-finalized
|
|
4
|
+
*/
|
|
5
|
+
export declare const subscribeServiceData: Handler<"subscribeServiceData">;
|
|
6
|
+
//# sourceMappingURL=subscribe-service-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-service-data.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/subscribe-service-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAKrE;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,sBAAsB,CAWhE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import { bestBlock } from "./best-block.js";
|
|
3
|
+
import { finalizedBlock } from "./finalized-block.js";
|
|
4
|
+
import { serviceData } from "./service-data.js";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicedataid-finalized
|
|
7
|
+
*/
|
|
8
|
+
export const subscribeServiceData = async (params, { subscription }) => {
|
|
9
|
+
return subscription.subscribe("subscribeServiceData", async ([serviceId, finalized], context) => {
|
|
10
|
+
const block = finalized ? await finalizedBlock([], context) : await bestBlock([], context);
|
|
11
|
+
return serviceData([block.header_hash, serviceId], context);
|
|
12
|
+
}, validation.schemas.serviceData.output, params);
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicepreimageid-hash-finalized
|
|
4
|
+
*/
|
|
5
|
+
export declare const subscribeServicePreimage: Handler<"subscribeServicePreimage">;
|
|
6
|
+
//# sourceMappingURL=subscribe-service-preimage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-service-preimage.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/subscribe-service-preimage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAKrE;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,OAAO,CAAC,0BAA0B,CAWxE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import { bestBlock } from "./best-block.js";
|
|
3
|
+
import { finalizedBlock } from "./finalized-block.js";
|
|
4
|
+
import { servicePreimage } from "./service-preimage.js";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicepreimageid-hash-finalized
|
|
7
|
+
*/
|
|
8
|
+
export const subscribeServicePreimage = async (params, { subscription }) => {
|
|
9
|
+
return subscription.subscribe("subscribeServicePreimage", async ([serviceId, preimageHash, finalized], context) => {
|
|
10
|
+
const block = finalized ? await finalizedBlock([], context) : await bestBlock([], context);
|
|
11
|
+
return servicePreimage([block.header_hash, serviceId, preimageHash], context);
|
|
12
|
+
}, validation.schemas.servicePreimage.output, params);
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicerequestid-hash-len-finalized
|
|
4
|
+
*/
|
|
5
|
+
export declare const subscribeServiceRequest: Handler<"subscribeServiceRequest">;
|
|
6
|
+
//# sourceMappingURL=subscribe-service-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-service-request.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/subscribe-service-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAKrE;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,yBAAyB,CAWtE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import { bestBlock } from "./best-block.js";
|
|
3
|
+
import { finalizedBlock } from "./finalized-block.js";
|
|
4
|
+
import { serviceRequest } from "./service-request.js";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicerequestid-hash-len-finalized
|
|
7
|
+
*/
|
|
8
|
+
export const subscribeServiceRequest = async (params, { subscription }) => {
|
|
9
|
+
return subscription.subscribe("subscribeServiceRequest", async ([serviceId, preimageHash, preimageLength, finalized], context) => {
|
|
10
|
+
const block = finalized ? await finalizedBlock([], context) : await bestBlock([], context);
|
|
11
|
+
return serviceRequest([block.header_hash, serviceId, preimageHash, preimageLength], context);
|
|
12
|
+
}, validation.schemas.serviceRequest.output, params);
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicevalueid-key-finalized
|
|
4
|
+
*/
|
|
5
|
+
export declare const subscribeServiceValue: Handler<"subscribeServiceValue">;
|
|
6
|
+
//# sourceMappingURL=subscribe-service-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-service-value.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/subscribe-service-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAKrE;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,uBAAuB,CAWlE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import { bestBlock } from "./best-block.js";
|
|
3
|
+
import { finalizedBlock } from "./finalized-block.js";
|
|
4
|
+
import { serviceValue } from "./service-value.js";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribeservicevalueid-key-finalized
|
|
7
|
+
*/
|
|
8
|
+
export const subscribeServiceValue = async (params, { subscription }) => {
|
|
9
|
+
return subscription.subscribe("subscribeServiceValue", async ([serviceId, key, finalized], context) => {
|
|
10
|
+
const block = finalized ? await finalizedBlock([], context) : await bestBlock([], context);
|
|
11
|
+
return serviceValue([block.header_hash, serviceId, key], context);
|
|
12
|
+
}, validation.schemas.serviceValue.output, params);
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribestatisticsfinalized
|
|
4
|
+
*/
|
|
5
|
+
export declare const subscribeStatistics: Handler<"subscribeStatistics">;
|
|
6
|
+
//# sourceMappingURL=subscribe-statistics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe-statistics.d.ts","sourceRoot":"","sources":["../../../../../../../packages/jam/rpc/src/handlers/subscribe-statistics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AAKrE;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,qBAAqB,CAW9D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { validation } from "#@typeberry/rpc-validation";
|
|
2
|
+
import { bestBlock } from "./best-block.js";
|
|
3
|
+
import { finalizedBlock } from "./finalized-block.js";
|
|
4
|
+
import { statistics } from "./statistics.js";
|
|
5
|
+
/**
|
|
6
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#subscribestatisticsfinalized
|
|
7
|
+
*/
|
|
8
|
+
export const subscribeStatistics = async (params, { subscription }) => {
|
|
9
|
+
return subscription.subscribe("subscribeStatistics", async ([finalized], context) => {
|
|
10
|
+
const block = finalized ? await finalizedBlock([], context) : await bestBlock([], context);
|
|
11
|
+
return statistics([block.header_hash], context);
|
|
12
|
+
}, validation.schemas.statistics.output, params);
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Handler } from "#@typeberry/rpc-validation";
|
|
2
|
+
/**
|
|
3
|
+
* Simulate package refinement.
|
|
4
|
+
*
|
|
5
|
+
* https://github.com/polkadot-fellows/JIPs/blob/772ce90bfc33f4e1de9de3bbe10c561753cc0d41/JIP-2.md#submitworkpackagecore-package-extrinsics
|
|
6
|
+
*/
|
|
7
|
+
export declare const refineWorkPackage: Handler<"typeberry_refineWorkPackage">;
|
|
8
|
+
//# sourceMappingURL=refine-work-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refine-work-package.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/jam/rpc/src/handlers/typeberry/refine-work-package.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,OAAO,EAA0B,MAAM,2BAA2B,CAAC;AAIjF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,6BAA6B,CA6CpE,CAAC"}
|