@acala-network/chopsticks-core 0.8.3 → 0.8.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.
Files changed (40) hide show
  1. package/lib/blockchain/block-builder.js +0 -3
  2. package/lib/blockchain/block.d.ts +1 -1
  3. package/lib/blockchain/block.js +4 -4
  4. package/lib/blockchain/index.d.ts +2 -2
  5. package/lib/blockchain/index.js +4 -2
  6. package/lib/blockchain/inherent/parachain/validation-data.js +5 -5
  7. package/lib/chopsticks-provider.d.ts +0 -0
  8. package/lib/chopsticks-provider.js +249 -0
  9. package/lib/chopsticks-worker.d.ts +1 -0
  10. package/lib/chopsticks-worker.js +101 -0
  11. package/lib/genesis-provider.d.ts +1 -1
  12. package/lib/genesis-provider.js +3 -3
  13. package/lib/index.d.ts +2 -1
  14. package/lib/index.js +3 -1
  15. package/lib/rpc/index.d.ts +5 -0
  16. package/lib/rpc/index.js +26 -0
  17. package/lib/rpc/shared.d.ts +27 -0
  18. package/lib/rpc/shared.js +19 -0
  19. package/lib/rpc/substrate/author.d.ts +28 -0
  20. package/lib/rpc/substrate/author.js +98 -0
  21. package/lib/rpc/substrate/chain.d.ts +45 -0
  22. package/lib/rpc/substrate/chain.js +103 -0
  23. package/lib/rpc/substrate/index.d.ts +66 -0
  24. package/lib/rpc/substrate/index.js +38 -0
  25. package/lib/rpc/substrate/payment.d.ts +16 -0
  26. package/lib/rpc/substrate/payment.js +54 -0
  27. package/lib/rpc/substrate/state.d.ts +97 -0
  28. package/lib/rpc/substrate/state.js +184 -0
  29. package/lib/rpc/substrate/system.d.ts +28 -0
  30. package/lib/rpc/substrate/system.js +71 -0
  31. package/lib/utils/time-travel.js +2 -2
  32. package/lib/wasm-executor/browser-wasm-executor.mjs +37 -0
  33. package/lib/wasm-executor/browser-worker.d.ts +5 -0
  34. package/lib/wasm-executor/browser-worker.js +28 -0
  35. package/lib/{executor.d.ts → wasm-executor/index.d.ts} +18 -1
  36. package/lib/{executor.js → wasm-executor/index.js} +59 -15
  37. package/lib/wasm-executor/node-wasm-executor.mjs +34 -0
  38. package/lib/wasm-executor/node-worker.d.ts +5 -0
  39. package/lib/wasm-executor/node-worker.js +31 -0
  40. package/package.json +6 -4
@@ -0,0 +1,28 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { Handler } from '../shared';
3
+ /**
4
+ * @param context
5
+ * @param params - [`extrinsic`]
6
+ *
7
+ * @return Hash
8
+ */
9
+ export declare const author_submitExtrinsic: Handler<[HexString], HexString>;
10
+ /**
11
+ * @param context
12
+ * @param params - [`extrinsic`]
13
+ * @param subscriptionManager
14
+ *
15
+ * @return subscription id
16
+ */
17
+ export declare const author_submitAndWatchExtrinsic: Handler<[HexString], string>;
18
+ /**
19
+ * @param _context
20
+ * @param params - [`subid`]
21
+ */
22
+ export declare const author_unwatchExtrinsic: Handler<[string], void>;
23
+ /**
24
+ * Get pending extrinsics
25
+ *
26
+ * @return Array of pending extrinsics
27
+ */
28
+ export declare const author_pendingExtrinsics: Handler<void, HexString[]>;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.author_pendingExtrinsics = exports.author_unwatchExtrinsic = exports.author_submitAndWatchExtrinsic = exports.author_submitExtrinsic = void 0;
13
+ const txpool_1 = require("../../blockchain/txpool");
14
+ const shared_1 = require("../shared");
15
+ const logger_1 = require("../../logger");
16
+ const logger = logger_1.defaultLogger.child({ name: 'rpc-author' });
17
+ /**
18
+ * @param context
19
+ * @param params - [`extrinsic`]
20
+ *
21
+ * @return Hash
22
+ */
23
+ const author_submitExtrinsic = (context, [extrinsic]) => __awaiter(void 0, void 0, void 0, function* () {
24
+ return context.chain.submitExtrinsic(extrinsic).catch((error) => {
25
+ const code = error.isInvalid ? 1010 : 1011;
26
+ throw new shared_1.ResponseError(code, error.toString());
27
+ });
28
+ });
29
+ exports.author_submitExtrinsic = author_submitExtrinsic;
30
+ /**
31
+ * @param context
32
+ * @param params - [`extrinsic`]
33
+ * @param subscriptionManager
34
+ *
35
+ * @return subscription id
36
+ */
37
+ const author_submitAndWatchExtrinsic = (context, [extrinsic], { subscribe, unsubscribe }) => __awaiter(void 0, void 0, void 0, function* () {
38
+ let update = (_block) => { };
39
+ const id = context.chain.headState.subscribeHead((block) => update(block));
40
+ const callback = subscribe('author_extrinsicUpdate', id, () => context.chain.headState.unsubscribeHead(id));
41
+ const onExtrinsicFail = ([failedExtrinsic, error]) => {
42
+ if (failedExtrinsic === extrinsic) {
43
+ callback(error.toJSON());
44
+ done(id);
45
+ }
46
+ };
47
+ context.chain.txPool.event.on(txpool_1.APPLY_EXTRINSIC_ERROR, onExtrinsicFail);
48
+ const done = (id) => {
49
+ context.chain.txPool.event.removeListener(txpool_1.APPLY_EXTRINSIC_ERROR, onExtrinsicFail);
50
+ unsubscribe(id);
51
+ };
52
+ update = (block) => __awaiter(void 0, void 0, void 0, function* () {
53
+ const extrisnics = yield block.extrinsics;
54
+ if (!extrisnics.includes(extrinsic))
55
+ return;
56
+ logger.debug({ block: block.hash }, 'author_extrinsicUpdate');
57
+ callback({
58
+ inBlock: block.hash,
59
+ });
60
+ // wait a bit for InBlock to be sent
61
+ yield new Promise((r) => setTimeout(r, 100));
62
+ callback({
63
+ finalized: block.hash,
64
+ });
65
+ done(id);
66
+ });
67
+ try {
68
+ yield context.chain.submitExtrinsic(extrinsic);
69
+ callback({
70
+ ready: null,
71
+ });
72
+ }
73
+ catch (error) {
74
+ logger.error({ error }, 'ExtrinsicFailed');
75
+ const code = error.isInvalid ? 1010 : 1011;
76
+ done(id);
77
+ throw new shared_1.ResponseError(code, error.toString());
78
+ }
79
+ return id;
80
+ });
81
+ exports.author_submitAndWatchExtrinsic = author_submitAndWatchExtrinsic;
82
+ /**
83
+ * @param _context
84
+ * @param params - [`subid`]
85
+ */
86
+ const author_unwatchExtrinsic = (_context, [subid], { unsubscribe }) => __awaiter(void 0, void 0, void 0, function* () {
87
+ unsubscribe(subid);
88
+ });
89
+ exports.author_unwatchExtrinsic = author_unwatchExtrinsic;
90
+ /**
91
+ * Get pending extrinsics
92
+ *
93
+ * @return Array of pending extrinsics
94
+ */
95
+ const author_pendingExtrinsics = (context) => __awaiter(void 0, void 0, void 0, function* () {
96
+ return context.chain.txPool.pendingExtrinsics;
97
+ });
98
+ exports.author_pendingExtrinsics = author_pendingExtrinsics;
@@ -0,0 +1,45 @@
1
+ import { Header } from '@polkadot/types/interfaces';
2
+ import { HexString } from '@polkadot/util/types';
3
+ import { Handler } from '../shared';
4
+ /**
5
+ * @param context
6
+ * @param params - [`blockNumber` | `blockNumber[]` | null]
7
+ *
8
+ * @return Block hash | hash[] | null
9
+ */
10
+ export declare const chain_getBlockHash: Handler<[number | number[] | null], HexString | (HexString | null)[] | null>;
11
+ /**
12
+ * @param context
13
+ * @param params - [`blockhash`]
14
+ *
15
+ * @return Header - see `@polkadot/types/interfaces`
16
+ */
17
+ export declare const chain_getHeader: Handler<[HexString], Header>;
18
+ /**
19
+ * @param context
20
+ * @param params - [`blockhash`]
21
+ *
22
+ * @return Block header and extrinsics
23
+ */
24
+ export declare const chain_getBlock: Handler<[
25
+ HexString
26
+ ], {
27
+ block: {
28
+ header: Header;
29
+ extrinsics: HexString[];
30
+ };
31
+ justifications: null;
32
+ }>;
33
+ /**
34
+ * @param context
35
+ *
36
+ * @return head hash
37
+ */
38
+ export declare const chain_getFinalizedHead: Handler<void, HexString>;
39
+ export declare const chain_subscribeNewHead: Handler<void, string>;
40
+ export declare const chain_subscribeFinalizedHeads: Handler<void, string>;
41
+ export declare const chain_unsubscribeNewHead: Handler<[string], void>;
42
+ export declare const chain_getHead: Handler<[number | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
43
+ export declare const chain_subscribeNewHeads: Handler<void, string>;
44
+ export declare const chain_unsubscribeNewHeads: Handler<[string], void>;
45
+ export declare const chain_unsubscribeFinalizedHeads: Handler<[string], void>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.chain_unsubscribeFinalizedHeads = exports.chain_unsubscribeNewHeads = exports.chain_subscribeNewHeads = exports.chain_getHead = exports.chain_unsubscribeNewHead = exports.chain_subscribeFinalizedHeads = exports.chain_subscribeNewHead = exports.chain_getFinalizedHead = exports.chain_getBlock = exports.chain_getHeader = exports.chain_getBlockHash = void 0;
13
+ const shared_1 = require("../shared");
14
+ const processHeader = (header) => {
15
+ const res = header.toJSON();
16
+ res.number = '0x' + res.number.toString(16); // number is hex format
17
+ return res;
18
+ };
19
+ /**
20
+ * @param context
21
+ * @param params - [`blockNumber` | `blockNumber[]` | null]
22
+ *
23
+ * @return Block hash | hash[] | null
24
+ */
25
+ const chain_getBlockHash = (context, [blockNumber]) => __awaiter(void 0, void 0, void 0, function* () {
26
+ const numbers = Array.isArray(blockNumber) ? blockNumber : [blockNumber];
27
+ const hashes = yield Promise.all(numbers.map((n) => context.chain.getBlockAt(n))).then((blocks) => blocks.map((b) => (b === null || b === void 0 ? void 0 : b.hash) || null));
28
+ return Array.isArray(blockNumber) ? hashes : hashes[0];
29
+ });
30
+ exports.chain_getBlockHash = chain_getBlockHash;
31
+ /**
32
+ * @param context
33
+ * @param params - [`blockhash`]
34
+ *
35
+ * @return Header - see `@polkadot/types/interfaces`
36
+ */
37
+ const chain_getHeader = (context, [hash]) => __awaiter(void 0, void 0, void 0, function* () {
38
+ const block = yield context.chain.getBlock(hash);
39
+ if (!block) {
40
+ throw new shared_1.ResponseError(1, `Block ${hash} not found`);
41
+ }
42
+ return processHeader(yield block.header);
43
+ });
44
+ exports.chain_getHeader = chain_getHeader;
45
+ /**
46
+ * @param context
47
+ * @param params - [`blockhash`]
48
+ *
49
+ * @return Block header and extrinsics
50
+ */
51
+ const chain_getBlock = (context, [hash]) => __awaiter(void 0, void 0, void 0, function* () {
52
+ const block = yield context.chain.getBlock(hash);
53
+ if (!block) {
54
+ throw new shared_1.ResponseError(1, `Block ${hash} not found`);
55
+ }
56
+ return {
57
+ block: {
58
+ header: yield block.header,
59
+ extrinsics: yield block.extrinsics,
60
+ },
61
+ justifications: null,
62
+ };
63
+ });
64
+ exports.chain_getBlock = chain_getBlock;
65
+ /**
66
+ * @param context
67
+ *
68
+ * @return head hash
69
+ */
70
+ const chain_getFinalizedHead = (context) => __awaiter(void 0, void 0, void 0, function* () {
71
+ return context.chain.head.hash;
72
+ });
73
+ exports.chain_getFinalizedHead = chain_getFinalizedHead;
74
+ const chain_subscribeNewHead = (context, _params, { subscribe }) => __awaiter(void 0, void 0, void 0, function* () {
75
+ let update = () => { };
76
+ const id = context.chain.headState.subscribeHead(() => update());
77
+ const callback = subscribe('chain_newHead', id, () => context.chain.headState.unsubscribeHead(id));
78
+ update = () => __awaiter(void 0, void 0, void 0, function* () {
79
+ callback(processHeader(yield context.chain.head.header));
80
+ });
81
+ update();
82
+ return id;
83
+ });
84
+ exports.chain_subscribeNewHead = chain_subscribeNewHead;
85
+ const chain_subscribeFinalizedHeads = (context, _params, { subscribe }) => __awaiter(void 0, void 0, void 0, function* () {
86
+ let update = () => { };
87
+ const id = context.chain.headState.subscribeHead(() => update());
88
+ const callback = subscribe('chain_finalizedHead', id, () => context.chain.headState.unsubscribeHead(id));
89
+ update = () => __awaiter(void 0, void 0, void 0, function* () {
90
+ callback(processHeader(yield context.chain.head.header));
91
+ });
92
+ update();
93
+ return id;
94
+ });
95
+ exports.chain_subscribeFinalizedHeads = chain_subscribeFinalizedHeads;
96
+ const chain_unsubscribeNewHead = (_context, [subid], { unsubscribe }) => __awaiter(void 0, void 0, void 0, function* () {
97
+ unsubscribe(subid);
98
+ });
99
+ exports.chain_unsubscribeNewHead = chain_unsubscribeNewHead;
100
+ exports.chain_getHead = exports.chain_getBlockHash;
101
+ exports.chain_subscribeNewHeads = exports.chain_subscribeNewHead;
102
+ exports.chain_unsubscribeNewHeads = exports.chain_unsubscribeNewHead;
103
+ exports.chain_unsubscribeFinalizedHeads = exports.chain_unsubscribeNewHead;
@@ -0,0 +1,66 @@
1
+ import * as AuthorRPC from './author';
2
+ import * as ChainRPC from './chain';
3
+ import * as PaymentRPC from './payment';
4
+ import * as StateRPC from './state';
5
+ import * as SystemRPC from './system';
6
+ export { AuthorRPC };
7
+ export { ChainRPC };
8
+ export { PaymentRPC };
9
+ export { StateRPC };
10
+ export { SystemRPC };
11
+ declare const handlers: {
12
+ system_localPeerId: () => Promise<string>;
13
+ system_nodeRoles: () => Promise<string[]>;
14
+ system_localListenAddresses: () => Promise<never[]>;
15
+ system_chain: import("..").Handler<void, string>;
16
+ system_properties: import("..").Handler<void, import("../..").ChainProperties>;
17
+ system_name: import("..").Handler<void, string>;
18
+ system_version: import("..").Handler<void, string>;
19
+ system_chainType: import("..").Handler<void, string>;
20
+ system_health: () => Promise<{
21
+ peers: number;
22
+ isSyncing: boolean;
23
+ shouldHavePeers: boolean;
24
+ }>;
25
+ system_dryRun: import("..").Handler<[`0x${string}`, `0x${string}`], string>;
26
+ system_accountNextIndex: import("..").Handler<[`0x${string}`], number>;
27
+ state_getRuntimeVersion: import("..").Handler<[`0x${string}`], import("../..").RuntimeVersion | undefined>;
28
+ state_getMetadata: import("..").Handler<[`0x${string}`], `0x${string}` | undefined>;
29
+ state_getStorage: import("..").Handler<[`0x${string}`, `0x${string}`], string | undefined>;
30
+ state_getKeysPaged: import("..").Handler<[string, number, string, `0x${string}`], string[] | undefined>;
31
+ state_queryStorageAt: import("..").Handler<[string[], `0x${string}`], [] | [{
32
+ block: `0x${string}`;
33
+ changes: (string | undefined)[][];
34
+ }]>;
35
+ state_call: import("..").Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
36
+ state_subscribeRuntimeVersion: import("..").Handler<[], string>;
37
+ state_unsubscribeRuntimeVersion: import("..").Handler<[`0x${string}`], void>;
38
+ state_subscribeStorage: import("..").Handler<[string[]], string>;
39
+ state_unsubscribeStorage: import("..").Handler<[string], void>;
40
+ childstate_getStorage: import("..").Handler<[`0x${string}`, `0x${string}`, `0x${string}`], string | undefined>;
41
+ childstate_getKeysPaged: import("..").Handler<[`0x${string}`, `0x${string}`, number, `0x${string}`, `0x${string}`], `0x${string}`[] | undefined>;
42
+ payment_queryFeeDetails: import("..").Handler<[`0x${string}`, `0x${string}`], `0x${string}`>;
43
+ payment_queryInfo: import("..").Handler<[`0x${string}`, `0x${string}`], `0x${string}`>;
44
+ chain_getBlockHash: import("..").Handler<[number | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
45
+ chain_getHeader: import("..").Handler<[`0x${string}`], import("@polkadot/types/interfaces").Header>;
46
+ chain_getBlock: import("..").Handler<[`0x${string}`], {
47
+ block: {
48
+ header: import("@polkadot/types/interfaces").Header;
49
+ extrinsics: `0x${string}`[];
50
+ };
51
+ justifications: null;
52
+ }>;
53
+ chain_getFinalizedHead: import("..").Handler<void, `0x${string}`>;
54
+ chain_subscribeNewHead: import("..").Handler<void, string>;
55
+ chain_subscribeFinalizedHeads: import("..").Handler<void, string>;
56
+ chain_unsubscribeNewHead: import("..").Handler<[string], void>;
57
+ chain_getHead: import("..").Handler<[number | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
58
+ chain_subscribeNewHeads: import("..").Handler<void, string>;
59
+ chain_unsubscribeNewHeads: import("..").Handler<[string], void>;
60
+ chain_unsubscribeFinalizedHeads: import("..").Handler<[string], void>;
61
+ author_submitExtrinsic: import("..").Handler<[`0x${string}`], `0x${string}`>;
62
+ author_submitAndWatchExtrinsic: import("..").Handler<[`0x${string}`], string>;
63
+ author_unwatchExtrinsic: import("..").Handler<[string], void>;
64
+ author_pendingExtrinsics: import("..").Handler<void, `0x${string}`[]>;
65
+ };
66
+ export default handlers;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.SystemRPC = exports.StateRPC = exports.PaymentRPC = exports.ChainRPC = exports.AuthorRPC = void 0;
27
+ const AuthorRPC = __importStar(require("./author"));
28
+ exports.AuthorRPC = AuthorRPC;
29
+ const ChainRPC = __importStar(require("./chain"));
30
+ exports.ChainRPC = ChainRPC;
31
+ const PaymentRPC = __importStar(require("./payment"));
32
+ exports.PaymentRPC = PaymentRPC;
33
+ const StateRPC = __importStar(require("./state"));
34
+ exports.StateRPC = StateRPC;
35
+ const SystemRPC = __importStar(require("./system"));
36
+ exports.SystemRPC = SystemRPC;
37
+ const handlers = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, AuthorRPC), ChainRPC), PaymentRPC), StateRPC), SystemRPC);
38
+ exports.default = handlers;
@@ -0,0 +1,16 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { Handler } from '../shared';
3
+ /**
4
+ * @param context
5
+ * @param params - [`extrinsic`, `blockhash`]
6
+ *
7
+ * @return result in hash
8
+ */
9
+ export declare const payment_queryFeeDetails: Handler<[HexString, HexString], HexString>;
10
+ /**
11
+ * @param context
12
+ * @param params - [`extrinsic`, `blockhash`]
13
+ *
14
+ * @return result in hash
15
+ */
16
+ export declare const payment_queryInfo: Handler<[HexString, HexString], HexString>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.payment_queryInfo = exports.payment_queryFeeDetails = void 0;
13
+ const util_1 = require("@polkadot/util");
14
+ const shared_1 = require("../shared");
15
+ /**
16
+ * @param context
17
+ * @param params - [`extrinsic`, `blockhash`]
18
+ *
19
+ * @return result in hash
20
+ */
21
+ const payment_queryFeeDetails = (context, [extrinsic, hash]) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const block = yield context.chain.getBlock(hash);
23
+ if (!block) {
24
+ throw new shared_1.ResponseError(1, `Block ${hash} not found`);
25
+ }
26
+ const registry = yield block.registry;
27
+ const tx = (0, util_1.hexToU8a)(extrinsic);
28
+ const resp = yield block.call('TransactionPaymentApi_query_fee_details', [
29
+ registry.createType('Extrinsic', tx).toHex(),
30
+ registry.createType('u32', tx.byteLength).toHex(),
31
+ ]);
32
+ return resp.result;
33
+ });
34
+ exports.payment_queryFeeDetails = payment_queryFeeDetails;
35
+ /**
36
+ * @param context
37
+ * @param params - [`extrinsic`, `blockhash`]
38
+ *
39
+ * @return result in hash
40
+ */
41
+ const payment_queryInfo = (context, [extrinsic, hash]) => __awaiter(void 0, void 0, void 0, function* () {
42
+ const block = yield context.chain.getBlock(hash);
43
+ if (!block) {
44
+ throw new shared_1.ResponseError(1, `Block ${hash} not found`);
45
+ }
46
+ const registry = yield block.registry;
47
+ const tx = (0, util_1.hexToU8a)(extrinsic);
48
+ const resp = yield block.call('TransactionPaymentApi_query_info', [
49
+ registry.createType('Extrinsic', tx).toHex(),
50
+ registry.createType('u32', tx.byteLength).toHex(),
51
+ ]);
52
+ return resp.result;
53
+ });
54
+ exports.payment_queryInfo = payment_queryInfo;
@@ -0,0 +1,97 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { Handler } from '../shared';
3
+ import { RuntimeVersion } from '../../wasm-executor';
4
+ /**
5
+ * @param context
6
+ * @param params - [`blockhash`]
7
+ *
8
+ * @return runtime version
9
+ */
10
+ export declare const state_getRuntimeVersion: Handler<[HexString], RuntimeVersion | undefined>;
11
+ /**
12
+ * @param context
13
+ * @param params - [`blockhash`]
14
+ *
15
+ * @return metadata
16
+ */
17
+ export declare const state_getMetadata: Handler<[HexString], HexString | undefined>;
18
+ /**
19
+ * @param context
20
+ * @param params - [`key`, `blockhash`]
21
+ *
22
+ * @return storage value
23
+ */
24
+ export declare const state_getStorage: Handler<[HexString, HexString], string | undefined>;
25
+ /**
26
+ * @param context
27
+ * @param params - [`prefix`, `pageSize`, `startKey`, `blockhash`]
28
+ *
29
+ * @return paged keys
30
+ */
31
+ export declare const state_getKeysPaged: Handler<[string, number, string, HexString], string[] | undefined>;
32
+ /**
33
+ * @param context
34
+ * @param params - [`keys`, `blockhash`]
35
+ *
36
+ * @return storage values
37
+ */
38
+ export declare const state_queryStorageAt: Handler<[
39
+ string[],
40
+ HexString
41
+ ], [] | [
42
+ {
43
+ block: HexString;
44
+ changes: (string | undefined)[][];
45
+ }
46
+ ]>;
47
+ /**
48
+ * @param context
49
+ * @param params - [`method`, `data`, `blockhash`]
50
+ *
51
+ * @return result in hash
52
+ */
53
+ export declare const state_call: Handler<[HexString, HexString, HexString], HexString>;
54
+ /**
55
+ * @return subscription id
56
+ */
57
+ export declare const state_subscribeRuntimeVersion: Handler<[], string>;
58
+ /**
59
+ * @param context
60
+ * @param params - [`subid`]
61
+ * @param subscriptionManager
62
+ */
63
+ export declare const state_unsubscribeRuntimeVersion: Handler<[HexString], void>;
64
+ /**
65
+ * @param context
66
+ * @param params - [`keys`]
67
+ * @param subscriptionManager
68
+ *
69
+ * @return subscription id
70
+ */
71
+ export declare const state_subscribeStorage: Handler<[string[]], string>;
72
+ /**
73
+ * @param context
74
+ * @param params - [`subid`]
75
+ * @param subscriptionManager
76
+ */
77
+ export declare const state_unsubscribeStorage: Handler<[string], void>;
78
+ /**
79
+ * @param context
80
+ * @param params - [`child`, `key`, `blockhash`]
81
+ *
82
+ * @return storage valuse
83
+ */
84
+ export declare const childstate_getStorage: Handler<[HexString, HexString, HexString], string | undefined>;
85
+ /**
86
+ * @param context
87
+ * @param params - [`child`, `prefix`, `pageSize`, `startKey`, `blockhash`]
88
+ *
89
+ * @return paged keys
90
+ */
91
+ export declare const childstate_getKeysPaged: Handler<[
92
+ HexString,
93
+ HexString,
94
+ number,
95
+ HexString,
96
+ HexString
97
+ ], HexString[] | undefined>;