@ckb-ccc/core 0.0.6-alpha.0 → 0.0.7-alpha.1
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/dist/address/address.advanced.d.ts.map +1 -1
- package/dist/address/address.advanced.js +2 -5
- package/dist/address/index.d.ts +1 -1
- package/dist/address/index.d.ts.map +1 -1
- package/dist/address/index.js +2 -5
- package/dist/ckb/script.d.ts +43 -1
- package/dist/ckb/script.d.ts.map +1 -1
- package/dist/ckb/script.js +51 -0
- package/dist/ckb/transaction.d.ts +198 -21
- package/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +440 -21
- package/dist/client/advanced.d.ts +2 -0
- package/dist/client/advanced.d.ts.map +1 -1
- package/dist/client/advanced.js +2 -0
- package/dist/client/client.advanced.d.ts +10 -0
- package/dist/client/client.advanced.d.ts.map +1 -0
- package/dist/client/client.advanced.js +80 -0
- package/dist/client/client.d.ts +44 -8
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +137 -9
- package/dist/client/clientPublicMainnet.advanced.d.ts +4 -2
- package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
- package/dist/client/clientPublicMainnet.advanced.js +102 -0
- package/dist/client/clientPublicMainnet.d.ts +4 -2
- package/dist/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist/client/clientPublicMainnet.js +5 -1
- package/dist/client/clientPublicTestnet.advanced.d.ts +4 -2
- package/dist/client/clientPublicTestnet.advanced.d.ts.map +1 -1
- package/dist/client/clientPublicTestnet.advanced.js +151 -0
- package/dist/client/clientPublicTestnet.d.ts +4 -2
- package/dist/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist/client/clientPublicTestnet.js +6 -1
- package/dist/client/clientTypes.advanced.d.ts +23 -0
- package/dist/client/clientTypes.advanced.d.ts.map +1 -0
- package/dist/client/clientTypes.advanced.js +4 -0
- package/dist/client/clientTypes.d.ts +22 -36
- package/dist/client/clientTypes.d.ts.map +1 -1
- package/dist/client/clientTypes.js +15 -12
- package/dist/client/jsonRpc/index.d.ts +3 -3
- package/dist/client/jsonRpc/index.d.ts.map +1 -1
- package/dist/client/jsonRpc/index.js +3 -3
- package/dist/client/jsonRpc/transformers.d.ts +5 -7
- package/dist/client/jsonRpc/transformers.d.ts.map +1 -1
- package/dist/client/jsonRpc/transformers.js +8 -6
- package/dist/hasher/index.d.ts +1 -1
- package/dist/hasher/index.d.ts.map +1 -1
- package/dist/hasher/index.js +4 -2
- package/dist/num/index.d.ts +12 -0
- package/dist/num/index.d.ts.map +1 -1
- package/dist/num/index.js +21 -0
- package/dist/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist/signer/btc/signerBtc.js +2 -1
- package/dist/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist/signer/evm/signerEvm.js +5 -3
- package/dist/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist/signer/nostr/signerNostr.js +2 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist.commonjs/address/address.advanced.d.ts +29 -24
- package/dist.commonjs/address/address.advanced.d.ts.map +1 -1
- package/dist.commonjs/address/address.advanced.js +115 -92
- package/dist.commonjs/address/advanced.d.ts +1 -1
- package/dist.commonjs/address/advanced.js +30 -14
- package/dist.commonjs/address/index.d.ts +51 -44
- package/dist.commonjs/address/index.d.ts.map +1 -1
- package/dist.commonjs/address/index.js +84 -68
- package/dist.commonjs/advanced.d.ts +1 -1
- package/dist.commonjs/advanced.js +47 -22
- package/dist.commonjs/advancedBarrel.d.ts +1 -1
- package/dist.commonjs/advancedBarrel.js +30 -14
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.js +30 -14
- package/dist.commonjs/bytes/advanced.d.ts +11 -2
- package/dist.commonjs/bytes/index.d.ts +9 -3
- package/dist.commonjs/bytes/index.js +28 -26
- package/dist.commonjs/ckb/advanced.d.ts +1 -1
- package/dist.commonjs/ckb/advanced.js +47 -22
- package/dist.commonjs/ckb/index.d.ts +1 -1
- package/dist.commonjs/ckb/index.js +30 -14
- package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +420 -260
- package/dist.commonjs/ckb/molecule.advanced/generated.js +1536 -1332
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
- package/dist.commonjs/ckb/molecule.advanced/index.js +34 -18
- package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
- package/dist.commonjs/ckb/script.advanced.js +12 -9
- package/dist.commonjs/ckb/script.d.ts +123 -77
- package/dist.commonjs/ckb/script.d.ts.map +1 -1
- package/dist.commonjs/ckb/script.js +221 -126
- package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
- package/dist.commonjs/ckb/transaction.advanced.js +4 -4
- package/dist.commonjs/ckb/transaction.d.ts +796 -544
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +1373 -725
- package/dist.commonjs/client/advanced.d.ts +3 -1
- package/dist.commonjs/client/advanced.d.ts.map +1 -1
- package/dist.commonjs/client/advanced.js +32 -14
- package/dist.commonjs/client/client.advanced.d.ts +27 -0
- package/dist.commonjs/client/client.advanced.d.ts.map +1 -0
- package/dist.commonjs/client/client.advanced.js +116 -0
- package/dist.commonjs/client/client.d.ts +118 -22
- package/dist.commonjs/client/client.d.ts.map +1 -1
- package/dist.commonjs/client/client.js +218 -56
- package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +9 -3
- package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicMainnet.advanced.js +144 -25
- package/dist.commonjs/client/clientPublicMainnet.d.ts +9 -5
- package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicMainnet.js +18 -12
- package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +8 -3
- package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicTestnet.advanced.js +204 -28
- package/dist.commonjs/client/clientPublicTestnet.d.ts +9 -5
- package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicTestnet.js +14 -9
- package/dist.commonjs/client/clientTypes.advanced.d.ts +23 -0
- package/dist.commonjs/client/clientTypes.advanced.d.ts.map +1 -0
- package/dist.commonjs/client/clientTypes.advanced.js +8 -0
- package/dist.commonjs/client/clientTypes.d.ts +57 -46
- package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
- package/dist.commonjs/client/clientTypes.js +60 -22
- package/dist.commonjs/client/index.d.ts +1 -1
- package/dist.commonjs/client/index.js +30 -14
- package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
- package/dist.commonjs/client/jsonRpc/advanced.js +30 -14
- package/dist.commonjs/client/jsonRpc/index.d.ts +94 -75
- package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
- package/dist.commonjs/client/jsonRpc/index.js +135 -108
- package/dist.commonjs/client/jsonRpc/transformers.d.ts +76 -38
- package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +1 -1
- package/dist.commonjs/client/jsonRpc/transformers.js +174 -150
- package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
- package/dist.commonjs/fixedPoint/index.d.ts +9 -3
- package/dist.commonjs/fixedPoint/index.js +26 -20
- package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
- package/dist.commonjs/fixedPoint/index.test.js +42 -36
- package/dist.commonjs/hasher/advanced.d.ts +1 -1
- package/dist.commonjs/hasher/index.d.ts +37 -37
- package/dist.commonjs/hasher/index.d.ts.map +1 -1
- package/dist.commonjs/hasher/index.js +55 -46
- package/dist.commonjs/hex/index.d.ts +1 -1
- package/dist.commonjs/hex/index.js +1 -1
- package/dist.commonjs/index.d.ts +1 -1
- package/dist.commonjs/index.js +47 -22
- package/dist.commonjs/num/index.d.ts +13 -1
- package/dist.commonjs/num/index.d.ts.map +1 -1
- package/dist.commonjs/num/index.js +53 -19
- package/dist.commonjs/signer/btc/index.d.ts +1 -1
- package/dist.commonjs/signer/btc/index.js +30 -14
- package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
- package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/signerBtc.js +89 -65
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
- package/dist.commonjs/signer/btc/verify.d.ts +6 -2
- package/dist.commonjs/signer/btc/verify.js +10 -3
- package/dist.commonjs/signer/ckb/index.d.ts +1 -1
- package/dist.commonjs/signer/ckb/index.js +30 -14
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +6 -2
- package/dist.commonjs/signer/ckb/verifyJoyId.js +11 -8
- package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
- package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
- package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
- package/dist.commonjs/signer/dummy/dummy.js +16 -16
- package/dist.commonjs/signer/dummy/index.d.ts +1 -1
- package/dist.commonjs/signer/dummy/index.js +30 -14
- package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
- package/dist.commonjs/signer/dummy/openLink.js +7 -7
- package/dist.commonjs/signer/evm/index.d.ts +1 -1
- package/dist.commonjs/signer/evm/index.js +30 -14
- package/dist.commonjs/signer/evm/signerEvm.d.ts +42 -38
- package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/signerEvm.js +105 -68
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
- package/dist.commonjs/signer/evm/verify.d.ts +6 -2
- package/dist.commonjs/signer/evm/verify.js +7 -2
- package/dist.commonjs/signer/index.d.ts +1 -1
- package/dist.commonjs/signer/index.js +30 -14
- package/dist.commonjs/signer/nostr/index.d.ts +1 -1
- package/dist.commonjs/signer/nostr/index.js +30 -14
- package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
- package/dist.commonjs/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist.commonjs/signer/nostr/signerNostr.js +100 -70
- package/dist.commonjs/signer/nostr/verify.d.ts +9 -3
- package/dist.commonjs/signer/nostr/verify.js +50 -39
- package/dist.commonjs/signer/signer/index.d.ts +156 -150
- package/dist.commonjs/signer/signer/index.js +208 -181
- package/dist.commonjs/utils/index.d.ts +38 -8
- package/dist.commonjs/utils/index.d.ts.map +1 -1
- package/dist.commonjs/utils/index.js +18 -12
- package/package.json +2 -2
- package/src/address/address.advanced.ts +2 -5
- package/src/address/index.ts +2 -5
- package/src/ckb/script.ts +62 -2
- package/src/ckb/transaction.ts +637 -46
- package/src/client/advanced.ts +2 -0
- package/src/client/client.advanced.ts +134 -0
- package/src/client/client.ts +225 -16
- package/src/client/clientPublicMainnet.advanced.ts +116 -2
- package/src/client/clientPublicMainnet.ts +8 -3
- package/src/client/clientPublicTestnet.advanced.ts +171 -2
- package/src/client/clientPublicTestnet.ts +9 -3
- package/src/client/clientTypes.advanced.ts +26 -0
- package/src/client/clientTypes.ts +41 -43
- package/src/client/jsonRpc/index.ts +4 -4
- package/src/client/jsonRpc/transformers.ts +13 -11
- package/src/hasher/index.ts +4 -2
- package/src/num/index.ts +22 -0
- package/src/signer/btc/signerBtc.ts +2 -1
- package/src/signer/evm/signerEvm.ts +5 -3
- package/src/signer/nostr/signerNostr.ts +2 -1
- package/src/utils/index.ts +6 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { bytesFrom } from "../bytes";
|
|
2
|
+
import { Cell, Script } from "../ckb";
|
|
3
|
+
import { hexFrom } from "../hex";
|
|
4
|
+
import { numFrom } from "../num";
|
|
5
|
+
import { ClientIndexerSearchKey } from "./clientTypes";
|
|
6
|
+
import { clientSearchKeyRangeFrom, } from "./clientTypes.advanced";
|
|
7
|
+
export function filterData(dataLike, filterLike, filterMode) {
|
|
8
|
+
if (!filterLike) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
const data = hexFrom(dataLike);
|
|
12
|
+
const filter = hexFrom(filterLike);
|
|
13
|
+
if ((filterMode === "exact" && data !== filter) ||
|
|
14
|
+
(filterMode === "prefix" && !data.startsWith(filter)) ||
|
|
15
|
+
(filterMode === "partial" && data.search(filter) === -1)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
export function filterScript(valueLike, filterLike, filterMode) {
|
|
21
|
+
if (!filterLike) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (!valueLike) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const value = Script.from(valueLike);
|
|
28
|
+
const filter = Script.from(filterLike);
|
|
29
|
+
if (value.codeHash !== filter.codeHash ||
|
|
30
|
+
value.hashType !== filter.hashType) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return filterData(value.args, filter?.args, filterMode);
|
|
34
|
+
}
|
|
35
|
+
export function filterNumByRange(lengthLike, range) {
|
|
36
|
+
if (!range) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
const length = numFrom(lengthLike);
|
|
40
|
+
const [lower, upper] = clientSearchKeyRangeFrom(range);
|
|
41
|
+
return lower <= length && length < upper;
|
|
42
|
+
}
|
|
43
|
+
export function filterScriptByLenRange(valueLike, scriptLenRange) {
|
|
44
|
+
if (!scriptLenRange) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
const len = (() => {
|
|
48
|
+
if (!valueLike) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
return bytesFrom(Script.from(valueLike).args).length + 33;
|
|
52
|
+
})();
|
|
53
|
+
return filterNumByRange(len, scriptLenRange);
|
|
54
|
+
}
|
|
55
|
+
export function filterCell(searchKeyLike, cellLike) {
|
|
56
|
+
const key = ClientIndexerSearchKey.from(searchKeyLike);
|
|
57
|
+
const cell = Cell.from(cellLike);
|
|
58
|
+
if (key.scriptType === "lock") {
|
|
59
|
+
if (!filterScript(cell.cellOutput.lock, key.script, key.scriptSearchMode) ||
|
|
60
|
+
!filterScript(cell.cellOutput.type, key.filter?.script, "prefix") ||
|
|
61
|
+
!filterScriptByLenRange(cell.cellOutput.type, key.filter?.scriptLenRange)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (key.scriptType === "type") {
|
|
66
|
+
if (!filterScript(cell.cellOutput.type, key.script, key.scriptSearchMode) ||
|
|
67
|
+
!filterScript(cell.cellOutput.lock, key.filter?.script, "prefix") ||
|
|
68
|
+
!filterScriptByLenRange(cell.cellOutput.lock, key.filter?.scriptLenRange)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!filterData(cell.outputData, key.filter?.outputData, key.filter?.outputDataSearchMode ?? "prefix") ||
|
|
73
|
+
!filterNumByRange(bytesFrom(cell.outputData).length, key.filter?.outputDataLenRange)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (!filterNumByRange(cell.cellOutput.capacity, key.filter?.outputCapacityRange)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,28 +1,64 @@
|
|
|
1
|
-
import { Cell, OutPointLike, Script, ScriptLike, TransactionLike } from "../ckb";
|
|
1
|
+
import { Cell, CellDep, CellDepLike, CellLike, OutPointLike, Script, ScriptLike, TransactionLike } from "../ckb";
|
|
2
2
|
import { Hex, HexLike } from "../hex";
|
|
3
3
|
import { Num, NumLike } from "../num";
|
|
4
4
|
import { ClientFindCellsResponse, ClientIndexerSearchKeyLike, ClientTransactionResponse, OutputsValidator } from "./clientTypes";
|
|
5
|
+
import { ClientCollectableSearchKeyLike } from "./clientTypes.advanced";
|
|
5
6
|
export declare enum KnownScript {
|
|
6
7
|
Secp256k1Blake160 = "Secp256k1Blake160",
|
|
7
8
|
Secp256k1Multisig = "Secp256k1Multisig",
|
|
8
9
|
AnyoneCanPay = "AnyoneCanPay",
|
|
10
|
+
TypeId = "TypeId",
|
|
11
|
+
XUdt = "XUdt",
|
|
9
12
|
JoyId = "JoyId",
|
|
10
13
|
COTA = "COTA",
|
|
11
14
|
OmniLock = "OmniLock",
|
|
12
|
-
NostrLock = "NostrLock"
|
|
15
|
+
NostrLock = "NostrLock",
|
|
16
|
+
SingleUseLock = "SingleUseLock",
|
|
17
|
+
OutputTypeProxyLock = "OutputTypeProxyLock"
|
|
18
|
+
}
|
|
19
|
+
export type CellDepInfoLike = {
|
|
20
|
+
cellDep: CellDepLike;
|
|
21
|
+
type?: ScriptLike;
|
|
22
|
+
};
|
|
23
|
+
export declare class CellDepInfo {
|
|
24
|
+
cellDep: CellDep;
|
|
25
|
+
type?: Script | undefined;
|
|
26
|
+
constructor(cellDep: CellDep, type?: Script | undefined);
|
|
27
|
+
static from(cellDepInfoLike: CellDepInfoLike): CellDepInfo;
|
|
13
28
|
}
|
|
14
29
|
export declare abstract class Client {
|
|
30
|
+
private readonly cachedTransactions;
|
|
31
|
+
private readonly unusableOutPoints;
|
|
32
|
+
private readonly usableCells;
|
|
33
|
+
private readonly knownCells;
|
|
15
34
|
abstract get url(): string;
|
|
16
35
|
abstract get addressPrefix(): string;
|
|
17
|
-
abstract getKnownScript(script: KnownScript): Promise<Pick<Script, "codeHash" | "hashType"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
36
|
+
abstract getKnownScript(script: KnownScript): Promise<Pick<Script, "codeHash" | "hashType"> & {
|
|
37
|
+
cellDeps: CellDepInfo[];
|
|
38
|
+
}>;
|
|
39
|
+
markUsable(cellLike: CellLike): Promise<void>;
|
|
40
|
+
markUnusable(outPointLike: OutPointLike): Promise<void>;
|
|
41
|
+
abstract sendTransactionNoCache(transaction: TransactionLike, validator?: OutputsValidator): Promise<Hex>;
|
|
42
|
+
abstract getTransactionNoCache(txHash: HexLike): Promise<ClientTransactionResponse | null>;
|
|
43
|
+
getCell(outPointLike: OutPointLike): Promise<Cell | null>;
|
|
44
|
+
abstract findCellsPagedNoCache(key: ClientIndexerSearchKeyLike, order?: "asc" | "desc", limit?: NumLike, after?: string): Promise<ClientFindCellsResponse>;
|
|
45
|
+
findCellsPaged(key: ClientIndexerSearchKeyLike, order?: "asc" | "desc", limit?: NumLike, after?: string): Promise<ClientFindCellsResponse>;
|
|
22
46
|
findCells(key: ClientIndexerSearchKeyLike, order?: "asc" | "desc", limit?: number): AsyncGenerator<Cell>;
|
|
23
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Find cells by search key designed for collectable cells.
|
|
49
|
+
*
|
|
50
|
+
* @param key - The search key.
|
|
51
|
+
* @returns A async generator for yielding cells.
|
|
52
|
+
*/
|
|
53
|
+
findCellsByCollectableSearchKey(keyLike: ClientCollectableSearchKeyLike, order?: "asc" | "desc", limit?: number): AsyncGenerator<Cell>;
|
|
54
|
+
findCellsByLockAndType(lock: ScriptLike, type: ScriptLike, withData?: boolean, order?: "asc" | "desc", limit?: number): AsyncGenerator<Cell>;
|
|
55
|
+
findCellsByType(type: ScriptLike, withData?: boolean, order?: "asc" | "desc", limit?: number): AsyncGenerator<Cell>;
|
|
56
|
+
findSingletonCellByType(type: ScriptLike, withData?: boolean): Promise<Cell | undefined>;
|
|
57
|
+
getCellDeps(...cellDepsInfoLike: (CellDepInfoLike | CellDepInfoLike[])[]): Promise<CellDep[]>;
|
|
24
58
|
abstract getCellsCapacity(key: ClientIndexerSearchKeyLike): Promise<Num>;
|
|
25
59
|
getBalanceSingle(lock: ScriptLike): Promise<Num>;
|
|
26
60
|
getBalance(locks: ScriptLike[]): Promise<Num>;
|
|
61
|
+
sendTransaction(transaction: TransactionLike, validator?: OutputsValidator): Promise<Hex>;
|
|
62
|
+
getTransaction(txHashLike: HexLike): Promise<ClientTransactionResponse | null>;
|
|
27
63
|
}
|
|
28
64
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,UAAU,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"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"}
|
package/dist/client/client.js
CHANGED
|
@@ -1,20 +1,64 @@
|
|
|
1
|
-
import { Cell, } from "../ckb";
|
|
1
|
+
import { Cell, CellDep, OutPoint, Script, Transaction, } from "../ckb";
|
|
2
2
|
import { Zero } from "../fixedPoint";
|
|
3
|
+
import { hexFrom } from "../hex";
|
|
3
4
|
import { numFrom } from "../num";
|
|
4
|
-
import { reduceAsync } from "../utils";
|
|
5
|
+
import { apply, reduceAsync } from "../utils";
|
|
6
|
+
import { filterCell } from "./client.advanced";
|
|
7
|
+
import { ClientIndexerSearchKey, } from "./clientTypes";
|
|
5
8
|
export var KnownScript;
|
|
6
9
|
(function (KnownScript) {
|
|
7
10
|
KnownScript["Secp256k1Blake160"] = "Secp256k1Blake160";
|
|
8
11
|
KnownScript["Secp256k1Multisig"] = "Secp256k1Multisig";
|
|
9
12
|
KnownScript["AnyoneCanPay"] = "AnyoneCanPay";
|
|
13
|
+
KnownScript["TypeId"] = "TypeId";
|
|
14
|
+
KnownScript["XUdt"] = "XUdt";
|
|
10
15
|
KnownScript["JoyId"] = "JoyId";
|
|
11
16
|
KnownScript["COTA"] = "COTA";
|
|
12
17
|
KnownScript["OmniLock"] = "OmniLock";
|
|
13
18
|
KnownScript["NostrLock"] = "NostrLock";
|
|
19
|
+
KnownScript["SingleUseLock"] = "SingleUseLock";
|
|
20
|
+
KnownScript["OutputTypeProxyLock"] = "OutputTypeProxyLock";
|
|
14
21
|
})(KnownScript || (KnownScript = {}));
|
|
22
|
+
export class CellDepInfo {
|
|
23
|
+
constructor(cellDep, type) {
|
|
24
|
+
this.cellDep = cellDep;
|
|
25
|
+
this.type = type;
|
|
26
|
+
}
|
|
27
|
+
static from(cellDepInfoLike) {
|
|
28
|
+
return new CellDepInfo(CellDep.from(cellDepInfoLike.cellDep), apply(Script.from, cellDepInfoLike.type));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
15
31
|
export class Client {
|
|
16
|
-
|
|
17
|
-
|
|
32
|
+
constructor() {
|
|
33
|
+
this.cachedTransactions = [];
|
|
34
|
+
this.unusableOutPoints = [];
|
|
35
|
+
this.usableCells = [];
|
|
36
|
+
this.knownCells = [];
|
|
37
|
+
}
|
|
38
|
+
async markUsable(cellLike) {
|
|
39
|
+
const cell = Cell.from(cellLike).clone();
|
|
40
|
+
this.usableCells.push(cell);
|
|
41
|
+
this.knownCells.push(cell);
|
|
42
|
+
const index = this.unusableOutPoints.findIndex((o) => cell.outPoint.eq(o));
|
|
43
|
+
if (index !== -1) {
|
|
44
|
+
this.unusableOutPoints.splice(index, 1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async markUnusable(outPointLike) {
|
|
48
|
+
const outPoint = OutPoint.from(outPointLike);
|
|
49
|
+
this.unusableOutPoints.push(outPoint.clone());
|
|
50
|
+
const index = this.usableCells.findIndex((c) => c.outPoint.eq(outPoint));
|
|
51
|
+
if (index !== -1) {
|
|
52
|
+
this.usableCells.splice(index, 1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async getCell(outPointLike) {
|
|
56
|
+
const outPoint = OutPoint.from(outPointLike);
|
|
57
|
+
const cached = this.knownCells.find((cell) => cell.outPoint.eq(outPoint));
|
|
58
|
+
if (cached) {
|
|
59
|
+
return cached.clone();
|
|
60
|
+
}
|
|
61
|
+
const transaction = await this.getTransactionNoCache(outPoint.txHash);
|
|
18
62
|
if (!transaction) {
|
|
19
63
|
return null;
|
|
20
64
|
}
|
|
@@ -22,12 +66,18 @@ export class Client {
|
|
|
22
66
|
if (index >= transaction.transaction.outputs.length) {
|
|
23
67
|
return null;
|
|
24
68
|
}
|
|
25
|
-
|
|
69
|
+
const cell = Cell.from({
|
|
26
70
|
outPoint,
|
|
27
71
|
cellOutput: transaction.transaction.outputs[index],
|
|
28
72
|
outputData: transaction.transaction.outputsData[index] ?? "0x",
|
|
29
|
-
blockNumber: transaction.blockNumber,
|
|
30
73
|
});
|
|
74
|
+
this.knownCells.push(cell);
|
|
75
|
+
return cell.clone();
|
|
76
|
+
}
|
|
77
|
+
async findCellsPaged(key, order, limit, after) {
|
|
78
|
+
const res = await this.findCellsPagedNoCache(key, order, limit, after);
|
|
79
|
+
this.knownCells.push(...res.cells);
|
|
80
|
+
return res;
|
|
31
81
|
}
|
|
32
82
|
async *findCells(key, order, limit = 10) {
|
|
33
83
|
let last = undefined;
|
|
@@ -42,8 +92,27 @@ export class Client {
|
|
|
42
92
|
last = lastCursor;
|
|
43
93
|
}
|
|
44
94
|
}
|
|
45
|
-
|
|
46
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Find cells by search key designed for collectable cells.
|
|
97
|
+
*
|
|
98
|
+
* @param key - The search key.
|
|
99
|
+
* @returns A async generator for yielding cells.
|
|
100
|
+
*/
|
|
101
|
+
async *findCellsByCollectableSearchKey(keyLike, order, limit = 10) {
|
|
102
|
+
const key = ClientIndexerSearchKey.from(keyLike);
|
|
103
|
+
for (const cell of this.usableCells) {
|
|
104
|
+
if (filterCell(key, cell)) {
|
|
105
|
+
yield cell;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for await (const cell of this.findCells(key, order, limit)) {
|
|
109
|
+
if (!this.unusableOutPoints.some((o) => o.eq(cell.outPoint))) {
|
|
110
|
+
yield cell;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
findCellsByLockAndType(lock, type, withData = true, order, limit = 10) {
|
|
115
|
+
return this.findCellsByCollectableSearchKey({
|
|
47
116
|
script: lock,
|
|
48
117
|
scriptType: "lock",
|
|
49
118
|
scriptSearchMode: "exact",
|
|
@@ -51,7 +120,36 @@ export class Client {
|
|
|
51
120
|
script: type,
|
|
52
121
|
},
|
|
53
122
|
withData,
|
|
54
|
-
});
|
|
123
|
+
}, order, limit);
|
|
124
|
+
}
|
|
125
|
+
findCellsByType(type, withData = true, order, limit = 10) {
|
|
126
|
+
return this.findCellsByCollectableSearchKey({
|
|
127
|
+
script: type,
|
|
128
|
+
scriptType: "type",
|
|
129
|
+
scriptSearchMode: "exact",
|
|
130
|
+
withData,
|
|
131
|
+
}, order, limit);
|
|
132
|
+
}
|
|
133
|
+
async findSingletonCellByType(type, withData = false) {
|
|
134
|
+
for await (const cell of this.findCellsByType(type, withData, undefined, 1)) {
|
|
135
|
+
return cell;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async getCellDeps(...cellDepsInfoLike) {
|
|
139
|
+
return Promise.all(cellDepsInfoLike.flat().map(async (infoLike) => {
|
|
140
|
+
const { cellDep, type } = CellDepInfo.from(infoLike);
|
|
141
|
+
if (type === undefined) {
|
|
142
|
+
return cellDep;
|
|
143
|
+
}
|
|
144
|
+
const found = await this.findSingletonCellByType(type);
|
|
145
|
+
if (!found) {
|
|
146
|
+
return cellDep;
|
|
147
|
+
}
|
|
148
|
+
return CellDep.from({
|
|
149
|
+
outPoint: found.outPoint,
|
|
150
|
+
depType: cellDep.depType,
|
|
151
|
+
});
|
|
152
|
+
}));
|
|
55
153
|
}
|
|
56
154
|
async getBalanceSingle(lock) {
|
|
57
155
|
return this.getCellsCapacity({
|
|
@@ -67,4 +165,34 @@ export class Client {
|
|
|
67
165
|
async getBalance(locks) {
|
|
68
166
|
return reduceAsync(locks, async (acc, lock) => acc + (await this.getBalanceSingle(lock)), Zero);
|
|
69
167
|
}
|
|
168
|
+
async sendTransaction(transaction, validator) {
|
|
169
|
+
const tx = Transaction.from(transaction);
|
|
170
|
+
const txHash = await this.sendTransactionNoCache(tx, validator);
|
|
171
|
+
this.cachedTransactions.push(tx.clone());
|
|
172
|
+
await Promise.all(tx.inputs.map((i) => this.markUnusable(i.previousOutput)));
|
|
173
|
+
await Promise.all(tx.outputs.map((o, i) => this.markUsable({
|
|
174
|
+
cellOutput: o,
|
|
175
|
+
outputData: tx.outputsData[i],
|
|
176
|
+
outPoint: {
|
|
177
|
+
txHash,
|
|
178
|
+
index: i,
|
|
179
|
+
},
|
|
180
|
+
})));
|
|
181
|
+
return txHash;
|
|
182
|
+
}
|
|
183
|
+
async getTransaction(txHashLike) {
|
|
184
|
+
const txHash = hexFrom(txHashLike);
|
|
185
|
+
const res = await this.getTransactionNoCache(txHash);
|
|
186
|
+
if (res !== null) {
|
|
187
|
+
return res;
|
|
188
|
+
}
|
|
189
|
+
const tx = this.cachedTransactions.find((t) => t.hash() === txHash);
|
|
190
|
+
if (!tx) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
transaction: tx,
|
|
195
|
+
status: "proposed",
|
|
196
|
+
};
|
|
197
|
+
}
|
|
70
198
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Script } from "../ckb";
|
|
2
|
-
import { KnownScript } from "./client";
|
|
3
|
-
export declare const MAINNET_SCRIPTS: Record<KnownScript, Pick<Script, "codeHash" | "hashType">
|
|
2
|
+
import { CellDepInfoLike, KnownScript } from "./client";
|
|
3
|
+
export declare const MAINNET_SCRIPTS: Record<KnownScript, (Pick<Script, "codeHash" | "hashType"> & {
|
|
4
|
+
cellDeps: CellDepInfoLike[];
|
|
5
|
+
}) | undefined>;
|
|
4
6
|
//# sourceMappingURL=clientPublicMainnet.advanced.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientPublicMainnet.advanced.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicMainnet.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"clientPublicMainnet.advanced.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicMainnet.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,WAAW,EACT,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC,GACzE,SAAS,CAkJZ,CAAC"}
|
|
@@ -3,26 +3,128 @@ export const MAINNET_SCRIPTS = {
|
|
|
3
3
|
[KnownScript.Secp256k1Blake160]: {
|
|
4
4
|
codeHash: "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
|
|
5
5
|
hashType: "type",
|
|
6
|
+
cellDeps: [
|
|
7
|
+
{
|
|
8
|
+
cellDep: {
|
|
9
|
+
outPoint: {
|
|
10
|
+
txHash: "0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",
|
|
11
|
+
index: 0,
|
|
12
|
+
},
|
|
13
|
+
depType: "depGroup",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
],
|
|
6
17
|
},
|
|
7
18
|
[KnownScript.Secp256k1Multisig]: {
|
|
8
19
|
codeHash: "0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8",
|
|
9
20
|
hashType: "type",
|
|
21
|
+
cellDeps: [
|
|
22
|
+
{
|
|
23
|
+
cellDep: {
|
|
24
|
+
outPoint: {
|
|
25
|
+
txHash: "0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",
|
|
26
|
+
index: 1,
|
|
27
|
+
},
|
|
28
|
+
depType: "depGroup",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
10
32
|
},
|
|
11
33
|
[KnownScript.AnyoneCanPay]: {
|
|
12
34
|
codeHash: "0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354",
|
|
13
35
|
hashType: "type",
|
|
36
|
+
cellDeps: [
|
|
37
|
+
{
|
|
38
|
+
cellDep: {
|
|
39
|
+
outPoint: {
|
|
40
|
+
txHash: "0x4153a2014952d7cac45f285ce9a7c5c0c0e1b21f2d378b82ac1433cb11c25c4d",
|
|
41
|
+
index: 0,
|
|
42
|
+
},
|
|
43
|
+
depType: "depGroup",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
[KnownScript.TypeId]: {
|
|
49
|
+
codeHash: "0x00000000000000000000000000000000000000000000000000545950455f4944",
|
|
50
|
+
hashType: "type",
|
|
51
|
+
cellDeps: [],
|
|
52
|
+
},
|
|
53
|
+
[KnownScript.XUdt]: {
|
|
54
|
+
codeHash: "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",
|
|
55
|
+
hashType: "data1",
|
|
56
|
+
cellDeps: [
|
|
57
|
+
{
|
|
58
|
+
cellDep: {
|
|
59
|
+
outPoint: {
|
|
60
|
+
txHash: "0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7",
|
|
61
|
+
index: 0,
|
|
62
|
+
},
|
|
63
|
+
depType: "code",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
],
|
|
14
67
|
},
|
|
15
68
|
[KnownScript.JoyId]: {
|
|
16
69
|
codeHash: "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323",
|
|
17
70
|
hashType: "type",
|
|
71
|
+
cellDeps: [
|
|
72
|
+
{
|
|
73
|
+
cellDep: {
|
|
74
|
+
outPoint: {
|
|
75
|
+
txHash: "0xf05188e5f3a6767fc4687faf45ba5f1a6e25d3ada6129dae8722cb282f262493",
|
|
76
|
+
index: 0,
|
|
77
|
+
},
|
|
78
|
+
depType: "depGroup",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
18
82
|
},
|
|
19
83
|
[KnownScript.COTA]: {
|
|
20
84
|
codeHash: "0x1122a4fb54697cf2e6e3a96c9d80fd398a936559b90954c6e88eb7ba0cf652df",
|
|
21
85
|
hashType: "type",
|
|
86
|
+
cellDeps: [
|
|
87
|
+
{
|
|
88
|
+
cellDep: {
|
|
89
|
+
outPoint: {
|
|
90
|
+
txHash: "0xabaa25237554f0d6c586dc010e7e85e6870bcfd9fb8773257ecacfbe1fd738a0",
|
|
91
|
+
index: 0,
|
|
92
|
+
},
|
|
93
|
+
depType: "depGroup",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
],
|
|
22
97
|
},
|
|
23
98
|
[KnownScript.OmniLock]: {
|
|
24
99
|
codeHash: "0x9b819793a64463aed77c615d6cb226eea5487ccfc0783043a587254cda2b6f26",
|
|
25
100
|
hashType: "type",
|
|
101
|
+
cellDeps: [
|
|
102
|
+
{
|
|
103
|
+
cellDep: {
|
|
104
|
+
outPoint: {
|
|
105
|
+
txHash: "0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c",
|
|
106
|
+
index: 0,
|
|
107
|
+
},
|
|
108
|
+
depType: "depGroup",
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
cellDep: {
|
|
113
|
+
outPoint: {
|
|
114
|
+
txHash: "0xc76edf469816aa22f416503c38d0b533d2a018e253e379f134c3985b3472c842",
|
|
115
|
+
index: 0,
|
|
116
|
+
},
|
|
117
|
+
depType: "code",
|
|
118
|
+
},
|
|
119
|
+
type: {
|
|
120
|
+
codeHash: "0x00000000000000000000000000000000000000000000000000545950455f4944",
|
|
121
|
+
hashType: "type",
|
|
122
|
+
args: "0x855508fe0f0ca25b935b070452ecaee48f6c9f1d66cd15f046616b99e948236a",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
26
126
|
},
|
|
27
127
|
[KnownScript.NostrLock]: undefined,
|
|
128
|
+
[KnownScript.SingleUseLock]: undefined,
|
|
129
|
+
[KnownScript.OutputTypeProxyLock]: undefined,
|
|
28
130
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Script } from "../ckb";
|
|
2
|
-
import { KnownScript } from "./client";
|
|
2
|
+
import { CellDepInfo, KnownScript } from "./client";
|
|
3
3
|
import { ClientJsonRpc } from "./jsonRpc";
|
|
4
4
|
export declare class ClientPublicMainnet extends ClientJsonRpc {
|
|
5
5
|
constructor(url?: string, timeout?: number);
|
|
6
6
|
get addressPrefix(): string;
|
|
7
|
-
getKnownScript(script: KnownScript): Promise<Pick<Script, "codeHash" | "hashType"
|
|
7
|
+
getKnownScript(script: KnownScript): Promise<Pick<Script, "codeHash" | "hashType"> & {
|
|
8
|
+
cellDeps: CellDepInfo[];
|
|
9
|
+
}>;
|
|
8
10
|
}
|
|
9
11
|
//# sourceMappingURL=clientPublicMainnet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientPublicMainnet.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicMainnet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"clientPublicMainnet.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicMainnet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,GAAG,SAAgC,EAAE,OAAO,CAAC,EAAE,MAAM;IAIjE,IAAI,aAAa,IAAI,MAAM,CAE1B;IAEK,cAAc,CAClB,MAAM,EAAE,WAAW,GAClB,OAAO,CACR,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;QAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;KAAE,CACpE;CAYF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CellDepInfo } from "./client";
|
|
1
2
|
import { MAINNET_SCRIPTS } from "./clientPublicMainnet.advanced";
|
|
2
3
|
import { ClientJsonRpc } from "./jsonRpc";
|
|
3
4
|
export class ClientPublicMainnet extends ClientJsonRpc {
|
|
@@ -12,6 +13,9 @@ export class ClientPublicMainnet extends ClientJsonRpc {
|
|
|
12
13
|
if (!found) {
|
|
13
14
|
throw new Error(`No script information was found for ${script} on ${this.addressPrefix}`);
|
|
14
15
|
}
|
|
15
|
-
return {
|
|
16
|
+
return {
|
|
17
|
+
...found,
|
|
18
|
+
cellDeps: found.cellDeps.map((c) => CellDepInfo.from(c)),
|
|
19
|
+
};
|
|
16
20
|
}
|
|
17
21
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Script } from "../ckb";
|
|
2
|
-
import { KnownScript } from "./client";
|
|
3
|
-
export declare const TESTNET_SCRIPTS: Record<KnownScript, Pick<Script, "codeHash" | "hashType"
|
|
2
|
+
import { CellDepInfoLike, KnownScript } from "./client";
|
|
3
|
+
export declare const TESTNET_SCRIPTS: Record<KnownScript, Pick<Script, "codeHash" | "hashType"> & {
|
|
4
|
+
cellDeps: CellDepInfoLike[];
|
|
5
|
+
}>;
|
|
4
6
|
//# sourceMappingURL=clientPublicTestnet.advanced.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientPublicTestnet.advanced.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicTestnet.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"clientPublicTestnet.advanced.d.ts","sourceRoot":"","sources":["../../src/client/clientPublicTestnet.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,WAAW,EACX,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,CA8MxE,CAAC"}
|