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.
Files changed (172) hide show
  1. package/dist/cjs/lib/bitcore/crypto/point.js +2 -2
  2. package/dist/cjs/lib/bitcore/index.js +162 -162
  3. package/dist/esm/lib/bitcore/crypto/point.js +2 -2
  4. package/dist/esm/lib/bitcore/index.js +42 -42
  5. package/dist/types/index.d.ts +5 -0
  6. package/dist/types/index.d.ts.map +1 -1
  7. package/dist/types/lib/bitcore/address.d.ts +116 -0
  8. package/dist/types/lib/bitcore/address.d.ts.map +1 -1
  9. package/dist/types/lib/bitcore/block/block.d.ts +214 -0
  10. package/dist/types/lib/bitcore/block/block.d.ts.map +1 -1
  11. package/dist/types/lib/bitcore/block/blockheader.d.ts +220 -0
  12. package/dist/types/lib/bitcore/block/blockheader.d.ts.map +1 -1
  13. package/dist/types/lib/bitcore/block/merkleblock.d.ts +206 -0
  14. package/dist/types/lib/bitcore/block/merkleblock.d.ts.map +1 -1
  15. package/dist/types/lib/bitcore/crypto/bn.d.ts +224 -0
  16. package/dist/types/lib/bitcore/crypto/bn.d.ts.map +1 -1
  17. package/dist/types/lib/bitcore/crypto/ecdsa.d.ts +122 -0
  18. package/dist/types/lib/bitcore/crypto/ecdsa.d.ts.map +1 -1
  19. package/dist/types/lib/bitcore/crypto/hash.d.ts +56 -0
  20. package/dist/types/lib/bitcore/crypto/hash.d.ts.map +1 -1
  21. package/dist/types/lib/bitcore/crypto/index.d.ts +4 -0
  22. package/dist/types/lib/bitcore/crypto/index.d.ts.map +1 -1
  23. package/dist/types/lib/bitcore/crypto/musig2.d.ts +282 -0
  24. package/dist/types/lib/bitcore/crypto/musig2.d.ts.map +1 -1
  25. package/dist/types/lib/bitcore/crypto/point.d.ts +87 -0
  26. package/dist/types/lib/bitcore/crypto/point.d.ts.map +1 -1
  27. package/dist/types/lib/bitcore/crypto/random.d.ts +48 -0
  28. package/dist/types/lib/bitcore/crypto/random.d.ts.map +1 -1
  29. package/dist/types/lib/bitcore/crypto/schnorr.d.ts +203 -0
  30. package/dist/types/lib/bitcore/crypto/schnorr.d.ts.map +1 -1
  31. package/dist/types/lib/bitcore/crypto/signature.d.ts +452 -0
  32. package/dist/types/lib/bitcore/crypto/signature.d.ts.map +1 -1
  33. package/dist/types/lib/bitcore/crypto/sigtype.d.ts +46 -0
  34. package/dist/types/lib/bitcore/crypto/sigtype.d.ts.map +1 -1
  35. package/dist/types/lib/bitcore/encoding/base58.d.ts +68 -0
  36. package/dist/types/lib/bitcore/encoding/base58.d.ts.map +1 -1
  37. package/dist/types/lib/bitcore/encoding/base58check.d.ts +58 -0
  38. package/dist/types/lib/bitcore/encoding/base58check.d.ts.map +1 -1
  39. package/dist/types/lib/bitcore/encoding/bufferreader.d.ts +112 -0
  40. package/dist/types/lib/bitcore/encoding/bufferreader.d.ts.map +1 -1
  41. package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts +144 -0
  42. package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts.map +1 -1
  43. package/dist/types/lib/bitcore/encoding/varint.d.ts +86 -0
  44. package/dist/types/lib/bitcore/encoding/varint.d.ts.map +1 -1
  45. package/dist/types/lib/bitcore/errors.d.ts +4 -0
  46. package/dist/types/lib/bitcore/errors.d.ts.map +1 -1
  47. package/dist/types/lib/bitcore/hdprivatekey.d.ts +59 -0
  48. package/dist/types/lib/bitcore/hdprivatekey.d.ts.map +1 -1
  49. package/dist/types/lib/bitcore/hdpublickey.d.ts +145 -0
  50. package/dist/types/lib/bitcore/hdpublickey.d.ts.map +1 -1
  51. package/dist/types/lib/bitcore/index.d.ts +58 -54
  52. package/dist/types/lib/bitcore/index.d.ts.map +1 -1
  53. package/dist/types/lib/bitcore/message.d.ts +63 -0
  54. package/dist/types/lib/bitcore/message.d.ts.map +1 -1
  55. package/dist/types/lib/bitcore/mnemonic/errors.d.ts +4 -0
  56. package/dist/types/lib/bitcore/mnemonic/errors.d.ts.map +1 -1
  57. package/dist/types/lib/bitcore/mnemonic/index.d.ts +4 -0
  58. package/dist/types/lib/bitcore/mnemonic/index.d.ts.map +1 -1
  59. package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts +106 -0
  60. package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts.map +1 -1
  61. package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts +13 -0
  62. package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts.map +1 -1
  63. package/dist/types/lib/bitcore/mnemonic/words/english.d.ts +4 -0
  64. package/dist/types/lib/bitcore/mnemonic/words/english.d.ts.map +1 -1
  65. package/dist/types/lib/bitcore/mnemonic/words/french.d.ts +5 -0
  66. package/dist/types/lib/bitcore/mnemonic/words/french.d.ts.map +1 -1
  67. package/dist/types/lib/bitcore/mnemonic/words/index.d.ts +4 -0
  68. package/dist/types/lib/bitcore/mnemonic/words/index.d.ts.map +1 -1
  69. package/dist/types/lib/bitcore/musig2/index.d.ts +14 -0
  70. package/dist/types/lib/bitcore/musig2/index.d.ts.map +1 -1
  71. package/dist/types/lib/bitcore/musig2/session.d.ts +254 -0
  72. package/dist/types/lib/bitcore/musig2/session.d.ts.map +1 -1
  73. package/dist/types/lib/bitcore/musig2/signer.d.ts +212 -0
  74. package/dist/types/lib/bitcore/musig2/signer.d.ts.map +1 -1
  75. package/dist/types/lib/bitcore/networks.d.ts +17 -0
  76. package/dist/types/lib/bitcore/networks.d.ts.map +1 -1
  77. package/dist/types/lib/bitcore/opcode.d.ts +151 -0
  78. package/dist/types/lib/bitcore/opcode.d.ts.map +1 -1
  79. package/dist/types/lib/bitcore/privatekey.d.ts +80 -0
  80. package/dist/types/lib/bitcore/privatekey.d.ts.map +1 -1
  81. package/dist/types/lib/bitcore/publickey.d.ts +195 -0
  82. package/dist/types/lib/bitcore/publickey.d.ts.map +1 -1
  83. package/dist/types/lib/bitcore/script/chunk.d.ts +51 -0
  84. package/dist/types/lib/bitcore/script/chunk.d.ts.map +1 -1
  85. package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts +60 -0
  86. package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts.map +1 -1
  87. package/dist/types/lib/bitcore/script/interpreter/index.d.ts +23 -0
  88. package/dist/types/lib/bitcore/script/interpreter/index.d.ts.map +1 -1
  89. package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts +86 -0
  90. package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts.map +1 -1
  91. package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts +115 -0
  92. package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts.map +1 -1
  93. package/dist/types/lib/bitcore/script/interpreter/types.d.ts +119 -0
  94. package/dist/types/lib/bitcore/script/interpreter/types.d.ts.map +1 -1
  95. package/dist/types/lib/bitcore/script/taproot.d.ts +297 -0
  96. package/dist/types/lib/bitcore/script/taproot.d.ts.map +1 -1
  97. package/dist/types/lib/bitcore/script.d.ts +510 -0
  98. package/dist/types/lib/bitcore/script.d.ts.map +1 -1
  99. package/dist/types/lib/bitcore/taproot/musig2.d.ts +153 -0
  100. package/dist/types/lib/bitcore/taproot/musig2.d.ts.map +1 -1
  101. package/dist/types/lib/bitcore/transaction/input/multisig.d.ts +8 -0
  102. package/dist/types/lib/bitcore/transaction/input/multisig.d.ts.map +1 -1
  103. package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts +8 -0
  104. package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts.map +1 -1
  105. package/dist/types/lib/bitcore/transaction/input/publickey.d.ts +8 -0
  106. package/dist/types/lib/bitcore/transaction/input/publickey.d.ts.map +1 -1
  107. package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts +14 -0
  108. package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts.map +1 -1
  109. package/dist/types/lib/bitcore/transaction/input/taproot.d.ts +22 -0
  110. package/dist/types/lib/bitcore/transaction/input/taproot.d.ts.map +1 -1
  111. package/dist/types/lib/bitcore/transaction/input.d.ts +418 -0
  112. package/dist/types/lib/bitcore/transaction/input.d.ts.map +1 -1
  113. package/dist/types/lib/bitcore/transaction/outpoint.d.ts +110 -0
  114. package/dist/types/lib/bitcore/transaction/outpoint.d.ts.map +1 -1
  115. package/dist/types/lib/bitcore/transaction/output.d.ts +83 -0
  116. package/dist/types/lib/bitcore/transaction/output.d.ts.map +1 -1
  117. package/dist/types/lib/bitcore/transaction/sighash.d.ts +69 -0
  118. package/dist/types/lib/bitcore/transaction/sighash.d.ts.map +1 -1
  119. package/dist/types/lib/bitcore/transaction/signature.d.ts +98 -0
  120. package/dist/types/lib/bitcore/transaction/signature.d.ts.map +1 -1
  121. package/dist/types/lib/bitcore/transaction/transaction.d.ts +379 -0
  122. package/dist/types/lib/bitcore/transaction/transaction.d.ts.map +1 -1
  123. package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts +61 -0
  124. package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts.map +1 -1
  125. package/dist/types/lib/bitcore/unit.d.ts +140 -0
  126. package/dist/types/lib/bitcore/unit.d.ts.map +1 -1
  127. package/dist/types/lib/bitcore/uri.d.ts +34 -0
  128. package/dist/types/lib/bitcore/uri.d.ts.map +1 -1
  129. package/dist/types/lib/bitcore/util/base32.d.ts +55 -0
  130. package/dist/types/lib/bitcore/util/base32.d.ts.map +1 -1
  131. package/dist/types/lib/bitcore/util/bits.d.ts +76 -0
  132. package/dist/types/lib/bitcore/util/bits.d.ts.map +1 -1
  133. package/dist/types/lib/bitcore/util/buffer.d.ts +135 -0
  134. package/dist/types/lib/bitcore/util/buffer.d.ts.map +1 -1
  135. package/dist/types/lib/bitcore/util/convertBits.d.ts +15 -0
  136. package/dist/types/lib/bitcore/util/convertBits.d.ts.map +1 -1
  137. package/dist/types/lib/bitcore/util/js.d.ts +19 -0
  138. package/dist/types/lib/bitcore/util/js.d.ts.map +1 -1
  139. package/dist/types/lib/bitcore/util/merkle.d.ts +85 -0
  140. package/dist/types/lib/bitcore/util/merkle.d.ts.map +1 -1
  141. package/dist/types/lib/bitcore/util/preconditions.d.ts +29 -0
  142. package/dist/types/lib/bitcore/util/preconditions.d.ts.map +1 -1
  143. package/dist/types/lib/bitcore/util.d.ts +7 -0
  144. package/dist/types/lib/bitcore/util.d.ts.map +1 -1
  145. package/dist/types/lib/bitcore/xaddress.d.ts +117 -0
  146. package/dist/types/lib/bitcore/xaddress.d.ts.map +1 -1
  147. package/dist/types/lib/lokad.d.ts +292 -0
  148. package/dist/types/lib/lokad.d.ts.map +1 -1
  149. package/dist/types/lib/nft.d.ts +434 -0
  150. package/dist/types/lib/nft.d.ts.map +1 -1
  151. package/dist/types/lib/rank/api.d.ts +13 -0
  152. package/dist/types/lib/rank/api.d.ts.map +1 -1
  153. package/dist/types/lib/rank/index.d.ts +153 -0
  154. package/dist/types/lib/rank/index.d.ts.map +1 -1
  155. package/dist/types/lib/rank/opcode.d.ts +6 -2
  156. package/dist/types/lib/rank/opcode.d.ts.map +1 -1
  157. package/dist/types/lib/rank/script.d.ts +10 -0
  158. package/dist/types/lib/rank/script.d.ts.map +1 -1
  159. package/dist/types/lib/rank/transaction.d.ts +11 -0
  160. package/dist/types/lib/rank/transaction.d.ts.map +1 -1
  161. package/dist/types/lib/rpc.d.ts +176 -0
  162. package/dist/types/lib/rpc.d.ts.map +1 -1
  163. package/dist/types/utils/constants.d.ts +27 -0
  164. package/dist/types/utils/constants.d.ts.map +1 -1
  165. package/dist/types/utils/env.d.ts +15 -0
  166. package/dist/types/utils/env.d.ts.map +1 -1
  167. package/dist/types/utils/string.d.ts +57 -0
  168. package/dist/types/utils/string.d.ts.map +1 -1
  169. package/dist/types/utils/wallet.d.ts +43 -1
  170. package/dist/types/utils/wallet.d.ts.map +1 -1
  171. package/package.json +1 -1
  172. package/tsconfig.types.json +2 -1
@@ -1,3 +1,22 @@
1
+ /**
2
+ * Unit implementation for Lotus
3
+ * Migrated from bitcore-lib-xpi with ESM support and BigInt
4
+ */
5
+ /**
6
+ * Unit definitions for XPI (Lotus) amounts.
7
+ *
8
+ * The `UNITS` object maps unit codes to an array of two numbers:
9
+ * [factor, decimals], where:
10
+ * - `factor` is the number of satoshis ("base units") in one of the given unit.
11
+ * - `decimals` is the number of decimal places typically displayed for the unit.
12
+ *
13
+ * Units:
14
+ * - XPI: 1,000,000 satoshis per XPI (6 decimal places)
15
+ * - mXPI: 1,000 satoshis per mXPI (3 decimal places)
16
+ * - uXPI: 100 satoshis per uXPI (2 decimal places)
17
+ * - bits: 100 satoshis per bit (synonym for uXPI, 2 decimal places)
18
+ * - satoshis: 1 satoshi per satoshi (0 decimal places)
19
+ */
1
20
  declare const UNITS: {
2
21
  readonly XPI: readonly [1000000, 6];
3
22
  readonly mXPI: readonly [1000, 3];
@@ -10,6 +29,28 @@ export interface UnitData {
10
29
  code: string;
11
30
  }
12
31
  export type UnitCode = keyof typeof UNITS;
32
+ /**
33
+ * Utility for handling and converting Lotus XPI units.
34
+ *
35
+ * Supported units are XPI, mXPI, bits (also named uXPI) and satoshis.
36
+ * A unit instance can be created with an amount and a unit code, or
37
+ * alternatively using static methods like {@link Unit.fromXPI}.
38
+ * It also allows creation from a fiat amount and exchange rate, or
39
+ * alternatively using the {@link Unit.fromFiat} static method.
40
+ *
41
+ * You can query for different representations of a unit instance using its
42
+ * {@link Unit.to} method, the fixed unit methods like {@link Unit.toSatoshis},
43
+ * or alternatively using the unit accessors. It can also be converted to a
44
+ * fiat amount by providing the corresponding XPI/fiat exchange rate.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const sats = Unit.fromXPI(1.3).toSatoshis()
49
+ * const mili = Unit.fromMicros(1.3).to(Unit.mXPI)
50
+ * const bits = Unit.fromFiat(1.3, 350).bits
51
+ * const xpi = new Unit(1.3, Unit.bits).XPI
52
+ * ```
53
+ */
13
54
  export declare class Unit {
14
55
  private _value;
15
56
  static readonly XPI = "XPI";
@@ -18,26 +59,125 @@ export declare class Unit {
18
59
  static readonly bits = "bits";
19
60
  static readonly satoshis = "satoshis";
20
61
  constructor(amount: number, code: UnitCode | number);
62
+ /**
63
+ * Returns a Unit instance created from JSON string or object
64
+ *
65
+ * @param {Object} data - Object with keys: amount and code
66
+ * @returns {Unit} A Unit instance
67
+ */
21
68
  static fromObject(data: UnitData): Unit;
69
+ /**
70
+ * Returns a Unit instance created from an amount in XPI
71
+ *
72
+ * @param {Number} amount - The amount in XPI
73
+ * @returns {Unit} A Unit instance
74
+ */
22
75
  static fromXPI(amount: number): Unit;
76
+ /**
77
+ * Returns a Unit instance created from an amount in mXPI
78
+ *
79
+ * @param {Number} amount - The amount in mXPI
80
+ * @returns {Unit} A Unit instance
81
+ */
23
82
  static fromMillis(amount: number): Unit;
83
+ /**
84
+ * Alias for fromMillis
85
+ */
24
86
  static fromMilis: typeof Unit.fromMillis;
87
+ /**
88
+ * Returns a Unit instance created from an amount in bits
89
+ *
90
+ * @param {Number} amount - The amount in bits
91
+ * @returns {Unit} A Unit instance
92
+ */
25
93
  static fromMicros(amount: number): Unit;
94
+ /**
95
+ * Alias for fromMicros
96
+ */
26
97
  static fromBits: typeof Unit.fromMicros;
98
+ /**
99
+ * Returns a Unit instance created from an amount in satoshis
100
+ *
101
+ * @param {Number|bigint} amount - The amount in satoshis
102
+ * @returns {Unit} A Unit instance
103
+ */
27
104
  static fromSatoshis(amount: number | bigint): Unit;
105
+ /**
106
+ * Returns a Unit instance created from a fiat amount and exchange rate.
107
+ *
108
+ * @param {Number} amount - The amount in fiat
109
+ * @param {Number} rate - The exchange rate XPI/fiat
110
+ * @returns {Unit} A Unit instance
111
+ */
28
112
  static fromFiat(amount: number, rate: number): Unit;
29
113
  private _from;
114
+ /**
115
+ * Returns the value represented in the specified unit
116
+ *
117
+ * @param {String|Number} code - The unit code or exchange rate
118
+ * @returns {Number} The converted value
119
+ */
30
120
  to(code: UnitCode | number): number;
121
+ /**
122
+ * Returns the value represented in XPI
123
+ *
124
+ * @returns {Number} The value converted to XPI
125
+ */
31
126
  toXPI(): number;
127
+ /**
128
+ * Returns the value represented in mXPI
129
+ *
130
+ * @returns {Number} The value converted to mXPI
131
+ */
32
132
  toMillis(): number;
133
+ /**
134
+ * Alias for toMillis
135
+ */
33
136
  toMilis: () => number;
137
+ /**
138
+ * Returns the value represented in bits
139
+ *
140
+ * @returns {Number} The value converted to bits
141
+ */
34
142
  toMicros(): number;
143
+ /**
144
+ * Alias for toMicros
145
+ */
35
146
  toBits: () => number;
147
+ /**
148
+ * Returns the value represented in satoshis
149
+ *
150
+ * @returns {bigint} The value converted to satoshis
151
+ */
36
152
  toSatoshis(): bigint;
153
+ /**
154
+ * Returns the value represented in fiat
155
+ *
156
+ * @param {number} rate - The exchange rate between XPI/currency
157
+ * @returns {Number} The value converted to fiat
158
+ */
37
159
  atRate(rate: number): number;
160
+ /**
161
+ * Returns a the string representation of the value in satoshis
162
+ *
163
+ * @returns {string} the value in satoshis
164
+ */
38
165
  toString(): string;
166
+ /**
167
+ * Returns a plain object representation of the Unit
168
+ *
169
+ * @returns {Object} An object with the keys: amount and code
170
+ */
39
171
  toObject(): UnitData;
172
+ /**
173
+ * Alias for toObject
174
+ */
40
175
  toJSON: () => UnitData;
176
+ /**
177
+ * Returns a string formatted for the console
178
+ *
179
+ * @returns {string} the value in satoshis
180
+ */
41
181
  inspect(): string;
42
182
  }
43
183
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../../lib/bitcore/unit.ts"],"names":[],"mappings":"AAwBA,QAAA,MAAM,KAAK;;;;;;CAMD,CAAA;AAEV,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAA;AAwBzC,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAS;IAGvB,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAQ;IAC3B,MAAM,CAAC,QAAQ,CAAC,IAAI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,MAAM;IAkBnC;;;;OAIG;IACH,KAAK,IAAI,MAAM;IAIf;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,OAAO,QAPK,MAAM,CAOK;IAEvB;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,MAAM,QAPM,MAAM,CAOI;IAEtB;;;;OAIG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI5B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;OAIG;IACH,QAAQ,IAAI,QAAQ;IAOpB;;OAEG;IACH,MAAM,QAVM,QAAQ,CAUE;IAEtB;;;;OAIG;IACH,OAAO,IAAI,MAAM;CAGlB"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * URI class for Lotus URI handling
3
+ * Migrated from bitcore-lib-xpi with ESM support
4
+ */
1
5
  import { Address } from './address.js';
2
6
  export interface URIParams {
3
7
  address?: string;
@@ -13,17 +17,47 @@ export declare class URI {
13
17
  private _message?;
14
18
  private _otherParams;
15
19
  constructor(data: string | URIParams, knownParams?: string[]);
20
+ /**
21
+ * Create URI from string
22
+ */
16
23
  static fromString(data: string): URI;
24
+ /**
25
+ * Create URI from object
26
+ */
17
27
  static fromObject(data: URIParams): URI;
28
+ /**
29
+ * Check if URI is valid
30
+ */
18
31
  static isValid(data: string | URIParams, knownParams?: string[]): boolean;
19
32
  private _fromString;
20
33
  private _fromObject;
34
+ /**
35
+ * Get the address
36
+ */
21
37
  get address(): Address | undefined;
38
+ /**
39
+ * Get the amount
40
+ */
22
41
  get amount(): number | undefined;
42
+ /**
43
+ * Get the label
44
+ */
23
45
  get label(): string | undefined;
46
+ /**
47
+ * Get the message
48
+ */
24
49
  get message(): string | undefined;
50
+ /**
51
+ * Get other parameters
52
+ */
25
53
  get otherParams(): Record<string, string>;
54
+ /**
55
+ * Convert to string
56
+ */
26
57
  toString(prefix?: string): string;
58
+ /**
59
+ * Convert to object
60
+ */
27
61
  toObject(): URIParams;
28
62
  }
29
63
  //# sourceMappingURL=uri.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["../../../../lib/bitcore/uri.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAQtC,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAC3C;AAED,qBAAa,GAAG;IACd,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,MAAM,CAAC,CAAQ;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAQ;IACzB,OAAO,CAAC,YAAY,CAA6B;gBAErC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE;IAa5D,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG;IAOpC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,GAAG;IAOvC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO;IASzE,OAAO,CAAC,WAAW;IAiDnB,OAAO,CAAC,WAAW;IAgCnB,IAAI,OAAO,IAAI,OAAO,GAAG,SAAS,CAEjC;IAKD,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAKD,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAKD,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAE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AM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAExC;IAED;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAoCjC;;OAEG;IACH,QAAQ,IAAI,SAAS;CA0BtB"}
@@ -1,5 +1,60 @@
1
+ /**
2
+ * Base32 encoding/decoding utility
3
+ * Migrated from bitcore-lib-xpi with ESM support and TypeScript
4
+ *
5
+ * @deprecated This is a legacy module retained for backward compatibility.
6
+ * Lotus does **not** use Base32 encoding for addresses - Lotus XAddresses use {@link Base58}.
7
+ *
8
+ * This module is maintained solely for the CashWeb keyserver compatibility.
9
+ *
10
+ * These external services use bech32-style encoding which requires Base32.
11
+ * For all Lotus-native operations, use {@link Base58} or {@link Base58Check} instead.
12
+ *
13
+ * @module base32
14
+ * @see {@link Base58} For Lotus address encoding
15
+ * @see {@link Base58Check} For Lotus address encoding with checksum
16
+ */
17
+ /**
18
+ * Base32 encoding/decoding utility class.
19
+ *
20
+ * @deprecated This class is maintained for CashWeb keyserver compatibility only.
21
+ * Lotus addresses use {@link Base58}, not Base32. Do not use for new Lotus features.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // For CashWeb keyserver compatibility only
26
+ * const encoded = Base32.encode([0, 1, 2, 3])
27
+ * const decoded = Base32.decode('qpzr')
28
+ * ```
29
+ */
1
30
  export declare class Base32 {
31
+ /**
32
+ * Encodes the given array of 5-bit integers as a base32-encoded string.
33
+ * Uses the bech32 character set (qpzry9x8gf2tvdw0s3jn54khce6mua7l).
34
+ *
35
+ * @param data Array of integers between 0 and 31 inclusive.
36
+ * @returns Base32-encoded string
37
+ * @deprecated Only for CashWeb keyserver compatibility
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * Base32.encode([0, 1, 2]) // returns 'qpz'
42
+ * ```
43
+ */
2
44
  static encode(data: number[]): string;
45
+ /**
46
+ * Decodes the given base32-encoded string into an array of 5-bit integers.
47
+ * @deprecated Only for CashWeb keyserver compatibility
48
+ *
49
+ * @param base32 Base32-encoded string using bech32 charset
50
+ * @returns Array of 5-bit integers (0-31)
51
+ * @throws Error if string contains invalid characters
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * Base32.decode('qpzr') // returns [0, 1, 2, 3]
56
+ * ```
57
+ */
3
58
  static decode(base32: string): number[];
4
59
  }
5
60
  //# sourceMappingURL=base32.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base32.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/base32.ts"],"names":[],"mappings":"AA8EA,qBAAa,MAAM;IAcjB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM;IA4BrC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;CAkBxC"}
1
+ {"version":3,"file":"base32.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/base32.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAkDH;;;;;;;;;;;;GAYG;AACH,qBAAa,MAAM;IACjB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM;IAerC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;CAkBxC"}
@@ -1,5 +1,81 @@
1
+ /**
2
+ * Copyright 2026 The Lotusia Stewardship
3
+ * Github: https://github.com/LotusiaStewardship
4
+ * License: MIT
5
+ *
6
+ * Bit manipulation utilities
7
+ *
8
+ * These utilities provide functions for converting between boolean bit arrays
9
+ * and packed byte arrays (LSB-first bit ordering), used primarily for
10
+ * MerkleBlock flag serialization per Lotus protocol specification.
11
+ */
12
+ /**
13
+ * Converts an array of boolean bits into an array of bytes.
14
+ * Bits are packed LSB-first (least significant bit first) into each byte.
15
+ *
16
+ * This matches the Bitcoin/Lotus protocol specification for MerkleBlock
17
+ * flag serialization as implemented in lotusd (BitsToBytes).
18
+ *
19
+ * @param bits - Array of boolean values representing individual bits
20
+ * @returns Array of bytes with bits packed LSB-first
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const bits = [true, false, true, false, true, false, true, false]
25
+ * const bytes = bitsToBytes(bits) // [0b01010101] = [0x55]
26
+ * ```
27
+ */
1
28
  export declare function bitsToBytes(bits: boolean[]): number[];
29
+ /**
30
+ * Converts an array of bytes into an array of boolean bits.
31
+ * Bits are extracted LSB-first (least significant bit first) from each byte.
32
+ *
33
+ * This matches the Bitcoin/Lotus protocol specification for MerkleBlock
34
+ * flag deserialization as implemented in lotusd (BytesToBits).
35
+ *
36
+ * @param bytes - Array of bytes containing packed bits
37
+ * @returns Array of boolean values representing individual bits
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const bytes = [0x55, 0xAA]
42
+ * const bits = bytesToBits(bytes)
43
+ * // [true, false, true, false, true, false, true, false,
44
+ * // false, true, false, true, false, true, false, true]
45
+ * ```
46
+ */
2
47
  export declare function bytesToBits(bytes: number[]): boolean[];
48
+ /**
49
+ * Extracts a single bit from a byte array at the specified position.
50
+ * Uses LSB-first bit ordering consistent with Bitcoin/Lotus protocol.
51
+ *
52
+ * @param bytes - Array of bytes containing packed bits
53
+ * @param position - Bit position (0-indexed, LSB-first)
54
+ * @returns Boolean value of the bit at the specified position
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const bytes = [0b00001111] // 0x0F
59
+ * const bit0 = extractBit(bytes, 0) // true (LSB)
60
+ * const bit4 = extractBit(bytes, 4) // true
61
+ * const bit7 = extractBit(bytes, 7) // false
62
+ * ```
63
+ */
3
64
  export declare function extractBit(bytes: number[], position: number): boolean;
65
+ /**
66
+ * Sets a single bit in a byte array at the specified position.
67
+ * Uses LSB-first bit ordering consistent with Bitcoin/Lotus protocol.
68
+ *
69
+ * @param bytes - Array of bytes to modify
70
+ * @param position - Bit position (0-indexed, LSB-first)
71
+ * @param value - Boolean value to set
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const bytes = [0, 0]
76
+ * setBit(bytes, 0, true) // bytes = [1, 0] (0x01)
77
+ * setBit(bytes, 8, true) // bytes = [1, 1] (0x01, 0x01)
78
+ * ```
79
+ */
4
80
  export declare function setBit(bytes: number[], position: number, value: boolean): void;
5
81
  //# sourceMappingURL=bits.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bits.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/bits.ts"],"names":[],"mappings":"AA4BA,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAMrD;AAoBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAMtD;AAkBD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErE;AAiBD,wBAAgB,MAAM,CACpB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,GACb,IAAI,CAQN"}
1
+ {"version":3,"file":"bits.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/bits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAMrD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAMtD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,GACb,IAAI,CAQN"}
@@ -1,24 +1,159 @@
1
+ /**
2
+ * Buffer utility module
3
+ * Provides helper functions for working with Buffer objects
4
+ * Migrated from bitcore-lib-xpi with ESM support and TypeScript
5
+ */
1
6
  import { Buffer } from 'buffer/';
2
7
  export declare class BufferUtil {
8
+ /** Re-export Buffer class for convenience */
3
9
  static Buffer: typeof Buffer;
10
+ /**
11
+ * Fill a buffer with a value.
12
+ *
13
+ * @param buffer Buffer to fill
14
+ * @param value Value to fill with
15
+ * @return Buffer
16
+ */
4
17
  static fill(buffer: Buffer, value: number): Buffer;
18
+ /**
19
+ * Return a copy of a buffer
20
+ *
21
+ * @param original Original buffer
22
+ * @return Buffer
23
+ */
5
24
  static copy(original: Buffer): Buffer;
25
+ /**
26
+ * Returns true if the given argument is an instance of a buffer. Tests for
27
+ * both node's Buffer and Uint8Array
28
+ *
29
+ * @param arg Argument to test
30
+ * @return boolean
31
+ */
6
32
  static isBuffer(arg: unknown): arg is Buffer | Uint8Array;
33
+ /**
34
+ * Returns a zero-filled byte array
35
+ *
36
+ * @param bytes Number of bytes
37
+ * @return Buffer
38
+ */
7
39
  static emptyBuffer(bytes: number): Buffer;
40
+ /**
41
+ * Allocates a new buffer of the specified size.
42
+ *
43
+ * @param size - The desired length of the new buffer in bytes
44
+ * @param fill - Optional value to fill the buffer with (default: 0)
45
+ * @returns A new buffer of the specified size, filled with the specified value or zeros
46
+ */
8
47
  static alloc(size: number, fill?: string | number | Buffer): Buffer;
48
+ /**
49
+ * Concatenates buffers
50
+ *
51
+ * Shortcut for Buffer.concat
52
+ */
9
53
  static concat(list: ReadonlyArray<Buffer>, totalLength?: number): Buffer;
54
+ /**
55
+ * Check if two buffers are equal
56
+ */
10
57
  static equals(a: Buffer, b: Buffer): boolean;
58
+ /**
59
+ * Alias for equals
60
+ */
11
61
  static equal(a: Buffer, b: Buffer): boolean;
62
+ /**
63
+ * Transforms a number from 0 to 255 into a Buffer of size 1 with that value
64
+ *
65
+ * @param integer Number to convert
66
+ * @return Buffer
67
+ */
12
68
  static integerAsSingleByteBuffer(integer: number): Buffer;
69
+ /**
70
+ * Converts a number to a 4-byte big-endian buffer representation.
71
+ *
72
+ * @param integer - Number to convert (32-bit integer)
73
+ * @returns Buffer of length 4 containing the big-endian representation
74
+ */
13
75
  static integerAsBuffer(integer: number): Buffer;
76
+ /**
77
+ * Converts a 4-byte big-endian buffer to a 32-bit integer.
78
+ *
79
+ * @param buffer - Buffer to convert (must be at least 4 bytes)
80
+ * @returns The 32-bit integer value
81
+ */
14
82
  static integerFromBuffer(buffer: Buffer): number;
83
+ /**
84
+ * Transforms the first byte of an array into a number ranging from -128 to 127
85
+ * @param buffer Buffer to convert
86
+ * @return number
87
+ */
15
88
  static integerFromSingleByteBuffer(buffer: Buffer): number;
89
+ /**
90
+ * Transforms a buffer into a string with a number in hexa representation
91
+ *
92
+ * Shorthand for buffer.toString('hex')
93
+ *
94
+ * @param buffer Buffer to convert
95
+ * @return string
96
+ */
16
97
  static bufferToHex(buffer: Buffer): string;
98
+ /**
99
+ * Reverse a buffer
100
+ * @param param Buffer to reverse
101
+ * @return Buffer
102
+ */
17
103
  static reverse(param: Buffer): Buffer;
104
+ /**
105
+ * Allocates a new Buffer using an {array} of octets.
106
+ *
107
+ * @param array
108
+ */
18
109
  static from(array: any[]): Buffer;
110
+ /**
111
+ * When passed a reference to the .buffer property of a TypedArray instance,
112
+ * the newly created Buffer will share the same allocated memory as the TypedArray.
113
+ * The optional {byteOffset} and {length} arguments specify a memory range
114
+ * within the {arrayBuffer} that will be shared by the Buffer.
115
+ *
116
+ * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
117
+ * @param byteOffset
118
+ * @param length
119
+ */
19
120
  static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
121
+ /**
122
+ * Copies the passed {buffer} data onto a new Buffer instance.
123
+ *
124
+ * @param buffer
125
+ */
20
126
  static from(buffer: Buffer | Uint8Array): Buffer;
127
+ /**
128
+ * Creates a new Buffer containing the given JavaScript string {str}.
129
+ * If provided, the {encoding} parameter identifies the character encoding.
130
+ * If not provided, {encoding} defaults to 'utf8'.
131
+ *
132
+ * @param str
133
+ */
21
134
  static from(str: string, encoding?: BufferEncoding): Buffer;
135
+ /**
136
+ * Compare two buffers byte-by-byte.
137
+ *
138
+ * Performs a lexicographic comparison of two buffers, comparing each byte
139
+ * sequentially until a difference is found or one buffer ends.
140
+ *
141
+ * @param buf1 - First buffer to compare
142
+ * @param buf2 - Second buffer to compare
143
+ * @returns 0 if buffers are equal, -1 if buf1 < buf2, 1 if buf1 > buf2
144
+ *
145
+ * @example
146
+ * // Equal buffers
147
+ * BufferUtil.compare(Buffer.from([1, 2, 3]), Buffer.from([1, 2, 3])) // returns 0
148
+ *
149
+ * @example
150
+ * // First buffer is less
151
+ * BufferUtil.compare(Buffer.from([1, 2]), Buffer.from([1, 3])) // returns -1
152
+ *
153
+ * @example
154
+ * // First buffer is greater
155
+ * BufferUtil.compare(Buffer.from([1, 3]), Buffer.from([1, 2])) // returns 1
156
+ */
22
157
  static compare(buf1: Uint8Array, buf2: Uint8Array): number;
23
158
  }
24
159
  export declare const NULL_HASH: Buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/buffer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,qBAAa,UAAU;IAErB,MAAM,CAAC,MAAM,EAAE,OAAO,MAAM,CAAS;IAQrC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAclD,MAAM,CAAC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4
+ */
5
+ /**
6
+ * Converts an array of integers made up of `from` bits into an
7
+ * array of integers made up of `to` bits. The output array is
8
+ * zero-padded if necessary, unless strict mode is true.
9
+ * Original by Pieter Wuille: https://github.com/sipa/bech32.
10
+ *
11
+ * @param data Array of integers made up of `from` bits.
12
+ * @param from Length in bits of elements in the input array.
13
+ * @param to Length in bits of elements in the output array.
14
+ * @param strict Require the conversion to be completed without padding.
15
+ */
1
16
  export declare function convertBits(data: number[], from: number, to: number, strict?: boolean): number[];
2
17
  //# sourceMappingURL=convertBits.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertBits.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/convertBits.ts"],"names":[],"mappings":"AAkBA,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,OAAe,GACtB,MAAM,EAAE,CAkCV"}
1
+ {"version":3,"file":"convertBits.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/convertBits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,OAAe,GACtB,MAAM,EAAE,CAkCV"}
@@ -1,8 +1,27 @@
1
+ /**
2
+ * JavaScript utility functions
3
+ * Migrated from bitcore-lib-xpi with ESM support
4
+ */
1
5
  export declare class JSUtil {
6
+ /**
7
+ * Determines whether a string contains only hexadecimal values
8
+ */
2
9
  static isHexa(value: string): boolean;
10
+ /**
11
+ * Test if an argument is a valid JSON object
12
+ */
3
13
  static isValidJSON(arg: string): boolean;
14
+ /**
15
+ * Clone an array
16
+ */
4
17
  static cloneArray<T>(arr: T[]): T[];
18
+ /**
19
+ * Check if a value is a natural number
20
+ */
5
21
  static isNaturalNumber(value: unknown): boolean;
22
+ /**
23
+ * Define immutable properties on an object
24
+ */
6
25
  static defineImmutable(obj: object, properties: Record<string, unknown>): object;
7
26
  }
8
27
  //# sourceMappingURL=js.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/js.ts"],"names":[],"mappings":"AAKA,qBAAa,MAAM;IAIjB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAUrC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAexC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;IAOnC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAc/C,MAAM,CAAC,eAAe,CACpB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM;CAWV"}
1
+ {"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/util/js.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qBAAa,MAAM;IACjB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAOrC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAYxC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;IAInC;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAW/C;;OAEG;IACH,MAAM,CAAC,eAAe,CACpB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM;CAWV"}