ccxt 4.2.60 → 4.2.62

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 (160) hide show
  1. package/README.md +6 -5
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +11280 -3407
  4. package/dist/ccxt.browser.min.js +7 -7
  5. package/dist/cjs/ccxt.js +4 -1
  6. package/dist/cjs/src/abstract/hyperliquid.js +9 -0
  7. package/dist/cjs/src/base/Exchange.js +22 -1
  8. package/dist/cjs/src/base/functions/encode.js +5 -0
  9. package/dist/cjs/src/base/functions.js +1 -0
  10. package/dist/cjs/src/bitfinex2.js +1 -1
  11. package/dist/cjs/src/bitget.js +74 -23
  12. package/dist/cjs/src/coinbase.js +108 -103
  13. package/dist/cjs/src/coinex.js +61 -1
  14. package/dist/cjs/src/hyperliquid.js +2035 -0
  15. package/dist/cjs/src/kraken.js +8 -2
  16. package/dist/cjs/src/krakenfutures.js +28 -0
  17. package/dist/cjs/src/kucoinfutures.js +2 -2
  18. package/dist/cjs/src/okx.js +1 -1
  19. package/dist/cjs/src/phemex.js +2 -2
  20. package/dist/cjs/src/pro/bingx.js +1 -0
  21. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +158 -0
  22. package/dist/cjs/src/static_dependencies/ethers/address/address.js +144 -0
  23. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +407 -0
  24. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +45 -0
  25. package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +28 -0
  26. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +176 -0
  27. package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +27 -0
  28. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +52 -0
  29. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +45 -0
  30. package/dist/cjs/src/static_dependencies/ethers/coders/null.js +30 -0
  31. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +60 -0
  32. package/dist/cjs/src/static_dependencies/ethers/coders/string.js +27 -0
  33. package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +68 -0
  34. package/dist/cjs/src/static_dependencies/ethers/fragments.js +614 -0
  35. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +492 -0
  36. package/dist/cjs/src/static_dependencies/ethers/index.js +35 -0
  37. package/dist/cjs/src/static_dependencies/ethers/interface.js +44 -0
  38. package/dist/cjs/src/static_dependencies/ethers/typed.js +618 -0
  39. package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +20 -0
  40. package/dist/cjs/src/static_dependencies/ethers/utils/data.js +134 -0
  41. package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +228 -0
  42. package/dist/cjs/src/static_dependencies/ethers/utils/events.js +13 -0
  43. package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +29 -0
  44. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +53 -0
  45. package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +231 -0
  46. package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +47 -0
  47. package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +218 -0
  48. package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +292 -0
  49. package/dist/cjs/src/tokocrypto.js +22 -2
  50. package/dist/cjs/src/wazirx.js +308 -3
  51. package/js/ccxt.d.ts +5 -2
  52. package/js/ccxt.js +4 -2
  53. package/js/src/abstract/coinbase.d.ts +3 -3
  54. package/js/src/abstract/hyperliquid.d.ts +9 -0
  55. package/js/src/abstract/hyperliquid.js +11 -0
  56. package/js/src/base/Exchange.d.ts +4 -0
  57. package/js/src/base/Exchange.js +13 -1
  58. package/js/src/base/functions/encode.d.ts +2 -1
  59. package/js/src/base/functions/encode.js +5 -1
  60. package/js/src/bitfinex2.js +1 -1
  61. package/js/src/bitget.js +74 -23
  62. package/js/src/coinbase.js +108 -103
  63. package/js/src/coinex.d.ts +3 -1
  64. package/js/src/coinex.js +61 -1
  65. package/js/src/hyperliquid.d.ts +83 -0
  66. package/js/src/hyperliquid.js +2036 -0
  67. package/js/src/kraken.js +8 -2
  68. package/js/src/krakenfutures.d.ts +2 -1
  69. package/js/src/krakenfutures.js +28 -0
  70. package/js/src/kucoinfutures.js +2 -2
  71. package/js/src/okx.js +1 -1
  72. package/js/src/phemex.js +2 -2
  73. package/js/src/pro/bingx.js +1 -0
  74. package/js/src/static_dependencies/ethers/abi-coder.d.ts +50 -0
  75. package/js/src/static_dependencies/ethers/abi-coder.js +148 -0
  76. package/js/src/static_dependencies/ethers/address/address.d.ts +55 -0
  77. package/js/src/static_dependencies/ethers/address/address.js +162 -0
  78. package/js/src/static_dependencies/ethers/address/checks.d.ts +80 -0
  79. package/js/src/static_dependencies/ethers/address/checks.js +119 -0
  80. package/js/src/static_dependencies/ethers/address/contract-address.d.ts +47 -0
  81. package/js/src/static_dependencies/ethers/address/contract-address.js +73 -0
  82. package/js/src/static_dependencies/ethers/address/index.d.ts +48 -0
  83. package/js/src/static_dependencies/ethers/address/index.js +24 -0
  84. package/js/src/static_dependencies/ethers/bytes32.d.ts +14 -0
  85. package/js/src/static_dependencies/ethers/bytes32.js +45 -0
  86. package/js/src/static_dependencies/ethers/coders/abstract-coder.d.ts +120 -0
  87. package/js/src/static_dependencies/ethers/coders/abstract-coder.js +424 -0
  88. package/js/src/static_dependencies/ethers/coders/address.d.ts +12 -0
  89. package/js/src/static_dependencies/ethers/coders/address.js +34 -0
  90. package/js/src/static_dependencies/ethers/coders/anonymous.d.ts +14 -0
  91. package/js/src/static_dependencies/ethers/coders/anonymous.js +27 -0
  92. package/js/src/static_dependencies/ethers/coders/array.d.ts +24 -0
  93. package/js/src/static_dependencies/ethers/coders/array.js +162 -0
  94. package/js/src/static_dependencies/ethers/coders/boolean.d.ts +12 -0
  95. package/js/src/static_dependencies/ethers/coders/boolean.js +26 -0
  96. package/js/src/static_dependencies/ethers/coders/bytes.d.ts +18 -0
  97. package/js/src/static_dependencies/ethers/coders/bytes.js +39 -0
  98. package/js/src/static_dependencies/ethers/coders/fixed-bytes.d.ts +14 -0
  99. package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +32 -0
  100. package/js/src/static_dependencies/ethers/coders/null.d.ts +11 -0
  101. package/js/src/static_dependencies/ethers/coders/null.js +29 -0
  102. package/js/src/static_dependencies/ethers/coders/number.d.ts +15 -0
  103. package/js/src/static_dependencies/ethers/coders/number.js +48 -0
  104. package/js/src/static_dependencies/ethers/coders/string.d.ts +12 -0
  105. package/js/src/static_dependencies/ethers/coders/string.js +26 -0
  106. package/js/src/static_dependencies/ethers/coders/tuple.d.ts +15 -0
  107. package/js/src/static_dependencies/ethers/coders/tuple.js +67 -0
  108. package/js/src/static_dependencies/ethers/fragments.d.ts +458 -0
  109. package/js/src/static_dependencies/ethers/fragments.js +1252 -0
  110. package/js/src/static_dependencies/ethers/hash/index.d.ts +10 -0
  111. package/js/src/static_dependencies/ethers/hash/index.js +15 -0
  112. package/js/src/static_dependencies/ethers/hash/solidity.d.ts +30 -0
  113. package/js/src/static_dependencies/ethers/hash/solidity.js +107 -0
  114. package/js/src/static_dependencies/ethers/hash/typed-data.d.ts +144 -0
  115. package/js/src/static_dependencies/ethers/hash/typed-data.js +490 -0
  116. package/js/src/static_dependencies/ethers/index.d.ts +19 -0
  117. package/js/src/static_dependencies/ethers/index.js +22 -0
  118. package/js/src/static_dependencies/ethers/interface.d.ts +380 -0
  119. package/js/src/static_dependencies/ethers/interface.js +990 -0
  120. package/js/src/static_dependencies/ethers/typed.d.ts +569 -0
  121. package/js/src/static_dependencies/ethers/typed.js +608 -0
  122. package/js/src/static_dependencies/ethers/utils/base58.d.ts +22 -0
  123. package/js/src/static_dependencies/ethers/utils/base58.js +68 -0
  124. package/js/src/static_dependencies/ethers/utils/base64-browser.d.ts +3 -0
  125. package/js/src/static_dependencies/ethers/utils/base64-browser.js +24 -0
  126. package/js/src/static_dependencies/ethers/utils/base64.d.ts +39 -0
  127. package/js/src/static_dependencies/ethers/utils/base64.js +58 -0
  128. package/js/src/static_dependencies/ethers/utils/data.d.ts +92 -0
  129. package/js/src/static_dependencies/ethers/utils/data.js +175 -0
  130. package/js/src/static_dependencies/ethers/utils/errors.d.ts +509 -0
  131. package/js/src/static_dependencies/ethers/utils/errors.js +227 -0
  132. package/js/src/static_dependencies/ethers/utils/events.d.ts +76 -0
  133. package/js/src/static_dependencies/ethers/utils/events.js +52 -0
  134. package/js/src/static_dependencies/ethers/utils/fixednumber.d.ts +251 -0
  135. package/js/src/static_dependencies/ethers/utils/fixednumber.js +529 -0
  136. package/js/src/static_dependencies/ethers/utils/index.d.ts +30 -0
  137. package/js/src/static_dependencies/ethers/utils/index.js +38 -0
  138. package/js/src/static_dependencies/ethers/utils/maths.d.ts +65 -0
  139. package/js/src/static_dependencies/ethers/utils/maths.js +220 -0
  140. package/js/src/static_dependencies/ethers/utils/properties.d.ts +22 -0
  141. package/js/src/static_dependencies/ethers/utils/properties.js +59 -0
  142. package/js/src/static_dependencies/ethers/utils/rlp-decode.d.ts +5 -0
  143. package/js/src/static_dependencies/ethers/utils/rlp-decode.js +84 -0
  144. package/js/src/static_dependencies/ethers/utils/rlp-encode.d.ts +5 -0
  145. package/js/src/static_dependencies/ethers/utils/rlp-encode.js +54 -0
  146. package/js/src/static_dependencies/ethers/utils/rlp.d.ts +16 -0
  147. package/js/src/static_dependencies/ethers/utils/rlp.js +14 -0
  148. package/js/src/static_dependencies/ethers/utils/units.d.ts +23 -0
  149. package/js/src/static_dependencies/ethers/utils/units.js +88 -0
  150. package/js/src/static_dependencies/ethers/utils/utf8.d.ts +95 -0
  151. package/js/src/static_dependencies/ethers/utils/utf8.js +225 -0
  152. package/js/src/static_dependencies/ethers/utils/uuid.d.ts +7 -0
  153. package/js/src/static_dependencies/ethers/utils/uuid.js +35 -0
  154. package/js/src/static_dependencies/messagepack/msgpack.d.ts +2 -0
  155. package/js/src/static_dependencies/messagepack/msgpack.js +572 -0
  156. package/js/src/tokocrypto.js +22 -2
  157. package/js/src/wazirx.d.ts +12 -1
  158. package/js/src/wazirx.js +308 -3
  159. package/package.json +1 -1
  160. package/skip-tests.json +18 -0
@@ -0,0 +1,424 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
14
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
16
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17
+ };
18
+ var _Result_names, _Writer_instances, _Writer_data, _Writer_dataLength, _Writer_writeData, _Reader_instances, _Reader_data, _Reader_offset, _Reader_bytesRead, _Reader_parent, _Reader_maxInflation, _Reader_incrementBytesRead, _Reader_peekBytes;
19
+ import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertArgument } from "../utils/index.js";
20
+ /**
21
+ * @_ignore:
22
+ */
23
+ export const WordSize = 32;
24
+ const Padding = new Uint8Array(WordSize);
25
+ // Properties used to immediate pass through to the underlying object
26
+ // - `then` is used to detect if an object is a Promise for await
27
+ const passProperties = ["then"];
28
+ const _guard = {};
29
+ function throwError(name, error) {
30
+ const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`);
31
+ wrapped.error = error;
32
+ throw wrapped;
33
+ }
34
+ /**
35
+ * A [[Result]] is a sub-class of Array, which allows accessing any
36
+ * of its values either positionally by its index or, if keys are
37
+ * provided by its name.
38
+ *
39
+ * @_docloc: api/abi
40
+ */
41
+ export class Result extends Array {
42
+ /**
43
+ * @private
44
+ */
45
+ constructor(...args) {
46
+ // To properly sub-class Array so the other built-in
47
+ // functions work, the constructor has to behave fairly
48
+ // well. So, in the event we are created via fromItems()
49
+ // we build the read-only Result object we want, but on
50
+ // any other input, we use the default constructor
51
+ // constructor(guard: any, items: Array<any>, keys?: Array<null | string>);
52
+ const guard = args[0];
53
+ let items = args[1];
54
+ let names = (args[2] || []).slice();
55
+ let wrap = true;
56
+ if (guard !== _guard) {
57
+ items = args;
58
+ names = [];
59
+ wrap = false;
60
+ }
61
+ // Can't just pass in ...items since an array of length 1
62
+ // is a special case in the super.
63
+ super(items.length);
64
+ _Result_names.set(this, void 0);
65
+ items.forEach((item, index) => { this[index] = item; });
66
+ // Find all unique keys
67
+ const nameCounts = names.reduce((accum, name) => {
68
+ if (typeof (name) === "string") {
69
+ accum.set(name, (accum.get(name) || 0) + 1);
70
+ }
71
+ return accum;
72
+ }, (new Map()));
73
+ // Remove any key thats not unique
74
+ __classPrivateFieldSet(this, _Result_names, Object.freeze(items.map((item, index) => {
75
+ const name = names[index];
76
+ if (name != null && nameCounts.get(name) === 1) {
77
+ return name;
78
+ }
79
+ return null;
80
+ })), "f");
81
+ if (!wrap) {
82
+ return;
83
+ }
84
+ // A wrapped Result is immutable
85
+ Object.freeze(this);
86
+ // Proxy indices and names so we can trap deferred errors
87
+ return new Proxy(this, {
88
+ get: (target, prop, receiver) => {
89
+ if (typeof (prop) === "string") {
90
+ // Index accessor
91
+ if (prop.match(/^[0-9]+$/)) {
92
+ const index = getNumber(prop, "%index");
93
+ if (index < 0 || index >= this.length) {
94
+ throw new RangeError("out of result range");
95
+ }
96
+ const item = target[index];
97
+ if (item instanceof Error) {
98
+ throwError(`index ${index}`, item);
99
+ }
100
+ return item;
101
+ }
102
+ // Pass important checks (like `then` for Promise) through
103
+ if (passProperties.indexOf(prop) >= 0) {
104
+ return Reflect.get(target, prop, receiver);
105
+ }
106
+ const value = target[prop];
107
+ if (value instanceof Function) {
108
+ // Make sure functions work with private variables
109
+ // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding
110
+ return function (...args) {
111
+ return value.apply((this === receiver) ? target : this, args);
112
+ };
113
+ }
114
+ else if (!(prop in target)) {
115
+ // Possible name accessor
116
+ return target.getValue.apply((this === receiver) ? target : this, [prop]);
117
+ }
118
+ }
119
+ return Reflect.get(target, prop, receiver);
120
+ }
121
+ });
122
+ }
123
+ /**
124
+ * Returns the Result as a normal Array.
125
+ *
126
+ * This will throw if there are any outstanding deferred
127
+ * errors.
128
+ */
129
+ toArray() {
130
+ const result = [];
131
+ this.forEach((item, index) => {
132
+ if (item instanceof Error) {
133
+ throwError(`index ${index}`, item);
134
+ }
135
+ result.push(item);
136
+ });
137
+ return result;
138
+ }
139
+ /**
140
+ * Returns the Result as an Object with each name-value pair.
141
+ *
142
+ * This will throw if any value is unnamed, or if there are
143
+ * any outstanding deferred errors.
144
+ */
145
+ toObject() {
146
+ return __classPrivateFieldGet(this, _Result_names, "f").reduce((accum, name, index) => {
147
+ assert(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", {
148
+ operation: "toObject()"
149
+ });
150
+ // Add values for names that don't conflict
151
+ if (!(name in accum)) {
152
+ accum[name] = this.getValue(name);
153
+ }
154
+ return accum;
155
+ }, {});
156
+ }
157
+ /**
158
+ * @_ignore
159
+ */
160
+ slice(start, end) {
161
+ if (start == null) {
162
+ start = 0;
163
+ }
164
+ if (start < 0) {
165
+ start += this.length;
166
+ if (start < 0) {
167
+ start = 0;
168
+ }
169
+ }
170
+ if (end == null) {
171
+ end = this.length;
172
+ }
173
+ if (end < 0) {
174
+ end += this.length;
175
+ if (end < 0) {
176
+ end = 0;
177
+ }
178
+ }
179
+ if (end > this.length) {
180
+ end = this.length;
181
+ }
182
+ const result = [], names = [];
183
+ for (let i = start; i < end; i++) {
184
+ result.push(this[i]);
185
+ names.push(__classPrivateFieldGet(this, _Result_names, "f")[i]);
186
+ }
187
+ return new Result(_guard, result, names);
188
+ }
189
+ /**
190
+ * @_ignore
191
+ */
192
+ filter(callback, thisArg) {
193
+ const result = [], names = [];
194
+ for (let i = 0; i < this.length; i++) {
195
+ const item = this[i];
196
+ if (item instanceof Error) {
197
+ throwError(`index ${i}`, item);
198
+ }
199
+ if (callback.call(thisArg, item, i, this)) {
200
+ result.push(item);
201
+ names.push(__classPrivateFieldGet(this, _Result_names, "f")[i]);
202
+ }
203
+ }
204
+ return new Result(_guard, result, names);
205
+ }
206
+ /**
207
+ * @_ignore
208
+ */
209
+ map(callback, thisArg) {
210
+ const result = [];
211
+ for (let i = 0; i < this.length; i++) {
212
+ const item = this[i];
213
+ if (item instanceof Error) {
214
+ throwError(`index ${i}`, item);
215
+ }
216
+ result.push(callback.call(thisArg, item, i, this));
217
+ }
218
+ return result;
219
+ }
220
+ /**
221
+ * Returns the value for %%name%%.
222
+ *
223
+ * Since it is possible to have a key whose name conflicts with
224
+ * a method on a [[Result]] or its superclass Array, or any
225
+ * JavaScript keyword, this ensures all named values are still
226
+ * accessible by name.
227
+ */
228
+ getValue(name) {
229
+ const index = __classPrivateFieldGet(this, _Result_names, "f").indexOf(name);
230
+ if (index === -1) {
231
+ return undefined;
232
+ }
233
+ const value = this[index];
234
+ if (value instanceof Error) {
235
+ throwError(`property ${JSON.stringify(name)}`, value.error);
236
+ }
237
+ return value;
238
+ }
239
+ /**
240
+ * Creates a new [[Result]] for %%items%% with each entry
241
+ * also accessible by its corresponding name in %%keys%%.
242
+ */
243
+ static fromItems(items, keys) {
244
+ return new Result(_guard, items, keys);
245
+ }
246
+ }
247
+ _Result_names = new WeakMap();
248
+ /**
249
+ * Returns all errors found in a [[Result]].
250
+ *
251
+ * Since certain errors encountered when creating a [[Result]] do
252
+ * not impact the ability to continue parsing data, they are
253
+ * deferred until they are actually accessed. Hence a faulty string
254
+ * in an Event that is never used does not impact the program flow.
255
+ *
256
+ * However, sometimes it may be useful to access, identify or
257
+ * validate correctness of a [[Result]].
258
+ *
259
+ * @_docloc api/abi
260
+ */
261
+ export function checkResultErrors(result) {
262
+ // Find the first error (if any)
263
+ const errors = [];
264
+ const checkErrors = function (path, object) {
265
+ if (!Array.isArray(object)) {
266
+ return;
267
+ }
268
+ for (let key in object) {
269
+ const childPath = path.slice();
270
+ childPath.push(key);
271
+ try {
272
+ checkErrors(childPath, object[key]);
273
+ }
274
+ catch (error) {
275
+ errors.push({ path: childPath, error: error });
276
+ }
277
+ }
278
+ };
279
+ checkErrors([], result);
280
+ return errors;
281
+ }
282
+ function getValue(value) {
283
+ let bytes = toBeArray(value);
284
+ assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length });
285
+ if (bytes.length !== WordSize) {
286
+ bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));
287
+ }
288
+ return bytes;
289
+ }
290
+ /**
291
+ * @_ignore
292
+ */
293
+ export class Coder {
294
+ constructor(name, type, localName, dynamic) {
295
+ defineProperties(this, { name, type, localName, dynamic }, {
296
+ name: "string", type: "string", localName: "string", dynamic: "boolean"
297
+ });
298
+ }
299
+ _throwError(message, value) {
300
+ assertArgument(false, message, this.localName, value);
301
+ }
302
+ }
303
+ /**
304
+ * @_ignore
305
+ */
306
+ export class Writer {
307
+ constructor() {
308
+ _Writer_instances.add(this);
309
+ // An array of WordSize lengthed objects to concatenation
310
+ _Writer_data.set(this, void 0);
311
+ _Writer_dataLength.set(this, void 0);
312
+ __classPrivateFieldSet(this, _Writer_data, [], "f");
313
+ __classPrivateFieldSet(this, _Writer_dataLength, 0, "f");
314
+ }
315
+ get data() {
316
+ return concat(__classPrivateFieldGet(this, _Writer_data, "f"));
317
+ }
318
+ get length() { return __classPrivateFieldGet(this, _Writer_dataLength, "f"); }
319
+ appendWriter(writer) {
320
+ return __classPrivateFieldGet(this, _Writer_instances, "m", _Writer_writeData).call(this, getBytesCopy(writer.data));
321
+ }
322
+ // Arrayish item; pad on the right to *nearest* WordSize
323
+ writeBytes(value) {
324
+ let bytes = getBytesCopy(value);
325
+ const paddingOffset = bytes.length % WordSize;
326
+ if (paddingOffset) {
327
+ bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));
328
+ }
329
+ return __classPrivateFieldGet(this, _Writer_instances, "m", _Writer_writeData).call(this, bytes);
330
+ }
331
+ // Numeric item; pad on the left *to* WordSize
332
+ writeValue(value) {
333
+ return __classPrivateFieldGet(this, _Writer_instances, "m", _Writer_writeData).call(this, getValue(value));
334
+ }
335
+ // Inserts a numeric place-holder, returning a callback that can
336
+ // be used to asjust the value later
337
+ writeUpdatableValue() {
338
+ const offset = __classPrivateFieldGet(this, _Writer_data, "f").length;
339
+ __classPrivateFieldGet(this, _Writer_data, "f").push(Padding);
340
+ __classPrivateFieldSet(this, _Writer_dataLength, __classPrivateFieldGet(this, _Writer_dataLength, "f") + WordSize, "f");
341
+ return (value) => {
342
+ __classPrivateFieldGet(this, _Writer_data, "f")[offset] = getValue(value);
343
+ };
344
+ }
345
+ }
346
+ _Writer_data = new WeakMap(), _Writer_dataLength = new WeakMap(), _Writer_instances = new WeakSet(), _Writer_writeData = function _Writer_writeData(data) {
347
+ __classPrivateFieldGet(this, _Writer_data, "f").push(data);
348
+ __classPrivateFieldSet(this, _Writer_dataLength, __classPrivateFieldGet(this, _Writer_dataLength, "f") + data.length, "f");
349
+ return data.length;
350
+ };
351
+ /**
352
+ * @_ignore
353
+ */
354
+ export class Reader {
355
+ constructor(data, allowLoose, maxInflation) {
356
+ _Reader_instances.add(this);
357
+ _Reader_data.set(this, void 0);
358
+ _Reader_offset.set(this, void 0);
359
+ _Reader_bytesRead.set(this, void 0);
360
+ _Reader_parent.set(this, void 0);
361
+ _Reader_maxInflation.set(this, void 0);
362
+ defineProperties(this, { allowLoose: !!allowLoose });
363
+ __classPrivateFieldSet(this, _Reader_data, getBytesCopy(data), "f");
364
+ __classPrivateFieldSet(this, _Reader_bytesRead, 0, "f");
365
+ __classPrivateFieldSet(this, _Reader_parent, null, "f");
366
+ __classPrivateFieldSet(this, _Reader_maxInflation, (maxInflation != null) ? maxInflation : 1024, "f");
367
+ __classPrivateFieldSet(this, _Reader_offset, 0, "f");
368
+ }
369
+ get data() { return hexlify(__classPrivateFieldGet(this, _Reader_data, "f")); }
370
+ get dataLength() { return __classPrivateFieldGet(this, _Reader_data, "f").length; }
371
+ get consumed() { return __classPrivateFieldGet(this, _Reader_offset, "f"); }
372
+ get bytes() { return new Uint8Array(__classPrivateFieldGet(this, _Reader_data, "f")); }
373
+ // Create a sub-reader with the same underlying data, but offset
374
+ subReader(offset) {
375
+ const reader = new Reader(__classPrivateFieldGet(this, _Reader_data, "f").slice(__classPrivateFieldGet(this, _Reader_offset, "f") + offset), this.allowLoose, __classPrivateFieldGet(this, _Reader_maxInflation, "f"));
376
+ __classPrivateFieldSet(reader, _Reader_parent, this, "f");
377
+ return reader;
378
+ }
379
+ // Read bytes
380
+ readBytes(length, loose) {
381
+ let bytes = __classPrivateFieldGet(this, _Reader_instances, "m", _Reader_peekBytes).call(this, 0, length, !!loose);
382
+ __classPrivateFieldGet(this, _Reader_instances, "m", _Reader_incrementBytesRead).call(this, length);
383
+ __classPrivateFieldSet(this, _Reader_offset, __classPrivateFieldGet(this, _Reader_offset, "f") + bytes.length, "f");
384
+ // @TODO: Make sure the length..end bytes are all 0?
385
+ return bytes.slice(0, length);
386
+ }
387
+ // Read a numeric values
388
+ readValue() {
389
+ return toBigInt(this.readBytes(WordSize));
390
+ }
391
+ readIndex() {
392
+ return toNumber(this.readBytes(WordSize));
393
+ }
394
+ }
395
+ _Reader_data = new WeakMap(), _Reader_offset = new WeakMap(), _Reader_bytesRead = new WeakMap(), _Reader_parent = new WeakMap(), _Reader_maxInflation = new WeakMap(), _Reader_instances = new WeakSet(), _Reader_incrementBytesRead = function _Reader_incrementBytesRead(count) {
396
+ var _a;
397
+ if (__classPrivateFieldGet(this, _Reader_parent, "f")) {
398
+ return __classPrivateFieldGet((_a = __classPrivateFieldGet(this, _Reader_parent, "f")), _Reader_instances, "m", _Reader_incrementBytesRead).call(_a, count);
399
+ }
400
+ __classPrivateFieldSet(this, _Reader_bytesRead, __classPrivateFieldGet(this, _Reader_bytesRead, "f") + count, "f");
401
+ // Check for excessive inflation (see: #4537)
402
+ assert(__classPrivateFieldGet(this, _Reader_maxInflation, "f") < 1 || __classPrivateFieldGet(this, _Reader_bytesRead, "f") <= __classPrivateFieldGet(this, _Reader_maxInflation, "f") * this.dataLength, `compressed ABI data exceeds inflation ratio of ${__classPrivateFieldGet(this, _Reader_maxInflation, "f")} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
403
+ buffer: getBytesCopy(__classPrivateFieldGet(this, _Reader_data, "f")), offset: __classPrivateFieldGet(this, _Reader_offset, "f"),
404
+ length: count, info: {
405
+ bytesRead: __classPrivateFieldGet(this, _Reader_bytesRead, "f"),
406
+ dataLength: this.dataLength
407
+ }
408
+ });
409
+ }, _Reader_peekBytes = function _Reader_peekBytes(offset, length, loose) {
410
+ let alignedLength = Math.ceil(length / WordSize) * WordSize;
411
+ if (__classPrivateFieldGet(this, _Reader_offset, "f") + alignedLength > __classPrivateFieldGet(this, _Reader_data, "f").length) {
412
+ if (this.allowLoose && loose && __classPrivateFieldGet(this, _Reader_offset, "f") + length <= __classPrivateFieldGet(this, _Reader_data, "f").length) {
413
+ alignedLength = length;
414
+ }
415
+ else {
416
+ assert(false, "data out-of-bounds", "BUFFER_OVERRUN", {
417
+ buffer: getBytesCopy(__classPrivateFieldGet(this, _Reader_data, "f")),
418
+ length: __classPrivateFieldGet(this, _Reader_data, "f").length,
419
+ offset: __classPrivateFieldGet(this, _Reader_offset, "f") + alignedLength
420
+ });
421
+ }
422
+ }
423
+ return __classPrivateFieldGet(this, _Reader_data, "f").slice(__classPrivateFieldGet(this, _Reader_offset, "f"), __classPrivateFieldGet(this, _Reader_offset, "f") + alignedLength);
424
+ };
@@ -0,0 +1,12 @@
1
+ import { Typed } from "../typed.js";
2
+ import { Coder } from "./abstract-coder.js";
3
+ import type { Reader, Writer } from "./abstract-coder.js";
4
+ /**
5
+ * @_ignore
6
+ */
7
+ export declare class AddressCoder extends Coder {
8
+ constructor(localName: string);
9
+ defaultValue(): string;
10
+ encode(writer: Writer, _value: string | Typed): number;
11
+ decode(reader: Reader): any;
12
+ }
@@ -0,0 +1,34 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ import { getAddress } from "../address/index.js";
8
+ import { toBeHex } from "../utils/maths.js";
9
+ import { Typed } from "../typed.js";
10
+ import { Coder } from "./abstract-coder.js";
11
+ /**
12
+ * @_ignore
13
+ */
14
+ export class AddressCoder extends Coder {
15
+ constructor(localName) {
16
+ super("address", "address", localName, false);
17
+ }
18
+ defaultValue() {
19
+ return "0x0000000000000000000000000000000000000000";
20
+ }
21
+ encode(writer, _value) {
22
+ let value = Typed.dereference(_value, "string");
23
+ try {
24
+ value = getAddress(value);
25
+ }
26
+ catch (error) {
27
+ return this._throwError(error.message, _value);
28
+ }
29
+ return writer.writeValue(value);
30
+ }
31
+ decode(reader) {
32
+ return getAddress(toBeHex(reader.readValue(), 20));
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ import { Coder } from "./abstract-coder.js";
2
+ import type { Reader, Writer } from "./abstract-coder.js";
3
+ /**
4
+ * Clones the functionality of an existing Coder, but without a localName
5
+ *
6
+ * @_ignore
7
+ */
8
+ export declare class AnonymousCoder extends Coder {
9
+ private coder;
10
+ constructor(coder: Coder);
11
+ defaultValue(): any;
12
+ encode(writer: Writer, value: any): number;
13
+ decode(reader: Reader): any;
14
+ }
@@ -0,0 +1,27 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ import { Coder } from "./abstract-coder.js";
8
+ /**
9
+ * Clones the functionality of an existing Coder, but without a localName
10
+ *
11
+ * @_ignore
12
+ */
13
+ export class AnonymousCoder extends Coder {
14
+ constructor(coder) {
15
+ super(coder.name, coder.type, "_", coder.dynamic);
16
+ this.coder = coder;
17
+ }
18
+ defaultValue() {
19
+ return this.coder.defaultValue();
20
+ }
21
+ encode(writer, value) {
22
+ return this.coder.encode(writer, value);
23
+ }
24
+ decode(reader) {
25
+ return this.coder.decode(reader);
26
+ }
27
+ }
@@ -0,0 +1,24 @@
1
+ import { Typed } from "../typed.js";
2
+ import { Coder, Result, Writer } from "./abstract-coder.js";
3
+ import type { Reader } from "./abstract-coder.js";
4
+ /**
5
+ * @_ignore
6
+ */
7
+ export declare function pack(writer: Writer, coders: ReadonlyArray<Coder>, values: Array<any> | {
8
+ [name: string]: any;
9
+ }): number;
10
+ /**
11
+ * @_ignore
12
+ */
13
+ export declare function unpack(reader: Reader, coders: ReadonlyArray<Coder>): Result;
14
+ /**
15
+ * @_ignore
16
+ */
17
+ export declare class ArrayCoder extends Coder {
18
+ readonly coder: Coder;
19
+ readonly length: number;
20
+ constructor(coder: Coder, length: number, localName: string);
21
+ defaultValue(): Array<any>;
22
+ encode(writer: Writer, _value: Array<any> | Typed): number;
23
+ decode(reader: Reader): any;
24
+ }