@acala-network/chopsticks 0.9.4-1 → 0.9.4-3

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 (91) hide show
  1. package/dist/cjs/plugins/run-block/__snapshots__/index.test.ts.snap +2995 -2629
  2. package/dist/{types → cjs}/plugins/run-block/rpc.d.ts +1 -0
  3. package/dist/cjs/plugins/run-block/rpc.js +3 -1
  4. package/dist/esm/cli-options.d.ts +40 -0
  5. package/dist/esm/cli.d.ts +1 -0
  6. package/dist/esm/context.d.ts +7 -0
  7. package/dist/esm/index.d.ts +4 -0
  8. package/dist/esm/logger.d.ts +1 -0
  9. package/dist/esm/plugins/decode-key/cli.d.ts +2 -0
  10. package/dist/esm/plugins/decode-key/index.d.ts +1 -0
  11. package/dist/esm/plugins/dry-run/cli.d.ts +2 -0
  12. package/dist/esm/plugins/dry-run/dry-run-extrinsic.d.ts +2 -0
  13. package/dist/esm/plugins/dry-run/dry-run-preimage.d.ts +2 -0
  14. package/dist/esm/plugins/dry-run/index.d.ts +2 -0
  15. package/dist/esm/plugins/dry-run/rpc.d.ts +139 -0
  16. package/dist/esm/plugins/follow-chain/cli.d.ts +2 -0
  17. package/dist/esm/plugins/follow-chain/index.d.ts +1 -0
  18. package/dist/esm/plugins/index.d.ts +6 -0
  19. package/dist/esm/plugins/new-block/index.d.ts +1 -0
  20. package/dist/esm/plugins/new-block/rpc.d.ts +128 -0
  21. package/dist/esm/plugins/run-block/__snapshots__/index.test.ts.snap +2995 -2629
  22. package/dist/esm/plugins/run-block/cli.d.ts +2 -0
  23. package/dist/esm/plugins/run-block/index.d.ts +2 -0
  24. package/dist/esm/plugins/run-block/rpc.d.ts +140 -0
  25. package/dist/esm/plugins/run-block/rpc.js +3 -1
  26. package/dist/esm/plugins/set-block-build-mode/index.d.ts +1 -0
  27. package/dist/esm/plugins/set-block-build-mode/rpc.d.ts +20 -0
  28. package/dist/esm/plugins/set-head/index.d.ts +1 -0
  29. package/dist/esm/plugins/set-head/rpc.d.ts +21 -0
  30. package/dist/esm/plugins/set-runtime-log-level/index.d.ts +1 -0
  31. package/dist/esm/plugins/set-runtime-log-level/rpc.d.ts +17 -0
  32. package/dist/esm/plugins/set-storage/index.d.ts +1 -0
  33. package/dist/esm/plugins/set-storage/rpc.d.ts +28 -0
  34. package/dist/esm/plugins/time-travel/index.d.ts +1 -0
  35. package/dist/esm/plugins/time-travel/rpc.d.ts +17 -0
  36. package/dist/esm/plugins/try-runtime/index.d.ts +2 -0
  37. package/dist/esm/plugins/types.d.ts +11 -0
  38. package/dist/esm/rpc/index.d.ts +5 -0
  39. package/dist/esm/schema/index.d.ts +140 -0
  40. package/dist/esm/server.d.ts +9 -0
  41. package/dist/esm/setup-with-server.d.ts +6 -0
  42. package/dist/esm/types.d.ts +15 -0
  43. package/dist/esm/utils/decoder.d.ts +7 -0
  44. package/dist/esm/utils/generate-html-diff.d.ts +4 -0
  45. package/dist/esm/utils/index.d.ts +4 -0
  46. package/dist/esm/utils/open-html.d.ts +1 -0
  47. package/dist/esm/utils/override.d.ts +4 -0
  48. package/dist/esm/utils/tunnel.d.ts +1 -0
  49. package/package.json +8 -17
  50. /package/dist/{types → cjs}/cli-options.d.ts +0 -0
  51. /package/dist/{types → cjs}/cli.d.ts +0 -0
  52. /package/dist/{types → cjs}/context.d.ts +0 -0
  53. /package/dist/{types → cjs}/index.d.ts +0 -0
  54. /package/dist/{types → cjs}/logger.d.ts +0 -0
  55. /package/dist/{types → cjs}/plugins/decode-key/cli.d.ts +0 -0
  56. /package/dist/{types → cjs}/plugins/decode-key/index.d.ts +0 -0
  57. /package/dist/{types → cjs}/plugins/dry-run/cli.d.ts +0 -0
  58. /package/dist/{types → cjs}/plugins/dry-run/dry-run-extrinsic.d.ts +0 -0
  59. /package/dist/{types → cjs}/plugins/dry-run/dry-run-preimage.d.ts +0 -0
  60. /package/dist/{types → cjs}/plugins/dry-run/index.d.ts +0 -0
  61. /package/dist/{types → cjs}/plugins/dry-run/rpc.d.ts +0 -0
  62. /package/dist/{types → cjs}/plugins/follow-chain/cli.d.ts +0 -0
  63. /package/dist/{types → cjs}/plugins/follow-chain/index.d.ts +0 -0
  64. /package/dist/{types → cjs}/plugins/index.d.ts +0 -0
  65. /package/dist/{types → cjs}/plugins/new-block/index.d.ts +0 -0
  66. /package/dist/{types → cjs}/plugins/new-block/rpc.d.ts +0 -0
  67. /package/dist/{types → cjs}/plugins/run-block/cli.d.ts +0 -0
  68. /package/dist/{types → cjs}/plugins/run-block/index.d.ts +0 -0
  69. /package/dist/{types → cjs}/plugins/set-block-build-mode/index.d.ts +0 -0
  70. /package/dist/{types → cjs}/plugins/set-block-build-mode/rpc.d.ts +0 -0
  71. /package/dist/{types → cjs}/plugins/set-head/index.d.ts +0 -0
  72. /package/dist/{types → cjs}/plugins/set-head/rpc.d.ts +0 -0
  73. /package/dist/{types → cjs}/plugins/set-runtime-log-level/index.d.ts +0 -0
  74. /package/dist/{types → cjs}/plugins/set-runtime-log-level/rpc.d.ts +0 -0
  75. /package/dist/{types → cjs}/plugins/set-storage/index.d.ts +0 -0
  76. /package/dist/{types → cjs}/plugins/set-storage/rpc.d.ts +0 -0
  77. /package/dist/{types → cjs}/plugins/time-travel/index.d.ts +0 -0
  78. /package/dist/{types → cjs}/plugins/time-travel/rpc.d.ts +0 -0
  79. /package/dist/{types → cjs}/plugins/try-runtime/index.d.ts +0 -0
  80. /package/dist/{types → cjs}/plugins/types.d.ts +0 -0
  81. /package/dist/{types → cjs}/rpc/index.d.ts +0 -0
  82. /package/dist/{types → cjs}/schema/index.d.ts +0 -0
  83. /package/dist/{types → cjs}/server.d.ts +0 -0
  84. /package/dist/{types → cjs}/setup-with-server.d.ts +0 -0
  85. /package/dist/{types → cjs}/types.d.ts +0 -0
  86. /package/dist/{types → cjs}/utils/decoder.d.ts +0 -0
  87. /package/dist/{types → cjs}/utils/generate-html-diff.d.ts +0 -0
  88. /package/dist/{types → cjs}/utils/index.d.ts +0 -0
  89. /package/dist/{types → cjs}/utils/open-html.d.ts +0 -0
  90. /package/dist/{types → cjs}/utils/override.d.ts +0 -0
  91. /package/dist/{types → cjs}/utils/tunnel.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ import type { Argv } from 'yargs';
2
+ export declare const cli: (y: Argv) => void;
@@ -0,0 +1,2 @@
1
+ export * from './cli.js';
2
+ export * from './rpc.js';
@@ -0,0 +1,140 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { z } from 'zod';
3
+ import { Context, RuntimeLog } from '@acala-network/chopsticks-core';
4
+ declare const schema: z.ZodObject<{
5
+ includeRaw: z.ZodOptional<z.ZodBoolean>;
6
+ includeParsed: z.ZodOptional<z.ZodBoolean>;
7
+ includeBlockDetails: z.ZodOptional<z.ZodBoolean>;
8
+ parent: z.ZodOptional<z.ZodIntersection<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>>;
9
+ block: z.ZodObject<{
10
+ header: z.ZodAny;
11
+ extrinsics: z.ZodArray<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>, "many">;
12
+ }, "strip", z.ZodTypeAny, {
13
+ extrinsics: `0x${string}`[];
14
+ header?: any;
15
+ }, {
16
+ extrinsics: `0x${string}`[];
17
+ header?: any;
18
+ }>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ block: {
21
+ extrinsics: `0x${string}`[];
22
+ header?: any;
23
+ };
24
+ includeRaw?: boolean | undefined;
25
+ includeParsed?: boolean | undefined;
26
+ includeBlockDetails?: boolean | undefined;
27
+ parent?: `0x${string}` | undefined;
28
+ }, {
29
+ block: {
30
+ extrinsics: `0x${string}`[];
31
+ header?: any;
32
+ };
33
+ includeRaw?: boolean | undefined;
34
+ includeParsed?: boolean | undefined;
35
+ includeBlockDetails?: boolean | undefined;
36
+ parent?: `0x${string}` | undefined;
37
+ }>;
38
+ type Params = z.infer<typeof schema>;
39
+ export interface RunBlockParams {
40
+ /**
41
+ * Include raw storage diff. Default to true
42
+ */
43
+ includeRaw: Params['includeRaw'];
44
+ /**
45
+ * Include parsed storage diff in json format
46
+ */
47
+ includeParsed: Params['includeParsed'];
48
+ /**
49
+ * Include block details such as parsed extrinsics in json format
50
+ */
51
+ includeBlockDetails: Params['includeBlockDetails'];
52
+ /**
53
+ * The parent block hash to run on top of. Default to chain head.
54
+ */
55
+ parent: Params['parent'];
56
+ /**
57
+ * Block to run
58
+ */
59
+ block: Params['block'];
60
+ }
61
+ /**
62
+ * The phase of an execution.
63
+ * `number` means the phase is ApplyExtrinsic and the value is the extrinsic index.
64
+ */
65
+ export type Phase = 'Initialization' | 'Finalization' | number;
66
+ export interface RunBlockResponse {
67
+ /**
68
+ * The storage diff of each phase.
69
+ */
70
+ phases: {
71
+ /**
72
+ * The phase of the execution. See {@link Phase}.
73
+ */
74
+ phase: Phase;
75
+ /**
76
+ * The modified storages of this phase.
77
+ */
78
+ storageDiff: {
79
+ /**
80
+ * Raw storage diff in bytes. Only available when `includeRaw` is true.
81
+ */
82
+ raw?: {
83
+ key: HexString;
84
+ value: HexString | null;
85
+ };
86
+ /**
87
+ * Decoded storage diff. Only available when `includeParsed` is true.
88
+ */
89
+ parsed?: {
90
+ method: string;
91
+ section: string;
92
+ key: any[];
93
+ value: any;
94
+ };
95
+ }[];
96
+ /**
97
+ * Runtime logs.
98
+ */
99
+ logs?: RuntimeLog[];
100
+ }[];
101
+ /**
102
+ * Block details. Only available when `includeBlockDetails` is true.
103
+ */
104
+ blockDetails?: {
105
+ /**
106
+ * Block timestamp in ms
107
+ */
108
+ timestamp?: string;
109
+ /**
110
+ * Parsed events in this block.
111
+ */
112
+ events?: {
113
+ phase: Phase;
114
+ section: string;
115
+ method: string;
116
+ args: any[];
117
+ }[];
118
+ /**
119
+ * Parsed extrinsics in this block.
120
+ */
121
+ extrinsics: {
122
+ section: string;
123
+ method: string;
124
+ args: any[];
125
+ success: boolean;
126
+ signer: string | null;
127
+ }[];
128
+ };
129
+ }
130
+ export declare const name = "runBlock";
131
+ /**
132
+ * Run a set of extrinsics on top of a block and get the storage diff
133
+ * and optionally the parsed storage diff and block details.
134
+ * NOTE: The extrinsics should include inherents or tranasctions may have unexpected results.
135
+ * NOTE: system.events and system.extrinsicData are excluded from storage diff to reduce size.
136
+ *
137
+ * This function is a dev rpc handler. Use `dev_runBlock` as the method name when calling it.
138
+ */
139
+ export declare const rpc: ({ chain }: Context, [params]: [RunBlockParams]) => Promise<RunBlockResponse>;
140
+ export {};
@@ -131,11 +131,13 @@ export const name = 'runBlock';
131
131
  const extrinsics = block.extrinsics.map((extrinsic, idx)=>{
132
132
  const parsed = registry.createType('GenericExtrinsic', extrinsic);
133
133
  const resultEvent = events?.find(({ event, phase })=>event.section === 'system' && (event.method === 'ExtrinsicSuccess' || event.method === 'ExtrinsicFailed') && phase.isApplyExtrinsic && phase.asApplyExtrinsic.eq(idx));
134
+ const signer = parsed.signer.isEmpty ? null : parsed.signer.toHex();
134
135
  return {
135
136
  section: parsed.method.section,
136
137
  method: parsed.method.method,
137
138
  args: parsed.method.args.map((arg)=>arg.toJSON()),
138
- success: resultEvent?.event.method === 'ExtrinsicSuccess'
139
+ success: resultEvent?.event.method === 'ExtrinsicSuccess',
140
+ signer
139
141
  };
140
142
  });
141
143
  resp.blockDetails = {
@@ -0,0 +1 @@
1
+ export * from './rpc.js';
@@ -0,0 +1,20 @@
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>;
@@ -0,0 +1 @@
1
+ export * from './rpc.js';
@@ -0,0 +1,21 @@
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 {};
@@ -0,0 +1 @@
1
+ export * from './rpc.js';
@@ -0,0 +1,17 @@
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>;
@@ -0,0 +1 @@
1
+ export * from './rpc.js';
@@ -0,0 +1,28 @@
1
+ import { Context, StorageValues } from '@acala-network/chopsticks-core';
2
+ import { HexString } from '@polkadot/util/types';
3
+ /**
4
+ * Set storage values.
5
+ *
6
+ * This function is a dev rpc handler. Use `dev_setStorage` as the method name when calling it.
7
+ *
8
+ * @param context - The context object of the rpc handler
9
+ * @param params - The parameters of the rpc handler
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { WsProvider } from '@polkadot/rpc-provider'
14
+ * import { Keyring } from '@polkadot/keyring'
15
+ *
16
+ * const ws = new WsProvider(`ws://localhost:8000`)
17
+ * const keyring = new Keyring({ type: 'ed25519' })
18
+ * const bob = keyring.addFromUri('//Bob')
19
+ *
20
+ * const storage = {
21
+ * System: {
22
+ * Account: [[[bob.address], { data: { free: 100000 }, nonce: 1 }]],
23
+ * },
24
+ * }
25
+ * await ws.send('dev_setStorage', [storage])
26
+ * ```
27
+ */
28
+ export declare const rpc: (context: Context, params: [StorageValues, HexString?]) => Promise<`0x${string}`>;
@@ -0,0 +1 @@
1
+ export * from './rpc.js';
@@ -0,0 +1,17 @@
1
+ import { Context } from '@acala-network/chopsticks-core';
2
+ /**
3
+ * Travel to a specific time.
4
+ *
5
+ * This function is a dev rpc handler. Use `dev_timeTravel` as the method name when calling it.
6
+ *
7
+ * @param context - The context object of the rpc handler
8
+ * @param date - Timestamp or date string to set
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { WsProvider } from '@polkadot/rpc-provider'
13
+ * const ws = new WsProvider(`ws://localhost:8000`)
14
+ * await ws.send('dev_timeTravel', ['Jan 1, 2023'])
15
+ * ```
16
+ */
17
+ export declare const rpc: (context: Context, [date]: [string | number]) => Promise<number>;
@@ -0,0 +1,2 @@
1
+ import type { Argv } from 'yargs';
2
+ export declare const cli: (y: Argv) => void;
@@ -0,0 +1,11 @@
1
+ export { rpc as newBlock } from './new-block/index.js';
2
+ 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
+ export { rpc as runBlock } from './run-block/index.js';
9
+ export type { NewBlockParams } from './new-block/index.js';
10
+ export type { DryRunParams } from './dry-run/index.js';
11
+ export type { RunBlockParams } from './run-block/index.js';
@@ -0,0 +1,5 @@
1
+ import { Context, SubscriptionManager } from '@acala-network/chopsticks-core';
2
+ export declare const handler: (context: Context) => ({ method, params }: {
3
+ method: string;
4
+ params: any[];
5
+ }, subscriptionManager: SubscriptionManager) => Promise<any>;
@@ -0,0 +1,140 @@
1
+ import { BuildBlockMode } from '@acala-network/chopsticks-core';
2
+ import { z } from 'zod';
3
+ export declare const zHex: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
4
+ export declare const zHash: z.ZodIntersection<z.ZodString, z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
5
+ export declare const configSchema: z.ZodObject<{
6
+ port: z.ZodOptional<z.ZodNumber>;
7
+ endpoint: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
8
+ block: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodNull]>>;
9
+ 'build-block-mode': z.ZodOptional<z.ZodNativeEnum<typeof BuildBlockMode>>;
10
+ 'import-storage': z.ZodOptional<z.ZodAny>;
11
+ 'mock-signature-host': z.ZodOptional<z.ZodBoolean>;
12
+ 'max-memory-block-count': z.ZodOptional<z.ZodNumber>;
13
+ db: z.ZodOptional<z.ZodString>;
14
+ 'wasm-override': z.ZodOptional<z.ZodString>;
15
+ genesis: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
16
+ id: z.ZodString;
17
+ name: z.ZodString;
18
+ properties: z.ZodObject<{
19
+ ss58Format: z.ZodOptional<z.ZodNumber>;
20
+ tokenDecimals: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>>;
21
+ tokenSymbol: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ ss58Format?: number | undefined;
24
+ tokenDecimals?: number | number[] | undefined;
25
+ tokenSymbol?: string | string[] | undefined;
26
+ }, {
27
+ ss58Format?: number | undefined;
28
+ tokenDecimals?: number | number[] | undefined;
29
+ tokenSymbol?: string | string[] | undefined;
30
+ }>;
31
+ genesis: z.ZodObject<{
32
+ raw: z.ZodObject<{
33
+ top: z.ZodRecord<z.ZodString, z.ZodString>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ top: Record<string, string>;
36
+ }, {
37
+ top: Record<string, string>;
38
+ }>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ raw: {
41
+ top: Record<string, string>;
42
+ };
43
+ }, {
44
+ raw: {
45
+ top: Record<string, string>;
46
+ };
47
+ }>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ name: string;
50
+ id: string;
51
+ properties: {
52
+ ss58Format?: number | undefined;
53
+ tokenDecimals?: number | number[] | undefined;
54
+ tokenSymbol?: string | string[] | undefined;
55
+ };
56
+ genesis: {
57
+ raw: {
58
+ top: Record<string, string>;
59
+ };
60
+ };
61
+ }, {
62
+ name: string;
63
+ id: string;
64
+ properties: {
65
+ ss58Format?: number | undefined;
66
+ tokenDecimals?: number | number[] | undefined;
67
+ tokenSymbol?: string | string[] | undefined;
68
+ };
69
+ genesis: {
70
+ raw: {
71
+ top: Record<string, string>;
72
+ };
73
+ };
74
+ }>]>>;
75
+ timestamp: z.ZodOptional<z.ZodNumber>;
76
+ 'registered-types': z.ZodOptional<z.ZodAny>;
77
+ 'runtime-log-level': z.ZodOptional<z.ZodNumber>;
78
+ 'offchain-worker': z.ZodOptional<z.ZodBoolean>;
79
+ resume: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
80
+ }, "strict", z.ZodTypeAny, {
81
+ port?: number | undefined;
82
+ endpoint?: string | string[] | undefined;
83
+ block?: string | number | null | undefined;
84
+ 'build-block-mode'?: BuildBlockMode | undefined;
85
+ 'import-storage'?: any;
86
+ 'mock-signature-host'?: boolean | undefined;
87
+ 'max-memory-block-count'?: number | undefined;
88
+ db?: string | undefined;
89
+ 'wasm-override'?: string | undefined;
90
+ genesis?: string | {
91
+ name: string;
92
+ id: string;
93
+ properties: {
94
+ ss58Format?: number | undefined;
95
+ tokenDecimals?: number | number[] | undefined;
96
+ tokenSymbol?: string | string[] | undefined;
97
+ };
98
+ genesis: {
99
+ raw: {
100
+ top: Record<string, string>;
101
+ };
102
+ };
103
+ } | undefined;
104
+ timestamp?: number | undefined;
105
+ 'registered-types'?: any;
106
+ 'runtime-log-level'?: number | undefined;
107
+ 'offchain-worker'?: boolean | undefined;
108
+ resume?: string | number | boolean | undefined;
109
+ }, {
110
+ port?: number | undefined;
111
+ endpoint?: string | string[] | undefined;
112
+ block?: string | number | null | undefined;
113
+ 'build-block-mode'?: BuildBlockMode | undefined;
114
+ 'import-storage'?: any;
115
+ 'mock-signature-host'?: boolean | undefined;
116
+ 'max-memory-block-count'?: number | undefined;
117
+ db?: string | undefined;
118
+ 'wasm-override'?: string | undefined;
119
+ genesis?: string | {
120
+ name: string;
121
+ id: string;
122
+ properties: {
123
+ ss58Format?: number | undefined;
124
+ tokenDecimals?: number | number[] | undefined;
125
+ tokenSymbol?: string | string[] | undefined;
126
+ };
127
+ genesis: {
128
+ raw: {
129
+ top: Record<string, string>;
130
+ };
131
+ };
132
+ } | undefined;
133
+ timestamp?: number | undefined;
134
+ 'registered-types'?: any;
135
+ 'runtime-log-level'?: number | undefined;
136
+ 'offchain-worker'?: boolean | undefined;
137
+ resume?: string | number | boolean | undefined;
138
+ }>;
139
+ export type Config = z.infer<typeof configSchema>;
140
+ export declare const fetchConfig: (path: string) => Promise<Config>;
@@ -0,0 +1,9 @@
1
+ import { SubscriptionManager } from '@acala-network/chopsticks-core';
2
+ export type Handler = (data: {
3
+ method: string;
4
+ params: string[];
5
+ }, subscriptionManager: SubscriptionManager) => Promise<any>;
6
+ export declare const createServer: (handler: Handler, port?: number) => Promise<{
7
+ port: number;
8
+ close: () => Promise<void>;
9
+ }>;
@@ -0,0 +1,6 @@
1
+ import { Config } from './schema/index.js';
2
+ export declare const setupWithServer: (argv: Config) => Promise<{
3
+ listenPort: number;
4
+ close(): Promise<void>;
5
+ chain: import("@acala-network/chopsticks-core").Blockchain;
6
+ }>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Chopsticks JSON RPC and CLI.
3
+ *
4
+ * @remarks
5
+ * This package extends the `@acala-network/chopsticks-core` package a with JSON RPC server and CLI support.
6
+ *
7
+ * @privateRemarks
8
+ * Above is the package documentation for 'chopsticks' package.
9
+ * `export` below is for tsdoc.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ export type { ChainProperties, RuntimeVersion, Context, SubscriptionManager, Handler, } from '@acala-network/chopsticks-core';
14
+ export * from '@acala-network/chopsticks-core/rpc/substrate/index.js';
15
+ export * from './plugins/types.js';
@@ -0,0 +1,7 @@
1
+ import { Block } from '@acala-network/chopsticks-core';
2
+ import { HexString } from '@polkadot/util/types';
3
+ export declare const decodeStorageDiff: (block: Block, diff: [HexString, HexString | null][]) => Promise<{
4
+ oldState: {};
5
+ newState: {};
6
+ delta: import("jsondiffpatch").Delta | undefined;
7
+ }>;
@@ -0,0 +1,4 @@
1
+ import { Block } from '@acala-network/chopsticks-core';
2
+ import { HexString } from '@polkadot/util/types';
3
+ export declare const generateHtmlDiff: (block: Block, diff: [HexString, HexString | null][]) => Promise<string>;
4
+ export declare const generateHtmlDiffPreviewFile: (block: Block, diff: [HexString, HexString | null][], filename: string) => Promise<string>;
@@ -0,0 +1,4 @@
1
+ export * from './decoder.js';
2
+ export * from './generate-html-diff.js';
3
+ export * from './open-html.js';
4
+ export * from './override.js';
@@ -0,0 +1 @@
1
+ export declare const openHtml: (filePath: string) => void;
@@ -0,0 +1,4 @@
1
+ import { Blockchain, StorageValues } from '@acala-network/chopsticks-core';
2
+ import { HexString } from '@polkadot/util/types';
3
+ export declare const overrideStorage: (chain: Blockchain, storage?: string | StorageValues, at?: HexString) => Promise<void>;
4
+ export declare const overrideWasm: (chain: Blockchain, wasmPath?: string, at?: HexString) => Promise<void>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,21 +1,20 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks",
3
- "version": "0.9.4-1",
3
+ "version": "0.9.4-3",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "bin": "./chopsticks.cjs",
7
7
  "type": "module",
8
8
  "scripts": {
9
- "clean": "rm -rf dist",
10
- "build": "yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
11
- "build:cjs": "swc ./src --config-file ../../.cjsswcrc -d dist/cjs --copy-files && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
12
- "build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm --copy-files",
13
- "build:types": "tsc -p tsconfig.json --emitDeclarationOnly --outDir dist/types",
9
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
10
+ "build": "yarn clean && yarn build:cjs && yarn build:esm",
11
+ "build:cjs": "swc ./src --config-file ../../.cjsswcrc -d dist/cjs --copy-files && tsc -p tsconfig.json --declarationDir dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
12
+ "build:esm": "swc ./src --config-file ../../.esmswcrc -d dist/esm --copy-files && tsc -p tsconfig.json --declarationDir dist/esm",
14
13
  "docs:prep": "typedoc"
15
14
  },
16
15
  "dependencies": {
17
- "@acala-network/chopsticks-core": "0.9.4-1",
18
- "@acala-network/chopsticks-db": "0.9.4-1",
16
+ "@acala-network/chopsticks-core": "0.9.4-3",
17
+ "@acala-network/chopsticks-db": "0.9.4-3",
19
18
  "@pnpm/npm-conf": "^2.2.2",
20
19
  "@polkadot/api-augment": "^10.10.1",
21
20
  "@polkadot/types": "^10.10.1",
@@ -46,38 +45,30 @@
46
45
  "files": [
47
46
  "dist/esm/**",
48
47
  "dist/cjs/**",
49
- "dist/types/**",
50
48
  "chopsticks.cjs"
51
49
  ],
52
50
  "main": "./dist/cjs/index.js",
53
51
  "module": "./dist/esm/index.js",
54
- "types": "./dist/types/index.d.ts",
55
52
  "exports": {
56
53
  ".": {
57
- "types": "./dist/types/index.d.ts",
58
54
  "require": "./dist/cjs/index.js",
59
55
  "import": "./dist/esm/index.js",
60
56
  "default": "./dist/esm/index.js"
61
57
  },
62
58
  "./*": {
63
- "types": "./dist/types/*.d.ts",
64
59
  "require": "./dist/cjs/*.js",
65
60
  "import": "./dist/esm/*.js",
66
61
  "default": "./dist/esm/*.js"
67
62
  },
68
63
  "./plugins/*": {
69
- "types": "./dist/types/plugins/*.d.ts",
70
64
  "require": "./dist/cjs/plugins/*.js",
71
65
  "import": "./dist/esm/plugins/*.js",
72
66
  "default": "./dist/esm/plugins/*.js"
73
67
  },
74
68
  "./utils/*": {
75
- "types": "./dist/types/utils/*.d.ts",
76
69
  "require": "./dist/cjs/utils/*.js",
77
70
  "import": "./dist/esm/utils/*.js",
78
71
  "default": "./dist/esm/utils/*.js"
79
- },
80
- "./package.json": "./package.json",
81
- "./package.cjs.json": "./dist/cjs/package.json"
72
+ }
82
73
  }
83
74
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes