@ckb-ccc/core 0.0.13-alpha.1 → 0.0.13-alpha.3
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 +12 -0
- package/dist/client/advanced.d.ts +1 -1
- package/dist/client/advanced.d.ts.map +1 -1
- package/dist/client/advanced.js +1 -1
- package/dist/client/cache/advanced.d.ts +2 -0
- package/dist/client/cache/advanced.d.ts.map +1 -0
- package/dist/client/cache/advanced.js +1 -0
- package/dist/client/cache/cache.d.ts +15 -0
- package/dist/client/cache/cache.d.ts.map +1 -0
- package/dist/client/cache/cache.js +1 -0
- package/dist/client/cache/index.d.ts +3 -0
- package/dist/client/cache/index.d.ts.map +1 -0
- package/dist/client/cache/index.js +2 -0
- package/dist/client/{client.advanced.d.ts → cache/memory.advanced.d.ts} +5 -5
- package/dist/client/cache/memory.advanced.d.ts.map +1 -0
- package/dist/client/{client.advanced.js → cache/memory.advanced.js} +6 -6
- package/dist/client/cache/memory.d.ts +20 -0
- package/dist/client/cache/memory.d.ts.map +1 -0
- package/dist/client/cache/memory.js +73 -0
- package/dist/client/client.d.ts +4 -7
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +13 -44
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist.commonjs/client/advanced.d.ts +1 -1
- package/dist.commonjs/client/advanced.d.ts.map +1 -1
- package/dist.commonjs/client/advanced.js +1 -1
- package/dist.commonjs/client/cache/advanced.d.ts +2 -0
- package/dist.commonjs/client/cache/advanced.d.ts.map +1 -0
- package/dist.commonjs/client/cache/advanced.js +17 -0
- package/dist.commonjs/client/cache/cache.d.ts +15 -0
- package/dist.commonjs/client/cache/cache.d.ts.map +1 -0
- package/dist.commonjs/client/cache/cache.js +2 -0
- package/dist.commonjs/client/cache/index.d.ts +3 -0
- package/dist.commonjs/client/cache/index.d.ts.map +1 -0
- package/dist.commonjs/client/cache/index.js +18 -0
- package/dist.commonjs/client/{client.advanced.d.ts → cache/memory.advanced.d.ts} +5 -5
- package/dist.commonjs/client/cache/memory.advanced.d.ts.map +1 -0
- package/dist.commonjs/client/{client.advanced.js → cache/memory.advanced.js} +6 -6
- package/dist.commonjs/client/cache/memory.d.ts +20 -0
- package/dist.commonjs/client/cache/memory.d.ts.map +1 -0
- package/dist.commonjs/client/cache/memory.js +77 -0
- package/dist.commonjs/client/client.d.ts +4 -7
- package/dist.commonjs/client/client.d.ts.map +1 -1
- package/dist.commonjs/client/client.js +13 -44
- package/dist.commonjs/client/index.d.ts +1 -0
- package/dist.commonjs/client/index.d.ts.map +1 -1
- package/dist.commonjs/client/index.js +1 -0
- package/package.json +1 -1
- package/src/client/advanced.ts +1 -1
- package/src/client/cache/advanced.ts +1 -0
- package/src/client/cache/cache.ts +30 -0
- package/src/client/cache/index.ts +2 -0
- package/src/client/{client.advanced.ts → cache/memory.advanced.ts} +6 -6
- package/src/client/cache/memory.ts +110 -0
- package/src/client/client.ts +14 -55
- package/src/client/index.ts +1 -0
- package/dist/client/client.advanced.d.ts.map +0 -1
- package/dist.commonjs/client/client.advanced.d.ts.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientCacheMemory = void 0;
|
|
4
|
+
const index_js_1 = require("../../ckb/index.js");
|
|
5
|
+
const index_js_2 = require("../../hex/index.js");
|
|
6
|
+
const memory_advanced_js_1 = require("./memory.advanced.js");
|
|
7
|
+
class ClientCacheMemory {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.cachedTransactions = [];
|
|
10
|
+
this.unusableOutPoints = [];
|
|
11
|
+
this.usableCells = [];
|
|
12
|
+
this.knownCells = [];
|
|
13
|
+
}
|
|
14
|
+
async markUsable(...cellLikes) {
|
|
15
|
+
cellLikes.flat().forEach((cellLike) => {
|
|
16
|
+
const cell = index_js_1.Cell.from(cellLike).clone();
|
|
17
|
+
this.usableCells.push(cell);
|
|
18
|
+
this.knownCells.push(cell);
|
|
19
|
+
const index = this.unusableOutPoints.findIndex((o) => cell.outPoint.eq(o));
|
|
20
|
+
if (index !== -1) {
|
|
21
|
+
this.unusableOutPoints.splice(index, 1);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async markUnusable(...outPointLikes) {
|
|
26
|
+
outPointLikes.flat().forEach((outPointLike) => {
|
|
27
|
+
const outPoint = index_js_1.OutPoint.from(outPointLike);
|
|
28
|
+
this.unusableOutPoints.push(outPoint.clone());
|
|
29
|
+
const index = this.usableCells.findIndex((c) => c.outPoint.eq(outPoint));
|
|
30
|
+
if (index !== -1) {
|
|
31
|
+
this.usableCells.splice(index, 1);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async markTransactions(...transactionLike) {
|
|
36
|
+
await Promise.all(transactionLike.flat().map(async (transactionLike) => {
|
|
37
|
+
const tx = index_js_1.Transaction.from(transactionLike);
|
|
38
|
+
const txHash = tx.hash();
|
|
39
|
+
await Promise.all(tx.inputs.map((i) => this.markUnusable(i.previousOutput)));
|
|
40
|
+
await Promise.all(tx.outputs.map((o, i) => this.markUsable({
|
|
41
|
+
cellOutput: o,
|
|
42
|
+
outputData: tx.outputsData[i],
|
|
43
|
+
outPoint: {
|
|
44
|
+
txHash,
|
|
45
|
+
index: i,
|
|
46
|
+
},
|
|
47
|
+
})));
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
async isUnusable(outPointLike) {
|
|
51
|
+
const outPoint = index_js_1.OutPoint.from(outPointLike);
|
|
52
|
+
return this.unusableOutPoints.find((o) => o.eq(outPoint)) !== undefined;
|
|
53
|
+
}
|
|
54
|
+
async recordTransactions(...transactions) {
|
|
55
|
+
this.cachedTransactions.push(...transactions.flat().map(index_js_1.Transaction.from));
|
|
56
|
+
}
|
|
57
|
+
async getTransaction(txHashLike) {
|
|
58
|
+
const txHash = (0, index_js_2.hexFrom)(txHashLike);
|
|
59
|
+
return this.cachedTransactions.find((tx) => tx.hash() === txHash);
|
|
60
|
+
}
|
|
61
|
+
async recordCells(...cells) {
|
|
62
|
+
this.usableCells.push(...cells.flat().map(index_js_1.Cell.from));
|
|
63
|
+
}
|
|
64
|
+
async getCell(outPointLike) {
|
|
65
|
+
const outPoint = index_js_1.OutPoint.from(outPointLike);
|
|
66
|
+
return this.usableCells.find((cell) => cell.outPoint.eq(outPoint));
|
|
67
|
+
}
|
|
68
|
+
async *findCells(keyLike) {
|
|
69
|
+
for (const cell of this.usableCells) {
|
|
70
|
+
if (!(0, memory_advanced_js_1.filterCell)(keyLike, cell)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
yield cell;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.ClientCacheMemory = ClientCacheMemory;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Cell, CellDep, CellDepLike,
|
|
1
|
+
import { Cell, CellDep, CellDepLike, OutPointLike, Script, ScriptLike, TransactionLike } from "../ckb/index.js";
|
|
2
2
|
import { Hex, HexLike } from "../hex/index.js";
|
|
3
3
|
import { Num, NumLike } from "../num/index.js";
|
|
4
|
+
import { ClientCache } from "./cache/index.js";
|
|
4
5
|
import { ClientCollectableSearchKeyLike } from "./clientTypes.advanced.js";
|
|
5
6
|
import { ClientBlock, ClientFindCellsResponse, ClientFindTransactionsGroupedResponse, ClientFindTransactionsResponse, ClientIndexerSearchKeyLike, ClientIndexerSearchKeyTransactionLike, ClientTransactionResponse, OutputsValidator } from "./clientTypes.js";
|
|
6
7
|
/**
|
|
@@ -41,10 +42,8 @@ export declare class CellDepInfo {
|
|
|
41
42
|
* @public
|
|
42
43
|
*/
|
|
43
44
|
export declare abstract class Client {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
private readonly usableCells;
|
|
47
|
-
private readonly knownCells;
|
|
45
|
+
cache: ClientCache;
|
|
46
|
+
constructor(cache?: ClientCache);
|
|
48
47
|
abstract get url(): string;
|
|
49
48
|
abstract get addressPrefix(): string;
|
|
50
49
|
abstract getKnownScript(script: KnownScript): Promise<Pick<Script, "codeHash" | "hashType"> & {
|
|
@@ -53,8 +52,6 @@ export declare abstract class Client {
|
|
|
53
52
|
abstract getTip(): Promise<Num>;
|
|
54
53
|
abstract getBlockByNumber(blockNumber: NumLike, verbosity?: number | null, withCycles?: boolean | null): Promise<ClientBlock | undefined>;
|
|
55
54
|
abstract getBlockByHash(blockHash: HexLike, verbosity?: number | null, withCycles?: boolean | null): Promise<ClientBlock | undefined>;
|
|
56
|
-
markUsable(cellLike: CellLike): Promise<void>;
|
|
57
|
-
markUnusable(outPointLike: OutPointLike): Promise<void>;
|
|
58
55
|
abstract sendTransactionNoCache(transaction: TransactionLike, validator?: OutputsValidator): Promise<Hex>;
|
|
59
56
|
abstract getTransactionNoCache(txHash: HexLike): Promise<ClientTransactionResponse | undefined>;
|
|
60
57
|
getCell(outPointLike: OutPointLike): Promise<Cell | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,WAAW,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,WAAW,EAEX,YAAY,EACZ,MAAM,EACN,UAAU,EAEV,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAA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,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC;IAYhD,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAQ7C,eAAe,CACnB,WAAW,EAAE,eAAe,EAC5B,SAAS,CAAC,EAAE,gBAAgB,GAC3B,OAAO,CAAC,GAAG,CAAC;IAWT,cAAc,CAClB,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;CAwBlD"}
|
|
@@ -6,7 +6,7 @@ const index_js_2 = require("../fixedPoint/index.js");
|
|
|
6
6
|
const index_js_3 = require("../hex/index.js");
|
|
7
7
|
const index_js_4 = require("../num/index.js");
|
|
8
8
|
const index_js_5 = require("../utils/index.js");
|
|
9
|
-
const
|
|
9
|
+
const memory_js_1 = require("./cache/memory.js");
|
|
10
10
|
const clientTypes_js_1 = require("./clientTypes.js");
|
|
11
11
|
/**
|
|
12
12
|
* @public
|
|
@@ -44,34 +44,14 @@ exports.CellDepInfo = CellDepInfo;
|
|
|
44
44
|
* @public
|
|
45
45
|
*/
|
|
46
46
|
class Client {
|
|
47
|
-
constructor() {
|
|
48
|
-
this.
|
|
49
|
-
this.unusableOutPoints = [];
|
|
50
|
-
this.usableCells = [];
|
|
51
|
-
this.knownCells = [];
|
|
52
|
-
}
|
|
53
|
-
async markUsable(cellLike) {
|
|
54
|
-
const cell = index_js_1.Cell.from(cellLike).clone();
|
|
55
|
-
this.usableCells.push(cell);
|
|
56
|
-
this.knownCells.push(cell);
|
|
57
|
-
const index = this.unusableOutPoints.findIndex((o) => cell.outPoint.eq(o));
|
|
58
|
-
if (index !== -1) {
|
|
59
|
-
this.unusableOutPoints.splice(index, 1);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async markUnusable(outPointLike) {
|
|
63
|
-
const outPoint = index_js_1.OutPoint.from(outPointLike);
|
|
64
|
-
this.unusableOutPoints.push(outPoint.clone());
|
|
65
|
-
const index = this.usableCells.findIndex((c) => c.outPoint.eq(outPoint));
|
|
66
|
-
if (index !== -1) {
|
|
67
|
-
this.usableCells.splice(index, 1);
|
|
68
|
-
}
|
|
47
|
+
constructor(cache = new memory_js_1.ClientCacheMemory()) {
|
|
48
|
+
this.cache = cache;
|
|
69
49
|
}
|
|
70
50
|
async getCell(outPointLike) {
|
|
71
51
|
const outPoint = index_js_1.OutPoint.from(outPointLike);
|
|
72
|
-
const cached = this.
|
|
52
|
+
const cached = await this.cache.getCell(outPoint);
|
|
73
53
|
if (cached) {
|
|
74
|
-
return cached
|
|
54
|
+
return cached;
|
|
75
55
|
}
|
|
76
56
|
const transaction = await this.getTransactionNoCache(outPoint.txHash);
|
|
77
57
|
if (!transaction) {
|
|
@@ -86,12 +66,12 @@ class Client {
|
|
|
86
66
|
cellOutput: transaction.transaction.outputs[index],
|
|
87
67
|
outputData: transaction.transaction.outputsData[index] ?? "0x",
|
|
88
68
|
});
|
|
89
|
-
this.
|
|
90
|
-
return cell
|
|
69
|
+
await this.cache.recordCells(cell);
|
|
70
|
+
return cell;
|
|
91
71
|
}
|
|
92
72
|
async findCellsPaged(key, order, limit, after) {
|
|
93
73
|
const res = await this.findCellsPagedNoCache(key, order, limit, after);
|
|
94
|
-
this.
|
|
74
|
+
await this.cache.recordCells(res.cells);
|
|
95
75
|
return res;
|
|
96
76
|
}
|
|
97
77
|
async *findCells(key, order, limit = 10) {
|
|
@@ -116,15 +96,12 @@ class Client {
|
|
|
116
96
|
async *findCellsByCollectableSearchKey(keyLike, order, limit = 10) {
|
|
117
97
|
const key = clientTypes_js_1.ClientIndexerSearchKey.from(keyLike);
|
|
118
98
|
const foundedOutPoints = [];
|
|
119
|
-
for (const cell of this.
|
|
120
|
-
if (!(0, client_advanced_js_1.filterCell)(key, cell)) {
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
99
|
+
for await (const cell of this.cache.findCells(key)) {
|
|
123
100
|
foundedOutPoints.push(cell.outPoint);
|
|
124
101
|
yield cell;
|
|
125
102
|
}
|
|
126
103
|
for await (const cell of this.findCells(key, order, limit)) {
|
|
127
|
-
if (this.
|
|
104
|
+
if ((await this.cache.isUnusable(cell.outPoint)) ||
|
|
128
105
|
foundedOutPoints.some((founded) => founded.eq(cell.outPoint))) {
|
|
129
106
|
continue;
|
|
130
107
|
}
|
|
@@ -220,16 +197,8 @@ class Client {
|
|
|
220
197
|
async sendTransaction(transaction, validator) {
|
|
221
198
|
const tx = index_js_1.Transaction.from(transaction);
|
|
222
199
|
const txHash = await this.sendTransactionNoCache(tx, validator);
|
|
223
|
-
this.
|
|
224
|
-
await
|
|
225
|
-
await Promise.all(tx.outputs.map((o, i) => this.markUsable({
|
|
226
|
-
cellOutput: o,
|
|
227
|
-
outputData: tx.outputsData[i],
|
|
228
|
-
outPoint: {
|
|
229
|
-
txHash,
|
|
230
|
-
index: i,
|
|
231
|
-
},
|
|
232
|
-
})));
|
|
200
|
+
await this.cache.recordTransactions(tx);
|
|
201
|
+
await this.cache.markTransactions(tx);
|
|
233
202
|
return txHash;
|
|
234
203
|
}
|
|
235
204
|
async getTransaction(txHashLike) {
|
|
@@ -238,7 +207,7 @@ class Client {
|
|
|
238
207
|
if (res?.transaction) {
|
|
239
208
|
return res;
|
|
240
209
|
}
|
|
241
|
-
const tx = this.
|
|
210
|
+
const tx = await this.cache.getTransaction(txHash);
|
|
242
211
|
if (!tx) {
|
|
243
212
|
return;
|
|
244
213
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cache/index.js"), exports);
|
|
17
18
|
__exportStar(require("./client.js"), exports);
|
|
18
19
|
__exportStar(require("./clientPublicMainnet.js"), exports);
|
|
19
20
|
__exportStar(require("./clientPublicTestnet.js"), exports);
|
package/package.json
CHANGED
package/src/client/advanced.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./memory.advanced.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cell,
|
|
3
|
+
CellLike,
|
|
4
|
+
OutPointLike,
|
|
5
|
+
Transaction,
|
|
6
|
+
TransactionLike,
|
|
7
|
+
} from "../../ckb/index.js";
|
|
8
|
+
import { HexLike } from "../../hex/index.js";
|
|
9
|
+
import { ClientCollectableSearchKeyLike } from "../clientTypes.advanced.js";
|
|
10
|
+
|
|
11
|
+
export interface ClientCache {
|
|
12
|
+
markUsable(...cellLikes: (CellLike | CellLike[])[]): Promise<void>;
|
|
13
|
+
markUnusable(
|
|
14
|
+
...outPointLike: (OutPointLike | OutPointLike[])[]
|
|
15
|
+
): Promise<void>;
|
|
16
|
+
markTransactions(
|
|
17
|
+
...transactionLike: (TransactionLike | TransactionLike[])[]
|
|
18
|
+
): Promise<void>;
|
|
19
|
+
|
|
20
|
+
isUnusable(outPointLike: OutPointLike): Promise<boolean>;
|
|
21
|
+
|
|
22
|
+
recordTransactions(
|
|
23
|
+
...transactions: (TransactionLike | TransactionLike[])[]
|
|
24
|
+
): Promise<void>;
|
|
25
|
+
getTransaction(txHash: HexLike): Promise<Transaction | undefined>;
|
|
26
|
+
|
|
27
|
+
recordCells(...cells: (CellLike | CellLike[])[]): Promise<void>;
|
|
28
|
+
getCell(outPoint: OutPointLike): Promise<Cell | undefined>;
|
|
29
|
+
findCells(filter: ClientCollectableSearchKeyLike): AsyncGenerator<Cell>;
|
|
30
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { bytesFrom } from "
|
|
2
|
-
import { Cell, CellLike, Script, ScriptLike } from "
|
|
3
|
-
import { HexLike, hexFrom } from "
|
|
4
|
-
import { NumLike, numFrom } from "
|
|
1
|
+
import { bytesFrom } from "../../bytes/index.js";
|
|
2
|
+
import { Cell, CellLike, Script, ScriptLike } from "../../ckb/index.js";
|
|
3
|
+
import { HexLike, hexFrom } from "../../hex/index.js";
|
|
4
|
+
import { NumLike, numFrom } from "../../num/index.js";
|
|
5
5
|
import {
|
|
6
6
|
ClientCollectableSearchKeyLike,
|
|
7
7
|
clientSearchKeyRangeFrom,
|
|
8
|
-
} from "
|
|
9
|
-
import { ClientIndexerSearchKey } from "
|
|
8
|
+
} from "../clientTypes.advanced.js";
|
|
9
|
+
import { ClientIndexerSearchKey } from "../clientTypes.js";
|
|
10
10
|
|
|
11
11
|
export function filterData(
|
|
12
12
|
dataLike: HexLike,
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cell,
|
|
3
|
+
CellLike,
|
|
4
|
+
OutPoint,
|
|
5
|
+
OutPointLike,
|
|
6
|
+
Transaction,
|
|
7
|
+
TransactionLike,
|
|
8
|
+
} from "../../ckb/index.js";
|
|
9
|
+
import { HexLike, hexFrom } from "../../hex/index.js";
|
|
10
|
+
import { ClientCollectableSearchKeyLike } from "../clientTypes.advanced.js";
|
|
11
|
+
import { ClientCache } from "./cache.js";
|
|
12
|
+
import { filterCell } from "./memory.advanced.js";
|
|
13
|
+
|
|
14
|
+
export class ClientCacheMemory implements ClientCache {
|
|
15
|
+
private readonly cachedTransactions: Transaction[] = [];
|
|
16
|
+
private readonly unusableOutPoints: OutPoint[] = [];
|
|
17
|
+
private readonly usableCells: Cell[] = [];
|
|
18
|
+
private readonly knownCells: Cell[] = [];
|
|
19
|
+
|
|
20
|
+
async markUsable(...cellLikes: (CellLike | CellLike[])[]): Promise<void> {
|
|
21
|
+
cellLikes.flat().forEach((cellLike) => {
|
|
22
|
+
const cell = Cell.from(cellLike).clone();
|
|
23
|
+
this.usableCells.push(cell);
|
|
24
|
+
this.knownCells.push(cell);
|
|
25
|
+
|
|
26
|
+
const index = this.unusableOutPoints.findIndex((o) =>
|
|
27
|
+
cell.outPoint.eq(o),
|
|
28
|
+
);
|
|
29
|
+
if (index !== -1) {
|
|
30
|
+
this.unusableOutPoints.splice(index, 1);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async markUnusable(
|
|
36
|
+
...outPointLikes: (OutPointLike | OutPointLike[])[]
|
|
37
|
+
): Promise<void> {
|
|
38
|
+
outPointLikes.flat().forEach((outPointLike) => {
|
|
39
|
+
const outPoint = OutPoint.from(outPointLike);
|
|
40
|
+
this.unusableOutPoints.push(outPoint.clone());
|
|
41
|
+
|
|
42
|
+
const index = this.usableCells.findIndex((c) => c.outPoint.eq(outPoint));
|
|
43
|
+
if (index !== -1) {
|
|
44
|
+
this.usableCells.splice(index, 1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async markTransactions(
|
|
50
|
+
...transactionLike: (TransactionLike | TransactionLike[])[]
|
|
51
|
+
): Promise<void> {
|
|
52
|
+
await Promise.all(
|
|
53
|
+
transactionLike.flat().map(async (transactionLike) => {
|
|
54
|
+
const tx = Transaction.from(transactionLike);
|
|
55
|
+
const txHash = tx.hash();
|
|
56
|
+
|
|
57
|
+
await Promise.all(
|
|
58
|
+
tx.inputs.map((i) => this.markUnusable(i.previousOutput)),
|
|
59
|
+
);
|
|
60
|
+
await Promise.all(
|
|
61
|
+
tx.outputs.map((o, i) =>
|
|
62
|
+
this.markUsable({
|
|
63
|
+
cellOutput: o,
|
|
64
|
+
outputData: tx.outputsData[i],
|
|
65
|
+
outPoint: {
|
|
66
|
+
txHash,
|
|
67
|
+
index: i,
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async isUnusable(outPointLike: OutPointLike): Promise<boolean> {
|
|
77
|
+
const outPoint = OutPoint.from(outPointLike);
|
|
78
|
+
return this.unusableOutPoints.find((o) => o.eq(outPoint)) !== undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async recordTransactions(
|
|
82
|
+
...transactions: (TransactionLike | TransactionLike[])[]
|
|
83
|
+
): Promise<void> {
|
|
84
|
+
this.cachedTransactions.push(...transactions.flat().map(Transaction.from));
|
|
85
|
+
}
|
|
86
|
+
async getTransaction(txHashLike: HexLike): Promise<Transaction | undefined> {
|
|
87
|
+
const txHash = hexFrom(txHashLike);
|
|
88
|
+
return this.cachedTransactions.find((tx) => tx.hash() === txHash);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async recordCells(...cells: (CellLike | CellLike[])[]): Promise<void> {
|
|
92
|
+
this.usableCells.push(...cells.flat().map(Cell.from));
|
|
93
|
+
}
|
|
94
|
+
async getCell(outPointLike: OutPointLike): Promise<Cell | undefined> {
|
|
95
|
+
const outPoint = OutPoint.from(outPointLike);
|
|
96
|
+
return this.usableCells.find((cell) => cell.outPoint.eq(outPoint));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async *findCells(
|
|
100
|
+
keyLike: ClientCollectableSearchKeyLike,
|
|
101
|
+
): AsyncGenerator<Cell> {
|
|
102
|
+
for (const cell of this.usableCells) {
|
|
103
|
+
if (!filterCell(keyLike, cell)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
yield cell;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
package/src/client/client.ts
CHANGED
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
Cell,
|
|
3
3
|
CellDep,
|
|
4
4
|
CellDepLike,
|
|
5
|
-
CellLike,
|
|
6
5
|
OutPoint,
|
|
7
6
|
OutPointLike,
|
|
8
7
|
Script,
|
|
@@ -14,7 +13,8 @@ import { Zero } from "../fixedPoint/index.js";
|
|
|
14
13
|
import { Hex, HexLike, hexFrom } from "../hex/index.js";
|
|
15
14
|
import { Num, NumLike, numFrom } from "../num/index.js";
|
|
16
15
|
import { apply, reduceAsync } from "../utils/index.js";
|
|
17
|
-
import {
|
|
16
|
+
import { ClientCache } from "./cache/index.js";
|
|
17
|
+
import { ClientCacheMemory } from "./cache/memory.js";
|
|
18
18
|
import { ClientCollectableSearchKeyLike } from "./clientTypes.advanced.js";
|
|
19
19
|
import {
|
|
20
20
|
ClientBlock,
|
|
@@ -76,10 +76,7 @@ export class CellDepInfo {
|
|
|
76
76
|
* @public
|
|
77
77
|
*/
|
|
78
78
|
export abstract class Client {
|
|
79
|
-
|
|
80
|
-
private readonly unusableOutPoints: OutPoint[] = [];
|
|
81
|
-
private readonly usableCells: Cell[] = [];
|
|
82
|
-
private readonly knownCells: Cell[] = [];
|
|
79
|
+
constructor(public cache: ClientCache = new ClientCacheMemory()) {}
|
|
83
80
|
|
|
84
81
|
abstract get url(): string;
|
|
85
82
|
abstract get addressPrefix(): string;
|
|
@@ -102,27 +99,6 @@ export abstract class Client {
|
|
|
102
99
|
withCycles?: boolean | null,
|
|
103
100
|
): Promise<ClientBlock | undefined>;
|
|
104
101
|
|
|
105
|
-
async markUsable(cellLike: CellLike): Promise<void> {
|
|
106
|
-
const cell = Cell.from(cellLike).clone();
|
|
107
|
-
this.usableCells.push(cell);
|
|
108
|
-
this.knownCells.push(cell);
|
|
109
|
-
|
|
110
|
-
const index = this.unusableOutPoints.findIndex((o) => cell.outPoint.eq(o));
|
|
111
|
-
if (index !== -1) {
|
|
112
|
-
this.unusableOutPoints.splice(index, 1);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async markUnusable(outPointLike: OutPointLike): Promise<void> {
|
|
117
|
-
const outPoint = OutPoint.from(outPointLike);
|
|
118
|
-
this.unusableOutPoints.push(outPoint.clone());
|
|
119
|
-
|
|
120
|
-
const index = this.usableCells.findIndex((c) => c.outPoint.eq(outPoint));
|
|
121
|
-
if (index !== -1) {
|
|
122
|
-
this.usableCells.splice(index, 1);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
102
|
abstract sendTransactionNoCache(
|
|
127
103
|
transaction: TransactionLike,
|
|
128
104
|
validator?: OutputsValidator,
|
|
@@ -133,10 +109,10 @@ export abstract class Client {
|
|
|
133
109
|
|
|
134
110
|
async getCell(outPointLike: OutPointLike): Promise<Cell | undefined> {
|
|
135
111
|
const outPoint = OutPoint.from(outPointLike);
|
|
136
|
-
const cached = this.
|
|
112
|
+
const cached = await this.cache.getCell(outPoint);
|
|
137
113
|
|
|
138
114
|
if (cached) {
|
|
139
|
-
return cached
|
|
115
|
+
return cached;
|
|
140
116
|
}
|
|
141
117
|
|
|
142
118
|
const transaction = await this.getTransactionNoCache(outPoint.txHash);
|
|
@@ -154,8 +130,8 @@ export abstract class Client {
|
|
|
154
130
|
cellOutput: transaction.transaction.outputs[index],
|
|
155
131
|
outputData: transaction.transaction.outputsData[index] ?? "0x",
|
|
156
132
|
});
|
|
157
|
-
this.
|
|
158
|
-
return cell
|
|
133
|
+
await this.cache.recordCells(cell);
|
|
134
|
+
return cell;
|
|
159
135
|
}
|
|
160
136
|
|
|
161
137
|
abstract findCellsPagedNoCache(
|
|
@@ -171,7 +147,7 @@ export abstract class Client {
|
|
|
171
147
|
after?: string,
|
|
172
148
|
): Promise<ClientFindCellsResponse> {
|
|
173
149
|
const res = await this.findCellsPagedNoCache(key, order, limit, after);
|
|
174
|
-
this.
|
|
150
|
+
await this.cache.recordCells(res.cells);
|
|
175
151
|
return res;
|
|
176
152
|
}
|
|
177
153
|
|
|
@@ -213,18 +189,14 @@ export abstract class Client {
|
|
|
213
189
|
const key = ClientIndexerSearchKey.from(keyLike);
|
|
214
190
|
const foundedOutPoints = [];
|
|
215
191
|
|
|
216
|
-
for (const cell of this.
|
|
217
|
-
if (!filterCell(key, cell)) {
|
|
218
|
-
continue;
|
|
219
|
-
}
|
|
220
|
-
|
|
192
|
+
for await (const cell of this.cache.findCells(key)) {
|
|
221
193
|
foundedOutPoints.push(cell.outPoint);
|
|
222
194
|
yield cell;
|
|
223
195
|
}
|
|
224
196
|
|
|
225
197
|
for await (const cell of this.findCells(key, order, limit)) {
|
|
226
198
|
if (
|
|
227
|
-
this.
|
|
199
|
+
(await this.cache.isUnusable(cell.outPoint)) ||
|
|
228
200
|
foundedOutPoints.some((founded) => founded.eq(cell.outPoint))
|
|
229
201
|
) {
|
|
230
202
|
continue;
|
|
@@ -506,22 +478,9 @@ export abstract class Client {
|
|
|
506
478
|
|
|
507
479
|
const txHash = await this.sendTransactionNoCache(tx, validator);
|
|
508
480
|
|
|
509
|
-
this.
|
|
510
|
-
await
|
|
511
|
-
|
|
512
|
-
);
|
|
513
|
-
await Promise.all(
|
|
514
|
-
tx.outputs.map((o, i) =>
|
|
515
|
-
this.markUsable({
|
|
516
|
-
cellOutput: o,
|
|
517
|
-
outputData: tx.outputsData[i],
|
|
518
|
-
outPoint: {
|
|
519
|
-
txHash,
|
|
520
|
-
index: i,
|
|
521
|
-
},
|
|
522
|
-
}),
|
|
523
|
-
),
|
|
524
|
-
);
|
|
481
|
+
await this.cache.recordTransactions(tx);
|
|
482
|
+
await this.cache.markTransactions(tx);
|
|
483
|
+
|
|
525
484
|
return txHash;
|
|
526
485
|
}
|
|
527
486
|
|
|
@@ -534,7 +493,7 @@ export abstract class Client {
|
|
|
534
493
|
return res;
|
|
535
494
|
}
|
|
536
495
|
|
|
537
|
-
const tx = this.
|
|
496
|
+
const tx = await this.cache.getTransaction(txHash);
|
|
538
497
|
if (!tx) {
|
|
539
498
|
return;
|
|
540
499
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.advanced.d.ts","sourceRoot":"","sources":["../../src/client/client.advanced.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,QAAQ,EAAU,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACL,8BAA8B,EAE/B,MAAM,2BAA2B,CAAC;AAGnC,wBAAgB,UAAU,CACxB,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,GAAG,SAAS,EAC/B,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GACzC,OAAO,CAgBT;AAED,wBAAgB,YAAY,CAC1B,SAAS,EAAE,UAAU,GAAG,SAAS,EACjC,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,UAAU,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GACzC,OAAO,CAkBT;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,OAAO,EACnB,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,GACpC,OAAO,CAQT;AAED,wBAAgB,sBAAsB,CACpC,SAAS,CAAC,EAAE,UAAU,EACtB,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,GAClC,OAAO,CAYT;AAED,wBAAgB,UAAU,CACxB,aAAa,EAAE,8BAA8B,EAC7C,QAAQ,EAAE,QAAQ,GACjB,OAAO,CA4CT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.advanced.d.ts","sourceRoot":"","sources":["../../src/client/client.advanced.ts"],"names":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