@ckb-ccc/core 1.2.2 → 1.3.0

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 (145) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/advancedBarrel.d.ts +1 -0
  3. package/dist/advancedBarrel.d.ts.map +1 -1
  4. package/dist/advancedBarrel.js +1 -0
  5. package/dist/barrel.d.ts +1 -0
  6. package/dist/barrel.d.ts.map +1 -1
  7. package/dist/barrel.js +1 -0
  8. package/dist/ckb/script.d.ts +1 -0
  9. package/dist/ckb/script.d.ts.map +1 -1
  10. package/dist/ckb/script.js +1 -0
  11. package/dist/ckb/transaction.d.ts +3 -1
  12. package/dist/ckb/transaction.d.ts.map +1 -1
  13. package/dist/ckb/transaction.js +25 -2
  14. package/dist/client/advanced.d.ts +0 -1
  15. package/dist/client/advanced.d.ts.map +1 -1
  16. package/dist/client/advanced.js +0 -1
  17. package/dist/client/clientPublicMainnet.d.ts +3 -9
  18. package/dist/client/clientPublicMainnet.d.ts.map +1 -1
  19. package/dist/client/clientPublicTestnet.d.ts +3 -9
  20. package/dist/client/clientPublicTestnet.d.ts.map +1 -1
  21. package/dist/client/jsonRpc/client.d.ts +160 -0
  22. package/dist/client/jsonRpc/client.d.ts.map +1 -0
  23. package/dist/client/jsonRpc/client.js +220 -0
  24. package/dist/client/jsonRpc/index.d.ts +1 -182
  25. package/dist/client/jsonRpc/index.d.ts.map +1 -1
  26. package/dist/client/jsonRpc/index.js +1 -293
  27. package/dist/jsonRpc/advanced.d.ts +2 -0
  28. package/dist/jsonRpc/advanced.d.ts.map +1 -0
  29. package/dist/jsonRpc/advanced.js +1 -0
  30. package/dist/jsonRpc/index.d.ts +2 -0
  31. package/dist/jsonRpc/index.d.ts.map +1 -0
  32. package/dist/jsonRpc/index.js +1 -0
  33. package/dist/jsonRpc/requestor.d.ts +48 -0
  34. package/dist/jsonRpc/requestor.d.ts.map +1 -0
  35. package/dist/jsonRpc/requestor.js +107 -0
  36. package/dist/jsonRpc/transports/advanced.d.ts +5 -0
  37. package/dist/jsonRpc/transports/advanced.d.ts.map +1 -0
  38. package/dist/jsonRpc/transports/advanced.js +4 -0
  39. package/dist/{client/transports/advanced.d.ts → jsonRpc/transports/factory.d.ts} +1 -4
  40. package/dist/jsonRpc/transports/factory.d.ts.map +1 -0
  41. package/dist/{client/transports/advanced.js → jsonRpc/transports/factory.js} +0 -3
  42. package/dist/jsonRpc/transports/http.d.ts.map +1 -0
  43. package/dist/jsonRpc/transports/transport.d.ts +18 -0
  44. package/dist/jsonRpc/transports/transport.d.ts.map +1 -0
  45. package/dist/jsonRpc/transports/webSocket.d.ts.map +1 -0
  46. package/dist/molecule/codec.d.ts.map +1 -1
  47. package/dist/molecule/codec.js +3 -3
  48. package/dist/molecule/predefined.d.ts +12 -0
  49. package/dist/molecule/predefined.d.ts.map +1 -1
  50. package/dist/molecule/predefined.js +28 -0
  51. package/dist/num/index.d.ts.map +1 -1
  52. package/dist/num/index.js +10 -2
  53. package/dist.commonjs/advancedBarrel.d.ts +1 -0
  54. package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
  55. package/dist.commonjs/advancedBarrel.js +1 -0
  56. package/dist.commonjs/barrel.d.ts +1 -0
  57. package/dist.commonjs/barrel.d.ts.map +1 -1
  58. package/dist.commonjs/barrel.js +1 -0
  59. package/dist.commonjs/ckb/script.d.ts +1 -0
  60. package/dist.commonjs/ckb/script.d.ts.map +1 -1
  61. package/dist.commonjs/ckb/script.js +2 -1
  62. package/dist.commonjs/ckb/transaction.d.ts +3 -1
  63. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  64. package/dist.commonjs/ckb/transaction.js +25 -2
  65. package/dist.commonjs/client/advanced.d.ts +0 -1
  66. package/dist.commonjs/client/advanced.d.ts.map +1 -1
  67. package/dist.commonjs/client/advanced.js +0 -1
  68. package/dist.commonjs/client/clientPublicMainnet.d.ts +3 -9
  69. package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
  70. package/dist.commonjs/client/clientPublicTestnet.d.ts +3 -9
  71. package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
  72. package/dist.commonjs/client/jsonRpc/client.d.ts +160 -0
  73. package/dist.commonjs/client/jsonRpc/client.d.ts.map +1 -0
  74. package/dist.commonjs/client/jsonRpc/client.js +224 -0
  75. package/dist.commonjs/client/jsonRpc/index.d.ts +1 -182
  76. package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
  77. package/dist.commonjs/client/jsonRpc/index.js +15 -295
  78. package/dist.commonjs/jsonRpc/advanced.d.ts +2 -0
  79. package/dist.commonjs/jsonRpc/advanced.d.ts.map +1 -0
  80. package/dist.commonjs/jsonRpc/advanced.js +17 -0
  81. package/dist.commonjs/jsonRpc/index.d.ts +2 -0
  82. package/dist.commonjs/jsonRpc/index.d.ts.map +1 -0
  83. package/dist.commonjs/jsonRpc/index.js +17 -0
  84. package/dist.commonjs/jsonRpc/requestor.d.ts +48 -0
  85. package/dist.commonjs/jsonRpc/requestor.d.ts.map +1 -0
  86. package/dist.commonjs/jsonRpc/requestor.js +111 -0
  87. package/dist.commonjs/jsonRpc/transports/advanced.d.ts +5 -0
  88. package/dist.commonjs/jsonRpc/transports/advanced.d.ts.map +1 -0
  89. package/dist.commonjs/{client → jsonRpc}/transports/advanced.js +1 -9
  90. package/dist.commonjs/{client/transports/advanced.d.ts → jsonRpc/transports/factory.d.ts} +1 -4
  91. package/dist.commonjs/jsonRpc/transports/factory.d.ts.map +1 -0
  92. package/dist.commonjs/jsonRpc/transports/factory.js +11 -0
  93. package/dist.commonjs/jsonRpc/transports/http.d.ts.map +1 -0
  94. package/dist.commonjs/jsonRpc/transports/transport.d.ts +18 -0
  95. package/dist.commonjs/jsonRpc/transports/transport.d.ts.map +1 -0
  96. package/dist.commonjs/jsonRpc/transports/webSocket.d.ts.map +1 -0
  97. package/dist.commonjs/molecule/codec.d.ts.map +1 -1
  98. package/dist.commonjs/molecule/codec.js +3 -3
  99. package/dist.commonjs/molecule/predefined.d.ts +12 -0
  100. package/dist.commonjs/molecule/predefined.d.ts.map +1 -1
  101. package/dist.commonjs/molecule/predefined.js +30 -1
  102. package/dist.commonjs/num/index.d.ts.map +1 -1
  103. package/dist.commonjs/num/index.js +10 -2
  104. package/package.json +1 -1
  105. package/src/advancedBarrel.ts +1 -0
  106. package/src/barrel.ts +1 -0
  107. package/src/ckb/script.ts +1 -0
  108. package/src/ckb/transaction.ts +52 -2
  109. package/src/client/advanced.ts +0 -1
  110. package/src/client/clientPublicMainnet.ts +2 -8
  111. package/src/client/clientPublicTestnet.ts +2 -8
  112. package/src/client/jsonRpc/client.ts +395 -0
  113. package/src/client/jsonRpc/index.ts +1 -490
  114. package/src/jsonRpc/advanced.ts +1 -0
  115. package/src/jsonRpc/index.ts +1 -0
  116. package/src/jsonRpc/requestor.ts +157 -0
  117. package/src/jsonRpc/transports/advanced.ts +4 -0
  118. package/src/{client/transports/advanced.ts → jsonRpc/transports/factory.ts} +0 -4
  119. package/src/jsonRpc/transports/transport.ts +18 -0
  120. package/src/molecule/codec.ts +5 -3
  121. package/src/molecule/predefined.ts +32 -0
  122. package/src/num/index.ts +12 -2
  123. package/dist/client/transports/advanced.d.ts.map +0 -1
  124. package/dist/client/transports/http.d.ts.map +0 -1
  125. package/dist/client/transports/transport.d.ts +0 -10
  126. package/dist/client/transports/transport.d.ts.map +0 -1
  127. package/dist/client/transports/webSocket.d.ts.map +0 -1
  128. package/dist.commonjs/client/transports/advanced.d.ts.map +0 -1
  129. package/dist.commonjs/client/transports/http.d.ts.map +0 -1
  130. package/dist.commonjs/client/transports/transport.d.ts +0 -10
  131. package/dist.commonjs/client/transports/transport.d.ts.map +0 -1
  132. package/dist.commonjs/client/transports/webSocket.d.ts.map +0 -1
  133. package/src/client/transports/transport.ts +0 -10
  134. /package/dist/{client → jsonRpc}/transports/http.d.ts +0 -0
  135. /package/dist/{client → jsonRpc}/transports/http.js +0 -0
  136. /package/dist/{client → jsonRpc}/transports/transport.js +0 -0
  137. /package/dist/{client → jsonRpc}/transports/webSocket.d.ts +0 -0
  138. /package/dist/{client → jsonRpc}/transports/webSocket.js +0 -0
  139. /package/dist.commonjs/{client → jsonRpc}/transports/http.d.ts +0 -0
  140. /package/dist.commonjs/{client → jsonRpc}/transports/http.js +0 -0
  141. /package/dist.commonjs/{client → jsonRpc}/transports/transport.js +0 -0
  142. /package/dist.commonjs/{client → jsonRpc}/transports/webSocket.d.ts +0 -0
  143. /package/dist.commonjs/{client → jsonRpc}/transports/webSocket.js +0 -0
  144. /package/src/{client → jsonRpc}/transports/http.ts +0 -0
  145. /package/src/{client → jsonRpc}/transports/webSocket.ts +0 -0
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientJsonRpc = void 0;
4
+ const index_js_1 = require("../../ckb/index.js");
5
+ const index_js_2 = require("../../hex/index.js");
6
+ const requestor_js_1 = require("../../jsonRpc/requestor.js");
7
+ const index_js_3 = require("../../num/index.js");
8
+ const index_js_4 = require("../../utils/index.js");
9
+ const client_js_1 = require("../client.js");
10
+ const clientTypes_js_1 = require("../clientTypes.js");
11
+ const advanced_js_1 = require("./advanced.js");
12
+ const ERROR_PARSERS = [
13
+ [
14
+ "Resolve\\(Unknown\\(OutPoint\\((0x.*)\\)\\)\\)",
15
+ (error, match) => new clientTypes_js_1.ErrorClientResolveUnknown(error, index_js_1.OutPoint.fromBytes(match[1])),
16
+ ],
17
+ [
18
+ "Verification\\(Error { kind: Script, inner: TransactionScriptError { source: (Inputs|Outputs)\\[([0-9]*)\\].(Lock|Type), cause: ValidationFailure: see error code (-?[0-9])* on page https://nervosnetwork\\.github\\.io/ckb-script-error-codes/by-(type|data)-hash/(.*)\\.html",
19
+ (error, match) => new clientTypes_js_1.ErrorClientVerification(error, match[3] === "Lock"
20
+ ? "lock"
21
+ : match[1] === "Inputs"
22
+ ? "inputType"
23
+ : "outputType", match[2], Number(match[4]), match[5] === "data" ? "data" : "type", match[6]),
24
+ ],
25
+ [
26
+ "Duplicated\\(Byte32\\((0x.*)\\)\\)",
27
+ (error, match) => new clientTypes_js_1.ErrorClientDuplicatedTransaction(error, match[1]),
28
+ ],
29
+ [
30
+ 'RBFRejected\\("Tx\'s current fee is ([0-9]*), expect it to >= ([0-9]*) to replace old txs"\\)',
31
+ (error, match) => new clientTypes_js_1.ErrorClientRBFRejected(error, match[1], match[2]),
32
+ ],
33
+ ];
34
+ /**
35
+ * An abstract class implementing JSON-RPC client functionality for a specific URL and timeout.
36
+ * Provides methods for sending transactions and building JSON-RPC payloads.
37
+ */
38
+ class ClientJsonRpc extends client_js_1.Client {
39
+ /**
40
+ * Creates an instance of ClientJsonRpc.
41
+ *
42
+ * @param url_ - The URL of the JSON-RPC server.
43
+ * @param timeout - The timeout for requests in milliseconds
44
+ */
45
+ constructor(url_, config) {
46
+ super(config);
47
+ /**
48
+ * Get fee rate statistics
49
+ *
50
+ * @returns Fee rate statistics
51
+ */
52
+ this.getFeeRateStatistics = this.buildSender("get_fee_rate_statistics", [(n) => (0, index_js_4.apply)(index_js_3.numFrom, n)], ({ mean, median }) => ({
53
+ mean: (0, index_js_3.numFrom)(mean),
54
+ median: (0, index_js_3.numFrom)(median),
55
+ }));
56
+ /**
57
+ * Get tip block number
58
+ *
59
+ * @returns Tip block number
60
+ */
61
+ this.getTip = this.buildSender("get_tip_block_number", [], index_js_3.numFrom);
62
+ /**
63
+ * Get tip block header
64
+ *
65
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
66
+ * @returns BlockHeader
67
+ */
68
+ this.getTipHeader = this.buildSender("get_tip_header", [], (b) => (0, index_js_4.apply)(advanced_js_1.JsonRpcTransformers.blockHeaderTo, b));
69
+ /**
70
+ * Get block by block number
71
+ *
72
+ * @param blockNumber - The block number.
73
+ * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
74
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
75
+ * @returns Block
76
+ */
77
+ this.getBlockByNumber = this.buildSender("get_block_by_number", [(v) => (0, index_js_3.numToHex)((0, index_js_3.numFrom)(v))], (b) => (0, index_js_4.apply)(advanced_js_1.JsonRpcTransformers.blockTo, b));
78
+ /**
79
+ * Get block by block hash
80
+ *
81
+ * @param blockHash - The block hash.
82
+ * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
83
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
84
+ * @returns Block
85
+ */
86
+ this.getBlockByHash = this.buildSender("get_block", [index_js_2.hexFrom], (b) => (0, index_js_4.apply)(advanced_js_1.JsonRpcTransformers.blockTo, b));
87
+ /**
88
+ * Get header by block number
89
+ *
90
+ * @param blockNumber - The block number.
91
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
92
+ * @returns BlockHeader
93
+ */
94
+ this.getHeaderByNumber = this.buildSender("get_header_by_number", [(v) => (0, index_js_3.numToHex)((0, index_js_3.numFrom)(v))], (b) => (0, index_js_4.apply)(advanced_js_1.JsonRpcTransformers.blockHeaderTo, b));
95
+ /**
96
+ * Get header by block hash
97
+ *
98
+ * @param blockHash - The block hash.
99
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
100
+ * @returns BlockHeader
101
+ */
102
+ this.getHeaderByHash = this.buildSender("get_header", [index_js_2.hexFrom], (b) => (0, index_js_4.apply)(advanced_js_1.JsonRpcTransformers.blockHeaderTo, b));
103
+ /**
104
+ * Estimate cycles of a transaction.
105
+ *
106
+ * @param transaction - The transaction to estimate.
107
+ * @returns Consumed cycles
108
+ */
109
+ this.estimateCycles = this.buildSender("estimate_cycles", [advanced_js_1.JsonRpcTransformers.transactionFrom], ({ cycles }) => (0, index_js_3.numFrom)(cycles));
110
+ /**
111
+ * Test a transaction.
112
+ *
113
+ * @param transaction - The transaction to test.
114
+ * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
115
+ * @returns Consumed cycles
116
+ */
117
+ this.sendTransactionDry = this.buildSender("test_tx_pool_accept", [advanced_js_1.JsonRpcTransformers.transactionFrom], ({ cycles }) => (0, index_js_3.numFrom)(cycles));
118
+ /**
119
+ * Send a transaction to node.
120
+ *
121
+ * @param transaction - The transaction to send.
122
+ * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
123
+ * @returns Transaction hash.
124
+ */
125
+ this.sendTransactionNoCache = this.buildSender("send_transaction", [advanced_js_1.JsonRpcTransformers.transactionFrom], index_js_2.hexFrom);
126
+ /**
127
+ * Get a transaction from node.
128
+ *
129
+ * @param txHash - The hash of the transaction.
130
+ * @returns The transaction with status.
131
+ */
132
+ this.getTransactionNoCache = this.buildSender("get_transaction", [index_js_2.hexFrom], advanced_js_1.JsonRpcTransformers.transactionResponseTo);
133
+ /**
134
+ * find cells from node.
135
+ *
136
+ * @param key - The search key of cells.
137
+ * @param order - The order of cells.
138
+ * @param limit - The max return size of cells.
139
+ * @param after - Pagination parameter.
140
+ * @returns The found cells.
141
+ */
142
+ this.findCellsPagedNoCache = this.buildSender("get_cells", [
143
+ advanced_js_1.JsonRpcTransformers.indexerSearchKeyFrom,
144
+ (order) => order ?? "asc",
145
+ (limit) => (0, index_js_3.numToHex)(limit ?? 10),
146
+ ], advanced_js_1.JsonRpcTransformers.findCellsResponseTo);
147
+ /**
148
+ * find transactions from node.
149
+ *
150
+ * @param key - The search key of transactions.
151
+ * @param order - The order of transactions.
152
+ * @param limit - The max return size of transactions.
153
+ * @param after - Pagination parameter.
154
+ * @returns The found transactions.
155
+ */
156
+ this.findTransactionsPaged = this.buildSender("get_transactions", [
157
+ advanced_js_1.JsonRpcTransformers.indexerSearchKeyTransactionFrom,
158
+ (order) => order ?? "asc",
159
+ (limit) => (0, index_js_3.numToHex)(limit ?? 10),
160
+ ], advanced_js_1.JsonRpcTransformers.findTransactionsResponseTo);
161
+ /**
162
+ * get cells capacity from node.
163
+ *
164
+ * @param key - The search key of cells.
165
+ * @returns The sum of cells capacity.
166
+ */
167
+ this.getCellsCapacity = this.buildSender("get_cells_capacity", [advanced_js_1.JsonRpcTransformers.indexerSearchKeyFrom], ({ capacity }) => (0, index_js_3.numFrom)(capacity));
168
+ this.requestor =
169
+ config?.requestor ??
170
+ new requestor_js_1.RequestorJsonRpc(url_, config, (errAny) => {
171
+ if (typeof errAny !== "object" ||
172
+ errAny === null ||
173
+ !("data" in errAny) ||
174
+ typeof errAny.data !== "string") {
175
+ throw errAny;
176
+ }
177
+ const err = errAny;
178
+ for (const [regexp, builder] of ERROR_PARSERS) {
179
+ const match = err.data.match(regexp);
180
+ if (match) {
181
+ throw builder(err, match);
182
+ }
183
+ }
184
+ throw new clientTypes_js_1.ErrorClientBase(err);
185
+ });
186
+ }
187
+ /**
188
+ * Returns the URL of the JSON-RPC server.
189
+ *
190
+ * @returns The URL of the JSON-RPC server.
191
+ */
192
+ get url() {
193
+ return this.requestor.url;
194
+ }
195
+ /**
196
+ * Get a live cell from node.
197
+ *
198
+ * @param outPoint - The out point of the cell.
199
+ * @param withData - Include data in the response.
200
+ * @param includeTxPool - Include cells in the tx pool.
201
+ * @returns The cell
202
+ */
203
+ getCellLiveNoCache(outPoint, withData, includeTxPool) {
204
+ return this.buildSender("get_live_cell", [advanced_js_1.JsonRpcTransformers.outPointFrom], ({ cell, }) => (0, index_js_4.apply)(({ output, data, }) => index_js_1.Cell.from({
205
+ cellOutput: advanced_js_1.JsonRpcTransformers.cellOutputTo(output),
206
+ outputData: data?.content ?? "0x",
207
+ outPoint,
208
+ }), cell))(outPoint, withData ?? true, includeTxPool);
209
+ }
210
+ /**
211
+ * Builds a sender function for a JSON-RPC method.
212
+ *
213
+ * @param rpcMethod - The JSON-RPC method.
214
+ * @param inTransformers - An array of input transformers.
215
+ * @param outTransformer - An output transformer function.
216
+ * @returns A function that sends a JSON-RPC request with the given method and transformed parameters.
217
+ */
218
+ buildSender(rpcMethod, inTransformers, outTransformer) {
219
+ return async (...req) => {
220
+ return this.requestor.request(rpcMethod, req, inTransformers, outTransformer);
221
+ };
222
+ }
223
+ }
224
+ exports.ClientJsonRpc = ClientJsonRpc;
@@ -1,183 +1,2 @@
1
- import { Cell, OutPointLike, TransactionLike } from "../../ckb/index.js";
2
- import { Hex, HexLike } from "../../hex/index.js";
3
- import { Num, NumLike } from "../../num/index.js";
4
- import { ClientCache } from "../cache/index.js";
5
- import { Client } from "../client.js";
6
- import { ClientFindCellsResponse, ClientIndexerSearchKeyLike, ClientTransactionResponse, OutputsValidator } from "../clientTypes.js";
7
- import { JsonRpcPayload, Transport } from "../transports/advanced.js";
8
- /**
9
- * An abstract class implementing JSON-RPC client functionality for a specific URL and timeout.
10
- * Provides methods for sending transactions and building JSON-RPC payloads.
11
- */
12
- export declare abstract class ClientJsonRpc extends Client {
13
- private readonly url_;
14
- private readonly maxConcurrent?;
15
- private concurrent;
16
- private readonly pending;
17
- private id;
18
- private readonly transport;
19
- /**
20
- * Creates an instance of ClientJsonRpc.
21
- *
22
- * @param url_ - The URL of the JSON-RPC server.
23
- * @param timeout - The timeout for requests in milliseconds
24
- */
25
- constructor(url_: string, config?: {
26
- timeout?: number;
27
- cache?: ClientCache;
28
- maxConcurrent?: number;
29
- transport?: Transport;
30
- });
31
- /**
32
- * Returns the URL of the JSON-RPC server.
33
- *
34
- * @returns The URL of the JSON-RPC server.
35
- */
36
- get url(): string;
37
- /**
38
- * Get fee rate statistics
39
- *
40
- * @returns Fee rate statistics
41
- */
42
- getFeeRateStatistics: Client["getFeeRateStatistics"];
43
- /**
44
- * Get tip block number
45
- *
46
- * @returns Tip block number
47
- */
48
- getTip: () => Promise<Num>;
49
- /**
50
- * Get tip block header
51
- *
52
- * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
53
- * @returns BlockHeader
54
- */
55
- getTipHeader: Client["getTipHeader"];
56
- /**
57
- * Get block by block number
58
- *
59
- * @param blockNumber - The block number.
60
- * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
61
- * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
62
- * @returns Block
63
- */
64
- getBlockByNumber: Client["getBlockByNumber"];
65
- /**
66
- * Get block by block hash
67
- *
68
- * @param blockHash - The block hash.
69
- * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
70
- * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
71
- * @returns Block
72
- */
73
- getBlockByHash: Client["getBlockByHash"];
74
- /**
75
- * Get header by block number
76
- *
77
- * @param blockNumber - The block number.
78
- * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
79
- * @returns BlockHeader
80
- */
81
- getHeaderByNumber: Client["getHeaderByNumber"];
82
- /**
83
- * Get header by block hash
84
- *
85
- * @param blockHash - The block hash.
86
- * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
87
- * @returns BlockHeader
88
- */
89
- getHeaderByHash: Client["getHeaderByHash"];
90
- /**
91
- * Estimate cycles of a transaction.
92
- *
93
- * @param transaction - The transaction to estimate.
94
- * @returns Consumed cycles
95
- */
96
- estimateCycles: Client["estimateCycles"];
97
- /**
98
- * Test a transaction.
99
- *
100
- * @param transaction - The transaction to test.
101
- * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
102
- * @returns Consumed cycles
103
- */
104
- sendTransactionDry: Client["sendTransactionDry"];
105
- /**
106
- * Send a transaction to node.
107
- *
108
- * @param transaction - The transaction to send.
109
- * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
110
- * @returns Transaction hash.
111
- */
112
- sendTransactionNoCache: (transaction: TransactionLike, validator?: OutputsValidator | undefined) => Promise<Hex>;
113
- /**
114
- * Get a transaction from node.
115
- *
116
- * @param txHash - The hash of the transaction.
117
- * @returns The transaction with status.
118
- */
119
- getTransactionNoCache: (txHash: HexLike) => Promise<ClientTransactionResponse | undefined>;
120
- /**
121
- * Get a live cell from node.
122
- *
123
- * @param outPoint - The out point of the cell.
124
- * @param withData - Include data in the response.
125
- * @param includeTxPool - Include cells in the tx pool.
126
- * @returns The cell
127
- */
128
- getCellLiveNoCache(outPoint: OutPointLike, withData?: boolean | null, includeTxPool?: boolean | null): Promise<Cell | undefined>;
129
- /**
130
- * find cells from node.
131
- *
132
- * @param key - The search key of cells.
133
- * @param order - The order of cells.
134
- * @param limit - The max return size of cells.
135
- * @param after - Pagination parameter.
136
- * @returns The found cells.
137
- */
138
- findCellsPagedNoCache: (key: ClientIndexerSearchKeyLike, order?: "asc" | "desc", limit?: NumLike, after?: string) => Promise<ClientFindCellsResponse>;
139
- /**
140
- * find transactions from node.
141
- *
142
- * @param key - The search key of transactions.
143
- * @param order - The order of transactions.
144
- * @param limit - The max return size of transactions.
145
- * @param after - Pagination parameter.
146
- * @returns The found transactions.
147
- */
148
- findTransactionsPaged: Client["findTransactionsPaged"];
149
- /**
150
- * get cells capacity from node.
151
- *
152
- * @param key - The search key of cells.
153
- * @returns The sum of cells capacity.
154
- */
155
- getCellsCapacity: (key: ClientIndexerSearchKeyLike) => Promise<Num>;
156
- /**
157
- * Builds a sender function for a JSON-RPC method.
158
- *
159
- * @param rpcMethod - The JSON-RPC method.
160
- * @param inTransformers - An array of input transformers.
161
- * @param outTransformer - An output transformer function.
162
- * @returns A function that sends a JSON-RPC request with the given method and transformed parameters.
163
- */
164
- buildSender(rpcMethod: string, inTransformers: (((_: any) => unknown) | undefined)[], outTransformer?: (_: any) => unknown): (...req: unknown[]) => Promise<unknown>;
165
- /**
166
- * Sends a JSON-RPC request to the server.
167
- *
168
- * @param payload - The JSON-RPC payload to send.
169
- * @returns The result of the JSON-RPC request.
170
- *
171
- * @throws Will throw an error if the response ID does not match the request ID, or if the response contains an error.
172
- */
173
- send(payload: JsonRpcPayload): Promise<unknown>;
174
- /**
175
- * Builds a JSON-RPC payload for the given method and parameters.
176
- *
177
- * @param method - The JSON-RPC method name.
178
- * @param req - The parameters for the JSON-RPC method.
179
- * @returns The JSON-RPC payload.
180
- */
181
- buildPayload(method: string, req: unknown[]): JsonRpcPayload;
182
- }
1
+ export * from "./client.js";
183
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/jsonRpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAEJ,YAAY,EACZ,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EAOzB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,SAAS,EAEV,MAAM,2BAA2B,CAAC;AAgEnC;;;GAGG;AAEH,8BAAsB,aAAc,SAAQ,MAAM;IAgB9C,OAAO,CAAC,QAAQ,CAAC,IAAI;IAfvB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAS;IACxC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAE9C,OAAO,CAAC,EAAE,CAAK;IACf,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IAEtC;;;;;OAKG;gBAGgB,IAAI,EAAE,MAAM,EAC7B,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB;IAQH;;;;OAIG;IAEH,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;;;OAIG;IAEH,oBAAoB,EAOf,MAAM,CAAC,sBAAsB,CAAC,CAAC;IA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