@acala-network/chopsticks 0.9.9-1 → 0.9.9-2

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 (59) hide show
  1. package/dist/cjs/plugins/types.d.ts +0 -7
  2. package/dist/cjs/plugins/types.js +3 -27
  3. package/dist/cjs/rpc/index.js +2 -2
  4. package/dist/cjs/types.d.ts +1 -0
  5. package/dist/cjs/types.js +48 -0
  6. package/dist/esm/plugins/types.d.ts +0 -7
  7. package/dist/esm/plugins/types.js +0 -6
  8. package/dist/esm/rpc/index.js +3 -3
  9. package/dist/esm/types.d.ts +1 -0
  10. package/dist/esm/types.js +1 -0
  11. package/package.json +3 -3
  12. package/dist/cjs/plugins/new-block/index.d.ts +0 -1
  13. package/dist/cjs/plugins/new-block/index.js +0 -18
  14. package/dist/cjs/plugins/new-block/rpc.d.ts +0 -128
  15. package/dist/cjs/plugins/new-block/rpc.js +0 -58
  16. package/dist/cjs/plugins/set-block-build-mode/index.d.ts +0 -1
  17. package/dist/cjs/plugins/set-block-build-mode/index.js +0 -18
  18. package/dist/cjs/plugins/set-block-build-mode/rpc.d.ts +0 -20
  19. package/dist/cjs/plugins/set-block-build-mode/rpc.js +0 -21
  20. package/dist/cjs/plugins/set-head/index.d.ts +0 -1
  21. package/dist/cjs/plugins/set-head/index.js +0 -18
  22. package/dist/cjs/plugins/set-head/rpc.d.ts +0 -21
  23. package/dist/cjs/plugins/set-head/rpc.js +0 -29
  24. package/dist/cjs/plugins/set-runtime-log-level/index.d.ts +0 -1
  25. package/dist/cjs/plugins/set-runtime-log-level/index.js +0 -18
  26. package/dist/cjs/plugins/set-runtime-log-level/rpc.d.ts +0 -17
  27. package/dist/cjs/plugins/set-runtime-log-level/rpc.js +0 -21
  28. package/dist/cjs/plugins/set-storage/index.d.ts +0 -1
  29. package/dist/cjs/plugins/set-storage/index.js +0 -18
  30. package/dist/cjs/plugins/set-storage/rpc.d.ts +0 -28
  31. package/dist/cjs/plugins/set-storage/rpc.js +0 -23
  32. package/dist/cjs/plugins/time-travel/index.d.ts +0 -1
  33. package/dist/cjs/plugins/time-travel/index.js +0 -18
  34. package/dist/cjs/plugins/time-travel/rpc.d.ts +0 -17
  35. package/dist/cjs/plugins/time-travel/rpc.js +0 -17
  36. package/dist/esm/plugins/new-block/index.d.ts +0 -1
  37. package/dist/esm/plugins/new-block/index.js +0 -1
  38. package/dist/esm/plugins/new-block/rpc.d.ts +0 -128
  39. package/dist/esm/plugins/new-block/rpc.js +0 -85
  40. package/dist/esm/plugins/set-block-build-mode/index.d.ts +0 -1
  41. package/dist/esm/plugins/set-block-build-mode/index.js +0 -1
  42. package/dist/esm/plugins/set-block-build-mode/rpc.d.ts +0 -20
  43. package/dist/esm/plugins/set-block-build-mode/rpc.js +0 -28
  44. package/dist/esm/plugins/set-head/index.d.ts +0 -1
  45. package/dist/esm/plugins/set-head/index.js +0 -1
  46. package/dist/esm/plugins/set-head/rpc.d.ts +0 -21
  47. package/dist/esm/plugins/set-head/rpc.js +0 -33
  48. package/dist/esm/plugins/set-runtime-log-level/index.d.ts +0 -1
  49. package/dist/esm/plugins/set-runtime-log-level/index.js +0 -1
  50. package/dist/esm/plugins/set-runtime-log-level/rpc.d.ts +0 -17
  51. package/dist/esm/plugins/set-runtime-log-level/rpc.js +0 -25
  52. package/dist/esm/plugins/set-storage/index.d.ts +0 -1
  53. package/dist/esm/plugins/set-storage/index.js +0 -1
  54. package/dist/esm/plugins/set-storage/rpc.d.ts +0 -28
  55. package/dist/esm/plugins/set-storage/rpc.js +0 -37
  56. package/dist/esm/plugins/time-travel/index.d.ts +0 -1
  57. package/dist/esm/plugins/time-travel/index.js +0 -1
  58. package/dist/esm/plugins/time-travel/rpc.d.ts +0 -17
  59. package/dist/esm/plugins/time-travel/rpc.js +0 -21
@@ -1,11 +1,4 @@
1
- export { rpc as newBlock } from './new-block/index.js';
2
1
  export { rpc as dryRun } from './dry-run/index.js';
3
- export { rpc as setBlockBuildMode } from './set-block-build-mode/index.js';
4
- export { rpc as setHead } from './set-head/index.js';
5
- export { rpc as setRuntimeLogLevel } from './set-runtime-log-level/index.js';
6
- export { rpc as setStorage } from './set-storage/index.js';
7
- export { rpc as timeTravel } from './time-travel/index.js';
8
2
  export { rpc as runBlock } from './run-block/index.js';
9
- export type { NewBlockParams } from './new-block/index.js';
10
3
  export type { DryRunParams } from './dry-run/index.js';
11
4
  export type { RunBlockParams } from './run-block/index.js';
@@ -10,35 +10,11 @@ function _export(target, all) {
10
10
  }
11
11
  _export(exports, {
12
12
  dryRun: function() {
13
- return _index1.rpc;
14
- },
15
- newBlock: function() {
16
13
  return _index.rpc;
17
14
  },
18
15
  runBlock: function() {
19
- return _index7.rpc;
20
- },
21
- setBlockBuildMode: function() {
22
- return _index2.rpc;
23
- },
24
- setHead: function() {
25
- return _index3.rpc;
26
- },
27
- setRuntimeLogLevel: function() {
28
- return _index4.rpc;
29
- },
30
- setStorage: function() {
31
- return _index5.rpc;
32
- },
33
- timeTravel: function() {
34
- return _index6.rpc;
16
+ return _index1.rpc;
35
17
  }
36
18
  });
37
- const _index = require("./new-block/index.js");
38
- const _index1 = require("./dry-run/index.js");
39
- const _index2 = require("./set-block-build-mode/index.js");
40
- const _index3 = require("./set-head/index.js");
41
- const _index4 = require("./set-runtime-log-level/index.js");
42
- const _index5 = require("./set-storage/index.js");
43
- const _index6 = require("./time-travel/index.js");
44
- const _index7 = require("./run-block/index.js");
19
+ const _index = require("./dry-run/index.js");
20
+ const _index1 = require("./run-block/index.js");
@@ -14,13 +14,13 @@ const rpcLogger = _chopstickscore.defaultLogger.child({
14
14
  name: 'rpc'
15
15
  });
16
16
  const allHandlers = {
17
- ..._chopstickscore.substrate,
17
+ ..._chopstickscore.allHandlers,
18
18
  rpc_methods: async ()=>Promise.resolve({
19
19
  version: 1,
20
20
  methods: [
21
21
  ...Object.keys(allHandlers),
22
22
  ..._index.rpcPluginMethods
23
- ]
23
+ ].sort()
24
24
  })
25
25
  };
26
26
  const getHandler = async (method)=>{
@@ -12,4 +12,5 @@
12
12
  */
13
13
  export type { ChainProperties, RuntimeVersion, Context, SubscriptionManager, Handler, } from '@acala-network/chopsticks-core';
14
14
  export * from '@acala-network/chopsticks-core/rpc/substrate/index.js';
15
+ export * as DevRPC from '@acala-network/chopsticks-core/rpc/dev/index.js';
15
16
  export * from './plugins/types.js';
package/dist/cjs/types.js CHANGED
@@ -13,7 +13,14 @@
13
13
  Object.defineProperty(exports, "__esModule", {
14
14
  value: true
15
15
  });
16
+ Object.defineProperty(exports, "DevRPC", {
17
+ enumerable: true,
18
+ get: function() {
19
+ return _index;
20
+ }
21
+ });
16
22
  _export_star(require("@acala-network/chopsticks-core/rpc/substrate/index.js"), exports);
23
+ const _index = /*#__PURE__*/ _interop_require_wildcard(require("@acala-network/chopsticks-core/rpc/dev/index.js"));
17
24
  _export_star(require("./plugins/types.js"), exports);
18
25
  function _export_star(from, to) {
19
26
  Object.keys(from).forEach(function(k) {
@@ -28,3 +35,44 @@ function _export_star(from, to) {
28
35
  });
29
36
  return from;
30
37
  }
38
+ function _getRequireWildcardCache(nodeInterop) {
39
+ if (typeof WeakMap !== "function") return null;
40
+ var cacheBabelInterop = new WeakMap();
41
+ var cacheNodeInterop = new WeakMap();
42
+ return (_getRequireWildcardCache = function(nodeInterop) {
43
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
44
+ })(nodeInterop);
45
+ }
46
+ function _interop_require_wildcard(obj, nodeInterop) {
47
+ if (!nodeInterop && obj && obj.__esModule) {
48
+ return obj;
49
+ }
50
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
51
+ return {
52
+ default: obj
53
+ };
54
+ }
55
+ var cache = _getRequireWildcardCache(nodeInterop);
56
+ if (cache && cache.has(obj)) {
57
+ return cache.get(obj);
58
+ }
59
+ var newObj = {
60
+ __proto__: null
61
+ };
62
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
63
+ for(var key in obj){
64
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
65
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
66
+ if (desc && (desc.get || desc.set)) {
67
+ Object.defineProperty(newObj, key, desc);
68
+ } else {
69
+ newObj[key] = obj[key];
70
+ }
71
+ }
72
+ }
73
+ newObj.default = obj;
74
+ if (cache) {
75
+ cache.set(obj, newObj);
76
+ }
77
+ return newObj;
78
+ }
@@ -1,11 +1,4 @@
1
- export { rpc as newBlock } from './new-block/index.js';
2
1
  export { rpc as dryRun } from './dry-run/index.js';
3
- export { rpc as setBlockBuildMode } from './set-block-build-mode/index.js';
4
- export { rpc as setHead } from './set-head/index.js';
5
- export { rpc as setRuntimeLogLevel } from './set-runtime-log-level/index.js';
6
- export { rpc as setStorage } from './set-storage/index.js';
7
- export { rpc as timeTravel } from './time-travel/index.js';
8
2
  export { rpc as runBlock } from './run-block/index.js';
9
- export type { NewBlockParams } from './new-block/index.js';
10
3
  export type { DryRunParams } from './dry-run/index.js';
11
4
  export type { RunBlockParams } from './run-block/index.js';
@@ -1,8 +1,2 @@
1
- export { rpc as newBlock } from './new-block/index.js';
2
1
  export { rpc as dryRun } from './dry-run/index.js';
3
- export { rpc as setBlockBuildMode } from './set-block-build-mode/index.js';
4
- export { rpc as setHead } from './set-head/index.js';
5
- export { rpc as setRuntimeLogLevel } from './set-runtime-log-level/index.js';
6
- export { rpc as setStorage } from './set-storage/index.js';
7
- export { rpc as timeTravel } from './time-travel/index.js';
8
2
  export { rpc as runBlock } from './run-block/index.js';
@@ -1,16 +1,16 @@
1
- import { ResponseError, defaultLogger, substrate } from '@acala-network/chopsticks-core';
1
+ import { ResponseError, allHandlers as coreHandlers, defaultLogger } from '@acala-network/chopsticks-core';
2
2
  import { loadRpcPlugin, rpcPluginMethods } from '../plugins/index.js';
3
3
  const rpcLogger = defaultLogger.child({
4
4
  name: 'rpc'
5
5
  });
6
6
  const allHandlers = {
7
- ...substrate,
7
+ ...coreHandlers,
8
8
  rpc_methods: async ()=>Promise.resolve({
9
9
  version: 1,
10
10
  methods: [
11
11
  ...Object.keys(allHandlers),
12
12
  ...rpcPluginMethods
13
- ]
13
+ ].sort()
14
14
  })
15
15
  };
16
16
  const getHandler = async (method)=>{
@@ -12,4 +12,5 @@
12
12
  */
13
13
  export type { ChainProperties, RuntimeVersion, Context, SubscriptionManager, Handler, } from '@acala-network/chopsticks-core';
14
14
  export * from '@acala-network/chopsticks-core/rpc/substrate/index.js';
15
+ export * as DevRPC from '@acala-network/chopsticks-core/rpc/dev/index.js';
15
16
  export * from './plugins/types.js';
package/dist/esm/types.js CHANGED
@@ -10,4 +10,5 @@
10
10
  *
11
11
  * @packageDocumentation
12
12
  */ export * from '@acala-network/chopsticks-core/rpc/substrate/index.js';
13
+ export * as DevRPC from '@acala-network/chopsticks-core/rpc/dev/index.js';
13
14
  export * from './plugins/types.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks",
3
- "version": "0.9.9-1",
3
+ "version": "0.9.9-2",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "bin": "./chopsticks.cjs",
@@ -13,8 +13,8 @@
13
13
  "docs:prep": "typedoc"
14
14
  },
15
15
  "dependencies": {
16
- "@acala-network/chopsticks-core": "0.9.9-1",
17
- "@acala-network/chopsticks-db": "0.9.9-1",
16
+ "@acala-network/chopsticks-core": "0.9.9-2",
17
+ "@acala-network/chopsticks-db": "0.9.9-2",
18
18
  "@pnpm/npm-conf": "^2.2.2",
19
19
  "@polkadot/api-augment": "^10.11.2",
20
20
  "@polkadot/types": "^10.11.2",
@@ -1 +0,0 @@
1
- export * from './rpc.js';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./rpc.js"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
@@ -1,128 +0,0 @@
1
- import { Context } from '@acala-network/chopsticks-core';
2
- import { z } from 'zod';
3
- declare const schema: z.ZodObject<{
4
- count: z.ZodOptional<z.ZodNumber>;
5
- to: z.ZodOptional<z.ZodNumber>;
6
- dmp: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
- sentAt: z.ZodNumber;
8
- msg: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
9
- }, "strip", z.ZodTypeAny, {
10
- sentAt: number;
11
- msg: `0x${string}`;
12
- }, {
13
- sentAt: number;
14
- msg: `0x${string}`;
15
- }>, "many">>;
16
- ump: z.ZodOptional<z.ZodRecord<z.ZodNumber, z.ZodArray<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, "many">>>;
17
- hrmp: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodNumber, z.ZodString]>, z.ZodArray<z.ZodObject<{
18
- sentAt: z.ZodNumber;
19
- data: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
20
- }, "strip", z.ZodTypeAny, {
21
- data: `0x${string}`;
22
- sentAt: number;
23
- }, {
24
- data: `0x${string}`;
25
- sentAt: number;
26
- }>, "many">>>;
27
- transactions: z.ZodOptional<z.ZodArray<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, "many">>;
28
- unsafeBlockHeight: z.ZodOptional<z.ZodNumber>;
29
- }, "strip", z.ZodTypeAny, {
30
- count?: number | undefined;
31
- to?: number | undefined;
32
- dmp?: {
33
- sentAt: number;
34
- msg: `0x${string}`;
35
- }[] | undefined;
36
- ump?: Record<number, `0x${string}`[]> | undefined;
37
- hrmp?: Record<string | number, {
38
- data: `0x${string}`;
39
- sentAt: number;
40
- }[]> | undefined;
41
- transactions?: `0x${string}`[] | undefined;
42
- unsafeBlockHeight?: number | undefined;
43
- }, {
44
- count?: number | undefined;
45
- to?: number | undefined;
46
- dmp?: {
47
- sentAt: number;
48
- msg: `0x${string}`;
49
- }[] | undefined;
50
- ump?: Record<number, `0x${string}`[]> | undefined;
51
- hrmp?: Record<string | number, {
52
- data: `0x${string}`;
53
- sentAt: number;
54
- }[]> | undefined;
55
- transactions?: `0x${string}`[] | undefined;
56
- unsafeBlockHeight?: number | undefined;
57
- }>;
58
- type Params = z.infer<typeof schema>;
59
- export interface NewBlockParams {
60
- /**
61
- * The number of blocks to build
62
- */
63
- count: Params['count'];
64
- /**
65
- * The block number to build to
66
- */
67
- to: Params['to'];
68
- /**
69
- * The downward messages to include in the block
70
- */
71
- dmp: Params['dmp'];
72
- /**
73
- * The upward messages to include in the block
74
- */
75
- ump: Params['ump'];
76
- /**
77
- * The horizontal messages to include in the block
78
- */
79
- hrmp: Params['hrmp'];
80
- /**
81
- * The transactions to include in the block
82
- */
83
- transactions: Params['transactions'];
84
- /**
85
- * Build block using a specific block height (unsafe)
86
- */
87
- unsafeBlockHeight: Params['unsafeBlockHeight'];
88
- }
89
- /**
90
- * Build new blocks.
91
- *
92
- * This function is a dev rpc handler. Use `dev_newBlock` as the method name when calling it.
93
- *
94
- * @param context - The context object of the rpc handler
95
- * @param params - The parameters of the rpc handler
96
- *
97
- * @example Build 2 blocks
98
- * ```ts
99
- * import { WsProvider } from '@polkadot/rpc-provider'
100
- * const ws = new WsProvider(`ws://localhost:8000`)
101
- * await ws.send('dev_newBlock', [{ count: 2 }])
102
- * ```
103
- * @example Build a block with upward messages
104
- * ```ts
105
- * import { WsProvider } from '@polkadot/rpc-provider'
106
- * const ws = new WsProvider(`ws://localhost:8000`)
107
- * await ws.send('dev_newBlock', [
108
- * {
109
- * ump: {
110
- * // https://acala.subscan.io/xcm_message/polkadot-ff66f28818d0b74573e62db8317e354b253fbc80
111
- * 2000: [
112
- * '0x021000040000000007903fc4db080a130000000007903fc4db08000d010004000101009c4b11a0974cba4a395c94832fba812868a6cb0ba09e8519b3521093ea359905',
113
- * ],
114
- * }
115
- * }
116
- * ])
117
- * ```
118
- *
119
- * @example Build two blocks with unsafeBlockHeight
120
- * ```ts
121
- * import { WsProvider } from '@polkadot/rpc-provider'
122
- * const ws = new WsProvider(`ws://localhost:8000`)
123
- * // this will create two blocks with block height 100000001 and 100000002
124
- * await ws.send('dev_newBlock', [{ count: 2, unsafeBlockHeight: 100000001 }])
125
- * ```
126
- */
127
- export declare const rpc: (context: Context, [params]: [NewBlockParams]) => Promise<string | undefined>;
128
- export {};
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "rpc", {
6
- enumerable: true,
7
- get: function() {
8
- return rpc;
9
- }
10
- });
11
- const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _zod = require("zod");
13
- const _logger = require("../../logger.js");
14
- const _index = require("../../schema/index.js");
15
- const schema = _zod.z.object({
16
- count: _zod.z.number().optional(),
17
- to: _zod.z.number().optional(),
18
- dmp: _zod.z.array(_zod.z.object({
19
- sentAt: _zod.z.number(),
20
- msg: _index.zHex
21
- })).min(1).optional(),
22
- ump: _zod.z.record(_zod.z.number(), _zod.z.array(_index.zHex).min(1)).optional(),
23
- hrmp: _zod.z.record(_zod.z.union([
24
- _zod.z.number(),
25
- _zod.z.string()
26
- ]), _zod.z.array(_zod.z.object({
27
- sentAt: _zod.z.number(),
28
- data: _index.zHex
29
- })).min(1)).optional(),
30
- transactions: _zod.z.array(_index.zHex).min(1).optional(),
31
- unsafeBlockHeight: _zod.z.number().optional()
32
- });
33
- const rpc = async (context, [params])=>{
34
- const { count, to, hrmp, ump, dmp, transactions, unsafeBlockHeight } = schema.parse(params || {});
35
- const now = context.chain.head.number;
36
- const diff = to ? to - now : count;
37
- const finalCount = diff !== undefined ? Math.max(diff, 1) : 1;
38
- let finalHash;
39
- if (unsafeBlockHeight !== undefined && unsafeBlockHeight <= now) {
40
- throw new _chopstickscore.ResponseError(1, 'unsafeBlockHeight must be greater than current block height');
41
- }
42
- for(let i = 0; i < finalCount; i++){
43
- const block = await context.chain.newBlock({
44
- transactions,
45
- horizontalMessages: hrmp,
46
- upwardMessages: ump,
47
- downwardMessages: dmp,
48
- unsafeBlockHeight: i === 0 ? unsafeBlockHeight : undefined
49
- }).catch((error)=>{
50
- throw new _chopstickscore.ResponseError(1, error.toString());
51
- });
52
- _logger.defaultLogger.debug({
53
- hash: block.hash
54
- }, 'dev_newBlock');
55
- finalHash = block.hash;
56
- }
57
- return finalHash;
58
- };
@@ -1 +0,0 @@
1
- export * from './rpc.js';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./rpc.js"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
@@ -1,20 +0,0 @@
1
- import { BuildBlockMode, Context } from '@acala-network/chopsticks-core';
2
- /**
3
- * Set a build block mode. See [BuildBlockMode](../core/enums/BuildBlockMode).
4
- *
5
- * 1 - Batch, 2 - Instant, 3 - Manual
6
- *
7
- * This function is a dev rpc handler. Use `dev_setBlockBuildMode` as the method name when calling it.
8
- *
9
- * @param context - The context object of the rpc handler
10
- * @param params - The parameters of the rpc handler
11
- *
12
- * @example Set build block mode to instant
13
- * ```ts
14
- * import { WsProvider } from '@polkadot/rpc-provider'
15
- * import { BuildBlockMode } from '@acala-network/chopsticks-core'
16
- * const ws = new WsProvider(`ws://localhost:8000`)
17
- * await ws.send('dev_setBlockBuildMode', [BuildBlockMode.Instant])
18
- * ```
19
- */
20
- export declare const rpc: (context: Context, [mode]: [BuildBlockMode]) => Promise<void>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "rpc", {
6
- enumerable: true,
7
- get: function() {
8
- return rpc;
9
- }
10
- });
11
- const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _logger = require("../../logger.js");
13
- const rpc = async (context, [mode])=>{
14
- _logger.defaultLogger.debug({
15
- mode: _chopstickscore.BuildBlockMode[mode]
16
- }, 'dev_setBlockBuildMode');
17
- if (_chopstickscore.BuildBlockMode[mode] === undefined) {
18
- throw new _chopstickscore.ResponseError(1, `Invalid mode ${mode}`);
19
- }
20
- context.chain.txPool.mode = mode;
21
- };
@@ -1 +0,0 @@
1
- export * from './rpc.js';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./rpc.js"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
@@ -1,21 +0,0 @@
1
- import { Context } from '@acala-network/chopsticks-core';
2
- import { z } from 'zod';
3
- declare const schema: z.ZodUnion<[z.ZodIntersection<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>, z.ZodNumber]>;
4
- type Params = z.infer<typeof schema>;
5
- /**
6
- * Set head.
7
- *
8
- * This function is a dev rpc handler. Use `dev_setHead` as the method name when calling it.
9
- *
10
- * @param context - The context object of the rpc handler
11
- * @param hashOrNumber - The block hash or number to set as head
12
- *
13
- * @example Set head to block 1000000
14
- * ```ts
15
- * import { WsProvider } from '@polkadot/rpc-provider'
16
- * const ws = new WsProvider(`ws://localhost:8000`)
17
- * await ws.send('dev_setHead', [1000000])
18
- * ```
19
- */
20
- export declare const rpc: (context: Context, [params]: [Params]) => Promise<`0x${string}`>;
21
- export {};
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "rpc", {
6
- enumerable: true,
7
- get: function() {
8
- return rpc;
9
- }
10
- });
11
- const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _zod = require("zod");
13
- const _index = require("../../schema/index.js");
14
- const schema = _index.zHash.or(_zod.z.number());
15
- const rpc = async (context, [params])=>{
16
- const hashOrNumber = schema.parse(params);
17
- let block;
18
- if (typeof hashOrNumber === 'number') {
19
- const blockNumber = hashOrNumber > 0 ? hashOrNumber : context.chain.head.number + hashOrNumber;
20
- block = await context.chain.getBlockAt(blockNumber);
21
- } else {
22
- block = await context.chain.getBlock(hashOrNumber);
23
- }
24
- if (!block) {
25
- throw new _chopstickscore.ResponseError(1, `Block not found ${hashOrNumber}`);
26
- }
27
- await context.chain.setHead(block);
28
- return block.hash;
29
- };
@@ -1 +0,0 @@
1
- export * from './rpc.js';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./rpc.js"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
@@ -1,17 +0,0 @@
1
- import { Context } from '@acala-network/chopsticks-core';
2
- /**
3
- * Set runtime log level.
4
- *
5
- * This function is a dev rpc handler. Use `dev_setRuntimeLogLevel` as the method name when calling it.
6
- *
7
- * @param context - The context object of the rpc handler
8
- * @param runtimeLogLevel - The runtime log level to set
9
- *
10
- * @example Set runtime log level to 1
11
- * ```ts
12
- * import { WsProvider } from '@polkadot/rpc-provider'
13
- * const ws = new WsProvider(`ws://localhost:8000`)
14
- * await ws.send('dev_setRuntimeLogLevel', [1])
15
- * ```
16
- */
17
- export declare const rpc: (context: Context, [runtimeLogLevel]: [number]) => Promise<void>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "rpc", {
6
- enumerable: true,
7
- get: function() {
8
- return rpc;
9
- }
10
- });
11
- const _chopstickscore = require("@acala-network/chopsticks-core");
12
- const _logger = require("../../logger.js");
13
- const rpc = async (context, [runtimeLogLevel])=>{
14
- _logger.defaultLogger.debug({
15
- runtimeLogLevel
16
- }, 'dev_setRuntimeLogLevel');
17
- if (typeof runtimeLogLevel !== 'number') {
18
- throw new _chopstickscore.ResponseError(1, `Invalid runtimeLogLevel ${runtimeLogLevel}`);
19
- }
20
- context.chain.runtimeLogLevel = runtimeLogLevel;
21
- };
@@ -1 +0,0 @@
1
- export * from './rpc.js';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./rpc.js"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }