@ckb-ccc/core 0.0.14-alpha.2 → 0.0.14
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.
- package/CHANGELOG.md +21 -0
- package/dist/signer/signer/index.d.ts +25 -2
- package/dist/signer/signer/index.d.ts.map +1 -1
- package/dist/signer/signer/index.js +26 -2
- package/dist.commonjs/signer/signer/index.d.ts +25 -2
- package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
- package/dist.commonjs/signer/signer/index.js +26 -2
- package/package.json +1 -1
- package/src/signer/signer/index.ts +91 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @ckb-ccc/core
|
|
2
2
|
|
|
3
|
+
## 0.0.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5e942f8`](https://github.com/ckb-ecofund/ccc/commit/5e942f8f1ed678abdb7ab9716f5449f0714cea53) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): numLeFromBytes should not modify args
|
|
8
|
+
|
|
9
|
+
- [`f5b5938`](https://github.com/ckb-ecofund/ccc/commit/f5b5938ab8f9c0a338dfd6765fe717f7ad1b1dd8) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): ErrorClient types
|
|
10
|
+
|
|
11
|
+
- ErrorClientRBFRejected
|
|
12
|
+
- ErrorClientDuplicatedTransaction
|
|
13
|
+
|
|
14
|
+
- [#56](https://github.com/ckb-ecofund/ccc/pull/56) [`f13f4d3`](https://github.com/ckb-ecofund/ccc/commit/f13f4d319ca66b571029a65e945e3a038bfeea25) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): Signer.findTransactions
|
|
15
|
+
|
|
16
|
+
- [#50](https://github.com/ckb-ecofund/ccc/pull/50) [`7ba62a0`](https://github.com/ckb-ecofund/ccc/commit/7ba62a056f17808fe5684786c00c2dff80bb7d1d) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): jsonrpc id conflict
|
|
17
|
+
|
|
18
|
+
- [`2164efd`](https://github.com/ckb-ecofund/ccc/commit/2164efd6d834c1917ad5f4a514dc25941f937185) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): Support ACP addresses for private key signer
|
|
19
|
+
|
|
20
|
+
- [`e5bd2ad`](https://github.com/ckb-ecofund/ccc/commit/e5bd2ad5de4b42a22c422ecfc42056750f69b88b) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): since encoding
|
|
21
|
+
|
|
22
|
+
- [#48](https://github.com/ckb-ecofund/ccc/pull/48) [`aae3e06`](https://github.com/ckb-ecofund/ccc/commit/aae3e0679fb940dd8c12ac9be12a4b53277a339d) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): readable client error
|
|
23
|
+
|
|
3
24
|
## 0.0.14-alpha.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -2,7 +2,7 @@ import { Address } from "../../address/index.js";
|
|
|
2
2
|
import { ClientCollectableSearchKeyFilterLike } from "../../advancedBarrel.js";
|
|
3
3
|
import { BytesLike } from "../../bytes/index.js";
|
|
4
4
|
import { Cell, Transaction, TransactionLike } from "../../ckb/index.js";
|
|
5
|
-
import { Client } from "../../client/index.js";
|
|
5
|
+
import { Client, ClientFindTransactionsGroupedResponse, ClientFindTransactionsResponse } from "../../client/index.js";
|
|
6
6
|
import { Hex } from "../../hex/index.js";
|
|
7
7
|
import { Num } from "../../num/index.js";
|
|
8
8
|
/**
|
|
@@ -129,7 +129,30 @@ export declare abstract class Signer {
|
|
|
129
129
|
* @returns A promise that resolves to an array of addresses as strings.
|
|
130
130
|
*/
|
|
131
131
|
getAddresses(): Promise<string[]>;
|
|
132
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Find cells of this signer
|
|
134
|
+
*
|
|
135
|
+
* @returns A async generator that yields all matches cells
|
|
136
|
+
*/
|
|
137
|
+
findCells(filter: ClientCollectableSearchKeyFilterLike, withData?: boolean | null, order?: "asc" | "desc", limit?: number): AsyncGenerator<Cell>;
|
|
138
|
+
/**
|
|
139
|
+
* Find transactions of this signer
|
|
140
|
+
*
|
|
141
|
+
* @returns A async generator that yields all matches transactions
|
|
142
|
+
*/
|
|
143
|
+
findTransactions(filter: ClientCollectableSearchKeyFilterLike, groupByTransaction?: false | null, order?: "asc" | "desc", limit?: number): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0]>;
|
|
144
|
+
/**
|
|
145
|
+
* Find transactions of this signer
|
|
146
|
+
*
|
|
147
|
+
* @returns A async generator that yields all matches transactions
|
|
148
|
+
*/
|
|
149
|
+
findTransactions(filter: ClientCollectableSearchKeyFilterLike, groupByTransaction: true, order?: "asc" | "desc", limit?: number): AsyncGenerator<ClientFindTransactionsGroupedResponse["transactions"][0]>;
|
|
150
|
+
/**
|
|
151
|
+
* Find transactions of this signer
|
|
152
|
+
*
|
|
153
|
+
* @returns A async generator that yields all matches transactions
|
|
154
|
+
*/
|
|
155
|
+
findTransactions(filter: ClientCollectableSearchKeyFilterLike, groupByTransaction?: boolean | null, order?: "asc" | "desc", limit?: number): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0] | ClientFindTransactionsGroupedResponse["transactions"][0]>;
|
|
133
156
|
/**
|
|
134
157
|
* Gets balance of all addresses
|
|
135
158
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/signer/signer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/signer/signer/index.ts"],"names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C,WAAW,CAAC;IAKhE;;;;;;OAMG;IACH,kBAAkB,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAI5D;;;;;;OAMG;IACH,mBAAmB,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;CAG9D;AAED;;;GAGG;AACH,qBAAa,UAAU;IAEZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;gBADd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM;CAExB;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -125,7 +125,12 @@ export class Signer {
|
|
|
125
125
|
async getAddresses() {
|
|
126
126
|
return this.getAddressObjs().then((addresses) => addresses.map((address) => address.toString()));
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Find cells of this signer
|
|
130
|
+
*
|
|
131
|
+
* @returns A async generator that yields all matches cells
|
|
132
|
+
*/
|
|
133
|
+
async *findCells(filter, withData, order, limit) {
|
|
129
134
|
const scripts = await this.getAddressObjs();
|
|
130
135
|
for (const { script } of scripts) {
|
|
131
136
|
for await (const cell of this.client.findCells({
|
|
@@ -134,11 +139,30 @@ export class Signer {
|
|
|
134
139
|
filter,
|
|
135
140
|
scriptSearchMode: "exact",
|
|
136
141
|
withData,
|
|
137
|
-
})) {
|
|
142
|
+
}, order, limit)) {
|
|
138
143
|
yield cell;
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Find transactions of this signer
|
|
149
|
+
*
|
|
150
|
+
* @returns A async generator that yields all matches transactions
|
|
151
|
+
*/
|
|
152
|
+
async *findTransactions(filter, groupByTransaction, order, limit) {
|
|
153
|
+
const scripts = await this.getAddressObjs();
|
|
154
|
+
for (const { script } of scripts) {
|
|
155
|
+
for await (const transaction of this.client.findTransactions({
|
|
156
|
+
script,
|
|
157
|
+
scriptType: "lock",
|
|
158
|
+
filter,
|
|
159
|
+
scriptSearchMode: "exact",
|
|
160
|
+
groupByTransaction,
|
|
161
|
+
}, order, limit)) {
|
|
162
|
+
yield transaction;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
142
166
|
/**
|
|
143
167
|
* Gets balance of all addresses
|
|
144
168
|
*
|
|
@@ -2,7 +2,7 @@ import { Address } from "../../address/index.js";
|
|
|
2
2
|
import { ClientCollectableSearchKeyFilterLike } from "../../advancedBarrel.js";
|
|
3
3
|
import { BytesLike } from "../../bytes/index.js";
|
|
4
4
|
import { Cell, Transaction, TransactionLike } from "../../ckb/index.js";
|
|
5
|
-
import { Client } from "../../client/index.js";
|
|
5
|
+
import { Client, ClientFindTransactionsGroupedResponse, ClientFindTransactionsResponse } from "../../client/index.js";
|
|
6
6
|
import { Hex } from "../../hex/index.js";
|
|
7
7
|
import { Num } from "../../num/index.js";
|
|
8
8
|
/**
|
|
@@ -129,7 +129,30 @@ export declare abstract class Signer {
|
|
|
129
129
|
* @returns A promise that resolves to an array of addresses as strings.
|
|
130
130
|
*/
|
|
131
131
|
getAddresses(): Promise<string[]>;
|
|
132
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Find cells of this signer
|
|
134
|
+
*
|
|
135
|
+
* @returns A async generator that yields all matches cells
|
|
136
|
+
*/
|
|
137
|
+
findCells(filter: ClientCollectableSearchKeyFilterLike, withData?: boolean | null, order?: "asc" | "desc", limit?: number): AsyncGenerator<Cell>;
|
|
138
|
+
/**
|
|
139
|
+
* Find transactions of this signer
|
|
140
|
+
*
|
|
141
|
+
* @returns A async generator that yields all matches transactions
|
|
142
|
+
*/
|
|
143
|
+
findTransactions(filter: ClientCollectableSearchKeyFilterLike, groupByTransaction?: false | null, order?: "asc" | "desc", limit?: number): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0]>;
|
|
144
|
+
/**
|
|
145
|
+
* Find transactions of this signer
|
|
146
|
+
*
|
|
147
|
+
* @returns A async generator that yields all matches transactions
|
|
148
|
+
*/
|
|
149
|
+
findTransactions(filter: ClientCollectableSearchKeyFilterLike, groupByTransaction: true, order?: "asc" | "desc", limit?: number): AsyncGenerator<ClientFindTransactionsGroupedResponse["transactions"][0]>;
|
|
150
|
+
/**
|
|
151
|
+
* Find transactions of this signer
|
|
152
|
+
*
|
|
153
|
+
* @returns A async generator that yields all matches transactions
|
|
154
|
+
*/
|
|
155
|
+
findTransactions(filter: ClientCollectableSearchKeyFilterLike, groupByTransaction?: boolean | null, order?: "asc" | "desc", limit?: number): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0] | ClientFindTransactionsGroupedResponse["transactions"][0]>;
|
|
133
156
|
/**
|
|
134
157
|
* Gets balance of all addresses
|
|
135
158
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/signer/signer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/signer/signer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EACL,MAAM,EACN,qCAAqC,EACrC,8BAA8B,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E,MAAM,EACZ,MAAM,EAAE,MAAM;CAExB;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -129,7 +129,12 @@ class Signer {
|
|
|
129
129
|
async getAddresses() {
|
|
130
130
|
return this.getAddressObjs().then((addresses) => addresses.map((address) => address.toString()));
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Find cells of this signer
|
|
134
|
+
*
|
|
135
|
+
* @returns A async generator that yields all matches cells
|
|
136
|
+
*/
|
|
137
|
+
async *findCells(filter, withData, order, limit) {
|
|
133
138
|
const scripts = await this.getAddressObjs();
|
|
134
139
|
for (const { script } of scripts) {
|
|
135
140
|
for await (const cell of this.client.findCells({
|
|
@@ -138,11 +143,30 @@ class Signer {
|
|
|
138
143
|
filter,
|
|
139
144
|
scriptSearchMode: "exact",
|
|
140
145
|
withData,
|
|
141
|
-
})) {
|
|
146
|
+
}, order, limit)) {
|
|
142
147
|
yield cell;
|
|
143
148
|
}
|
|
144
149
|
}
|
|
145
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Find transactions of this signer
|
|
153
|
+
*
|
|
154
|
+
* @returns A async generator that yields all matches transactions
|
|
155
|
+
*/
|
|
156
|
+
async *findTransactions(filter, groupByTransaction, order, limit) {
|
|
157
|
+
const scripts = await this.getAddressObjs();
|
|
158
|
+
for (const { script } of scripts) {
|
|
159
|
+
for await (const transaction of this.client.findTransactions({
|
|
160
|
+
script,
|
|
161
|
+
scriptType: "lock",
|
|
162
|
+
filter,
|
|
163
|
+
scriptSearchMode: "exact",
|
|
164
|
+
groupByTransaction,
|
|
165
|
+
}, order, limit)) {
|
|
166
|
+
yield transaction;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
146
170
|
/**
|
|
147
171
|
* Gets balance of all addresses
|
|
148
172
|
*
|
package/package.json
CHANGED
|
@@ -2,7 +2,11 @@ import { Address } from "../../address/index.js";
|
|
|
2
2
|
import { ClientCollectableSearchKeyFilterLike } from "../../advancedBarrel.js";
|
|
3
3
|
import { BytesLike } from "../../bytes/index.js";
|
|
4
4
|
import { Cell, Transaction, TransactionLike } from "../../ckb/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Client,
|
|
7
|
+
ClientFindTransactionsGroupedResponse,
|
|
8
|
+
ClientFindTransactionsResponse,
|
|
9
|
+
} from "../../client/index.js";
|
|
6
10
|
import { Hex } from "../../hex/index.js";
|
|
7
11
|
import { Num } from "../../num/index.js";
|
|
8
12
|
import { verifyMessageBtcEcdsa } from "../btc/index.js";
|
|
@@ -226,24 +230,103 @@ export abstract class Signer {
|
|
|
226
230
|
);
|
|
227
231
|
}
|
|
228
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Find cells of this signer
|
|
235
|
+
*
|
|
236
|
+
* @returns A async generator that yields all matches cells
|
|
237
|
+
*/
|
|
229
238
|
async *findCells(
|
|
230
239
|
filter: ClientCollectableSearchKeyFilterLike,
|
|
231
240
|
withData?: boolean | null,
|
|
241
|
+
order?: "asc" | "desc",
|
|
242
|
+
limit?: number,
|
|
232
243
|
): AsyncGenerator<Cell> {
|
|
233
244
|
const scripts = await this.getAddressObjs();
|
|
234
245
|
for (const { script } of scripts) {
|
|
235
|
-
for await (const cell of this.client.findCells(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
246
|
+
for await (const cell of this.client.findCells(
|
|
247
|
+
{
|
|
248
|
+
script,
|
|
249
|
+
scriptType: "lock",
|
|
250
|
+
filter,
|
|
251
|
+
scriptSearchMode: "exact",
|
|
252
|
+
withData,
|
|
253
|
+
},
|
|
254
|
+
order,
|
|
255
|
+
limit,
|
|
256
|
+
)) {
|
|
242
257
|
yield cell;
|
|
243
258
|
}
|
|
244
259
|
}
|
|
245
260
|
}
|
|
246
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Find transactions of this signer
|
|
264
|
+
*
|
|
265
|
+
* @returns A async generator that yields all matches transactions
|
|
266
|
+
*/
|
|
267
|
+
findTransactions(
|
|
268
|
+
filter: ClientCollectableSearchKeyFilterLike,
|
|
269
|
+
groupByTransaction?: false | null,
|
|
270
|
+
order?: "asc" | "desc",
|
|
271
|
+
limit?: number,
|
|
272
|
+
): AsyncGenerator<ClientFindTransactionsResponse["transactions"][0]>;
|
|
273
|
+
/**
|
|
274
|
+
* Find transactions of this signer
|
|
275
|
+
*
|
|
276
|
+
* @returns A async generator that yields all matches transactions
|
|
277
|
+
*/
|
|
278
|
+
findTransactions(
|
|
279
|
+
filter: ClientCollectableSearchKeyFilterLike,
|
|
280
|
+
groupByTransaction: true,
|
|
281
|
+
order?: "asc" | "desc",
|
|
282
|
+
limit?: number,
|
|
283
|
+
): AsyncGenerator<ClientFindTransactionsGroupedResponse["transactions"][0]>;
|
|
284
|
+
/**
|
|
285
|
+
* Find transactions of this signer
|
|
286
|
+
*
|
|
287
|
+
* @returns A async generator that yields all matches transactions
|
|
288
|
+
*/
|
|
289
|
+
findTransactions(
|
|
290
|
+
filter: ClientCollectableSearchKeyFilterLike,
|
|
291
|
+
groupByTransaction?: boolean | null,
|
|
292
|
+
order?: "asc" | "desc",
|
|
293
|
+
limit?: number,
|
|
294
|
+
): AsyncGenerator<
|
|
295
|
+
| ClientFindTransactionsResponse["transactions"][0]
|
|
296
|
+
| ClientFindTransactionsGroupedResponse["transactions"][0]
|
|
297
|
+
>;
|
|
298
|
+
/**
|
|
299
|
+
* Find transactions of this signer
|
|
300
|
+
*
|
|
301
|
+
* @returns A async generator that yields all matches transactions
|
|
302
|
+
*/
|
|
303
|
+
async *findTransactions(
|
|
304
|
+
filter: ClientCollectableSearchKeyFilterLike,
|
|
305
|
+
groupByTransaction?: boolean | null,
|
|
306
|
+
order?: "asc" | "desc",
|
|
307
|
+
limit?: number,
|
|
308
|
+
): AsyncGenerator<
|
|
309
|
+
| ClientFindTransactionsResponse["transactions"][0]
|
|
310
|
+
| ClientFindTransactionsGroupedResponse["transactions"][0]
|
|
311
|
+
> {
|
|
312
|
+
const scripts = await this.getAddressObjs();
|
|
313
|
+
for (const { script } of scripts) {
|
|
314
|
+
for await (const transaction of this.client.findTransactions(
|
|
315
|
+
{
|
|
316
|
+
script,
|
|
317
|
+
scriptType: "lock",
|
|
318
|
+
filter,
|
|
319
|
+
scriptSearchMode: "exact",
|
|
320
|
+
groupByTransaction,
|
|
321
|
+
},
|
|
322
|
+
order,
|
|
323
|
+
limit,
|
|
324
|
+
)) {
|
|
325
|
+
yield transaction;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
247
330
|
/**
|
|
248
331
|
* Gets balance of all addresses
|
|
249
332
|
*
|