@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,220 @@
1
+ import { Cell, OutPoint, } from "../../ckb/index.js";
2
+ import { hexFrom } from "../../hex/index.js";
3
+ import { RequestorJsonRpc, } from "../../jsonRpc/requestor.js";
4
+ import { numFrom, numToHex } from "../../num/index.js";
5
+ import { apply } from "../../utils/index.js";
6
+ import { Client } from "../client.js";
7
+ import { ErrorClientBase, ErrorClientDuplicatedTransaction, ErrorClientRBFRejected, ErrorClientResolveUnknown, ErrorClientVerification, } from "../clientTypes.js";
8
+ import { JsonRpcTransformers, } from "./advanced.js";
9
+ const ERROR_PARSERS = [
10
+ [
11
+ "Resolve\\(Unknown\\(OutPoint\\((0x.*)\\)\\)\\)",
12
+ (error, match) => new ErrorClientResolveUnknown(error, OutPoint.fromBytes(match[1])),
13
+ ],
14
+ [
15
+ "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",
16
+ (error, match) => new ErrorClientVerification(error, match[3] === "Lock"
17
+ ? "lock"
18
+ : match[1] === "Inputs"
19
+ ? "inputType"
20
+ : "outputType", match[2], Number(match[4]), match[5] === "data" ? "data" : "type", match[6]),
21
+ ],
22
+ [
23
+ "Duplicated\\(Byte32\\((0x.*)\\)\\)",
24
+ (error, match) => new ErrorClientDuplicatedTransaction(error, match[1]),
25
+ ],
26
+ [
27
+ 'RBFRejected\\("Tx\'s current fee is ([0-9]*), expect it to >= ([0-9]*) to replace old txs"\\)',
28
+ (error, match) => new ErrorClientRBFRejected(error, match[1], match[2]),
29
+ ],
30
+ ];
31
+ /**
32
+ * An abstract class implementing JSON-RPC client functionality for a specific URL and timeout.
33
+ * Provides methods for sending transactions and building JSON-RPC payloads.
34
+ */
35
+ export class ClientJsonRpc extends Client {
36
+ /**
37
+ * Creates an instance of ClientJsonRpc.
38
+ *
39
+ * @param url_ - The URL of the JSON-RPC server.
40
+ * @param timeout - The timeout for requests in milliseconds
41
+ */
42
+ constructor(url_, config) {
43
+ super(config);
44
+ /**
45
+ * Get fee rate statistics
46
+ *
47
+ * @returns Fee rate statistics
48
+ */
49
+ this.getFeeRateStatistics = this.buildSender("get_fee_rate_statistics", [(n) => apply(numFrom, n)], ({ mean, median }) => ({
50
+ mean: numFrom(mean),
51
+ median: numFrom(median),
52
+ }));
53
+ /**
54
+ * Get tip block number
55
+ *
56
+ * @returns Tip block number
57
+ */
58
+ this.getTip = this.buildSender("get_tip_block_number", [], numFrom);
59
+ /**
60
+ * Get tip block header
61
+ *
62
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
63
+ * @returns BlockHeader
64
+ */
65
+ this.getTipHeader = this.buildSender("get_tip_header", [], (b) => apply(JsonRpcTransformers.blockHeaderTo, b));
66
+ /**
67
+ * Get block by block number
68
+ *
69
+ * @param blockNumber - The block number.
70
+ * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
71
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
72
+ * @returns Block
73
+ */
74
+ this.getBlockByNumber = this.buildSender("get_block_by_number", [(v) => numToHex(numFrom(v))], (b) => apply(JsonRpcTransformers.blockTo, b));
75
+ /**
76
+ * Get block by block hash
77
+ *
78
+ * @param blockHash - The block hash.
79
+ * @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
80
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
81
+ * @returns Block
82
+ */
83
+ this.getBlockByHash = this.buildSender("get_block", [hexFrom], (b) => apply(JsonRpcTransformers.blockTo, b));
84
+ /**
85
+ * Get header by block number
86
+ *
87
+ * @param blockNumber - The block number.
88
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
89
+ * @returns BlockHeader
90
+ */
91
+ this.getHeaderByNumber = this.buildSender("get_header_by_number", [(v) => numToHex(numFrom(v))], (b) => apply(JsonRpcTransformers.blockHeaderTo, b));
92
+ /**
93
+ * Get header by block hash
94
+ *
95
+ * @param blockHash - The block hash.
96
+ * @param verbosity - result format which allows 0 and 1. (Optional, the default is 1.)
97
+ * @returns BlockHeader
98
+ */
99
+ this.getHeaderByHash = this.buildSender("get_header", [hexFrom], (b) => apply(JsonRpcTransformers.blockHeaderTo, b));
100
+ /**
101
+ * Estimate cycles of a transaction.
102
+ *
103
+ * @param transaction - The transaction to estimate.
104
+ * @returns Consumed cycles
105
+ */
106
+ this.estimateCycles = this.buildSender("estimate_cycles", [JsonRpcTransformers.transactionFrom], ({ cycles }) => numFrom(cycles));
107
+ /**
108
+ * Test a transaction.
109
+ *
110
+ * @param transaction - The transaction to test.
111
+ * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
112
+ * @returns Consumed cycles
113
+ */
114
+ this.sendTransactionDry = this.buildSender("test_tx_pool_accept", [JsonRpcTransformers.transactionFrom], ({ cycles }) => numFrom(cycles));
115
+ /**
116
+ * Send a transaction to node.
117
+ *
118
+ * @param transaction - The transaction to send.
119
+ * @param validator - "passthrough": Disable validation. "well_known_scripts_only": Only accept well known scripts in the transaction.
120
+ * @returns Transaction hash.
121
+ */
122
+ this.sendTransactionNoCache = this.buildSender("send_transaction", [JsonRpcTransformers.transactionFrom], hexFrom);
123
+ /**
124
+ * Get a transaction from node.
125
+ *
126
+ * @param txHash - The hash of the transaction.
127
+ * @returns The transaction with status.
128
+ */
129
+ this.getTransactionNoCache = this.buildSender("get_transaction", [hexFrom], JsonRpcTransformers.transactionResponseTo);
130
+ /**
131
+ * find cells from node.
132
+ *
133
+ * @param key - The search key of cells.
134
+ * @param order - The order of cells.
135
+ * @param limit - The max return size of cells.
136
+ * @param after - Pagination parameter.
137
+ * @returns The found cells.
138
+ */
139
+ this.findCellsPagedNoCache = this.buildSender("get_cells", [
140
+ JsonRpcTransformers.indexerSearchKeyFrom,
141
+ (order) => order ?? "asc",
142
+ (limit) => numToHex(limit ?? 10),
143
+ ], JsonRpcTransformers.findCellsResponseTo);
144
+ /**
145
+ * find transactions from node.
146
+ *
147
+ * @param key - The search key of transactions.
148
+ * @param order - The order of transactions.
149
+ * @param limit - The max return size of transactions.
150
+ * @param after - Pagination parameter.
151
+ * @returns The found transactions.
152
+ */
153
+ this.findTransactionsPaged = this.buildSender("get_transactions", [
154
+ JsonRpcTransformers.indexerSearchKeyTransactionFrom,
155
+ (order) => order ?? "asc",
156
+ (limit) => numToHex(limit ?? 10),
157
+ ], JsonRpcTransformers.findTransactionsResponseTo);
158
+ /**
159
+ * get cells capacity from node.
160
+ *
161
+ * @param key - The search key of cells.
162
+ * @returns The sum of cells capacity.
163
+ */
164
+ this.getCellsCapacity = this.buildSender("get_cells_capacity", [JsonRpcTransformers.indexerSearchKeyFrom], ({ capacity }) => numFrom(capacity));
165
+ this.requestor =
166
+ config?.requestor ??
167
+ new RequestorJsonRpc(url_, config, (errAny) => {
168
+ if (typeof errAny !== "object" ||
169
+ errAny === null ||
170
+ !("data" in errAny) ||
171
+ typeof errAny.data !== "string") {
172
+ throw errAny;
173
+ }
174
+ const err = errAny;
175
+ for (const [regexp, builder] of ERROR_PARSERS) {
176
+ const match = err.data.match(regexp);
177
+ if (match) {
178
+ throw builder(err, match);
179
+ }
180
+ }
181
+ throw new ErrorClientBase(err);
182
+ });
183
+ }
184
+ /**
185
+ * Returns the URL of the JSON-RPC server.
186
+ *
187
+ * @returns The URL of the JSON-RPC server.
188
+ */
189
+ get url() {
190
+ return this.requestor.url;
191
+ }
192
+ /**
193
+ * Get a live cell from node.
194
+ *
195
+ * @param outPoint - The out point of the cell.
196
+ * @param withData - Include data in the response.
197
+ * @param includeTxPool - Include cells in the tx pool.
198
+ * @returns The cell
199
+ */
200
+ getCellLiveNoCache(outPoint, withData, includeTxPool) {
201
+ return this.buildSender("get_live_cell", [JsonRpcTransformers.outPointFrom], ({ cell, }) => apply(({ output, data, }) => Cell.from({
202
+ cellOutput: JsonRpcTransformers.cellOutputTo(output),
203
+ outputData: data?.content ?? "0x",
204
+ outPoint,
205
+ }), cell))(outPoint, withData ?? true, includeTxPool);
206
+ }
207
+ /**
208
+ * Builds a sender function for a JSON-RPC method.
209
+ *
210
+ * @param rpcMethod - The JSON-RPC method.
211
+ * @param inTransformers - An array of input transformers.
212
+ * @param outTransformer - An output transformer function.
213
+ * @returns A function that sends a JSON-RPC request with the given method and transformed parameters.
214
+ */
215
+ buildSender(rpcMethod, inTransformers, outTransformer) {
216
+ return async (...req) => {
217
+ return this.requestor.request(rpcMethod, req, inTransformers, outTransformer);
218
+ };
219
+ }
220
+ }
@@ -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,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