@acala-network/chopsticks-core 1.0.6-1 → 1.0.6

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.
@@ -7,5 +7,20 @@ import { type Handler } from '../shared.js';
7
7
  * @return Block extrinsics
8
8
  */
9
9
  export declare const archive_unstable_body: Handler<[HexString], HexString[]>;
10
+ /**
11
+ * @param context
12
+ * @param params - [`blockhash`, `method`, `data` ]
13
+ *
14
+ * @return {Object} result The call result.
15
+ * @return {boolean} result.success Whether the call is successful.
16
+ * @return {string} result.value The call result.
17
+ */
18
+ export declare const archive_unstable_call: Handler<[
19
+ HexString,
20
+ string,
21
+ HexString
22
+ ], {
23
+ success: boolean;
24
+ value: `0x${string}`;
25
+ }>;
10
26
  export declare const archive_unstable_hashByHeight: Handler<[number | `0x${string}` | `0x${string}`[] | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
11
- export declare const archive_unstable_call: Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
@@ -21,7 +21,6 @@ _export(exports, {
21
21
  });
22
22
  const _shared = require("../shared.js");
23
23
  const _chain = require("./chain.js");
24
- const _state = require("./state.js");
25
24
  const archive_unstable_body = async (context, [hash])=>{
26
25
  const block = await context.chain.getBlock(hash);
27
26
  if (!block) {
@@ -29,5 +28,17 @@ const archive_unstable_body = async (context, [hash])=>{
29
28
  }
30
29
  return await block.extrinsics;
31
30
  };
31
+ const archive_unstable_call = async (context, [hash, method, data])=>{
32
+ const block = await context.chain.getBlock(hash);
33
+ if (!block) {
34
+ throw new _shared.ResponseError(1, `Block ${hash} not found`);
35
+ }
36
+ const resp = await block.call(method, [
37
+ data
38
+ ]);
39
+ return {
40
+ success: true,
41
+ value: resp.result
42
+ };
43
+ };
32
44
  const archive_unstable_hashByHeight = _chain.chain_getBlockHash;
33
- const archive_unstable_call = _state.state_call;
@@ -66,7 +66,10 @@ declare const handlers: {
66
66
  author_unwatchExtrinsic: import("../shared.js").Handler<[string], void>;
67
67
  author_pendingExtrinsics: import("../shared.js").Handler<void, import("@polkadot/util/types").HexString[]>;
68
68
  archive_unstable_body: import("../shared.js").Handler<[import("@polkadot/util/types").HexString], import("@polkadot/util/types").HexString[]>;
69
+ archive_unstable_call: import("../shared.js").Handler<[import("@polkadot/util/types").HexString, string, import("@polkadot/util/types").HexString], {
70
+ success: boolean;
71
+ value: `0x${string}`;
72
+ }>;
69
73
  archive_unstable_hashByHeight: import("../shared.js").Handler<[number | `0x${string}` | `0x${string}`[] | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
70
- archive_unstable_call: import("../shared.js").Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
71
74
  };
72
75
  export default handlers;
@@ -7,5 +7,20 @@ import { type Handler } from '../shared.js';
7
7
  * @return Block extrinsics
8
8
  */
9
9
  export declare const archive_unstable_body: Handler<[HexString], HexString[]>;
10
+ /**
11
+ * @param context
12
+ * @param params - [`blockhash`, `method`, `data` ]
13
+ *
14
+ * @return {Object} result The call result.
15
+ * @return {boolean} result.success Whether the call is successful.
16
+ * @return {string} result.value The call result.
17
+ */
18
+ export declare const archive_unstable_call: Handler<[
19
+ HexString,
20
+ string,
21
+ HexString
22
+ ], {
23
+ success: boolean;
24
+ value: `0x${string}`;
25
+ }>;
10
26
  export declare const archive_unstable_hashByHeight: Handler<[number | `0x${string}` | `0x${string}`[] | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
11
- export declare const archive_unstable_call: Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
@@ -1,6 +1,5 @@
1
1
  import { ResponseError } from '../shared.js';
2
2
  import { chain_getBlockHash } from './chain.js';
3
- import { state_call } from './state.js';
4
3
  /**
5
4
  * @param context
6
5
  * @param params - [`blockhash`]
@@ -13,5 +12,24 @@ import { state_call } from './state.js';
13
12
  }
14
13
  return await block.extrinsics;
15
14
  };
15
+ /**
16
+ * @param context
17
+ * @param params - [`blockhash`, `method`, `data` ]
18
+ *
19
+ * @return {Object} result The call result.
20
+ * @return {boolean} result.success Whether the call is successful.
21
+ * @return {string} result.value The call result.
22
+ */ export const archive_unstable_call = async (context, [hash, method, data])=>{
23
+ const block = await context.chain.getBlock(hash);
24
+ if (!block) {
25
+ throw new ResponseError(1, `Block ${hash} not found`);
26
+ }
27
+ const resp = await block.call(method, [
28
+ data
29
+ ]);
30
+ return {
31
+ success: true,
32
+ value: resp.result
33
+ };
34
+ };
16
35
  export const archive_unstable_hashByHeight = chain_getBlockHash;
17
- export const archive_unstable_call = state_call;
@@ -66,7 +66,10 @@ declare const handlers: {
66
66
  author_unwatchExtrinsic: import("../shared.js").Handler<[string], void>;
67
67
  author_pendingExtrinsics: import("../shared.js").Handler<void, import("@polkadot/util/types").HexString[]>;
68
68
  archive_unstable_body: import("../shared.js").Handler<[import("@polkadot/util/types").HexString], import("@polkadot/util/types").HexString[]>;
69
+ archive_unstable_call: import("../shared.js").Handler<[import("@polkadot/util/types").HexString, string, import("@polkadot/util/types").HexString], {
70
+ success: boolean;
71
+ value: `0x${string}`;
72
+ }>;
69
73
  archive_unstable_hashByHeight: import("../shared.js").Handler<[number | `0x${string}` | `0x${string}`[] | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
70
- archive_unstable_call: import("../shared.js").Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
71
74
  };
72
75
  export default handlers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks-core",
3
- "version": "1.0.6-1",
3
+ "version": "1.0.6",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "depcheck": "npx depcheck"
15
15
  },
16
16
  "dependencies": {
17
- "@acala-network/chopsticks-executor": "1.0.6-1",
17
+ "@acala-network/chopsticks-executor": "1.0.6",
18
18
  "@polkadot/rpc-provider": "^15.7.1",
19
19
  "@polkadot/types": "^15.7.1",
20
20
  "@polkadot/types-codec": "^15.7.1",