ccxt 4.2.60 → 4.2.61

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 (158) hide show
  1. package/README.md +103 -102
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +107943 -100121
  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/coinbase.js +108 -103
  12. package/dist/cjs/src/coinex.js +61 -1
  13. package/dist/cjs/src/hyperliquid.js +2035 -0
  14. package/dist/cjs/src/kraken.js +8 -2
  15. package/dist/cjs/src/krakenfutures.js +28 -0
  16. package/dist/cjs/src/kucoinfutures.js +2 -2
  17. package/dist/cjs/src/okx.js +1 -1
  18. package/dist/cjs/src/phemex.js +2 -2
  19. package/dist/cjs/src/pro/bingx.js +1 -0
  20. package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +158 -0
  21. package/dist/cjs/src/static_dependencies/ethers/address/address.js +144 -0
  22. package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +407 -0
  23. package/dist/cjs/src/static_dependencies/ethers/coders/address.js +45 -0
  24. package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +28 -0
  25. package/dist/cjs/src/static_dependencies/ethers/coders/array.js +176 -0
  26. package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +27 -0
  27. package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +52 -0
  28. package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +45 -0
  29. package/dist/cjs/src/static_dependencies/ethers/coders/null.js +30 -0
  30. package/dist/cjs/src/static_dependencies/ethers/coders/number.js +60 -0
  31. package/dist/cjs/src/static_dependencies/ethers/coders/string.js +27 -0
  32. package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +68 -0
  33. package/dist/cjs/src/static_dependencies/ethers/fragments.js +614 -0
  34. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +492 -0
  35. package/dist/cjs/src/static_dependencies/ethers/index.js +35 -0
  36. package/dist/cjs/src/static_dependencies/ethers/interface.js +44 -0
  37. package/dist/cjs/src/static_dependencies/ethers/typed.js +618 -0
  38. package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +20 -0
  39. package/dist/cjs/src/static_dependencies/ethers/utils/data.js +134 -0
  40. package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +228 -0
  41. package/dist/cjs/src/static_dependencies/ethers/utils/events.js +13 -0
  42. package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +29 -0
  43. package/dist/cjs/src/static_dependencies/ethers/utils/index.js +53 -0
  44. package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +231 -0
  45. package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +47 -0
  46. package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +218 -0
  47. package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +292 -0
  48. package/dist/cjs/src/tokocrypto.js +22 -2
  49. package/dist/cjs/src/wazirx.js +308 -3
  50. package/js/ccxt.d.ts +5 -2
  51. package/js/ccxt.js +4 -2
  52. package/js/src/abstract/coinbase.d.ts +3 -3
  53. package/js/src/abstract/hyperliquid.d.ts +9 -0
  54. package/js/src/abstract/hyperliquid.js +11 -0
  55. package/js/src/base/Exchange.d.ts +4 -0
  56. package/js/src/base/Exchange.js +13 -1
  57. package/js/src/base/functions/encode.d.ts +2 -1
  58. package/js/src/base/functions/encode.js +5 -1
  59. package/js/src/bitfinex2.js +1 -1
  60. package/js/src/coinbase.js +108 -103
  61. package/js/src/coinex.d.ts +3 -1
  62. package/js/src/coinex.js +61 -1
  63. package/js/src/hyperliquid.d.ts +83 -0
  64. package/js/src/hyperliquid.js +2036 -0
  65. package/js/src/kraken.js +8 -2
  66. package/js/src/krakenfutures.d.ts +2 -1
  67. package/js/src/krakenfutures.js +28 -0
  68. package/js/src/kucoinfutures.js +2 -2
  69. package/js/src/okx.js +1 -1
  70. package/js/src/phemex.js +2 -2
  71. package/js/src/pro/bingx.js +1 -0
  72. package/js/src/static_dependencies/ethers/abi-coder.d.ts +50 -0
  73. package/js/src/static_dependencies/ethers/abi-coder.js +148 -0
  74. package/js/src/static_dependencies/ethers/address/address.d.ts +55 -0
  75. package/js/src/static_dependencies/ethers/address/address.js +162 -0
  76. package/js/src/static_dependencies/ethers/address/checks.d.ts +80 -0
  77. package/js/src/static_dependencies/ethers/address/checks.js +119 -0
  78. package/js/src/static_dependencies/ethers/address/contract-address.d.ts +47 -0
  79. package/js/src/static_dependencies/ethers/address/contract-address.js +73 -0
  80. package/js/src/static_dependencies/ethers/address/index.d.ts +48 -0
  81. package/js/src/static_dependencies/ethers/address/index.js +24 -0
  82. package/js/src/static_dependencies/ethers/bytes32.d.ts +14 -0
  83. package/js/src/static_dependencies/ethers/bytes32.js +45 -0
  84. package/js/src/static_dependencies/ethers/coders/abstract-coder.d.ts +120 -0
  85. package/js/src/static_dependencies/ethers/coders/abstract-coder.js +424 -0
  86. package/js/src/static_dependencies/ethers/coders/address.d.ts +12 -0
  87. package/js/src/static_dependencies/ethers/coders/address.js +34 -0
  88. package/js/src/static_dependencies/ethers/coders/anonymous.d.ts +14 -0
  89. package/js/src/static_dependencies/ethers/coders/anonymous.js +27 -0
  90. package/js/src/static_dependencies/ethers/coders/array.d.ts +24 -0
  91. package/js/src/static_dependencies/ethers/coders/array.js +162 -0
  92. package/js/src/static_dependencies/ethers/coders/boolean.d.ts +12 -0
  93. package/js/src/static_dependencies/ethers/coders/boolean.js +26 -0
  94. package/js/src/static_dependencies/ethers/coders/bytes.d.ts +18 -0
  95. package/js/src/static_dependencies/ethers/coders/bytes.js +39 -0
  96. package/js/src/static_dependencies/ethers/coders/fixed-bytes.d.ts +14 -0
  97. package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +32 -0
  98. package/js/src/static_dependencies/ethers/coders/null.d.ts +11 -0
  99. package/js/src/static_dependencies/ethers/coders/null.js +29 -0
  100. package/js/src/static_dependencies/ethers/coders/number.d.ts +15 -0
  101. package/js/src/static_dependencies/ethers/coders/number.js +48 -0
  102. package/js/src/static_dependencies/ethers/coders/string.d.ts +12 -0
  103. package/js/src/static_dependencies/ethers/coders/string.js +26 -0
  104. package/js/src/static_dependencies/ethers/coders/tuple.d.ts +15 -0
  105. package/js/src/static_dependencies/ethers/coders/tuple.js +67 -0
  106. package/js/src/static_dependencies/ethers/fragments.d.ts +458 -0
  107. package/js/src/static_dependencies/ethers/fragments.js +1252 -0
  108. package/js/src/static_dependencies/ethers/hash/index.d.ts +10 -0
  109. package/js/src/static_dependencies/ethers/hash/index.js +15 -0
  110. package/js/src/static_dependencies/ethers/hash/solidity.d.ts +30 -0
  111. package/js/src/static_dependencies/ethers/hash/solidity.js +107 -0
  112. package/js/src/static_dependencies/ethers/hash/typed-data.d.ts +144 -0
  113. package/js/src/static_dependencies/ethers/hash/typed-data.js +490 -0
  114. package/js/src/static_dependencies/ethers/index.d.ts +19 -0
  115. package/js/src/static_dependencies/ethers/index.js +22 -0
  116. package/js/src/static_dependencies/ethers/interface.d.ts +380 -0
  117. package/js/src/static_dependencies/ethers/interface.js +990 -0
  118. package/js/src/static_dependencies/ethers/typed.d.ts +569 -0
  119. package/js/src/static_dependencies/ethers/typed.js +608 -0
  120. package/js/src/static_dependencies/ethers/utils/base58.d.ts +22 -0
  121. package/js/src/static_dependencies/ethers/utils/base58.js +68 -0
  122. package/js/src/static_dependencies/ethers/utils/base64-browser.d.ts +3 -0
  123. package/js/src/static_dependencies/ethers/utils/base64-browser.js +24 -0
  124. package/js/src/static_dependencies/ethers/utils/base64.d.ts +39 -0
  125. package/js/src/static_dependencies/ethers/utils/base64.js +58 -0
  126. package/js/src/static_dependencies/ethers/utils/data.d.ts +92 -0
  127. package/js/src/static_dependencies/ethers/utils/data.js +175 -0
  128. package/js/src/static_dependencies/ethers/utils/errors.d.ts +509 -0
  129. package/js/src/static_dependencies/ethers/utils/errors.js +227 -0
  130. package/js/src/static_dependencies/ethers/utils/events.d.ts +76 -0
  131. package/js/src/static_dependencies/ethers/utils/events.js +52 -0
  132. package/js/src/static_dependencies/ethers/utils/fixednumber.d.ts +251 -0
  133. package/js/src/static_dependencies/ethers/utils/fixednumber.js +529 -0
  134. package/js/src/static_dependencies/ethers/utils/index.d.ts +30 -0
  135. package/js/src/static_dependencies/ethers/utils/index.js +38 -0
  136. package/js/src/static_dependencies/ethers/utils/maths.d.ts +65 -0
  137. package/js/src/static_dependencies/ethers/utils/maths.js +220 -0
  138. package/js/src/static_dependencies/ethers/utils/properties.d.ts +22 -0
  139. package/js/src/static_dependencies/ethers/utils/properties.js +59 -0
  140. package/js/src/static_dependencies/ethers/utils/rlp-decode.d.ts +5 -0
  141. package/js/src/static_dependencies/ethers/utils/rlp-decode.js +84 -0
  142. package/js/src/static_dependencies/ethers/utils/rlp-encode.d.ts +5 -0
  143. package/js/src/static_dependencies/ethers/utils/rlp-encode.js +54 -0
  144. package/js/src/static_dependencies/ethers/utils/rlp.d.ts +16 -0
  145. package/js/src/static_dependencies/ethers/utils/rlp.js +14 -0
  146. package/js/src/static_dependencies/ethers/utils/units.d.ts +23 -0
  147. package/js/src/static_dependencies/ethers/utils/units.js +88 -0
  148. package/js/src/static_dependencies/ethers/utils/utf8.d.ts +95 -0
  149. package/js/src/static_dependencies/ethers/utils/utf8.js +225 -0
  150. package/js/src/static_dependencies/ethers/utils/uuid.d.ts +7 -0
  151. package/js/src/static_dependencies/ethers/utils/uuid.js +35 -0
  152. package/js/src/static_dependencies/messagepack/msgpack.d.ts +2 -0
  153. package/js/src/static_dependencies/messagepack/msgpack.js +572 -0
  154. package/js/src/tokocrypto.js +22 -2
  155. package/js/src/wazirx.d.ts +12 -1
  156. package/js/src/wazirx.js +308 -3
  157. package/package.json +1 -1
  158. package/skip-tests.json +18 -0
@@ -0,0 +1,119 @@
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 { assert, assertArgument } from "../utils/index.js";
8
+ import { getAddress } from "./address.js";
9
+ /**
10
+ * Returns true if %%value%% is an object which implements the
11
+ * [[Addressable]] interface.
12
+ *
13
+ * @example:
14
+ * // Wallets and AbstractSigner sub-classes
15
+ * isAddressable(Wallet.createRandom())
16
+ * //_result:
17
+ *
18
+ * // Contracts
19
+ * contract = new Contract("dai.tokens.ethers.eth", [ ], provider)
20
+ * isAddressable(contract)
21
+ * //_result:
22
+ */
23
+ export function isAddressable(value) {
24
+ return (value && typeof (value.getAddress) === "function");
25
+ }
26
+ /**
27
+ * Returns true if %%value%% is a valid address.
28
+ *
29
+ * @example:
30
+ * // Valid address
31
+ * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72")
32
+ * //_result:
33
+ *
34
+ * // Valid ICAP address
35
+ * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36")
36
+ * //_result:
37
+ *
38
+ * // Invalid checksum
39
+ * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72")
40
+ * //_result:
41
+ *
42
+ * // Invalid ICAP checksum
43
+ * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
44
+ * //_result:
45
+ *
46
+ * // Not an address (an ENS name requires a provided and an
47
+ * // asynchronous API to access)
48
+ * isAddress("ricmoo.eth")
49
+ * //_result:
50
+ */
51
+ export function isAddress(value) {
52
+ try {
53
+ getAddress(value);
54
+ return true;
55
+ }
56
+ catch (error) { }
57
+ return false;
58
+ }
59
+ async function checkAddress(target, promise) {
60
+ const result = await promise;
61
+ if (result == null || result === "0x0000000000000000000000000000000000000000") {
62
+ assert(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target });
63
+ assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target);
64
+ }
65
+ return getAddress(result);
66
+ }
67
+ /**
68
+ * Resolves to an address for the %%target%%, which may be any
69
+ * supported address type, an [[Addressable]] or a Promise which
70
+ * resolves to an address.
71
+ *
72
+ * If an ENS name is provided, but that name has not been correctly
73
+ * configured a [[UnconfiguredNameError]] is thrown.
74
+ *
75
+ * @example:
76
+ * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
77
+ *
78
+ * // Addresses are return synchronously
79
+ * resolveAddress(addr, provider)
80
+ * //_result:
81
+ *
82
+ * // Address promises are resolved asynchronously
83
+ * resolveAddress(Promise.resolve(addr))
84
+ * //_result:
85
+ *
86
+ * // ENS names are resolved asynchronously
87
+ * resolveAddress("dai.tokens.ethers.eth", provider)
88
+ * //_result:
89
+ *
90
+ * // Addressable objects are resolved asynchronously
91
+ * contract = new Contract(addr, [ ])
92
+ * resolveAddress(contract, provider)
93
+ * //_result:
94
+ *
95
+ * // Unconfigured ENS names reject
96
+ * resolveAddress("nothing-here.ricmoo.eth", provider)
97
+ * //_error:
98
+ *
99
+ * // ENS names require a NameResolver object passed in
100
+ * // (notice the provider was omitted)
101
+ * resolveAddress("nothing-here.ricmoo.eth")
102
+ * //_error:
103
+ */
104
+ export function resolveAddress(target, resolver) {
105
+ if (typeof (target) === "string") {
106
+ if (target.match(/^0x[0-9a-f]{40}$/i)) {
107
+ return getAddress(target);
108
+ }
109
+ assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" });
110
+ return checkAddress(target, resolver.resolveName(target));
111
+ }
112
+ else if (isAddressable(target)) {
113
+ return checkAddress(target, target.getAddress());
114
+ }
115
+ else if (target && typeof (target.then) === "function") {
116
+ return checkAddress(target, target);
117
+ }
118
+ assertArgument(false, "unsupported addressable value", "target", target);
119
+ }
@@ -0,0 +1,47 @@
1
+ import type { BigNumberish, BytesLike } from "../utils/index.js";
2
+ /**
3
+ * Returns the address that would result from a ``CREATE`` for %%tx%%.
4
+ *
5
+ * This can be used to compute the address a contract will be
6
+ * deployed to by an EOA when sending a deployment transaction (i.e.
7
+ * when the ``to`` address is ``null``).
8
+ *
9
+ * This can also be used to compute the address a contract will be
10
+ * deployed to by a contract, by using the contract's address as the
11
+ * ``to`` and the contract's nonce.
12
+ *
13
+ * @example
14
+ * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
15
+ * nonce = 5;
16
+ *
17
+ * getCreateAddress({ from, nonce });
18
+ * //_result:
19
+ */
20
+ export declare function getCreateAddress(tx: {
21
+ from: string;
22
+ nonce: BigNumberish;
23
+ }): string;
24
+ /**
25
+ * Returns the address that would result from a ``CREATE2`` operation
26
+ * with the given %%from%%, %%salt%% and %%initCodeHash%%.
27
+ *
28
+ * To compute the %%initCodeHash%% from a contract's init code, use
29
+ * the [[keccak256]] function.
30
+ *
31
+ * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].
32
+ *
33
+ * @example
34
+ * // The address of the contract
35
+ * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
36
+ *
37
+ * // The salt
38
+ * salt = id("HelloWorld")
39
+ *
40
+ * // The hash of the initCode
41
+ * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3";
42
+ * initCodeHash = keccak256(initCode)
43
+ *
44
+ * getCreate2Address(from, salt, initCodeHash)
45
+ * //_result:
46
+ */
47
+ export declare function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string;
@@ -0,0 +1,73 @@
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 { concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument, keccak256 } from "../utils/index.js";
8
+ import { getAddress } from "./address.js";
9
+ // http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
10
+ /**
11
+ * Returns the address that would result from a ``CREATE`` for %%tx%%.
12
+ *
13
+ * This can be used to compute the address a contract will be
14
+ * deployed to by an EOA when sending a deployment transaction (i.e.
15
+ * when the ``to`` address is ``null``).
16
+ *
17
+ * This can also be used to compute the address a contract will be
18
+ * deployed to by a contract, by using the contract's address as the
19
+ * ``to`` and the contract's nonce.
20
+ *
21
+ * @example
22
+ * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
23
+ * nonce = 5;
24
+ *
25
+ * getCreateAddress({ from, nonce });
26
+ * //_result:
27
+ */
28
+ export function getCreateAddress(tx) {
29
+ const from = getAddress(tx.from);
30
+ const nonce = getBigInt(tx.nonce, "tx.nonce");
31
+ let nonceHex = nonce.toString(16);
32
+ if (nonceHex === "0") {
33
+ nonceHex = "0x";
34
+ }
35
+ else if (nonceHex.length % 2) {
36
+ nonceHex = "0x0" + nonceHex;
37
+ }
38
+ else {
39
+ nonceHex = "0x" + nonceHex;
40
+ }
41
+ return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12));
42
+ }
43
+ /**
44
+ * Returns the address that would result from a ``CREATE2`` operation
45
+ * with the given %%from%%, %%salt%% and %%initCodeHash%%.
46
+ *
47
+ * To compute the %%initCodeHash%% from a contract's init code, use
48
+ * the [[keccak256]] function.
49
+ *
50
+ * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].
51
+ *
52
+ * @example
53
+ * // The address of the contract
54
+ * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
55
+ *
56
+ * // The salt
57
+ * salt = id("HelloWorld")
58
+ *
59
+ * // The hash of the initCode
60
+ * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3";
61
+ * initCodeHash = keccak256(initCode)
62
+ *
63
+ * getCreate2Address(from, salt, initCodeHash)
64
+ * //_result:
65
+ */
66
+ export function getCreate2Address(_from, _salt, _initCodeHash) {
67
+ const from = getAddress(_from);
68
+ const salt = getBytes(_salt, "salt");
69
+ const initCodeHash = getBytes(_initCodeHash, "initCodeHash");
70
+ assertArgument(salt.length === 32, "salt must be 32 bytes", "salt", _salt);
71
+ assertArgument(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash);
72
+ return getAddress(dataSlice(keccak256(concat(["0xff", from, salt, initCodeHash])), 12));
73
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Addresses are a fundamental part of interacting with Ethereum. They
3
+ * represent the gloabal identity of Externally Owned Accounts (accounts
4
+ * backed by a private key) and contracts.
5
+ *
6
+ * The Ethereum Naming Service (ENS) provides an interconnected ecosystem
7
+ * of contracts, standards and libraries which enable looking up an
8
+ * address for an ENS name.
9
+ *
10
+ * These functions help convert between various formats, validate
11
+ * addresses and safely resolve ENS names.
12
+ *
13
+ * @_section: api/address:Addresses [about-addresses]
14
+ */
15
+ /**
16
+ * An interface for objects which have an address, and can
17
+ * resolve it asyncronously.
18
+ *
19
+ * This allows objects such as [[Signer]] or [[Contract]] to
20
+ * be used most places an address can be, for example getting
21
+ * the [balance](Provider-getBalance).
22
+ */
23
+ export interface Addressable {
24
+ /**
25
+ * Get the object address.
26
+ */
27
+ getAddress(): Promise<string>;
28
+ }
29
+ /**
30
+ * Anything that can be used to return or resolve an address.
31
+ */
32
+ export declare type AddressLike = string | Promise<string> | Addressable;
33
+ /**
34
+ * An interface for any object which can resolve an ENS name.
35
+ */
36
+ export interface NameResolver {
37
+ /**
38
+ * Resolve to the address for the ENS %%name%%.
39
+ *
40
+ * Resolves to ``null`` if the name is unconfigued. Use
41
+ * [[resolveAddress]] (passing this object as %%resolver%%) to
42
+ * throw for names that are unconfigured.
43
+ */
44
+ resolveName(name: string): Promise<null | string>;
45
+ }
46
+ export { getAddress, getIcapAddress } from "./address.js";
47
+ export { getCreateAddress, getCreate2Address } from "./contract-address.js";
48
+ export { isAddressable, isAddress, resolveAddress } from "./checks.js";
@@ -0,0 +1,24 @@
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
+ /**
8
+ * Addresses are a fundamental part of interacting with Ethereum. They
9
+ * represent the gloabal identity of Externally Owned Accounts (accounts
10
+ * backed by a private key) and contracts.
11
+ *
12
+ * The Ethereum Naming Service (ENS) provides an interconnected ecosystem
13
+ * of contracts, standards and libraries which enable looking up an
14
+ * address for an ENS name.
15
+ *
16
+ * These functions help convert between various formats, validate
17
+ * addresses and safely resolve ENS names.
18
+ *
19
+ * @_section: api/address:Addresses [about-addresses]
20
+ */
21
+ null;
22
+ export { getAddress, getIcapAddress } from "./address.js";
23
+ export { getCreateAddress, getCreate2Address } from "./contract-address.js";
24
+ export { isAddressable, isAddress, resolveAddress } from "./checks.js";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * About bytes32 strings...
3
+ *
4
+ * @_docloc: api/utils:Bytes32 Strings
5
+ */
6
+ import type { BytesLike } from "./utils/index.js";
7
+ /**
8
+ * Encodes %%text%% as a Bytes32 string.
9
+ */
10
+ export declare function encodeBytes32String(text: string): string;
11
+ /**
12
+ * Encodes the Bytes32-encoded %%bytes%% into a string.
13
+ */
14
+ export declare function decodeBytes32String(_bytes: BytesLike): string;
@@ -0,0 +1,45 @@
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
+ /**
8
+ * About bytes32 strings...
9
+ *
10
+ * @_docloc: api/utils:Bytes32 Strings
11
+ */
12
+ import { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes } from "./utils/index.js";
13
+ /**
14
+ * Encodes %%text%% as a Bytes32 string.
15
+ */
16
+ export function encodeBytes32String(text) {
17
+ // Get the bytes
18
+ const bytes = toUtf8Bytes(text);
19
+ // Check we have room for null-termination
20
+ if (bytes.length > 31) {
21
+ throw new Error("bytes32 string must be less than 32 bytes");
22
+ }
23
+ // Zero-pad (implicitly null-terminates)
24
+ return zeroPadBytes(bytes, 32);
25
+ }
26
+ /**
27
+ * Encodes the Bytes32-encoded %%bytes%% into a string.
28
+ */
29
+ export function decodeBytes32String(_bytes) {
30
+ const data = getBytes(_bytes, "bytes");
31
+ // Must be 32 bytes with a null-termination
32
+ if (data.length !== 32) {
33
+ throw new Error("invalid bytes32 - not 32 bytes long");
34
+ }
35
+ if (data[31] !== 0) {
36
+ throw new Error("invalid bytes32 string - no null terminator");
37
+ }
38
+ // Find the null termination
39
+ let length = 31;
40
+ while (data[length - 1] === 0) {
41
+ length--;
42
+ }
43
+ // Determine the string value
44
+ return toUtf8String(data.slice(0, length));
45
+ }
@@ -0,0 +1,120 @@
1
+ import type { BigNumberish, BytesLike } from "../utils/index.js";
2
+ /**
3
+ * @_ignore:
4
+ */
5
+ export declare const WordSize: number;
6
+ /**
7
+ * A [[Result]] is a sub-class of Array, which allows accessing any
8
+ * of its values either positionally by its index or, if keys are
9
+ * provided by its name.
10
+ *
11
+ * @_docloc: api/abi
12
+ */
13
+ export declare class Result extends Array<any> {
14
+ #private;
15
+ [K: string | number]: any;
16
+ /**
17
+ * @private
18
+ */
19
+ constructor(...args: Array<any>);
20
+ /**
21
+ * Returns the Result as a normal Array.
22
+ *
23
+ * This will throw if there are any outstanding deferred
24
+ * errors.
25
+ */
26
+ toArray(): Array<any>;
27
+ /**
28
+ * Returns the Result as an Object with each name-value pair.
29
+ *
30
+ * This will throw if any value is unnamed, or if there are
31
+ * any outstanding deferred errors.
32
+ */
33
+ toObject(): Record<string, any>;
34
+ /**
35
+ * @_ignore
36
+ */
37
+ slice(start?: number | undefined, end?: number | undefined): Result;
38
+ /**
39
+ * @_ignore
40
+ */
41
+ filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result;
42
+ /**
43
+ * @_ignore
44
+ */
45
+ map<T extends any = any>(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array<T>;
46
+ /**
47
+ * Returns the value for %%name%%.
48
+ *
49
+ * Since it is possible to have a key whose name conflicts with
50
+ * a method on a [[Result]] or its superclass Array, or any
51
+ * JavaScript keyword, this ensures all named values are still
52
+ * accessible by name.
53
+ */
54
+ getValue(name: string): any;
55
+ /**
56
+ * Creates a new [[Result]] for %%items%% with each entry
57
+ * also accessible by its corresponding name in %%keys%%.
58
+ */
59
+ static fromItems(items: Array<any>, keys?: Array<null | string>): Result;
60
+ }
61
+ /**
62
+ * Returns all errors found in a [[Result]].
63
+ *
64
+ * Since certain errors encountered when creating a [[Result]] do
65
+ * not impact the ability to continue parsing data, they are
66
+ * deferred until they are actually accessed. Hence a faulty string
67
+ * in an Event that is never used does not impact the program flow.
68
+ *
69
+ * However, sometimes it may be useful to access, identify or
70
+ * validate correctness of a [[Result]].
71
+ *
72
+ * @_docloc api/abi
73
+ */
74
+ export declare function checkResultErrors(result: Result): Array<{
75
+ path: Array<string | number>;
76
+ error: Error;
77
+ }>;
78
+ /**
79
+ * @_ignore
80
+ */
81
+ export declare abstract class Coder {
82
+ readonly name: string;
83
+ readonly type: string;
84
+ readonly localName: string;
85
+ readonly dynamic: boolean;
86
+ constructor(name: string, type: string, localName: string, dynamic: boolean);
87
+ _throwError(message: string, value: any): never;
88
+ abstract encode(writer: Writer, value: any): number;
89
+ abstract decode(reader: Reader): any;
90
+ abstract defaultValue(): any;
91
+ }
92
+ /**
93
+ * @_ignore
94
+ */
95
+ export declare class Writer {
96
+ #private;
97
+ constructor();
98
+ get data(): string;
99
+ get length(): number;
100
+ appendWriter(writer: Writer): number;
101
+ writeBytes(value: BytesLike): number;
102
+ writeValue(value: BigNumberish): number;
103
+ writeUpdatableValue(): (value: BigNumberish) => void;
104
+ }
105
+ /**
106
+ * @_ignore
107
+ */
108
+ export declare class Reader {
109
+ #private;
110
+ readonly allowLoose: boolean;
111
+ constructor(data: BytesLike, allowLoose?: boolean, maxInflation?: number);
112
+ get data(): string;
113
+ get dataLength(): number;
114
+ get consumed(): number;
115
+ get bytes(): Uint8Array;
116
+ subReader(offset: number): Reader;
117
+ readBytes(length: number, loose?: boolean): Uint8Array;
118
+ readValue(): bigint;
119
+ readIndex(): number;
120
+ }