xpi-ts 0.2.22 → 0.2.24
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/cjs/lib/bitcore/crypto/point.js +2 -2
- package/dist/cjs/lib/bitcore/index.js +162 -162
- package/dist/esm/lib/bitcore/crypto/point.js +2 -2
- package/dist/esm/lib/bitcore/index.js +42 -42
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/address.d.ts +116 -0
- package/dist/types/lib/bitcore/address.d.ts.map +1 -1
- package/dist/types/lib/bitcore/block/block.d.ts +214 -0
- package/dist/types/lib/bitcore/block/block.d.ts.map +1 -1
- package/dist/types/lib/bitcore/block/blockheader.d.ts +220 -0
- package/dist/types/lib/bitcore/block/blockheader.d.ts.map +1 -1
- package/dist/types/lib/bitcore/block/merkleblock.d.ts +206 -0
- package/dist/types/lib/bitcore/block/merkleblock.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/bn.d.ts +224 -0
- package/dist/types/lib/bitcore/crypto/bn.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/ecdsa.d.ts +122 -0
- package/dist/types/lib/bitcore/crypto/ecdsa.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/hash.d.ts +56 -0
- package/dist/types/lib/bitcore/crypto/hash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/index.d.ts +4 -0
- package/dist/types/lib/bitcore/crypto/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/musig2.d.ts +282 -0
- package/dist/types/lib/bitcore/crypto/musig2.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/point.d.ts +87 -0
- package/dist/types/lib/bitcore/crypto/point.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/random.d.ts +48 -0
- package/dist/types/lib/bitcore/crypto/random.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/schnorr.d.ts +203 -0
- package/dist/types/lib/bitcore/crypto/schnorr.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/signature.d.ts +452 -0
- package/dist/types/lib/bitcore/crypto/signature.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/sigtype.d.ts +46 -0
- package/dist/types/lib/bitcore/crypto/sigtype.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/base58.d.ts +68 -0
- package/dist/types/lib/bitcore/encoding/base58.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/base58check.d.ts +58 -0
- package/dist/types/lib/bitcore/encoding/base58check.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/bufferreader.d.ts +112 -0
- package/dist/types/lib/bitcore/encoding/bufferreader.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts +144 -0
- package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/varint.d.ts +86 -0
- package/dist/types/lib/bitcore/encoding/varint.d.ts.map +1 -1
- package/dist/types/lib/bitcore/errors.d.ts +4 -0
- package/dist/types/lib/bitcore/errors.d.ts.map +1 -1
- package/dist/types/lib/bitcore/hdprivatekey.d.ts +59 -0
- package/dist/types/lib/bitcore/hdprivatekey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/hdpublickey.d.ts +145 -0
- package/dist/types/lib/bitcore/hdpublickey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/index.d.ts +58 -54
- package/dist/types/lib/bitcore/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/message.d.ts +63 -0
- package/dist/types/lib/bitcore/message.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/errors.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/errors.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/index.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts +106 -0
- package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts +13 -0
- package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/words/english.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/words/english.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/words/french.d.ts +5 -0
- package/dist/types/lib/bitcore/mnemonic/words/french.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/words/index.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/words/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/musig2/index.d.ts +14 -0
- package/dist/types/lib/bitcore/musig2/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/musig2/session.d.ts +254 -0
- package/dist/types/lib/bitcore/musig2/session.d.ts.map +1 -1
- package/dist/types/lib/bitcore/musig2/signer.d.ts +212 -0
- package/dist/types/lib/bitcore/musig2/signer.d.ts.map +1 -1
- package/dist/types/lib/bitcore/networks.d.ts +17 -0
- package/dist/types/lib/bitcore/networks.d.ts.map +1 -1
- package/dist/types/lib/bitcore/opcode.d.ts +151 -0
- package/dist/types/lib/bitcore/opcode.d.ts.map +1 -1
- package/dist/types/lib/bitcore/privatekey.d.ts +80 -0
- package/dist/types/lib/bitcore/privatekey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/publickey.d.ts +195 -0
- package/dist/types/lib/bitcore/publickey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/chunk.d.ts +51 -0
- package/dist/types/lib/bitcore/script/chunk.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts +60 -0
- package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/index.d.ts +23 -0
- package/dist/types/lib/bitcore/script/interpreter/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts +86 -0
- package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts +115 -0
- package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/types.d.ts +119 -0
- package/dist/types/lib/bitcore/script/interpreter/types.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/taproot.d.ts +297 -0
- package/dist/types/lib/bitcore/script/taproot.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script.d.ts +510 -0
- package/dist/types/lib/bitcore/script.d.ts.map +1 -1
- package/dist/types/lib/bitcore/taproot/musig2.d.ts +153 -0
- package/dist/types/lib/bitcore/taproot/musig2.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/multisig.d.ts +8 -0
- package/dist/types/lib/bitcore/transaction/input/multisig.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts +8 -0
- package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/publickey.d.ts +8 -0
- package/dist/types/lib/bitcore/transaction/input/publickey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts +14 -0
- package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/taproot.d.ts +22 -0
- package/dist/types/lib/bitcore/transaction/input/taproot.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input.d.ts +418 -0
- package/dist/types/lib/bitcore/transaction/input.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/outpoint.d.ts +110 -0
- package/dist/types/lib/bitcore/transaction/outpoint.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/output.d.ts +83 -0
- package/dist/types/lib/bitcore/transaction/output.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/sighash.d.ts +69 -0
- package/dist/types/lib/bitcore/transaction/sighash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/signature.d.ts +98 -0
- package/dist/types/lib/bitcore/transaction/signature.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/transaction.d.ts +379 -0
- package/dist/types/lib/bitcore/transaction/transaction.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts +61 -0
- package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts.map +1 -1
- package/dist/types/lib/bitcore/unit.d.ts +140 -0
- package/dist/types/lib/bitcore/unit.d.ts.map +1 -1
- package/dist/types/lib/bitcore/uri.d.ts +34 -0
- package/dist/types/lib/bitcore/uri.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/base32.d.ts +55 -0
- package/dist/types/lib/bitcore/util/base32.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/bits.d.ts +76 -0
- package/dist/types/lib/bitcore/util/bits.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/buffer.d.ts +135 -0
- package/dist/types/lib/bitcore/util/buffer.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/convertBits.d.ts +15 -0
- package/dist/types/lib/bitcore/util/convertBits.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/js.d.ts +19 -0
- package/dist/types/lib/bitcore/util/js.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/merkle.d.ts +85 -0
- package/dist/types/lib/bitcore/util/merkle.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/preconditions.d.ts +29 -0
- package/dist/types/lib/bitcore/util/preconditions.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util.d.ts +7 -0
- package/dist/types/lib/bitcore/util.d.ts.map +1 -1
- package/dist/types/lib/bitcore/xaddress.d.ts +117 -0
- package/dist/types/lib/bitcore/xaddress.d.ts.map +1 -1
- package/dist/types/lib/lokad.d.ts +292 -0
- package/dist/types/lib/lokad.d.ts.map +1 -1
- package/dist/types/lib/nft.d.ts +434 -0
- package/dist/types/lib/nft.d.ts.map +1 -1
- package/dist/types/lib/rank/api.d.ts +13 -0
- package/dist/types/lib/rank/api.d.ts.map +1 -1
- package/dist/types/lib/rank/index.d.ts +153 -0
- package/dist/types/lib/rank/index.d.ts.map +1 -1
- package/dist/types/lib/rank/opcode.d.ts +6 -2
- package/dist/types/lib/rank/opcode.d.ts.map +1 -1
- package/dist/types/lib/rank/script.d.ts +10 -0
- package/dist/types/lib/rank/script.d.ts.map +1 -1
- package/dist/types/lib/rank/transaction.d.ts +11 -0
- package/dist/types/lib/rank/transaction.d.ts.map +1 -1
- package/dist/types/lib/rpc.d.ts +176 -0
- package/dist/types/lib/rpc.d.ts.map +1 -1
- package/dist/types/utils/constants.d.ts +27 -0
- package/dist/types/utils/constants.d.ts.map +1 -1
- package/dist/types/utils/env.d.ts +15 -0
- package/dist/types/utils/env.d.ts.map +1 -1
- package/dist/types/utils/string.d.ts +57 -0
- package/dist/types/utils/string.d.ts.map +1 -1
- package/dist/types/utils/wallet.d.ts +43 -1
- package/dist/types/utils/wallet.d.ts.map +1 -1
- package/package.json +1 -1
- package/tsconfig.types.json +2 -1
|
@@ -1,32 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COutPoint - A combination of a transaction hash and an index n into its vout
|
|
3
|
+
*
|
|
4
|
+
* Faithful TypeScript implementation of lotusd/src/primitives/transaction.h COutPoint.
|
|
5
|
+
* An outpoint uniquely identifies a specific output of a previous transaction.
|
|
6
|
+
*
|
|
7
|
+
* Serialization format (36 bytes):
|
|
8
|
+
* - txid: 32 bytes (uint256, little-endian)
|
|
9
|
+
* - n: 4 bytes (uint32_t, little-endian)
|
|
10
|
+
*
|
|
11
|
+
* Reference: lotusd/src/primitives/transaction.h lines 22-54
|
|
12
|
+
*/
|
|
1
13
|
import { BufferReader } from '../encoding/bufferreader.js';
|
|
2
14
|
import { BufferWriter } from '../encoding/bufferwriter.js';
|
|
3
15
|
import type { Buffer } from 'buffer/';
|
|
16
|
+
/** Serialized size of an outpoint in bytes */
|
|
4
17
|
export declare const OUTPOINT_SIZE = 36;
|
|
18
|
+
/**
|
|
19
|
+
* Data for constructing an OutPoint from an object
|
|
20
|
+
*/
|
|
5
21
|
export interface OutPointData {
|
|
22
|
+
/** Transaction ID as hex string (big-endian display order) */
|
|
6
23
|
txid: string;
|
|
24
|
+
/** Output index within the transaction */
|
|
7
25
|
outputIndex: number;
|
|
8
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Serialized representation of an OutPoint
|
|
29
|
+
*/
|
|
9
30
|
export interface OutPointObject {
|
|
31
|
+
/** Transaction ID as hex string (big-endian display order) */
|
|
10
32
|
txid: string;
|
|
33
|
+
/** Output index within the transaction */
|
|
11
34
|
outputIndex: number;
|
|
12
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* An outpoint - a combination of a transaction hash and an index n into its
|
|
38
|
+
* vout.
|
|
39
|
+
*
|
|
40
|
+
* Reference: lotusd COutPoint (primitives/transaction.h)
|
|
41
|
+
*/
|
|
13
42
|
export declare class OutPoint {
|
|
43
|
+
/**
|
|
44
|
+
* Sentinel value for null output index.
|
|
45
|
+
* Matches lotusd COutPoint::NULL_INDEX = std::numeric_limits<uint32_t>::max()
|
|
46
|
+
*/
|
|
14
47
|
static readonly NULL_INDEX: number;
|
|
48
|
+
/** Transaction ID (32 bytes, stored as internal little-endian buffer) */
|
|
15
49
|
private _txid;
|
|
50
|
+
/** Output index within the transaction (uint32) */
|
|
16
51
|
private _n;
|
|
52
|
+
/**
|
|
53
|
+
* Create a new OutPoint
|
|
54
|
+
*
|
|
55
|
+
* @param txid - Transaction ID as 32-byte Buffer (little-endian) or hex string (big-endian display order)
|
|
56
|
+
* @param n - Output index (uint32), defaults to NULL_INDEX
|
|
57
|
+
*/
|
|
17
58
|
constructor(txid?: Buffer | string, n?: number);
|
|
59
|
+
/**
|
|
60
|
+
* Create an OutPoint from a data object
|
|
61
|
+
*
|
|
62
|
+
* @param data - Object with txid (hex string) and outputIndex
|
|
63
|
+
* @returns New OutPoint instance
|
|
64
|
+
*/
|
|
18
65
|
static fromObject(data: OutPointData): OutPoint;
|
|
66
|
+
/**
|
|
67
|
+
* Deserialize an OutPoint from a buffer
|
|
68
|
+
*
|
|
69
|
+
* @param buf - Buffer containing serialized outpoint (36 bytes)
|
|
70
|
+
* @returns New OutPoint instance
|
|
71
|
+
*/
|
|
19
72
|
static fromBuffer(buf: Buffer): OutPoint;
|
|
73
|
+
/**
|
|
74
|
+
* Deserialize an OutPoint from a BufferReader
|
|
75
|
+
*
|
|
76
|
+
* Reads: txid (32 bytes LE) + n (4 bytes LE)
|
|
77
|
+
* Matches lotusd SERIALIZE_METHODS(COutPoint, obj) { READWRITE(obj.txid, obj.n); }
|
|
78
|
+
*
|
|
79
|
+
* @param reader - BufferReader positioned at the outpoint data
|
|
80
|
+
* @returns New OutPoint instance
|
|
81
|
+
*/
|
|
20
82
|
static fromBufferReader(reader: BufferReader): OutPoint;
|
|
83
|
+
/**
|
|
84
|
+
* Check if this is a null outpoint (all-zero txid and NULL_INDEX)
|
|
85
|
+
*
|
|
86
|
+
* Matches lotusd: bool IsNull() const { return txid.IsNull() && n == NULL_INDEX; }
|
|
87
|
+
*/
|
|
21
88
|
isNull(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Get the transaction ID as a hex string (big-endian display order)
|
|
91
|
+
*
|
|
92
|
+
* Matches lotusd: const TxId &GetTxId() const
|
|
93
|
+
*/
|
|
22
94
|
getTxId(): string;
|
|
95
|
+
/**
|
|
96
|
+
* Get the transaction ID as a Buffer (internal little-endian)
|
|
97
|
+
*/
|
|
23
98
|
getTxIdBuffer(): Buffer;
|
|
99
|
+
/**
|
|
100
|
+
* Get the output index
|
|
101
|
+
*
|
|
102
|
+
* Matches lotusd: uint32_t GetN() const
|
|
103
|
+
*/
|
|
24
104
|
getN(): number;
|
|
105
|
+
/**
|
|
106
|
+
* Serialize to a Buffer (36 bytes)
|
|
107
|
+
*
|
|
108
|
+
* Format: txid (32 bytes LE) + n (4 bytes LE)
|
|
109
|
+
* Matches lotusd SERIALIZE_METHODS
|
|
110
|
+
*/
|
|
25
111
|
toBuffer(): Buffer;
|
|
112
|
+
/**
|
|
113
|
+
* Write serialized outpoint to a BufferWriter
|
|
114
|
+
*
|
|
115
|
+
* @param writer - BufferWriter to write to
|
|
116
|
+
* @returns The BufferWriter for chaining
|
|
117
|
+
*/
|
|
26
118
|
toBufferWriter(writer: BufferWriter): BufferWriter;
|
|
119
|
+
/**
|
|
120
|
+
* Convert to a plain object
|
|
121
|
+
*/
|
|
27
122
|
toObject(): OutPointObject;
|
|
123
|
+
/**
|
|
124
|
+
* String representation matching lotusd COutPoint::ToString()
|
|
125
|
+
*
|
|
126
|
+
* Format: "COutPoint(txid_prefix, n)"
|
|
127
|
+
*/
|
|
28
128
|
toString(): string;
|
|
129
|
+
/**
|
|
130
|
+
* Compare two outpoints for equality
|
|
131
|
+
*
|
|
132
|
+
* Matches lotusd: friend bool operator==(const COutPoint &a, const COutPoint &b)
|
|
133
|
+
*/
|
|
29
134
|
equals(other: OutPoint): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Compare two outpoints for ordering (less-than)
|
|
137
|
+
*
|
|
138
|
+
* Matches lotusd: friend bool operator<(const COutPoint &a, const COutPoint &b)
|
|
139
|
+
*/
|
|
30
140
|
lessThan(other: OutPoint): boolean;
|
|
31
141
|
}
|
|
32
142
|
//# sourceMappingURL=outpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outpoint.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/outpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outpoint.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/outpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,C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Q,IAAI,MAAM;IAIlB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAIhC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;CAInC"}
|
|
@@ -13,6 +13,9 @@ export interface OutputObject {
|
|
|
13
13
|
script: string;
|
|
14
14
|
asm: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents a transaction output
|
|
18
|
+
*/
|
|
16
19
|
export declare class Output {
|
|
17
20
|
satoshis: number;
|
|
18
21
|
private _satoshisBN;
|
|
@@ -20,31 +23,111 @@ export declare class Output {
|
|
|
20
23
|
private _script?;
|
|
21
24
|
constructor(args: OutputData);
|
|
22
25
|
static create(args: OutputData): Output;
|
|
26
|
+
/**
|
|
27
|
+
* Parse satoshis from various input types
|
|
28
|
+
*/
|
|
23
29
|
private _parseSatoshis;
|
|
30
|
+
/**
|
|
31
|
+
* Get the BN representation of satoshis
|
|
32
|
+
*/
|
|
24
33
|
get satoshisBN(): BN;
|
|
34
|
+
/**
|
|
35
|
+
* Set the BN representation of satoshis
|
|
36
|
+
*/
|
|
25
37
|
set satoshisBN(value: BN);
|
|
38
|
+
/**
|
|
39
|
+
* Get the script for this output
|
|
40
|
+
*/
|
|
26
41
|
get script(): Script;
|
|
42
|
+
/**
|
|
43
|
+
* Get the script buffer
|
|
44
|
+
*/
|
|
27
45
|
get scriptBuffer(): Buffer;
|
|
46
|
+
/**
|
|
47
|
+
* Set the script from a buffer
|
|
48
|
+
*/
|
|
28
49
|
setScriptFromBuffer(buffer: Buffer): void;
|
|
50
|
+
/**
|
|
51
|
+
* Set the script for this output
|
|
52
|
+
*/
|
|
29
53
|
setScript(script: Script | Buffer | string): Output;
|
|
54
|
+
/**
|
|
55
|
+
* Get the amount in XPI
|
|
56
|
+
*/
|
|
30
57
|
getXPI(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Set the amount from XPI
|
|
60
|
+
*/
|
|
31
61
|
setXPI(xpi: number): Output;
|
|
62
|
+
/**
|
|
63
|
+
* Check if this output is valid
|
|
64
|
+
*/
|
|
32
65
|
isValid(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Check if this output is dust (too small to be economical)
|
|
68
|
+
*/
|
|
33
69
|
isDust(dustThreshold?: number): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Check if satoshis are invalid
|
|
72
|
+
*/
|
|
34
73
|
invalidSatoshis(): string | false;
|
|
74
|
+
/**
|
|
75
|
+
* Check if this is an OP_RETURN output
|
|
76
|
+
*/
|
|
35
77
|
isOpReturn(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Convert to object representation
|
|
80
|
+
*/
|
|
36
81
|
toObject(): OutputObject;
|
|
82
|
+
/**
|
|
83
|
+
* Convert to JSON
|
|
84
|
+
*
|
|
85
|
+
* @alias Output.toObject
|
|
86
|
+
*/
|
|
37
87
|
toJSON: () => OutputObject;
|
|
88
|
+
/**
|
|
89
|
+
* Debug representation
|
|
90
|
+
*/
|
|
38
91
|
inspect(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Create from buffer reader
|
|
94
|
+
*/
|
|
39
95
|
static fromBufferReader(br: BufferReader): Output;
|
|
96
|
+
/**
|
|
97
|
+
* Serialize to buffer
|
|
98
|
+
*/
|
|
40
99
|
toBuffer(): Buffer;
|
|
100
|
+
/**
|
|
101
|
+
* Serialize to buffer writer
|
|
102
|
+
*/
|
|
41
103
|
toBufferWriter(writer?: BufferWriter): BufferWriter;
|
|
104
|
+
/**
|
|
105
|
+
* Get the size of this output in bytes
|
|
106
|
+
*/
|
|
42
107
|
getSize(): number;
|
|
108
|
+
/**
|
|
109
|
+
* Clone this output
|
|
110
|
+
*/
|
|
43
111
|
clone(): Output;
|
|
112
|
+
/**
|
|
113
|
+
* Create from object
|
|
114
|
+
*/
|
|
44
115
|
static fromObject(data: OutputData): Output;
|
|
116
|
+
/**
|
|
117
|
+
* Check if this output is a Pay-to-Public-Key-Hash output
|
|
118
|
+
*/
|
|
45
119
|
isPayToPublicKeyHash(): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Check if this output is a Pay-to-Script-Hash output
|
|
122
|
+
*/
|
|
46
123
|
isPayToScriptHash(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Check if this output is a Pay-to-Taproot output
|
|
126
|
+
*/
|
|
47
127
|
isPayToTaproot(): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Get the address for this output (if applicable)
|
|
130
|
+
*/
|
|
48
131
|
getAddress(): string | null;
|
|
49
132
|
}
|
|
50
133
|
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAKrC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,MAAM,CAAA;IACxC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IACjC,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACZ;
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EA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,MAAM,GAAG,MAAM;IAM3B;;OAEG;IACH,OAAO,IAAI,OAAO;IAQlB;;OAEG;IACH,MAAM,CAAC,aAAa,GAAE,MAAY,GAAG,OAAO;IAI5C;;OAEG;IACH,eAAe,IAAI,MAAM,GAAG,KAAK;IAajC;;OAEG;IACH,UAAU,IAAI,OAAO;IAYrB;;OAEG;IACH,QAAQ,IAAI,YAAY;IAQxB;;;;OAIG;IACH,MAAM,QAbM,YAAY,CAaF;IAEtB;;OAEG;IACH,OAAO,IAAI,MAAM;IAUjB;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,YAAY,GAAG,MAAM;IAYjD;;OAEG;IACH,QAAQ,IAAI,MAAM;IAQlB;;OAEG;IACH,cAAc,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY;IAWnD;;OAEG;IACH,OAAO,IAAI,MAAM;IAQjB;;OAEG;IACH,KAAK,IAAI,MAAM;IAOf;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;IAI3C;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,UAAU,IAAI,MAAM,GAAG,IAAI;CAQ5B"}
|
|
@@ -7,6 +7,7 @@ import { PrivateKey } from '../privatekey';
|
|
|
7
7
|
import { PublicKey } from '../publickey';
|
|
8
8
|
import type { Buffer } from 'buffer/';
|
|
9
9
|
export interface TransactionLike {
|
|
10
|
+
/** This array is also used */
|
|
10
11
|
inputs: Array<{
|
|
11
12
|
prevTxId: Buffer;
|
|
12
13
|
outputIndex: number;
|
|
@@ -23,11 +24,79 @@ export interface TransactionLike {
|
|
|
23
24
|
version?: number;
|
|
24
25
|
nLockTime?: number;
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Calculate the sighash for a transaction
|
|
29
|
+
*
|
|
30
|
+
* This function routes to the appropriate sighash algorithm based on flags:
|
|
31
|
+
* - SIGHASH_LOTUS (0x60): Lotus sighash with merkle trees
|
|
32
|
+
* - SIGHASH_FORKID (0x40): BIP143 sighash
|
|
33
|
+
* - Legacy (0x00): Original Bitcoin sighash
|
|
34
|
+
*
|
|
35
|
+
* Note: SIGHASH_LOTUS requires spent outputs for all inputs to be available
|
|
36
|
+
* in the transaction.spentOutputs property.
|
|
37
|
+
*
|
|
38
|
+
* @param transaction - The transaction being signed (must have spentOutputs for LOTUS)
|
|
39
|
+
* @param sighashType - Signature hash type flags
|
|
40
|
+
* @param inputNumber - Index of input being signed
|
|
41
|
+
* @param subscript - Script being executed/signed
|
|
42
|
+
* @param satoshisBN - Value of output being spent (required for FORKID/LOTUS)
|
|
43
|
+
* @param flags - Script validation flags
|
|
44
|
+
* @returns 32-byte signature hash
|
|
45
|
+
*/
|
|
26
46
|
declare function sighash(transaction: TransactionLike, sighashType: number, inputNumber: number, subscript: Script, satoshisBN?: BN, flags?: number): Buffer;
|
|
47
|
+
/**
|
|
48
|
+
* Sign a transaction input
|
|
49
|
+
*
|
|
50
|
+
* Generates a cryptographic signature for a transaction input using the specified
|
|
51
|
+
* signing method (ECDSA or Schnorr) and sighash algorithm.
|
|
52
|
+
*
|
|
53
|
+
* Sighash Algorithm Selection:
|
|
54
|
+
* - If SIGHASH_LOTUS flag is set: Uses Lotus sighash (requires transaction.spentOutputs)
|
|
55
|
+
* - If SIGHASH_FORKID flag is set: Uses BIP143 sighash
|
|
56
|
+
* - Otherwise: Uses legacy Bitcoin sighash
|
|
57
|
+
*
|
|
58
|
+
* @param transaction - The transaction being signed (must have spentOutputs for LOTUS)
|
|
59
|
+
* @param privateKey - Private key to sign with
|
|
60
|
+
* @param sighashType - Signature hash type (e.g., SIGHASH_ALL | SIGHASH_FORKID)
|
|
61
|
+
* @param inputIndex - Index of the input being signed
|
|
62
|
+
* @param subscript - The script being executed/signed
|
|
63
|
+
* @param satoshisBN - Value of the output being spent
|
|
64
|
+
* @param flags - Script validation flags
|
|
65
|
+
* @param signingMethod - 'ecdsa' (default) or 'schnorr'
|
|
66
|
+
* @returns Signature object with nhashtype set
|
|
67
|
+
* @throws Error if SIGHASH_LOTUS is used without transaction.spentOutputs
|
|
68
|
+
*/
|
|
27
69
|
declare function sign(transaction: TransactionLike, privateKey: PrivateKey, sighashType: number, inputIndex: number, subscript: Script, satoshisBN?: BN, flags?: number, signingMethod?: 'ecdsa' | 'schnorr'): Signature;
|
|
70
|
+
/**
|
|
71
|
+
* Verify a transaction signature
|
|
72
|
+
*
|
|
73
|
+
* Verifies that a signature is valid for the specified transaction input.
|
|
74
|
+
* Automatically uses the correct sighash algorithm based on the signature's
|
|
75
|
+
* nhashtype field (LOTUS, FORKID, or legacy).
|
|
76
|
+
*
|
|
77
|
+
* @param transaction - The transaction being verified (must have spentOutputs for LOTUS)
|
|
78
|
+
* @param signature - The signature to verify (must have nhashtype set)
|
|
79
|
+
* @param publicKey - Public key to verify against
|
|
80
|
+
* @param inputIndex - Index of the input being verified
|
|
81
|
+
* @param subscript - The script being executed
|
|
82
|
+
* @param satoshisBN - Value of the output being spent
|
|
83
|
+
* @param flags - Script validation flags
|
|
84
|
+
* @param signingMethod - 'ecdsa' (default) or 'schnorr'
|
|
85
|
+
* @returns true if signature is valid, false otherwise
|
|
86
|
+
* @throws Error if SIGHASH_LOTUS is used without transaction.spentOutputs
|
|
87
|
+
*/
|
|
28
88
|
declare function verify(transaction: TransactionLike, signature: Signature, publicKey: PublicKey, inputIndex: number, subscript: Script, satoshisBN?: BN, flags?: number, signingMethod?: 'ecdsa' | 'schnorr'): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Default sign flags
|
|
91
|
+
*/
|
|
29
92
|
export declare const DEFAULT_SIGN_FLAGS: number;
|
|
93
|
+
/**
|
|
94
|
+
* Constants
|
|
95
|
+
*/
|
|
30
96
|
export declare const SIGHASH_SINGLE_BUG = "0000000000000000000000000000000000000000000000000000000000000001";
|
|
31
97
|
export declare const BITS_64_ON = "ffffffffffffffff";
|
|
98
|
+
/**
|
|
99
|
+
* @namespace Signing
|
|
100
|
+
*/
|
|
32
101
|
export { sighash, sign, verify };
|
|
33
102
|
//# sourceMappingURL=sighash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sighash.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/sighash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAOjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,eAAe;
|
|
1
|
+
{"version":3,"file":"sighash.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/sighash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAOjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,eAAe;IAC9B,8BAA8B;I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AK,CAAC,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,GAClC,OAAO,CA6BT;AAyDD;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAA2B,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,kBAAkB,qEAA2B,CAAA;AAC1D,eAAO,MAAM,UAAU,qBAAmB,CAAA;AAE1C;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -17,25 +17,123 @@ export interface TransactionSignatureObject {
|
|
|
17
17
|
signature: string;
|
|
18
18
|
sigtype: number;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Represents a digital signature within a transaction input, including identifying information and the signature itself.
|
|
22
|
+
*
|
|
23
|
+
* The `TransactionSignature` class wraps a low-level cryptography `Signature` class and includes additional context,
|
|
24
|
+
* such as which input/output the signature is for, the signer public key, and the sighash type.
|
|
25
|
+
*
|
|
26
|
+
* CRITICAL: This class maintains automatic synchronization of the sighash type (nhashtype) between
|
|
27
|
+
* the TransactionSignature.sigtype and the inner Signature.nhashtype. This ensures that signature
|
|
28
|
+
* verification and serialization always use the correct sighash type.
|
|
29
|
+
*
|
|
30
|
+
* It automatically detects and parses ECDSA (DER format) and Schnorr signatures, supports serialization/deserialization,
|
|
31
|
+
* and provides basic validation logic.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const tsig = new TransactionSignature({
|
|
35
|
+
* publicKey: pubkey,
|
|
36
|
+
* prevTxId: txid,
|
|
37
|
+
* outputIndex: 0,
|
|
38
|
+
* inputIndex: 0,
|
|
39
|
+
* signature: sigBuf, // Buffer, Signature, or hex
|
|
40
|
+
* sigtype: Signature.SIGHASH_ALL,
|
|
41
|
+
* });
|
|
42
|
+
*/
|
|
20
43
|
export declare class TransactionSignature {
|
|
44
|
+
/** Public key of the signer */
|
|
21
45
|
publicKey: PublicKey;
|
|
46
|
+
/** Previous transaction id for the referenced UTXO (as Buffer) */
|
|
22
47
|
prevTxId: Buffer;
|
|
48
|
+
/** Index of the output in the previous transaction being spent */
|
|
23
49
|
outputIndex: number;
|
|
50
|
+
/** Index of this input in the current transaction */
|
|
24
51
|
inputIndex: number;
|
|
52
|
+
/** Signature hash type used for this signature (see Signature.SIGHASH_*) */
|
|
25
53
|
private _sigtype;
|
|
54
|
+
/** Signature value; can be Schnorr or ECDSA, as a Signature object */
|
|
26
55
|
private _signature;
|
|
56
|
+
/**
|
|
57
|
+
* Get the signature object
|
|
58
|
+
* @returns The inner Signature object
|
|
59
|
+
*/
|
|
27
60
|
get signature(): Signature;
|
|
61
|
+
/**
|
|
62
|
+
* Set the signature object and automatically sync nhashtype
|
|
63
|
+
* @param sig The signature to set
|
|
64
|
+
*/
|
|
28
65
|
set signature(sig: Signature);
|
|
66
|
+
/**
|
|
67
|
+
* Get the sighash type
|
|
68
|
+
* @returns The sighash type value
|
|
69
|
+
*/
|
|
29
70
|
get sigtype(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Set the sighash type and automatically sync to inner signature
|
|
73
|
+
* @param type The sighash type value
|
|
74
|
+
*/
|
|
30
75
|
set sigtype(type: number);
|
|
76
|
+
/**
|
|
77
|
+
* Creates a new TransactionSignature instance.
|
|
78
|
+
*
|
|
79
|
+
* @param arg - The signature data. Must be a TransactionSignatureData, another TransactionSignature, or (never used) string.
|
|
80
|
+
* @throws {BitcoreError} If required arguments are missing or invalid.
|
|
81
|
+
*/
|
|
31
82
|
constructor(arg?: TransactionSignatureData | TransactionSignature);
|
|
83
|
+
/**
|
|
84
|
+
* Initialize a TransactionSignature instance from an object.
|
|
85
|
+
*
|
|
86
|
+
* This method will set all required properties of the TransactionSignature, including
|
|
87
|
+
* parsing and detecting whether the signature uses Schnorr or ECDSA encoding.
|
|
88
|
+
*
|
|
89
|
+
* @param arg - The object containing properties to initialize the TransactionSignature.
|
|
90
|
+
* @returns The TransactionSignature instance with all fields set.
|
|
91
|
+
* @throws {BitcoreError} If required or invalid arguments are supplied.
|
|
92
|
+
*
|
|
93
|
+
* Signature parsing process:
|
|
94
|
+
* - If the signature is already a Signature instance, it is directly assigned.
|
|
95
|
+
* - If the signature is a Buffer, it detects type (Schnorr/ECDSA) based on length and content,
|
|
96
|
+
* optionally stripping a possible sighash byte for type detection.
|
|
97
|
+
* - If the signature is a string, it is parsed from hex; type detection is performed similarly.
|
|
98
|
+
*/
|
|
32
99
|
private _fromObject;
|
|
100
|
+
/**
|
|
101
|
+
* Validates the input object for TransactionSignature construction.
|
|
102
|
+
*
|
|
103
|
+
* @param arg - The object to validate.
|
|
104
|
+
* @throws {BitcoreError} If required fields are missing or invalid.
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
33
107
|
private _checkObjectArgs;
|
|
108
|
+
/**
|
|
109
|
+
* Converts signature to plain JS object representation.
|
|
110
|
+
* @returns The object with all signature fields as string/number types.
|
|
111
|
+
*/
|
|
34
112
|
toObject(): TransactionSignatureObject;
|
|
113
|
+
/**
|
|
114
|
+
* Converts signature to a plain object suitable for JSON serialization.
|
|
115
|
+
*/
|
|
35
116
|
toJSON: () => TransactionSignatureObject;
|
|
117
|
+
/**
|
|
118
|
+
* Factory for constructing a TransactionSignature from an object.
|
|
119
|
+
* @param obj - The signature data.
|
|
120
|
+
* @returns New TransactionSignature instance.
|
|
121
|
+
*/
|
|
36
122
|
static fromObject(obj: TransactionSignatureData): TransactionSignature;
|
|
123
|
+
/**
|
|
124
|
+
* Clone this transaction signature.
|
|
125
|
+
* @returns Deep copy of this TransactionSignature.
|
|
126
|
+
*/
|
|
37
127
|
clone(): TransactionSignature;
|
|
128
|
+
/**
|
|
129
|
+
* Checks if this signature has all required fields and format.
|
|
130
|
+
* @returns True if the signature is structurally valid.
|
|
131
|
+
*/
|
|
38
132
|
isValid(): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Returns a human-readable string representation.
|
|
135
|
+
* @returns Format like "TransactionSignature(0:0)".
|
|
136
|
+
*/
|
|
39
137
|
toString(): string;
|
|
40
138
|
}
|
|
41
139
|
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/signature.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAA;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;IACtC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;IACtC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/transaction/signature.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAA;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;IACtC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,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