@ckb-ccc/core 1.2.3 → 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 (140) hide show
  1. package/CHANGELOG.md +16 -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/predefined.d.ts +12 -0
  47. package/dist/molecule/predefined.d.ts.map +1 -1
  48. package/dist/molecule/predefined.js +28 -0
  49. package/dist/num/index.d.ts.map +1 -1
  50. package/dist/num/index.js +5 -1
  51. package/dist.commonjs/advancedBarrel.d.ts +1 -0
  52. package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
  53. package/dist.commonjs/advancedBarrel.js +1 -0
  54. package/dist.commonjs/barrel.d.ts +1 -0
  55. package/dist.commonjs/barrel.d.ts.map +1 -1
  56. package/dist.commonjs/barrel.js +1 -0
  57. package/dist.commonjs/ckb/script.d.ts +1 -0
  58. package/dist.commonjs/ckb/script.d.ts.map +1 -1
  59. package/dist.commonjs/ckb/script.js +2 -1
  60. package/dist.commonjs/ckb/transaction.d.ts +3 -1
  61. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  62. package/dist.commonjs/ckb/transaction.js +25 -2
  63. package/dist.commonjs/client/advanced.d.ts +0 -1
  64. package/dist.commonjs/client/advanced.d.ts.map +1 -1
  65. package/dist.commonjs/client/advanced.js +0 -1
  66. package/dist.commonjs/client/clientPublicMainnet.d.ts +3 -9
  67. package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
  68. package/dist.commonjs/client/clientPublicTestnet.d.ts +3 -9
  69. package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
  70. package/dist.commonjs/client/jsonRpc/client.d.ts +160 -0
  71. package/dist.commonjs/client/jsonRpc/client.d.ts.map +1 -0
  72. package/dist.commonjs/client/jsonRpc/client.js +224 -0
  73. package/dist.commonjs/client/jsonRpc/index.d.ts +1 -182
  74. package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
  75. package/dist.commonjs/client/jsonRpc/index.js +15 -295
  76. package/dist.commonjs/jsonRpc/advanced.d.ts +2 -0
  77. package/dist.commonjs/jsonRpc/advanced.d.ts.map +1 -0
  78. package/dist.commonjs/jsonRpc/advanced.js +17 -0
  79. package/dist.commonjs/jsonRpc/index.d.ts +2 -0
  80. package/dist.commonjs/jsonRpc/index.d.ts.map +1 -0
  81. package/dist.commonjs/jsonRpc/index.js +17 -0
  82. package/dist.commonjs/jsonRpc/requestor.d.ts +48 -0
  83. package/dist.commonjs/jsonRpc/requestor.d.ts.map +1 -0
  84. package/dist.commonjs/jsonRpc/requestor.js +111 -0
  85. package/dist.commonjs/jsonRpc/transports/advanced.d.ts +5 -0
  86. package/dist.commonjs/jsonRpc/transports/advanced.d.ts.map +1 -0
  87. package/dist.commonjs/{client → jsonRpc}/transports/advanced.js +1 -9
  88. package/dist.commonjs/{client/transports/advanced.d.ts → jsonRpc/transports/factory.d.ts} +1 -4
  89. package/dist.commonjs/jsonRpc/transports/factory.d.ts.map +1 -0
  90. package/dist.commonjs/jsonRpc/transports/factory.js +11 -0
  91. package/dist.commonjs/jsonRpc/transports/http.d.ts.map +1 -0
  92. package/dist.commonjs/jsonRpc/transports/transport.d.ts +18 -0
  93. package/dist.commonjs/jsonRpc/transports/transport.d.ts.map +1 -0
  94. package/dist.commonjs/jsonRpc/transports/webSocket.d.ts.map +1 -0
  95. package/dist.commonjs/molecule/predefined.d.ts +12 -0
  96. package/dist.commonjs/molecule/predefined.d.ts.map +1 -1
  97. package/dist.commonjs/molecule/predefined.js +30 -1
  98. package/dist.commonjs/num/index.d.ts.map +1 -1
  99. package/dist.commonjs/num/index.js +5 -1
  100. package/package.json +1 -1
  101. package/src/advancedBarrel.ts +1 -0
  102. package/src/barrel.ts +1 -0
  103. package/src/ckb/script.ts +1 -0
  104. package/src/ckb/transaction.ts +52 -2
  105. package/src/client/advanced.ts +0 -1
  106. package/src/client/clientPublicMainnet.ts +2 -8
  107. package/src/client/clientPublicTestnet.ts +2 -8
  108. package/src/client/jsonRpc/client.ts +395 -0
  109. package/src/client/jsonRpc/index.ts +1 -490
  110. package/src/jsonRpc/advanced.ts +1 -0
  111. package/src/jsonRpc/index.ts +1 -0
  112. package/src/jsonRpc/requestor.ts +157 -0
  113. package/src/jsonRpc/transports/advanced.ts +4 -0
  114. package/src/{client/transports/advanced.ts → jsonRpc/transports/factory.ts} +0 -4
  115. package/src/jsonRpc/transports/transport.ts +18 -0
  116. package/src/molecule/predefined.ts +32 -0
  117. package/src/num/index.ts +5 -1
  118. package/dist/client/transports/advanced.d.ts.map +0 -1
  119. package/dist/client/transports/http.d.ts.map +0 -1
  120. package/dist/client/transports/transport.d.ts +0 -10
  121. package/dist/client/transports/transport.d.ts.map +0 -1
  122. package/dist/client/transports/webSocket.d.ts.map +0 -1
  123. package/dist.commonjs/client/transports/advanced.d.ts.map +0 -1
  124. package/dist.commonjs/client/transports/http.d.ts.map +0 -1
  125. package/dist.commonjs/client/transports/transport.d.ts +0 -10
  126. package/dist.commonjs/client/transports/transport.d.ts.map +0 -1
  127. package/dist.commonjs/client/transports/webSocket.d.ts.map +0 -1
  128. package/src/client/transports/transport.ts +0 -10
  129. /package/dist/{client → jsonRpc}/transports/http.d.ts +0 -0
  130. /package/dist/{client → jsonRpc}/transports/http.js +0 -0
  131. /package/dist/{client → jsonRpc}/transports/transport.js +0 -0
  132. /package/dist/{client → jsonRpc}/transports/webSocket.d.ts +0 -0
  133. /package/dist/{client → jsonRpc}/transports/webSocket.js +0 -0
  134. /package/dist.commonjs/{client → jsonRpc}/transports/http.d.ts +0 -0
  135. /package/dist.commonjs/{client → jsonRpc}/transports/http.js +0 -0
  136. /package/dist.commonjs/{client → jsonRpc}/transports/transport.js +0 -0
  137. /package/dist.commonjs/{client → jsonRpc}/transports/webSocket.d.ts +0 -0
  138. /package/dist.commonjs/{client → jsonRpc}/transports/webSocket.js +0 -0
  139. /package/src/{client → jsonRpc}/transports/http.ts +0 -0
  140. /package/src/{client → jsonRpc}/transports/webSocket.ts +0 -0
@@ -0,0 +1,395 @@
1
+ import {
2
+ Cell,
3
+ OutPoint,
4
+ OutPointLike,
5
+ TransactionLike,
6
+ } from "../../ckb/index.js";
7
+ import { Hex, HexLike, hexFrom } from "../../hex/index.js";
8
+ import {
9
+ RequestorJsonRpc,
10
+ RequestorJsonRpcConfig,
11
+ } from "../../jsonRpc/requestor.js";
12
+ import { Num, NumLike, numFrom, numToHex } from "../../num/index.js";
13
+ import { apply } from "../../utils/index.js";
14
+ import { ClientCache } from "../cache/index.js";
15
+ import { Client } from "../client.js";
16
+ import {
17
+ ClientFindCellsResponse,
18
+ ClientIndexerSearchKeyLike,
19
+ ClientTransactionResponse,
20
+ ErrorClientBase,
21
+ ErrorClientBaseLike,
22
+ ErrorClientDuplicatedTransaction,
23
+ ErrorClientRBFRejected,
24
+ ErrorClientResolveUnknown,
25
+ ErrorClientVerification,
26
+ OutputsValidator,
27
+ } from "../clientTypes.js";
28
+ import {
29
+ JsonRpcBlock,
30
+ JsonRpcBlockHeader,
31
+ JsonRpcCellOutput,
32
+ JsonRpcTransformers,
33
+ } from "./advanced.js";
34
+
35
+ const ERROR_PARSERS: [
36
+ string,
37
+ (error: ErrorClientBaseLike, match: RegExpMatchArray) => ErrorClientBase,
38
+ ][] = [
39
+ [
40
+ "Resolve\\(Unknown\\(OutPoint\\((0x.*)\\)\\)\\)",
41
+ (error, match) =>
42
+ new ErrorClientResolveUnknown(error, OutPoint.fromBytes(match[1])),
43
+ ],
44
+ [
45
+ "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",
46
+ (error, match) =>
47
+ new ErrorClientVerification(
48
+ error,
49
+ match[3] === "Lock"
50
+ ? "lock"
51
+ : match[1] === "Inputs"
52
+ ? "inputType"
53
+ : "outputType",
54
+ match[2],
55
+ Number(match[4]),
56
+ match[5] === "data" ? "data" : "type",
57
+ match[6],
58
+ ),
59
+ ],
60
+ [
61
+ "Duplicated\\(Byte32\\((0x.*)\\)\\)",
62
+ (error, match) => new ErrorClientDuplicatedTransaction(error, match[1]),
63
+ ],
64
+ [
65
+ 'RBFRejected\\("Tx\'s current fee is ([0-9]*), expect it to >= ([0-9]*) to replace old txs"\\)',
66
+ (error, match) => new ErrorClientRBFRejected(error, match[1], match[2]),
67
+ ],
68
+ ];
69
+
70
+ export type ClientJsonRpcConfig = RequestorJsonRpcConfig & {
71
+ cache?: ClientCache;
72
+ requestor?: RequestorJsonRpc;
73
+ };
74
+
75
+ /**
76
+ * An abstract class implementing JSON-RPC client functionality for a specific URL and timeout.
77
+ * Provides methods for sending transactions and building JSON-RPC payloads.
78
+ */
79
+ export abstract class ClientJsonRpc extends Client {
80
+ public readonly requestor: RequestorJsonRpc;
81
+
82
+ /**
83
+ * Creates an instance of ClientJsonRpc.
84
+ *
85
+ * @param url_ - The URL of the JSON-RPC server.
86
+ * @param timeout - The timeout for requests in milliseconds
87
+ */
88
+
89
+ constructor(url_: string, config?: ClientJsonRpcConfig) {
90
+ super(config);
91
+
92
+ this.requestor =
93
+ config?.requestor ??
94
+ new RequestorJsonRpc(url_, config, (errAny) => {
95
+ if (
96
+ typeof errAny !== "object" ||
97
+ errAny === null ||
98
+ !("data" in errAny) ||
99
+ typeof errAny.data !== "string"
100
+ ) {
101
+ throw errAny;
102
+ }
103
+ const err = errAny as ErrorClientBaseLike;
104
+
105
+ for (const [regexp, builder] of ERROR_PARSERS) {
106
+ const match = err.data.match(regexp);
107
+ if (match) {
108
+ throw builder(err, match);
109
+ }
110
+ }
111
+
112
+ throw new ErrorClientBase(err);
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Returns the URL of the JSON-RPC server.
118
+ *
119
+ * @returns The URL of the JSON-RPC server.
120
+ */
121
+ get url(): string {
122
+ return this.requestor.url;
123
+ }
124
+
125
+ /**
126
+ * Get fee rate statistics
127
+ *
128
+ * @returns Fee rate statistics
129
+ */
130
+
131
+ getFeeRateStatistics = this.buildSender(
132
+ "get_fee_rate_statistics",
133
+ [(n: NumLike) => apply(numFrom, n)],
134
+ ({ mean, median }: { mean: NumLike; median: NumLike }) => ({
135
+ mean: numFrom(mean),
136
+ median: numFrom(median),
137
+ }),
138
+ ) as Client["getFeeRateStatistics"];
139
+
140
+ /**
141
+ * Get tip block number
142
+ *
143
+ * @returns Tip block number
144
+ */
145
+
146
+ getTip = this.buildSender(
147
+ "get_tip_block_number",
148
+ [],
149
+ numFrom,
150
+ ) as () => Promise<Num>;
151
+
152
+ /**
153
+ * Get tip block header
154
+ *
155
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
156
+ * @returns BlockHeader
157
+ */
158
+ getTipHeader = this.buildSender(
159
+ "get_tip_header",
160
+ [],
161
+ (b: JsonRpcBlockHeader) => apply(JsonRpcTransformers.blockHeaderTo, b),
162
+ ) as Client["getTipHeader"];
163
+
164
+ /**
165
+ * Get block by block number
166
+ *
167
+ * @param blockNumber - The block number.
168
+ * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
169
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
170
+ * @returns Block
171
+ */
172
+ getBlockByNumber = this.buildSender(
173
+ "get_block_by_number",
174
+ [(v: NumLike) => numToHex(numFrom(v))],
175
+ (b: JsonRpcBlock) => apply(JsonRpcTransformers.blockTo, b),
176
+ ) as Client["getBlockByNumber"];
177
+
178
+ /**
179
+ * Get block by block hash
180
+ *
181
+ * @param blockHash - The block hash.
182
+ * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
183
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
184
+ * @returns Block
185
+ */
186
+ getBlockByHash = this.buildSender("get_block", [hexFrom], (b: JsonRpcBlock) =>
187
+ apply(JsonRpcTransformers.blockTo, b),
188
+ ) as Client["getBlockByHash"];
189
+
190
+ /**
191
+ * Get header by block number
192
+ *
193
+ * @param blockNumber - The block number.
194
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
195
+ * @returns BlockHeader
196
+ */
197
+ getHeaderByNumber = this.buildSender(
198
+ "get_header_by_number",
199
+ [(v: NumLike) => numToHex(numFrom(v))],
200
+ (b: JsonRpcBlockHeader) => apply(JsonRpcTransformers.blockHeaderTo, b),
201
+ ) as Client["getHeaderByNumber"];
202
+
203
+ /**
204
+ * Get header by block hash
205
+ *
206
+ * @param blockHash - The block hash.
207
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
208
+ * @returns BlockHeader
209
+ */
210
+ getHeaderByHash = this.buildSender(
211
+ "get_header",
212
+ [hexFrom],
213
+ (b: JsonRpcBlockHeader) => apply(JsonRpcTransformers.blockHeaderTo, b),
214
+ ) as Client["getHeaderByHash"];
215
+
216
+ /**
217
+ * Estimate cycles of a transaction.
218
+ *
219
+ * @param transaction - The transaction to estimate.
220
+ * @returns Consumed cycles
221
+ */
222
+ estimateCycles = this.buildSender(
223
+ "estimate_cycles",
224
+ [JsonRpcTransformers.transactionFrom],
225
+ ({ cycles }: { cycles: NumLike }) => numFrom(cycles),
226
+ ) as Client["estimateCycles"];
227
+
228
+ /**
229
+ * Test a transaction.
230
+ *
231
+ * @param transaction - The transaction to test.
232
+ * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
233
+ * @returns Consumed cycles
234
+ */
235
+
236
+ sendTransactionDry = this.buildSender(
237
+ "test_tx_pool_accept",
238
+ [JsonRpcTransformers.transactionFrom],
239
+ ({ cycles }: { cycles: NumLike }) => numFrom(cycles),
240
+ ) as Client["sendTransactionDry"];
241
+
242
+ /**
243
+ * Send a transaction to node.
244
+ *
245
+ * @param transaction - The transaction to send.
246
+ * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
247
+ * @returns Transaction hash.
248
+ */
249
+
250
+ sendTransactionNoCache = this.buildSender(
251
+ "send_transaction",
252
+ [JsonRpcTransformers.transactionFrom],
253
+ hexFrom,
254
+ ) as (
255
+ transaction: TransactionLike,
256
+ validator?: OutputsValidator | undefined,
257
+ ) => Promise<Hex>;
258
+
259
+ /**
260
+ * Get a transaction from node.
261
+ *
262
+ * @param txHash - The hash of the transaction.
263
+ * @returns The transaction with status.
264
+ */
265
+
266
+ getTransactionNoCache = this.buildSender(
267
+ "get_transaction",
268
+ [hexFrom],
269
+ JsonRpcTransformers.transactionResponseTo,
270
+ ) as (txHash: HexLike) => Promise<ClientTransactionResponse | undefined>;
271
+
272
+ /**
273
+ * Get a live cell from node.
274
+ *
275
+ * @param outPoint - The out point of the cell.
276
+ * @param withData - Include data in the response.
277
+ * @param includeTxPool - Include cells in the tx pool.
278
+ * @returns The cell
279
+ */
280
+ getCellLiveNoCache(
281
+ outPoint: OutPointLike,
282
+ withData?: boolean | null,
283
+ includeTxPool?: boolean | null,
284
+ ) {
285
+ return this.buildSender(
286
+ "get_live_cell",
287
+ [JsonRpcTransformers.outPointFrom],
288
+ ({
289
+ cell,
290
+ }: {
291
+ cell?: {
292
+ output: JsonRpcCellOutput;
293
+ data?: { content: HexLike; hash: HexLike };
294
+ };
295
+ }) =>
296
+ apply(
297
+ ({
298
+ output,
299
+ data,
300
+ }: {
301
+ output: JsonRpcCellOutput;
302
+ data?: { content: HexLike; hash: HexLike };
303
+ }) =>
304
+ Cell.from({
305
+ cellOutput: JsonRpcTransformers.cellOutputTo(output),
306
+ outputData: data?.content ?? "0x",
307
+ outPoint,
308
+ }),
309
+ cell,
310
+ ),
311
+ )(outPoint, withData ?? true, includeTxPool) as Promise<Cell | undefined>;
312
+ }
313
+
314
+ /**
315
+ * find cells from node.
316
+ *
317
+ * @param key - The search key of cells.
318
+ * @param order - The order of cells.
319
+ * @param limit - The max return size of cells.
320
+ * @param after - Pagination parameter.
321
+ * @returns The found cells.
322
+ */
323
+
324
+ findCellsPagedNoCache = this.buildSender(
325
+ "get_cells",
326
+ [
327
+ JsonRpcTransformers.indexerSearchKeyFrom,
328
+ (order?: "asc" | "desc") => order ?? "asc",
329
+ (limit?: NumLike) => numToHex(limit ?? 10),
330
+ ],
331
+ JsonRpcTransformers.findCellsResponseTo,
332
+ ) as (
333
+ key: ClientIndexerSearchKeyLike,
334
+ order?: "asc" | "desc",
335
+ limit?: NumLike,
336
+ after?: string,
337
+ ) => Promise<ClientFindCellsResponse>;
338
+
339
+ /**
340
+ * find transactions from node.
341
+ *
342
+ * @param key - The search key of transactions.
343
+ * @param order - The order of transactions.
344
+ * @param limit - The max return size of transactions.
345
+ * @param after - Pagination parameter.
346
+ * @returns The found transactions.
347
+ */
348
+
349
+ findTransactionsPaged = this.buildSender(
350
+ "get_transactions",
351
+ [
352
+ JsonRpcTransformers.indexerSearchKeyTransactionFrom,
353
+ (order?: "asc" | "desc") => order ?? "asc",
354
+ (limit?: NumLike) => numToHex(limit ?? 10),
355
+ ],
356
+ JsonRpcTransformers.findTransactionsResponseTo,
357
+ ) as Client["findTransactionsPaged"];
358
+
359
+ /**
360
+ * get cells capacity from node.
361
+ *
362
+ * @param key - The search key of cells.
363
+ * @returns The sum of cells capacity.
364
+ */
365
+
366
+ getCellsCapacity = this.buildSender(
367
+ "get_cells_capacity",
368
+ [JsonRpcTransformers.indexerSearchKeyFrom],
369
+ ({ capacity }: { capacity: NumLike }) => numFrom(capacity),
370
+ ) as (key: ClientIndexerSearchKeyLike) => Promise<Num>;
371
+
372
+ /**
373
+ * Builds a sender function for a JSON-RPC method.
374
+ *
375
+ * @param rpcMethod - The JSON-RPC method.
376
+ * @param inTransformers - An array of input transformers.
377
+ * @param outTransformer - An output transformer function.
378
+ * @returns A function that sends a JSON-RPC request with the given method and transformed parameters.
379
+ */
380
+
381
+ buildSender(
382
+ rpcMethod: Parameters<RequestorJsonRpc["request"]>[0],
383
+ inTransformers?: Parameters<RequestorJsonRpc["request"]>[2],
384
+ outTransformer?: Parameters<RequestorJsonRpc["request"]>[3],
385
+ ): (...req: unknown[]) => Promise<unknown> {
386
+ return async (...req: unknown[]) => {
387
+ return this.requestor.request(
388
+ rpcMethod,
389
+ req,
390
+ inTransformers,
391
+ outTransformer,
392
+ );
393
+ };
394
+ }
395
+ }