ccxt 4.3.69 → 4.3.71

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 (187) hide show
  1. package/README.md +7 -6
  2. package/dist/ccxt.browser.min.js +13 -10
  3. package/dist/cjs/ccxt.js +8 -1
  4. package/dist/cjs/src/abstract/paradex.js +9 -0
  5. package/dist/cjs/src/ascendex.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +55 -0
  7. package/dist/cjs/src/binance.js +1 -1
  8. package/dist/cjs/src/blofin.js +63 -6
  9. package/dist/cjs/src/bybit.js +1 -1
  10. package/dist/cjs/src/coinbaseinternational.js +168 -2
  11. package/dist/cjs/src/cryptocom.js +9 -1
  12. package/dist/cjs/src/hitbtc.js +1 -1
  13. package/dist/cjs/src/paradex.js +2075 -0
  14. package/dist/cjs/src/poloniex.js +1 -0
  15. package/dist/cjs/src/pro/bequant.js +4 -0
  16. package/dist/cjs/src/pro/blofin.js +665 -0
  17. package/dist/cjs/src/pro/coinbaseinternational.js +154 -9
  18. package/dist/cjs/src/pro/cryptocom.js +3 -1
  19. package/dist/cjs/src/pro/hitbtc.js +26 -8
  20. package/dist/cjs/src/pro/okx.js +7 -0
  21. package/dist/cjs/src/pro/paradex.js +365 -0
  22. package/dist/cjs/src/pro/poloniex.js +37 -12
  23. package/dist/cjs/src/pro/woo.js +5 -4
  24. package/dist/cjs/src/static_dependencies/noble-curves/abstract/poseidon.js +100 -0
  25. package/dist/cjs/src/static_dependencies/noble-curves/abstract/weierstrass.js +1 -0
  26. package/dist/cjs/src/static_dependencies/scure-starknet/index.js +284 -0
  27. package/dist/cjs/src/static_dependencies/starknet/constants.js +60 -0
  28. package/dist/cjs/src/static_dependencies/starknet/types/calldata.js +26 -0
  29. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/abi.js +8 -0
  30. package/dist/cjs/src/static_dependencies/starknet/types/lib/contract/index.js +13 -0
  31. package/dist/cjs/src/static_dependencies/starknet/types/lib/index.js +56 -0
  32. package/dist/cjs/src/static_dependencies/starknet/types/typedData.js +19 -0
  33. package/dist/cjs/src/static_dependencies/starknet/utils/assert.js +15 -0
  34. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +44 -0
  35. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +122 -0
  36. package/dist/cjs/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +137 -0
  37. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/byteArray.js +61 -0
  38. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/cairo.js +218 -0
  39. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +57 -0
  40. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +64 -0
  41. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +63 -0
  42. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/formatter.js +66 -0
  43. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/index.js +281 -0
  44. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/index.js +33 -0
  45. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +37 -0
  46. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +40 -0
  47. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +156 -0
  48. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/requestParser.js +250 -0
  49. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/responseParser.js +215 -0
  50. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/tuple.js +112 -0
  51. package/dist/cjs/src/static_dependencies/starknet/utils/calldata/validate.js +206 -0
  52. package/dist/cjs/src/static_dependencies/starknet/utils/encode.js +58 -0
  53. package/dist/cjs/src/static_dependencies/starknet/utils/hash/classHash.js +57 -0
  54. package/dist/cjs/src/static_dependencies/starknet/utils/merkle.js +76 -0
  55. package/dist/cjs/src/static_dependencies/starknet/utils/num.js +92 -0
  56. package/dist/cjs/src/static_dependencies/starknet/utils/selector.js +48 -0
  57. package/dist/cjs/src/static_dependencies/starknet/utils/shortString.js +101 -0
  58. package/dist/cjs/src/static_dependencies/starknet/utils/typedData.js +334 -0
  59. package/dist/cjs/src/woo.js +4 -2
  60. package/js/ccxt.d.ts +11 -2
  61. package/js/ccxt.js +8 -2
  62. package/js/src/abstract/coinbaseinternational.d.ts +1 -1
  63. package/js/src/abstract/paradex.d.ts +43 -0
  64. package/js/src/abstract/paradex.js +11 -0
  65. package/js/src/ascendex.js +1 -1
  66. package/js/src/base/Exchange.d.ts +8 -0
  67. package/js/src/base/Exchange.js +51 -0
  68. package/js/src/binance.js +1 -1
  69. package/js/src/blofin.d.ts +1 -1
  70. package/js/src/blofin.js +63 -6
  71. package/js/src/bybit.js +1 -1
  72. package/js/src/coinbaseinternational.d.ts +6 -1
  73. package/js/src/coinbaseinternational.js +168 -2
  74. package/js/src/cryptocom.js +10 -2
  75. package/js/src/hitbtc.js +1 -1
  76. package/js/src/paradex.d.ts +76 -0
  77. package/js/src/paradex.js +2075 -0
  78. package/js/src/poloniex.js +1 -0
  79. package/js/src/pro/bequant.js +4 -0
  80. package/js/src/pro/blofin.d.ts +39 -0
  81. package/js/src/pro/blofin.js +668 -0
  82. package/js/src/pro/coinbaseinternational.d.ts +5 -1
  83. package/js/src/pro/coinbaseinternational.js +155 -10
  84. package/js/src/pro/cryptocom.js +4 -2
  85. package/js/src/pro/hitbtc.d.ts +1 -1
  86. package/js/src/pro/hitbtc.js +26 -8
  87. package/js/src/pro/okx.js +7 -0
  88. package/js/src/pro/paradex.d.ts +15 -0
  89. package/js/src/pro/paradex.js +366 -0
  90. package/js/src/pro/poloniex.js +37 -12
  91. package/js/src/pro/woo.js +5 -4
  92. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +24 -0
  93. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.js +1 -1
  94. package/js/src/static_dependencies/scure-starknet/index.d.ts +79 -0
  95. package/js/src/static_dependencies/scure-starknet/index.js +323 -0
  96. package/js/src/static_dependencies/starknet/constants.d.ts +61 -0
  97. package/js/src/static_dependencies/starknet/constants.js +67 -0
  98. package/js/src/static_dependencies/starknet/index.d.ts +7 -0
  99. package/js/src/static_dependencies/starknet/index.js +50 -0
  100. package/js/src/static_dependencies/starknet/types/cairoEnum.d.ts +2 -0
  101. package/js/src/static_dependencies/starknet/types/cairoEnum.js +7 -0
  102. package/js/src/static_dependencies/starknet/types/calldata.d.ts +19 -0
  103. package/js/src/static_dependencies/starknet/types/calldata.js +28 -0
  104. package/js/src/static_dependencies/starknet/types/index.d.ts +13 -0
  105. package/js/src/static_dependencies/starknet/types/index.js +16 -0
  106. package/js/src/static_dependencies/starknet/types/lib/contract/abi.d.ts +71 -0
  107. package/js/src/static_dependencies/starknet/types/lib/contract/abi.js +13 -0
  108. package/js/src/static_dependencies/starknet/types/lib/contract/index.d.ts +24 -0
  109. package/js/src/static_dependencies/starknet/types/lib/contract/index.js +16 -0
  110. package/js/src/static_dependencies/starknet/types/lib/contract/legacy.d.ts +33 -0
  111. package/js/src/static_dependencies/starknet/types/lib/contract/legacy.js +7 -0
  112. package/js/src/static_dependencies/starknet/types/lib/contract/sierra.d.ts +52 -0
  113. package/js/src/static_dependencies/starknet/types/lib/contract/sierra.js +7 -0
  114. package/js/src/static_dependencies/starknet/types/lib/index.d.ts +248 -0
  115. package/js/src/static_dependencies/starknet/types/lib/index.js +52 -0
  116. package/js/src/static_dependencies/starknet/types/typedData.d.ts +44 -0
  117. package/js/src/static_dependencies/starknet/types/typedData.js +19 -0
  118. package/js/src/static_dependencies/starknet/utils/address.d.ts +53 -0
  119. package/js/src/static_dependencies/starknet/utils/address.js +89 -0
  120. package/js/src/static_dependencies/starknet/utils/assert.d.ts +7 -0
  121. package/js/src/static_dependencies/starknet/utils/assert.js +17 -0
  122. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/felt.d.ts +6 -0
  123. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/felt.js +43 -0
  124. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.d.ts +72 -0
  125. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint256.js +117 -0
  126. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.d.ts +76 -0
  127. package/js/src/static_dependencies/starknet/utils/cairoDataTypes/uint512.js +136 -0
  128. package/js/src/static_dependencies/starknet/utils/calldata/byteArray.d.ts +32 -0
  129. package/js/src/static_dependencies/starknet/utils/calldata/byteArray.js +59 -0
  130. package/js/src/static_dependencies/starknet/utils/calldata/cairo.d.ts +183 -0
  131. package/js/src/static_dependencies/starknet/utils/calldata/cairo.js +229 -0
  132. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.d.ts +38 -0
  133. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoCustomEnum.js +57 -0
  134. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.d.ts +35 -0
  135. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoOption.js +64 -0
  136. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.d.ts +34 -0
  137. package/js/src/static_dependencies/starknet/utils/calldata/enum/CairoResult.js +63 -0
  138. package/js/src/static_dependencies/starknet/utils/calldata/enum/index.d.ts +3 -0
  139. package/js/src/static_dependencies/starknet/utils/calldata/enum/index.js +9 -0
  140. package/js/src/static_dependencies/starknet/utils/calldata/formatter.d.ts +9 -0
  141. package/js/src/static_dependencies/starknet/utils/calldata/formatter.js +67 -0
  142. package/js/src/static_dependencies/starknet/utils/calldata/index.d.ts +89 -0
  143. package/js/src/static_dependencies/starknet/utils/calldata/index.js +280 -0
  144. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -0
  145. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.js +30 -0
  146. package/js/src/static_dependencies/starknet/utils/calldata/parser/interface.d.ts +20 -0
  147. package/js/src/static_dependencies/starknet/utils/calldata/parser/interface.js +8 -0
  148. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.d.ts +24 -0
  149. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-0-1.1.0.js +36 -0
  150. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.d.ts +23 -0
  151. package/js/src/static_dependencies/starknet/utils/calldata/parser/parser-2.0.0.js +40 -0
  152. package/js/src/static_dependencies/starknet/utils/calldata/propertyOrder.d.ts +2 -0
  153. package/js/src/static_dependencies/starknet/utils/calldata/propertyOrder.js +155 -0
  154. package/js/src/static_dependencies/starknet/utils/calldata/requestParser.d.ts +11 -0
  155. package/js/src/static_dependencies/starknet/utils/calldata/requestParser.js +248 -0
  156. package/js/src/static_dependencies/starknet/utils/calldata/responseParser.d.ts +11 -0
  157. package/js/src/static_dependencies/starknet/utils/calldata/responseParser.js +214 -0
  158. package/js/src/static_dependencies/starknet/utils/calldata/tuple.d.ts +6 -0
  159. package/js/src/static_dependencies/starknet/utils/calldata/tuple.js +113 -0
  160. package/js/src/static_dependencies/starknet/utils/calldata/validate.d.ts +6 -0
  161. package/js/src/static_dependencies/starknet/utils/calldata/validate.js +208 -0
  162. package/js/src/static_dependencies/starknet/utils/encode.d.ts +207 -0
  163. package/js/src/static_dependencies/starknet/utils/encode.js +282 -0
  164. package/js/src/static_dependencies/starknet/utils/hash/classHash.d.ts +57 -0
  165. package/js/src/static_dependencies/starknet/utils/hash/classHash.js +224 -0
  166. package/js/src/static_dependencies/starknet/utils/hash/index.d.ts +6 -0
  167. package/js/src/static_dependencies/starknet/utils/hash/index.js +13 -0
  168. package/js/src/static_dependencies/starknet/utils/json.d.ts +24 -0
  169. package/js/src/static_dependencies/starknet/utils/json.js +43 -0
  170. package/js/src/static_dependencies/starknet/utils/merkle.d.ts +35 -0
  171. package/js/src/static_dependencies/starknet/utils/merkle.js +84 -0
  172. package/js/src/static_dependencies/starknet/utils/num.d.ts +182 -0
  173. package/js/src/static_dependencies/starknet/utils/num.js +244 -0
  174. package/js/src/static_dependencies/starknet/utils/selector.d.ts +48 -0
  175. package/js/src/static_dependencies/starknet/utils/selector.js +85 -0
  176. package/js/src/static_dependencies/starknet/utils/shortString.d.ts +57 -0
  177. package/js/src/static_dependencies/starknet/utils/shortString.js +96 -0
  178. package/js/src/static_dependencies/starknet/utils/starknetId.d.ts +113 -0
  179. package/js/src/static_dependencies/starknet/utils/starknetId.js +265 -0
  180. package/js/src/static_dependencies/starknet/utils/typedData.d.ts +54 -0
  181. package/js/src/static_dependencies/starknet/utils/typedData.js +321 -0
  182. package/js/src/static_dependencies/starknet/utils/uint256.d.ts +21 -0
  183. package/js/src/static_dependencies/starknet/utils/uint256.js +32 -0
  184. package/js/src/static_dependencies/starknet/utils/url.d.ts +29 -0
  185. package/js/src/static_dependencies/starknet/utils/url.js +70 -0
  186. package/js/src/woo.js +4 -2
  187. package/package.json +1 -1
@@ -0,0 +1,323 @@
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
+ /*! scure-starknet - MIT License (c) 2022 Paul Miller (paulmillr.com) */
8
+ import { keccak_256 } from '../noble-hashes/sha3.js';
9
+ import { sha256 } from '../noble-hashes/sha256.js';
10
+ import { utf8ToBytes } from '../noble-hashes/utils.js';
11
+ import { mod, Fp, validateField, invert } from '../noble-curves/abstract/modular.js';
12
+ import { poseidon } from '../noble-curves/abstract/poseidon.js';
13
+ import { weierstrass, DER } from '../noble-curves/abstract/weierstrass.js';
14
+ import * as u from '../noble-curves/abstract/utils.js';
15
+ import { getHash } from '../noble-curves/_shortw_utils.js';
16
+ const CURVE_ORDER = BigInt('3618502788666131213697322783095070105526743751716087489154079457884512865583');
17
+ // 2**251, limit for msgHash and Signature.r
18
+ export const MAX_VALUE = BigInt('0x800000000000000000000000000000000000000000000000000000000000000');
19
+ const nBitLength = 252;
20
+ function bits2int(bytes) {
21
+ while (bytes[0] === 0)
22
+ bytes = bytes.subarray(1); // strip leading 0s
23
+ // Copy-pasted from weierstrass.ts
24
+ const delta = bytes.length * 8 - nBitLength;
25
+ const num = u.bytesToNumberBE(bytes);
26
+ return delta > 0 ? num >> BigInt(delta) : num;
27
+ }
28
+ function hex0xToBytes(hex) {
29
+ if (typeof hex === 'string') {
30
+ hex = strip0x(hex); // allow 0x prefix
31
+ if (hex.length & 1)
32
+ hex = '0' + hex; // allow unpadded hex
33
+ }
34
+ return u.hexToBytes(hex);
35
+ }
36
+ const curve = weierstrass({
37
+ a: BigInt(1),
38
+ b: BigInt('3141592653589793238462643383279502884197169399375105820974944592307816406665'),
39
+ // Field over which we'll do calculations; 2n**251n + 17n * 2n**192n + 1n
40
+ // There is no efficient sqrt for field (P%4==1)
41
+ Fp: Fp(BigInt('0x800000000000011000000000000000000000000000000000000000000000001')),
42
+ n: CURVE_ORDER,
43
+ nBitLength,
44
+ // Base point (x, y) aka generator point
45
+ Gx: BigInt('874739451078007766457464989774322083649278607533249481151382481072868806602'),
46
+ Gy: BigInt('152666792071518830868575557812948353041420400780739481342941381225525861407'),
47
+ h: BigInt(1),
48
+ lowS: false,
49
+ ...getHash(sha256),
50
+ // Custom truncation routines for stark curve
51
+ bits2int,
52
+ bits2int_modN: (bytes) => {
53
+ // 2102820b232636d200cb21f1d330f20d096cae09d1bf3edb1cc333ddee11318 =>
54
+ // 2102820b232636d200cb21f1d330f20d096cae09d1bf3edb1cc333ddee113180
55
+ const hex = u.bytesToNumberBE(bytes).toString(16); // toHex unpadded
56
+ if (hex.length === 63)
57
+ bytes = hex0xToBytes(hex + '0'); // append trailing 0
58
+ return mod(bits2int(bytes), CURVE_ORDER);
59
+ },
60
+ });
61
+ export const _starkCurve = curve;
62
+ function ensureBytes(hex) {
63
+ return u.ensureBytes('', typeof hex === 'string' ? hex0xToBytes(hex) : hex);
64
+ }
65
+ function normPrivKey(privKey) {
66
+ return u.bytesToHex(ensureBytes(privKey)).padStart(64, '0');
67
+ }
68
+ export function getPublicKey(privKey, isCompressed = false) {
69
+ return curve.getPublicKey(normPrivKey(privKey), isCompressed);
70
+ }
71
+ export function getSharedSecret(privKeyA, pubKeyB) {
72
+ return curve.getSharedSecret(normPrivKey(privKeyA), pubKeyB);
73
+ }
74
+ function checkSignature(signature) {
75
+ // Signature.s checked inside weierstrass
76
+ const { r, s } = signature;
77
+ if (r < 0n || r >= MAX_VALUE)
78
+ throw new Error(`Signature.r should be [1, ${MAX_VALUE})`);
79
+ const w = invert(s, CURVE_ORDER);
80
+ if (w < 0n || w >= MAX_VALUE)
81
+ throw new Error(`inv(Signature.s) should be [1, ${MAX_VALUE})`);
82
+ }
83
+ function checkMessage(msgHash) {
84
+ const bytes = ensureBytes(msgHash);
85
+ const num = u.bytesToNumberBE(bytes);
86
+ // num < 0 impossible here
87
+ if (num >= MAX_VALUE)
88
+ throw new Error(`msgHash should be [0, ${MAX_VALUE})`);
89
+ return bytes;
90
+ }
91
+ export function sign(msgHash, privKey, opts) {
92
+ const sig = curve.sign(checkMessage(msgHash), normPrivKey(privKey), opts);
93
+ checkSignature(sig);
94
+ return sig;
95
+ }
96
+ export function verify(signature, msgHash, pubKey) {
97
+ if (!(signature instanceof Signature)) {
98
+ const bytes = ensureBytes(signature);
99
+ try {
100
+ signature = Signature.fromDER(bytes);
101
+ }
102
+ catch (derError) {
103
+ if (!(derError instanceof DER.Err))
104
+ throw derError;
105
+ signature = Signature.fromCompact(bytes);
106
+ }
107
+ }
108
+ checkSignature(signature);
109
+ return curve.verify(signature, checkMessage(msgHash), ensureBytes(pubKey));
110
+ }
111
+ const { CURVE, ProjectivePoint, Signature, utils } = curve;
112
+ export { CURVE, ProjectivePoint, Signature, utils };
113
+ function extractX(bytes) {
114
+ const hex = u.bytesToHex(bytes.subarray(1));
115
+ const stripped = hex.replace(/^0+/gm, ''); // strip leading 0s
116
+ return `0x${stripped}`;
117
+ }
118
+ function strip0x(hex) {
119
+ return hex.replace(/^0x/i, '');
120
+ }
121
+ // seed generation
122
+ export function grindKey(seed) {
123
+ const _seed = ensureBytes(seed);
124
+ const sha256mask = 2n ** 256n;
125
+ const limit = sha256mask - mod(sha256mask, CURVE_ORDER);
126
+ for (let i = 0;; i++) {
127
+ const key = sha256Num(u.concatBytes(_seed, u.numberToVarBytesBE(BigInt(i))));
128
+ if (key < limit)
129
+ return mod(key, CURVE_ORDER).toString(16); // key should be in [0, limit)
130
+ if (i === 100000)
131
+ throw new Error('grindKey is broken: tried 100k vals'); // prevent dos
132
+ }
133
+ }
134
+ export function getStarkKey(privateKey) {
135
+ return extractX(getPublicKey(privateKey, true));
136
+ }
137
+ export function ethSigToPrivate(signature) {
138
+ signature = strip0x(signature);
139
+ if (signature.length !== 130)
140
+ throw new Error('Wrong ethereum signature');
141
+ return grindKey(signature.substring(0, 64));
142
+ }
143
+ const MASK_31 = 2n ** 31n - 1n;
144
+ const int31 = (n) => Number(n & MASK_31);
145
+ export function getAccountPath(layer, application, ethereumAddress, index) {
146
+ const layerNum = int31(sha256Num(layer));
147
+ const applicationNum = int31(sha256Num(application));
148
+ const eth = u.hexToNumber(strip0x(ethereumAddress));
149
+ return `m/2645'/${layerNum}'/${applicationNum}'/${int31(eth)}'/${int31(eth >> 31n)}'/${index}`;
150
+ }
151
+ // The Pedersen hash uses five different points on the curve.
152
+ // This is critical to ensure that they have been generated in a way
153
+ // that nobody knows the discrete logarithm of one point regarding another.
154
+ //
155
+ // Starknet utilizes nothing-up-my-sleeve technique:
156
+ // The parameters of the Pedersen hash are generated from the constant 𝜋.
157
+ // The x-coordinate of each point is a chunk of 76 decimal digit of 𝜋 modulo 𝑝.
158
+ // If it is a quadratic residue then the point is valid
159
+ // else the x-coordinate coordinate is incremented by one.
160
+ // https://docs.starkware.co/starkex/pedersen-hash-function.html
161
+ // https://github.com/starkware-libs/starkex-for-spot-trading/blob/607f0b4ce507e1d95cd018d206a2797f6ba4aab4/src/starkware/crypto/starkware/crypto/signature/nothing_up_my_sleeve_gen.py
162
+ const PEDERSEN_POINTS = [
163
+ new ProjectivePoint(2089986280348253421170679821480865132823066470938446095505822317253594081284n, 1713931329540660377023406109199410414810705867260802078187082345529207694986n, 1n),
164
+ new ProjectivePoint(996781205833008774514500082376783249102396023663454813447423147977397232763n, 1668503676786377725805489344771023921079126552019160156920634619255970485781n, 1n),
165
+ new ProjectivePoint(2251563274489750535117886426533222435294046428347329203627021249169616184184n, 1798716007562728905295480679789526322175868328062420237419143593021674992973n, 1n),
166
+ new ProjectivePoint(2138414695194151160943305727036575959195309218611738193261179310511854807447n, 113410276730064486255102093846540133784865286929052426931474106396135072156n, 1n),
167
+ new ProjectivePoint(2379962749567351885752724891227938183011949129833673362440656643086021394946n, 776496453633298175483985398648758586525933812536653089401905292063708816422n, 1n),
168
+ ];
169
+ function pedersenPrecompute(p1, p2) {
170
+ const out = [];
171
+ let p = p1;
172
+ for (let i = 0; i < 248; i++) {
173
+ out.push(p);
174
+ p = p.double();
175
+ }
176
+ // NOTE: we cannot use wNAF here, because last 4 bits will require full 248 bits multiplication
177
+ // We can add support for this to wNAF, but it will complicate wNAF.
178
+ p = p2;
179
+ for (let i = 0; i < 4; i++) {
180
+ out.push(p);
181
+ p = p.double();
182
+ }
183
+ return out;
184
+ }
185
+ const PEDERSEN_POINTS1 = pedersenPrecompute(PEDERSEN_POINTS[1], PEDERSEN_POINTS[2]);
186
+ const PEDERSEN_POINTS2 = pedersenPrecompute(PEDERSEN_POINTS[3], PEDERSEN_POINTS[4]);
187
+ function pedersenArg(arg) {
188
+ let value;
189
+ if (typeof arg === 'bigint') {
190
+ value = arg;
191
+ }
192
+ else if (typeof arg === 'number') {
193
+ if (!Number.isSafeInteger(arg))
194
+ throw new Error(`Invalid pedersenArg: ${arg}`);
195
+ value = BigInt(arg);
196
+ }
197
+ else {
198
+ value = u.bytesToNumberBE(ensureBytes(arg));
199
+ }
200
+ if (!(0n <= value && value < curve.CURVE.Fp.ORDER))
201
+ throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${value}`); // [0..Fp)
202
+ return value;
203
+ }
204
+ /**
205
+ * Warning: Not algorithmic constant-time.
206
+ */
207
+ function pedersenSingle(point, value, constants) {
208
+ let x = pedersenArg(value);
209
+ for (let j = 0; j < 252; j++) {
210
+ const pt = constants[j];
211
+ if (!pt)
212
+ throw new Error('invalid constant index');
213
+ if (pt.equals(point))
214
+ throw new Error('Same point');
215
+ if ((x & 1n) !== 0n)
216
+ point = point.add(pt);
217
+ x >>= 1n;
218
+ }
219
+ return point;
220
+ }
221
+ // shift_point + x_low * P_0 + x_high * P1 + y_low * P2 + y_high * P3
222
+ export function pedersen(x, y) {
223
+ let point = PEDERSEN_POINTS[0];
224
+ point = pedersenSingle(point, x, PEDERSEN_POINTS1);
225
+ point = pedersenSingle(point, y, PEDERSEN_POINTS2);
226
+ return extractX(point.toRawBytes(true));
227
+ }
228
+ // Same as hashChain, but computes hash even for single element and order is not revesed
229
+ export const computeHashOnElements = (data, fn = pedersen) => [0, ...data, data.length].reduce((x, y) => fn(x, y));
230
+ const MASK_250 = u.bitMask(250);
231
+ export const keccak = (data) => u.bytesToNumberBE(keccak_256(data)) & MASK_250;
232
+ const sha256Num = (data) => u.bytesToNumberBE(sha256(data));
233
+ // Poseidon hash
234
+ // Unused for now
235
+ // export const Fp253 = Fp(
236
+ // BigInt('14474011154664525231415395255581126252639794253786371766033694892385558855681')
237
+ // ); // 2^253 + 2^199 + 1
238
+ export const Fp251 = Fp(BigInt('3618502788666131213697322783095070105623107215331596699973092056135872020481')); // 2^251 + 17 * 2^192 + 1
239
+ function poseidonRoundConstant(Fp, name, idx) {
240
+ const val = Fp.fromBytes(sha256(utf8ToBytes(`${name}${idx}`)));
241
+ return Fp.create(val);
242
+ }
243
+ // NOTE: doesn't check eiginvalues and possible can create unsafe matrix. But any filtration here will break compatibility with starknet
244
+ // Please use only if you really know what you doing.
245
+ // https://eprint.iacr.org/2019/458.pdf Section 2.3 (Avoiding Insecure Matrices)
246
+ export function _poseidonMDS(Fp, name, m, attempt = 0) {
247
+ const x_values = [];
248
+ const y_values = [];
249
+ for (let i = 0; i < m; i++) {
250
+ x_values.push(poseidonRoundConstant(Fp, `${name}x`, attempt * m + i));
251
+ y_values.push(poseidonRoundConstant(Fp, `${name}y`, attempt * m + i));
252
+ }
253
+ if (new Set([...x_values, ...y_values]).size !== 2 * m)
254
+ throw new Error('X and Y values are not distinct');
255
+ return x_values.map((x) => y_values.map((y) => Fp.inv(Fp.sub(x, y))));
256
+ }
257
+ const MDS_SMALL = [
258
+ [3, 1, 1],
259
+ [1, -1, 1],
260
+ [1, 1, -2],
261
+ ].map((i) => i.map(BigInt));
262
+ export function poseidonBasic(opts, mds) {
263
+ validateField(opts.Fp);
264
+ if (!Number.isSafeInteger(opts.rate) || !Number.isSafeInteger(opts.capacity))
265
+ throw new Error(`Wrong poseidon opts: ${opts}`);
266
+ const m = opts.rate + opts.capacity;
267
+ const rounds = opts.roundsFull + opts.roundsPartial;
268
+ const roundConstants = [];
269
+ for (let i = 0; i < rounds; i++) {
270
+ const row = [];
271
+ for (let j = 0; j < m; j++)
272
+ row.push(poseidonRoundConstant(opts.Fp, 'Hades', m * i + j));
273
+ roundConstants.push(row);
274
+ }
275
+ const res = poseidon({
276
+ ...opts,
277
+ t: m,
278
+ sboxPower: 3,
279
+ reversePartialPowIdx: true,
280
+ mds,
281
+ roundConstants,
282
+ });
283
+ res.m = m;
284
+ res.rate = opts.rate;
285
+ res.capacity = opts.capacity;
286
+ return res;
287
+ }
288
+ export function poseidonCreate(opts, mdsAttempt = 0) {
289
+ const m = opts.rate + opts.capacity;
290
+ if (!Number.isSafeInteger(mdsAttempt))
291
+ throw new Error(`Wrong mdsAttempt=${mdsAttempt}`);
292
+ return poseidonBasic(opts, _poseidonMDS(opts.Fp, 'HadesMDS', m, mdsAttempt));
293
+ }
294
+ export const poseidonSmall = poseidonBasic({ Fp: Fp251, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, MDS_SMALL);
295
+ export function poseidonHash(x, y, fn = poseidonSmall) {
296
+ return fn([x, y, 2n])[0];
297
+ }
298
+ export function poseidonHashFunc(x, y, fn = poseidonSmall) {
299
+ return u.numberToVarBytesBE(poseidonHash(u.bytesToNumberBE(x), u.bytesToNumberBE(y), fn));
300
+ }
301
+ export function poseidonHashSingle(x, fn = poseidonSmall) {
302
+ return fn([x, 0n, 1n])[0];
303
+ }
304
+ export function poseidonHashMany(values, fn = poseidonSmall) {
305
+ const { m, rate } = fn;
306
+ if (!Array.isArray(values))
307
+ throw new Error('bigint array expected in values');
308
+ const padded = Array.from(values); // copy
309
+ padded.push(1n);
310
+ while (padded.length % rate !== 0)
311
+ padded.push(0n);
312
+ let state = new Array(m).fill(0n);
313
+ for (let i = 0; i < padded.length; i += rate) {
314
+ for (let j = 0; j < rate; j++) {
315
+ const item = padded[i + j];
316
+ if (typeof item === 'undefined')
317
+ throw new Error('invalid index');
318
+ state[j] += item;
319
+ }
320
+ state = fn(state);
321
+ }
322
+ return state[0];
323
+ }
@@ -0,0 +1,61 @@
1
+ export { IS_BROWSER } from './utils/encode.js';
2
+ /**
3
+ * Cairo Felt support storing max 31 character
4
+ */
5
+ export declare const TEXT_TO_FELT_MAX_LEN = 31;
6
+ /**
7
+ * Alternatively use directly from api specification
8
+ * types.RPC.ETransactionVersion
9
+ * For BN do BigInt(TRANSACTION_VERSION.*)
10
+ */
11
+ export declare const ZERO = 0n;
12
+ export declare const MASK_250: bigint;
13
+ export declare const API_VERSION = 0n;
14
+ export declare const PRIME: bigint;
15
+ export declare const MAX_STORAGE_ITEM_SIZE = 256n;
16
+ export declare const ADDR_BOUND: bigint;
17
+ export declare const RANGE_FELT: {
18
+ readonly min: bigint;
19
+ readonly max: bigint;
20
+ };
21
+ export declare const RANGE_I128: {
22
+ readonly min: bigint;
23
+ readonly max: bigint;
24
+ };
25
+ export declare const RANGE_U128: {
26
+ readonly min: bigint;
27
+ readonly max: bigint;
28
+ };
29
+ export declare enum BaseUrl {
30
+ SN_MAIN = "https://alpha-mainnet.starknet.io",
31
+ SN_SEPOLIA = "https://alpha-sepolia.starknet.io"
32
+ }
33
+ export declare enum NetworkName {
34
+ SN_MAIN = "SN_MAIN",
35
+ SN_SEPOLIA = "SN_SEPOLIA"
36
+ }
37
+ export declare enum StarknetChainId {
38
+ SN_MAIN = "0x534e5f4d41494e",
39
+ SN_SEPOLIA = "0x534e5f5345504f4c4941"
40
+ }
41
+ export declare enum TransactionHashPrefix {
42
+ DECLARE = "0x6465636c617265",
43
+ DEPLOY = "0x6465706c6f79",
44
+ DEPLOY_ACCOUNT = "0x6465706c6f795f6163636f756e74",
45
+ INVOKE = "0x696e766f6b65",
46
+ L1_HANDLER = "0x6c315f68616e646c6572"
47
+ }
48
+ export declare const enum feeMarginPercentage {
49
+ L1_BOUND_MAX_AMOUNT = 50,
50
+ L1_BOUND_MAX_PRICE_PER_UNIT = 50,
51
+ MAX_FEE = 50
52
+ }
53
+ export declare const UDC: {
54
+ ADDRESS: string;
55
+ ENTRYPOINT: string;
56
+ };
57
+ export declare const RPC_DEFAULT_VERSION = "v0_7";
58
+ export declare const RPC_NODES: {
59
+ SN_MAIN: string[];
60
+ SN_SEPOLIA: string[];
61
+ };
@@ -0,0 +1,67 @@
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 { ETransactionVersion } from './types/api';
8
+ export { IS_BROWSER } from './utils/encode.js';
9
+ /**
10
+ * Cairo Felt support storing max 31 character
11
+ */
12
+ export const TEXT_TO_FELT_MAX_LEN = 31;
13
+ /**
14
+ * Alternatively use directly from api specification
15
+ * types.RPC.ETransactionVersion
16
+ * For BN do BigInt(TRANSACTION_VERSION.*)
17
+ */
18
+ // export { ETransactionVersion as TRANSACTION_VERSION };
19
+ export const ZERO = 0n;
20
+ export const MASK_250 = 2n ** 250n - 1n; // 2 ** 250 - 1
21
+ export const API_VERSION = ZERO;
22
+ export const PRIME = 2n ** 251n + 17n * 2n ** 192n + 1n;
23
+ // based on: https://github.com/starkware-libs/cairo-lang/blob/v0.12.3/src/starkware/starknet/common/storage.cairo#L3
24
+ export const MAX_STORAGE_ITEM_SIZE = 256n;
25
+ export const ADDR_BOUND = 2n ** 251n - MAX_STORAGE_ITEM_SIZE;
26
+ const range = (min, max) => ({ min, max });
27
+ export const RANGE_FELT = range(ZERO, PRIME - 1n);
28
+ export const RANGE_I128 = range(-(2n ** 127n), 2n ** 127n - 1n);
29
+ export const RANGE_U128 = range(ZERO, 2n ** 128n - 1n);
30
+ export var BaseUrl;
31
+ (function (BaseUrl) {
32
+ BaseUrl["SN_MAIN"] = "https://alpha-mainnet.starknet.io";
33
+ BaseUrl["SN_SEPOLIA"] = "https://alpha-sepolia.starknet.io";
34
+ })(BaseUrl || (BaseUrl = {}));
35
+ export var NetworkName;
36
+ (function (NetworkName) {
37
+ NetworkName["SN_MAIN"] = "SN_MAIN";
38
+ NetworkName["SN_SEPOLIA"] = "SN_SEPOLIA";
39
+ })(NetworkName || (NetworkName = {}));
40
+ export var StarknetChainId;
41
+ (function (StarknetChainId) {
42
+ StarknetChainId["SN_MAIN"] = "0x534e5f4d41494e";
43
+ StarknetChainId["SN_SEPOLIA"] = "0x534e5f5345504f4c4941";
44
+ })(StarknetChainId || (StarknetChainId = {}));
45
+ export var TransactionHashPrefix;
46
+ (function (TransactionHashPrefix) {
47
+ TransactionHashPrefix["DECLARE"] = "0x6465636c617265";
48
+ TransactionHashPrefix["DEPLOY"] = "0x6465706c6f79";
49
+ TransactionHashPrefix["DEPLOY_ACCOUNT"] = "0x6465706c6f795f6163636f756e74";
50
+ TransactionHashPrefix["INVOKE"] = "0x696e766f6b65";
51
+ TransactionHashPrefix["L1_HANDLER"] = "0x6c315f68616e646c6572";
52
+ })(TransactionHashPrefix || (TransactionHashPrefix = {}));
53
+ export const UDC = {
54
+ ADDRESS: '0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf',
55
+ ENTRYPOINT: 'deployContract',
56
+ };
57
+ export const RPC_DEFAULT_VERSION = 'v0_7';
58
+ export const RPC_NODES = {
59
+ SN_MAIN: [
60
+ `https://starknet-mainnet.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
61
+ `https://free-rpc.nethermind.io/mainnet-juno/${RPC_DEFAULT_VERSION}`,
62
+ ],
63
+ SN_SEPOLIA: [
64
+ `https://starknet-sepolia.public.blastapi.io/rpc/${RPC_DEFAULT_VERSION}`,
65
+ `https://free-rpc.nethermind.io/sepolia-juno/${RPC_DEFAULT_VERSION}`,
66
+ ],
67
+ };
@@ -0,0 +1,7 @@
1
+ export * as hash from './utils/hash/index.js';
2
+ export * from './utils/calldata/index.js';
3
+ export * as typedData from './utils/typedData.js';
4
+ /**
5
+ * Deprecated
6
+ */
7
+ /** @deprecated prefer the 'num' naming */
@@ -0,0 +1,50 @@
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
+ export * as hash from './utils/hash/index.js';
8
+ export * from './utils/calldata/index.js';
9
+ export * as typedData from './utils/typedData.js';
10
+ // /**
11
+ // * Main
12
+ // */
13
+ // export * from './account/index.js';
14
+ // export * from './contract/index.js';
15
+ // export * from './types/index.js';
16
+ // /**
17
+ // * Utils
18
+ // */
19
+ // export * as constants from './constants.js';
20
+ // export * as encode from './utils/encode.js';
21
+ // export * as v3hash from './utils/hash/transactionHash/v3.js';
22
+ // export * as v2hash from './utils/hash/transactionHash/v2.js';
23
+ // export * as num from './utils/num.js';
24
+ // export * as transaction from './utils/transaction.js';
25
+ // export * as stark from './utils/stark.js';
26
+ // export * as eth from './utils/eth.js';
27
+ // export * as merkle from './utils/merkle.js';
28
+ // export * as uint256 from './utils/uint256.js';
29
+ // export * as shortString from './utils/shortString.js';
30
+ // export * as starknetId from './utils/starknetId.js';
31
+ // export * as events from './utils/events/index.js';
32
+ // export * from './utils/cairoDataTypes/uint256.js';
33
+ // export * from './utils/cairoDataTypes/uint512.js';
34
+ // export * from './utils/address.js';
35
+ // export * from './utils/url.js';
36
+ // export * from './utils/calldata/enum/index.js';
37
+ // export * from './utils/contract.js';
38
+ // export * from './utils/transactionReceipt.js';
39
+ /**
40
+ * Deprecated
41
+ */
42
+ /* eslint-disable import/first */
43
+ // import * as num from './utils/num/index.js';
44
+ /** @deprecated prefer the 'num' naming */
45
+ // export const number = num;
46
+ // export * from './utils/events/index.js';
47
+ // export * as types from './types/index.js';
48
+ // export * as json from './utils/json.js';
49
+ // export * as provider from './utils/provider.js';
50
+ // export * as selector from './utils/selector/index.js';
@@ -0,0 +1,2 @@
1
+ import { CairoCustomEnum, CairoOption, CairoResult } from '../utils/calldata/enum/index.js';
2
+ export declare type CairoEnum = CairoCustomEnum | CairoOption<any> | CairoResult<any, any>;
@@ -0,0 +1,7 @@
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
+ export {};
@@ -0,0 +1,19 @@
1
+ export declare enum ValidateType {
2
+ DEPLOY = "DEPLOY",
3
+ CALL = "CALL",
4
+ INVOKE = "INVOKE"
5
+ }
6
+ export declare enum Uint {
7
+ u8 = "core::integer::u8",
8
+ u16 = "core::integer::u16",
9
+ u32 = "core::integer::u32",
10
+ u64 = "core::integer::u64",
11
+ u128 = "core::integer::u128",
12
+ u256 = "core::integer::u256",
13
+ u512 = "core::integer::u512"
14
+ }
15
+ export declare enum Literal {
16
+ ClassHash = "core::starknet::class_hash::ClassHash",
17
+ ContractAddress = "core::starknet::contract_address::ContractAddress",
18
+ Secp256k1Point = "core::starknet::secp256k1::Secp256k1Point"
19
+ }
@@ -0,0 +1,28 @@
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
+ export var ValidateType;
8
+ (function (ValidateType) {
9
+ ValidateType["DEPLOY"] = "DEPLOY";
10
+ ValidateType["CALL"] = "CALL";
11
+ ValidateType["INVOKE"] = "INVOKE";
12
+ })(ValidateType || (ValidateType = {}));
13
+ export var Uint;
14
+ (function (Uint) {
15
+ Uint["u8"] = "core::integer::u8";
16
+ Uint["u16"] = "core::integer::u16";
17
+ Uint["u32"] = "core::integer::u32";
18
+ Uint["u64"] = "core::integer::u64";
19
+ Uint["u128"] = "core::integer::u128";
20
+ Uint["u256"] = "core::integer::u256";
21
+ Uint["u512"] = "core::integer::u512";
22
+ })(Uint || (Uint = {}));
23
+ export var Literal;
24
+ (function (Literal) {
25
+ Literal["ClassHash"] = "core::starknet::class_hash::ClassHash";
26
+ Literal["ContractAddress"] = "core::starknet::contract_address::ContractAddress";
27
+ Literal["Secp256k1Point"] = "core::starknet::secp256k1::Secp256k1Point";
28
+ })(Literal || (Literal = {}));
@@ -0,0 +1,13 @@
1
+ export * from './calldata.js';
2
+ export * from './lib/index.js';
3
+ export * from './cairoEnum.js';
4
+ export declare type ArgsOrCalldata = any;
5
+ export declare type Result = any;
6
+ export declare type ParsedEvent = any;
7
+ export declare type ParsedEvents = any;
8
+ export declare type RPC = any;
9
+ export declare type InvokeTransactionReceiptResponse = any;
10
+ export declare type ContractClassResponse = any;
11
+ export declare type FeeEstimate = any;
12
+ export declare type UniversalDetails = any;
13
+ export * from './typedData.js';
@@ -0,0 +1,16 @@
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
+ export * from './calldata.js';
8
+ export * from './lib/index.js';
9
+ export * from './cairoEnum.js';
10
+ export * from './typedData.js';
11
+ // export * from './transactionReceipt.js';
12
+ // export * as RPC from './api.js';
13
+ // export * from './contract.js';
14
+ // export * from './account.js';
15
+ // export * from './provider.js';
16
+ // export * from './signer.js';
@@ -0,0 +1,71 @@
1
+ /** ABI */
2
+ export declare type Abi = ReadonlyArray<FunctionAbi | EventAbi | StructAbi | InterfaceAbi | any>;
3
+ export declare type AbiEntry = {
4
+ name: string;
5
+ type: 'felt' | 'felt*' | string;
6
+ };
7
+ export declare type EventEntry = {
8
+ name: string;
9
+ type: 'felt' | 'felt*' | string;
10
+ kind: 'key' | 'data';
11
+ };
12
+ declare enum FunctionAbiType {
13
+ 'function' = 0,
14
+ 'l1_handler' = 1,
15
+ 'constructor' = 2
16
+ }
17
+ export declare type FunctionAbi = {
18
+ inputs: AbiEntry[];
19
+ name: string;
20
+ outputs: AbiEntry[];
21
+ stateMutability?: 'view';
22
+ state_mutability?: string;
23
+ type: FunctionAbiType;
24
+ };
25
+ export declare type AbiStructs = {
26
+ [name: string]: StructAbi;
27
+ };
28
+ export declare type StructAbi = {
29
+ members: (AbiEntry & {
30
+ offset: number;
31
+ })[];
32
+ name: string;
33
+ size: number;
34
+ type: 'struct';
35
+ };
36
+ export declare type AbiInterfaces = {
37
+ [name: string]: InterfaceAbi;
38
+ };
39
+ export declare type InterfaceAbi = {
40
+ items: FunctionAbi[];
41
+ name: string;
42
+ type: 'interface';
43
+ };
44
+ export declare type AbiEnums = {
45
+ [name: string]: EnumAbi;
46
+ };
47
+ export declare type EnumAbi = {
48
+ variants: (AbiEntry & {
49
+ offset: number;
50
+ })[];
51
+ name: string;
52
+ size: number;
53
+ type: 'enum/index.js';
54
+ };
55
+ export declare type AbiEvents = {
56
+ [hash: string]: EventAbi;
57
+ };
58
+ export declare type EventAbi = Cairo1Event | LegacyEvent;
59
+ export declare type Cairo1Event = {
60
+ name: string;
61
+ members: EventEntry[];
62
+ kind: 'struct';
63
+ type: 'event';
64
+ };
65
+ export declare type LegacyEvent = {
66
+ name: string;
67
+ type: 'event';
68
+ data: EventEntry[];
69
+ keys: EventEntry[];
70
+ };
71
+ export {};