@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.advanced.d.ts","sourceRoot":"","sources":["../../src/address/address.advanced.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,W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|
1
1
|
import { bech32, bech32m } from "bech32";
|
|
2
|
-
import { hashTypeFromBytes } from "../ckb";
|
|
2
|
+
import { Script, hashTypeFromBytes } from "../ckb";
|
|
3
3
|
import { KnownScript } from "../client";
|
|
4
4
|
import { hexFrom } from "../hex";
|
|
5
5
|
/**
|
|
@@ -112,10 +112,7 @@ export async function addressFromPayload(prefix, format, payload, client) {
|
|
|
112
112
|
throw new Error(`Invalid short address with unknown script ${hexFrom(payload)}`);
|
|
113
113
|
}
|
|
114
114
|
return {
|
|
115
|
-
script:
|
|
116
|
-
...(await client.getKnownScript(script)),
|
|
117
|
-
args: payload.slice(1),
|
|
118
|
-
},
|
|
115
|
+
script: await Script.fromKnownScript(client, script, payload.slice(1)),
|
|
119
116
|
prefix,
|
|
120
117
|
};
|
|
121
118
|
}
|
package/dist/address/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class Address {
|
|
|
43
43
|
* @returns A promise that resolves to an Address instance.
|
|
44
44
|
*/
|
|
45
45
|
static fromScript(script: ScriptLike, client: Client): Address;
|
|
46
|
-
static fromKnownScript(script: KnownScript, args: HexLike
|
|
46
|
+
static fromKnownScript(client: Client, script: KnownScript, args: HexLike): Promise<Address>;
|
|
47
47
|
/**
|
|
48
48
|
* Converts the Address instance to a string.
|
|
49
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/address/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAmB,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAQjC,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AAEH,qBAAa,OAAO;IAQT,MAAM,EAA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C,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;WAIjD,eAAe,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,OAAO;IAQf;;;;OAIG;IAEH,QAAQ,IAAI,MAAM;CAcnB"}
|
package/dist/address/index.js
CHANGED
|
@@ -59,12 +59,9 @@ export class Address {
|
|
|
59
59
|
static fromScript(script, client) {
|
|
60
60
|
return Address.from({ script, prefix: client.addressPrefix });
|
|
61
61
|
}
|
|
62
|
-
static async fromKnownScript(script, args
|
|
62
|
+
static async fromKnownScript(client, script, args) {
|
|
63
63
|
return Address.from({
|
|
64
|
-
script:
|
|
65
|
-
...(await client.getKnownScript(script)),
|
|
66
|
-
args,
|
|
67
|
-
},
|
|
64
|
+
script: await Script.fromKnownScript(client, script, args),
|
|
68
65
|
prefix: client.addressPrefix,
|
|
69
66
|
});
|
|
70
67
|
}
|
package/dist/ckb/script.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Bytes, BytesLike } from "../bytes";
|
|
2
|
-
import {
|
|
2
|
+
import { Client, KnownScript } from "../client";
|
|
3
|
+
import { Hex, HexLike } from "../hex";
|
|
3
4
|
import * as mol from "./molecule.advanced";
|
|
4
5
|
export type HashTypeLike = string | number | bigint;
|
|
5
6
|
export type HashType = "type" | "data" | "data1" | "data2";
|
|
@@ -61,6 +62,18 @@ export declare class Script {
|
|
|
61
62
|
* @param args - The arguments for the script.
|
|
62
63
|
*/
|
|
63
64
|
constructor(codeHash: Hex, hashType: HashType, args: Hex);
|
|
65
|
+
get occupiedSize(): number;
|
|
66
|
+
/**
|
|
67
|
+
* Clone a script.
|
|
68
|
+
*
|
|
69
|
+
* @returns A cloned Script instance.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const script1 = script0.clone();
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
clone(): Script;
|
|
64
77
|
/**
|
|
65
78
|
* Creates a Script instance from a ScriptLike object.
|
|
66
79
|
*
|
|
@@ -77,6 +90,24 @@ export declare class Script {
|
|
|
77
90
|
* ```
|
|
78
91
|
*/
|
|
79
92
|
static from(script: ScriptLike): Script;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a Script instance from client and known script.
|
|
95
|
+
*
|
|
96
|
+
* @param knownScript - A KnownScript enum.
|
|
97
|
+
* @param args - Args for the script.
|
|
98
|
+
* @param client - A ScriptLike object or an instance of Script.
|
|
99
|
+
* @returns A promise that resolves to the script instance.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const script = await Script.fromKnownScript(
|
|
104
|
+
* client,
|
|
105
|
+
* KnownScript.XUdt,
|
|
106
|
+
* args: "0xabcd..."
|
|
107
|
+
* );
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
static fromKnownScript(client: Client, knownScript: KnownScript, args: HexLike): Promise<Script>;
|
|
80
111
|
/**
|
|
81
112
|
* Converts the Script instance to molecule data format.
|
|
82
113
|
*
|
|
@@ -98,6 +129,17 @@ export declare class Script {
|
|
|
98
129
|
* ```
|
|
99
130
|
*/
|
|
100
131
|
toBytes(): Bytes;
|
|
132
|
+
/**
|
|
133
|
+
* Get hash of a script
|
|
134
|
+
*
|
|
135
|
+
* @returns Hash of this script
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const hash = script.hash();
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
hash(): Hex;
|
|
101
143
|
/**
|
|
102
144
|
* Creates a Script instance from a byte-like value or molecule Script.
|
|
103
145
|
*
|
package/dist/ckb/script.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/ckb/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,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G;IAEH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAYvC;;;;;;;;;;;;;;;;OAgBG;WAEU,eAAe,CAC1B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,MAAM,CAAC;IAKlB;;;;OAIG;IAEH,UAAU;;;;;IAQV;;;;;;;;;OASG;IAEH,OAAO,IAAI,KAAK;IAIhB;;;;;;;;;OASG;IACH,IAAI,IAAI,GAAG;IAIX;;;;;;;;;;OAUG;IAEH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM;IAWvD;;;;;;;;;;OAUG;IAEH,EAAE,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO;CAQ7B"}
|
package/dist/ckb/script.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bytesFrom } from "../bytes";
|
|
2
|
+
import { ckbHash } from "../hasher";
|
|
2
3
|
import { hexFrom } from "../hex";
|
|
3
4
|
import * as mol from "./molecule.advanced";
|
|
4
5
|
import { HASH_TYPES, HASH_TYPE_TO_NUM, NUM_TO_HASH_TYPE, } from "./script.advanced";
|
|
@@ -77,6 +78,22 @@ export class Script {
|
|
|
77
78
|
this.hashType = hashType;
|
|
78
79
|
this.args = args;
|
|
79
80
|
}
|
|
81
|
+
get occupiedSize() {
|
|
82
|
+
return 33 + bytesFrom(this.args).length;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Clone a script.
|
|
86
|
+
*
|
|
87
|
+
* @returns A cloned Script instance.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const script1 = script0.clone();
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
clone() {
|
|
95
|
+
return new Script(this.codeHash, this.hashType, this.args);
|
|
96
|
+
}
|
|
80
97
|
/**
|
|
81
98
|
* Creates a Script instance from a ScriptLike object.
|
|
82
99
|
*
|
|
@@ -98,6 +115,27 @@ export class Script {
|
|
|
98
115
|
}
|
|
99
116
|
return new Script(hexFrom(script.codeHash), hashTypeFrom(script.hashType), hexFrom(script.args));
|
|
100
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Creates a Script instance from client and known script.
|
|
120
|
+
*
|
|
121
|
+
* @param knownScript - A KnownScript enum.
|
|
122
|
+
* @param args - Args for the script.
|
|
123
|
+
* @param client - A ScriptLike object or an instance of Script.
|
|
124
|
+
* @returns A promise that resolves to the script instance.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const script = await Script.fromKnownScript(
|
|
129
|
+
* client,
|
|
130
|
+
* KnownScript.XUdt,
|
|
131
|
+
* args: "0xabcd..."
|
|
132
|
+
* );
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
static async fromKnownScript(client, knownScript, args) {
|
|
136
|
+
const script = await client.getKnownScript(knownScript);
|
|
137
|
+
return new Script(script.codeHash, script.hashType, hexFrom(args));
|
|
138
|
+
}
|
|
101
139
|
/**
|
|
102
140
|
* Converts the Script instance to molecule data format.
|
|
103
141
|
*
|
|
@@ -123,6 +161,19 @@ export class Script {
|
|
|
123
161
|
toBytes() {
|
|
124
162
|
return bytesFrom(mol.SerializeScript(this._toMolData()));
|
|
125
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Get hash of a script
|
|
166
|
+
*
|
|
167
|
+
* @returns Hash of this script
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const hash = script.hash();
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
hash() {
|
|
175
|
+
return ckbHash(this.toBytes());
|
|
176
|
+
}
|
|
126
177
|
/**
|
|
127
178
|
* Creates a Script instance from a byte-like value or molecule Script.
|
|
128
179
|
*
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { TransactionSkeletonType } from "@ckb-lumos/helpers";
|
|
2
|
+
import { ClientCollectableSearchKeyFilterLike } from "../advancedBarrel";
|
|
2
3
|
import { Bytes, BytesLike } from "../bytes";
|
|
3
|
-
import { Client } from "../client";
|
|
4
|
+
import { CellDepInfoLike, Client, KnownScript } from "../client";
|
|
4
5
|
import { Hasher } from "../hasher";
|
|
5
6
|
import { Hex, HexLike } from "../hex";
|
|
6
7
|
import { Num, NumLike } from "../num";
|
|
8
|
+
import { Signer } from "../signer";
|
|
7
9
|
import * as mol from "./molecule.advanced";
|
|
8
10
|
import { Script, ScriptLike } from "./script";
|
|
9
11
|
export type DepTypeLike = string | number | bigint;
|
|
@@ -63,6 +65,17 @@ export declare class OutPoint {
|
|
|
63
65
|
* @param index - The index of the output in the transaction.
|
|
64
66
|
*/
|
|
65
67
|
constructor(txHash: Hex, index: Num);
|
|
68
|
+
/**
|
|
69
|
+
* Clone an OutPoint.
|
|
70
|
+
*
|
|
71
|
+
* @returns A cloned OutPoint instance.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const outPoint1 = outPoint0.clone();
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
clone(): OutPoint;
|
|
66
79
|
/**
|
|
67
80
|
* Creates an OutPoint instance from an OutPointLike object.
|
|
68
81
|
*
|
|
@@ -91,10 +104,10 @@ export declare class OutPoint {
|
|
|
91
104
|
*
|
|
92
105
|
* @example
|
|
93
106
|
* ```typescript
|
|
94
|
-
* const outPointBytes = outPoint.
|
|
107
|
+
* const outPointBytes = outPoint.toBytes();
|
|
95
108
|
* ```
|
|
96
109
|
*/
|
|
97
|
-
|
|
110
|
+
toBytes(): Bytes;
|
|
98
111
|
/**
|
|
99
112
|
* Creates an OutPoint instance from a byte-like value or molecule OutPoint.
|
|
100
113
|
*
|
|
@@ -107,6 +120,18 @@ export declare class OutPoint {
|
|
|
107
120
|
* ```
|
|
108
121
|
*/
|
|
109
122
|
static fromBytes(bytes: BytesLike | mol.OutPoint): OutPoint;
|
|
123
|
+
/**
|
|
124
|
+
* Compares the current OutPoint instance with another OutPointLike object for equality.
|
|
125
|
+
*
|
|
126
|
+
* @param val - The OutPointLike object to compare with.
|
|
127
|
+
* @returns True if the out points are equal, otherwise false.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const isEqual = outPoint.eq(anotherOutPoint);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
eq(val: OutPointLike): boolean;
|
|
110
135
|
}
|
|
111
136
|
export type CellOutputLike = {
|
|
112
137
|
capacity: NumLike;
|
|
@@ -125,6 +150,18 @@ export declare class CellOutput {
|
|
|
125
150
|
* @param type - The optional type script of the cell.
|
|
126
151
|
*/
|
|
127
152
|
constructor(capacity: Num, lock: Script, type?: Script | undefined);
|
|
153
|
+
get occupiedSize(): number;
|
|
154
|
+
/**
|
|
155
|
+
* Clone a CellOutput.
|
|
156
|
+
*
|
|
157
|
+
* @returns A cloned CellOutput instance.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const cellOutput1 = cellOutput0.clone();
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
clone(): CellOutput;
|
|
128
165
|
/**
|
|
129
166
|
* Creates a CellOutput instance from a CellOutputLike object.
|
|
130
167
|
*
|
|
@@ -187,22 +224,19 @@ export type CellLike = {
|
|
|
187
224
|
outPoint: OutPointLike;
|
|
188
225
|
cellOutput: CellOutputLike;
|
|
189
226
|
outputData: HexLike;
|
|
190
|
-
blockNumber: NumLike;
|
|
191
227
|
};
|
|
192
228
|
export declare class Cell {
|
|
193
229
|
outPoint: OutPoint;
|
|
194
230
|
cellOutput: CellOutput;
|
|
195
231
|
outputData: Hex;
|
|
196
|
-
blockNumber: Num;
|
|
197
232
|
/**
|
|
198
233
|
* Creates an instance of Cell.
|
|
199
234
|
*
|
|
200
235
|
* @param outPoint - The output point of the cell.
|
|
201
236
|
* @param cellOutput - The cell output of the cell.
|
|
202
237
|
* @param outputData - The output data of the cell.
|
|
203
|
-
* @param blockNumber - The block number of the cell.
|
|
204
238
|
*/
|
|
205
|
-
constructor(outPoint: OutPoint, cellOutput: CellOutput, outputData: Hex
|
|
239
|
+
constructor(outPoint: OutPoint, cellOutput: CellOutput, outputData: Hex);
|
|
206
240
|
/**
|
|
207
241
|
* Creates a Cell instance from a CellLike object.
|
|
208
242
|
*
|
|
@@ -210,20 +244,29 @@ export declare class Cell {
|
|
|
210
244
|
* @returns A Cell instance.
|
|
211
245
|
*/
|
|
212
246
|
static from(cell: CellLike): Cell;
|
|
247
|
+
/**
|
|
248
|
+
* Clone a Cell
|
|
249
|
+
*
|
|
250
|
+
* @returns A cloned Cell instance.
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const cell1 = cell0.clone();
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
clone(): Cell;
|
|
213
258
|
}
|
|
214
259
|
export type CellInputLike = {
|
|
215
260
|
previousOutput: OutPointLike;
|
|
216
|
-
since
|
|
261
|
+
since?: NumLike;
|
|
217
262
|
cellOutput?: CellOutputLike;
|
|
218
263
|
outputData?: HexLike;
|
|
219
|
-
blockNumber?: NumLike;
|
|
220
264
|
};
|
|
221
265
|
export declare class CellInput {
|
|
222
266
|
previousOutput: OutPoint;
|
|
223
267
|
since: Num;
|
|
224
268
|
cellOutput?: CellOutput | undefined;
|
|
225
269
|
outputData?: `0x${string}` | undefined;
|
|
226
|
-
blockNumber?: bigint | undefined;
|
|
227
270
|
/**
|
|
228
271
|
* Creates an instance of CellInput.
|
|
229
272
|
*
|
|
@@ -231,9 +274,19 @@ export declare class CellInput {
|
|
|
231
274
|
* @param since - The since value of the cell input.
|
|
232
275
|
* @param cellOutput - The optional cell output associated with the cell input.
|
|
233
276
|
* @param outputData - The optional output data associated with the cell input.
|
|
234
|
-
* @param blockNumber - The optional block number associated with the cell input.
|
|
235
277
|
*/
|
|
236
|
-
constructor(previousOutput: OutPoint, since: Num, cellOutput?: CellOutput | undefined, outputData?: `0x${string}` | undefined
|
|
278
|
+
constructor(previousOutput: OutPoint, since: Num, cellOutput?: CellOutput | undefined, outputData?: `0x${string}` | undefined);
|
|
279
|
+
/**
|
|
280
|
+
* Clone a CellInput.
|
|
281
|
+
*
|
|
282
|
+
* @returns A cloned CellInput instance.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```typescript
|
|
286
|
+
* const cellInput1 = cellInput0.clone();
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
clone(): CellInput;
|
|
237
290
|
/**
|
|
238
291
|
* Creates a CellInput instance from a CellInputLike object.
|
|
239
292
|
*
|
|
@@ -253,7 +306,7 @@ export declare class CellInput {
|
|
|
253
306
|
* Complete extra infos in the input. Like the output of the out point.
|
|
254
307
|
* The instance will be modified.
|
|
255
308
|
*
|
|
256
|
-
* @returns
|
|
309
|
+
* @returns true if succeed.
|
|
257
310
|
* @example
|
|
258
311
|
* ```typescript
|
|
259
312
|
* await cellInput.completeExtraInfos();
|
|
@@ -310,6 +363,17 @@ export declare class CellDep {
|
|
|
310
363
|
* @param depType - The dependency type.
|
|
311
364
|
*/
|
|
312
365
|
constructor(outPoint: OutPoint, depType: DepType);
|
|
366
|
+
/**
|
|
367
|
+
* Clone a CellDep.
|
|
368
|
+
*
|
|
369
|
+
* @returns A cloned CellDep instance.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* const cellDep1 = cellDep0.clone();
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
clone(): CellDep;
|
|
313
377
|
/**
|
|
314
378
|
* Creates a CellDep instance from a CellDepLike object.
|
|
315
379
|
*
|
|
@@ -360,6 +424,18 @@ export declare class CellDep {
|
|
|
360
424
|
* ```
|
|
361
425
|
*/
|
|
362
426
|
fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
|
|
427
|
+
/**
|
|
428
|
+
* Compares the current CellDep instance with another CellDepLike object for equality.
|
|
429
|
+
*
|
|
430
|
+
* @param val - The CellDepLike object to compare with.
|
|
431
|
+
* @returns True if the cell deps are equal, otherwise false.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```typescript
|
|
435
|
+
* const isEqual = cellDep.eq(anotherCellDep);
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
eq(val: CellDepLike): boolean;
|
|
363
439
|
}
|
|
364
440
|
export type WitnessArgsLike = {
|
|
365
441
|
lock?: HexLike;
|
|
@@ -428,14 +504,15 @@ export declare class WitnessArgs {
|
|
|
428
504
|
*/
|
|
429
505
|
static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
|
|
430
506
|
}
|
|
507
|
+
export declare function udtBalanceFrom(dataLike: BytesLike): bigint;
|
|
431
508
|
export type TransactionLike = {
|
|
432
|
-
version
|
|
433
|
-
cellDeps
|
|
434
|
-
headerDeps
|
|
435
|
-
inputs
|
|
436
|
-
outputs
|
|
437
|
-
outputsData
|
|
438
|
-
witnesses
|
|
509
|
+
version?: NumLike;
|
|
510
|
+
cellDeps?: CellDepLike[];
|
|
511
|
+
headerDeps?: HexLike[];
|
|
512
|
+
inputs?: CellInputLike[];
|
|
513
|
+
outputs?: (Omit<CellOutputLike, "capacity"> & Partial<Pick<CellOutputLike, "capacity">>)[];
|
|
514
|
+
outputsData?: HexLike[];
|
|
515
|
+
witnesses?: HexLike[];
|
|
439
516
|
};
|
|
440
517
|
export declare class Transaction {
|
|
441
518
|
version: Num;
|
|
@@ -468,6 +545,26 @@ export declare class Transaction {
|
|
|
468
545
|
* ```
|
|
469
546
|
*/
|
|
470
547
|
static default(): Transaction;
|
|
548
|
+
/**
|
|
549
|
+
* Copy every properties from another transaction.
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```typescript
|
|
553
|
+
* this.copy(Transaction.default());
|
|
554
|
+
* ```
|
|
555
|
+
*/
|
|
556
|
+
copy(txLike: TransactionLike): void;
|
|
557
|
+
/**
|
|
558
|
+
* Clone a Transaction.
|
|
559
|
+
*
|
|
560
|
+
* @returns A cloned instance
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```typescript
|
|
564
|
+
* const tx1 = tx0.clone();
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
clone(): Transaction;
|
|
471
568
|
/**
|
|
472
569
|
* Creates a Transaction instance from a TransactionLike object.
|
|
473
570
|
*
|
|
@@ -514,6 +611,17 @@ export declare class Transaction {
|
|
|
514
611
|
* ```
|
|
515
612
|
*/
|
|
516
613
|
rawToBytes(): Bytes;
|
|
614
|
+
/**
|
|
615
|
+
* Converts the whole transaction data to bytes.
|
|
616
|
+
*
|
|
617
|
+
* @returns A Uint8Array containing the full transaction bytes.
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* ```typescript
|
|
621
|
+
* const txBytes = transaction.toBytes();
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
toBytes(): Bytes;
|
|
517
625
|
/**
|
|
518
626
|
* Calculates the hash of the transaction.
|
|
519
627
|
*
|
|
@@ -584,6 +692,65 @@ export declare class Transaction {
|
|
|
584
692
|
* ```
|
|
585
693
|
*/
|
|
586
694
|
findLastInputIndexByLock(scriptLike: ScriptLike, client: Client): Promise<number | undefined>;
|
|
695
|
+
/**
|
|
696
|
+
* Add cell deps if they are not existed
|
|
697
|
+
*
|
|
698
|
+
* @param cellDepLikes - The cell deps to add
|
|
699
|
+
*
|
|
700
|
+
* @example
|
|
701
|
+
* ```typescript
|
|
702
|
+
* tx.addCellDeps(cellDep);
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
addCellDeps(...cellDepsLike: (CellDepLike | CellDepLike[])[]): void;
|
|
706
|
+
/**
|
|
707
|
+
* Add cell dep from infos if they are not existed
|
|
708
|
+
*
|
|
709
|
+
* @param client - A client for searching cell deps
|
|
710
|
+
* @param cellDepLikes - The cell dep infos to add
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```typescript
|
|
714
|
+
* tx.addCellDepInfos(client, cellDepInfos);
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
addCellDepInfos(client: Client, ...cellDepInfosLike: (CellDepInfoLike | CellDepInfoLike[])[]): Promise<void>;
|
|
718
|
+
/**
|
|
719
|
+
* Add cell deps from known script
|
|
720
|
+
*
|
|
721
|
+
* @param client - The client for searching known script and cell deps
|
|
722
|
+
* @param scripts - The known scripts to add
|
|
723
|
+
*
|
|
724
|
+
* @example
|
|
725
|
+
* ```typescript
|
|
726
|
+
* tx.addCellDepsOfKnownScripts(client, KnownScript.OmniLock);
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
addCellDepsOfKnownScripts(client: Client, ...scripts: (KnownScript | KnownScript[])[]): Promise<void>;
|
|
730
|
+
/**
|
|
731
|
+
* Set output data at index.
|
|
732
|
+
*
|
|
733
|
+
* @param index - The index of the output data.
|
|
734
|
+
* @param witness - The data to set.
|
|
735
|
+
*
|
|
736
|
+
* @example
|
|
737
|
+
* ```typescript
|
|
738
|
+
* await tx.setOutputData(0, "0x00");
|
|
739
|
+
* ```
|
|
740
|
+
*/
|
|
741
|
+
setOutputDataAt(index: number, data: HexLike): void;
|
|
742
|
+
/**
|
|
743
|
+
* Add output
|
|
744
|
+
*
|
|
745
|
+
* @param output - The cell output to add
|
|
746
|
+
* @param data - optional output data
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* ```typescript
|
|
750
|
+
* await tx.addOutput(cellOutput, "0xabcd");
|
|
751
|
+
* ```
|
|
752
|
+
*/
|
|
753
|
+
addOutput(outputLike: Omit<CellOutputLike, "capacity"> & Partial<Pick<CellOutputLike, "capacity">>, outputData?: HexLike): void;
|
|
587
754
|
/**
|
|
588
755
|
* Get witness at index as WitnessArgs
|
|
589
756
|
*
|
|
@@ -601,7 +768,6 @@ export declare class Transaction {
|
|
|
601
768
|
*
|
|
602
769
|
* @param index - The index of the witness.
|
|
603
770
|
* @param witness - The WitnessArgs to set.
|
|
604
|
-
* @returns The transaction itself.
|
|
605
771
|
*
|
|
606
772
|
* @example
|
|
607
773
|
* ```typescript
|
|
@@ -623,5 +789,16 @@ export declare class Transaction {
|
|
|
623
789
|
* ```
|
|
624
790
|
*/
|
|
625
791
|
prepareSighashAllWitness(scriptLike: ScriptLike, lockLen: number, client: Client): Promise<void>;
|
|
792
|
+
getInputsCapacity(client: Client): Promise<Num>;
|
|
793
|
+
getOutputsCapacity(): Num;
|
|
794
|
+
getInputsUdtBalance(client: Client, type: ScriptLike): Promise<Num>;
|
|
795
|
+
getOutputsUdtBalance(type: ScriptLike): Num;
|
|
796
|
+
completeInputs<T>(from: Signer, filter: ClientCollectableSearchKeyFilterLike, accumulator: (acc: T, v: Cell, i: number, array: Cell[]) => Promise<T | undefined> | T | undefined, init: T): Promise<number>;
|
|
797
|
+
completeInputsByCapacity(from: Signer, capacityTweak?: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<number>;
|
|
798
|
+
completeInputsByUdt(from: Signer, type: ScriptLike): Promise<number>;
|
|
799
|
+
estimateFee(feeRate: NumLike): Num;
|
|
800
|
+
completeFee(from: Signer, change: (tx: Transaction, capacity: Num) => Promise<NumLike> | NumLike, feeRate: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<[number, boolean]>;
|
|
801
|
+
completeFeeChangeToLock(from: Signer, change: ScriptLike, feeRate: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<[number, boolean]>;
|
|
802
|
+
completeFeeChangeToOutput(from: Signer, index: NumLike, feeRate: NumLike, filter?: ClientCollectableSearchKeyFilterLike): Promise<[number, boolean]>;
|
|
626
803
|
}
|
|
627
804
|
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/ckb/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/ckb/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAa,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAW,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAW,MAAM,QAAQ,CAAC;AAC/C,OAAO,EACL,GAAG,EACH,OAAO,EAKR,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAgBrD;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,KAAK,CAE1D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,gBA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