essential-eth 0.2.2 → 0.3.3

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 (114) hide show
  1. package/lib/cjs/classes/Contract.d.ts +69 -0
  2. package/lib/cjs/classes/Contract.js +122 -0
  3. package/lib/cjs/{rpc → classes}/get-block.test.d.ts +0 -0
  4. package/lib/cjs/{rpc → classes}/get-block.test.js +5 -5
  5. package/lib/cjs/classes/test/Contract/crv-abi.d.ts +2 -0
  6. package/lib/cjs/classes/test/Contract/crv-abi.js +488 -0
  7. package/lib/{esm/rpc/get-block.test.d.ts → cjs/classes/test/Contract/crv.test.d.ts} +0 -0
  8. package/lib/cjs/classes/test/Contract/crv.test.js +48 -0
  9. package/lib/cjs/classes/test/Contract/fei-abi.d.ts +2 -0
  10. package/lib/cjs/classes/test/Contract/fei-abi.js +526 -0
  11. package/lib/cjs/classes/test/Contract/fei.test.d.ts +1 -0
  12. package/lib/cjs/classes/test/Contract/fei.test.js +62 -0
  13. package/lib/cjs/classes/test/Contract/foo-abi.d.ts +2 -0
  14. package/lib/cjs/classes/test/Contract/foo-abi.js +42 -0
  15. package/lib/cjs/classes/test/Contract/foo.test.d.ts +1 -0
  16. package/lib/cjs/classes/test/Contract/foo.test.js +25 -0
  17. package/lib/cjs/classes/test/Contract/uni.test.d.ts +1 -0
  18. package/lib/cjs/classes/test/Contract/uni.test.js +67 -0
  19. package/lib/cjs/classes/test/Contract/uniswap-abi.d.ts +2 -0
  20. package/lib/cjs/classes/test/Contract/uniswap-abi.js +121 -0
  21. package/lib/cjs/{rpc → classes}/utils/clean-block.d.ts +0 -0
  22. package/lib/cjs/{rpc → classes}/utils/clean-block.js +0 -0
  23. package/lib/cjs/{rpc → classes}/utils/clean-transaction.d.ts +0 -0
  24. package/lib/cjs/{rpc → classes}/utils/clean-transaction.js +0 -0
  25. package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +3 -0
  26. package/lib/cjs/classes/utils/encode-decode-transaction.js +100 -0
  27. package/lib/cjs/classes/utils/fetchers.d.ts +9 -0
  28. package/lib/cjs/{rpc → classes}/utils/fetchers.js +8 -1
  29. package/lib/cjs/{rpc → classes}/utils/hex-to-decimal.d.ts +0 -0
  30. package/lib/cjs/{rpc → classes}/utils/hex-to-decimal.js +0 -0
  31. package/lib/cjs/index.d.ts +10 -6
  32. package/lib/cjs/index.js +12 -9
  33. package/lib/cjs/{rpc/index.d.ts → providers/JsonRpcProvider.d.ts} +5 -1
  34. package/lib/cjs/{rpc/index.js → providers/JsonRpcProvider.js} +14 -7
  35. package/lib/cjs/shared/tiny-big/tiny-big.d.ts +2 -2
  36. package/lib/cjs/types/Contract.types.d.ts +22 -0
  37. package/lib/cjs/types/Contract.types.js +2 -0
  38. package/lib/cjs/{ether-to-wei.d.ts → utils/ether-to-wei.d.ts} +3 -2
  39. package/lib/cjs/{ether-to-wei.js → utils/ether-to-wei.js} +4 -8
  40. package/lib/cjs/{is-address.d.ts → utils/is-address.d.ts} +0 -0
  41. package/lib/cjs/{is-address.js → utils/is-address.js} +3 -3
  42. package/lib/cjs/utils/tests/ether-to-wei.test.d.ts +1 -0
  43. package/lib/cjs/utils/tests/ether-to-wei.test.js +66 -0
  44. package/lib/cjs/utils/tests/is-address.test.d.ts +1 -0
  45. package/lib/cjs/utils/tests/is-address.test.js +56 -0
  46. package/lib/cjs/utils/tests/to-checksum-address.test.d.ts +1 -0
  47. package/lib/cjs/utils/tests/to-checksum-address.test.js +43 -0
  48. package/lib/cjs/utils/tests/wei-to-ether.test.d.ts +1 -0
  49. package/lib/cjs/utils/tests/wei-to-ether.test.js +69 -0
  50. package/lib/cjs/{to-checksum-address.d.ts → utils/to-checksum-address.d.ts} +0 -0
  51. package/lib/cjs/{to-checksum-address.js → utils/to-checksum-address.js} +1 -1
  52. package/lib/cjs/{wei-to-ether.d.ts → utils/wei-to-ether.d.ts} +3 -1
  53. package/lib/cjs/{wei-to-ether.js → utils/wei-to-ether.js} +4 -8
  54. package/lib/esm/classes/Contract.d.ts +12 -0
  55. package/lib/esm/classes/Contract.js +63 -0
  56. package/lib/esm/classes/get-block.test.d.ts +1 -0
  57. package/lib/esm/{rpc → classes}/get-block.test.js +5 -5
  58. package/lib/esm/classes/test/Contract/crv-abi.d.ts +2 -0
  59. package/lib/esm/classes/test/Contract/crv-abi.js +470 -0
  60. package/lib/esm/classes/test/Contract/crv.test.d.ts +1 -0
  61. package/lib/esm/classes/test/Contract/crv.test.js +43 -0
  62. package/lib/esm/classes/test/Contract/fei-abi.d.ts +2 -0
  63. package/lib/esm/classes/test/Contract/fei-abi.js +521 -0
  64. package/lib/esm/classes/test/Contract/fei.test.d.ts +1 -0
  65. package/lib/esm/classes/test/Contract/fei.test.js +46 -0
  66. package/lib/esm/classes/test/Contract/foo-abi.d.ts +2 -0
  67. package/lib/esm/classes/test/Contract/foo-abi.js +33 -0
  68. package/lib/esm/classes/test/Contract/foo.test.d.ts +1 -0
  69. package/lib/esm/classes/test/Contract/foo.test.js +14 -0
  70. package/lib/esm/classes/test/Contract/uni.test.d.ts +1 -0
  71. package/lib/esm/classes/test/Contract/uni.test.js +59 -0
  72. package/lib/esm/classes/test/Contract/uniswap-abi.d.ts +2 -0
  73. package/lib/esm/classes/test/Contract/uniswap-abi.js +116 -0
  74. package/lib/esm/{rpc → classes}/utils/clean-block.d.ts +0 -0
  75. package/lib/esm/{rpc → classes}/utils/clean-block.js +0 -0
  76. package/lib/esm/{rpc → classes}/utils/clean-transaction.d.ts +0 -0
  77. package/lib/esm/{rpc → classes}/utils/clean-transaction.js +0 -0
  78. package/lib/esm/classes/utils/encode-decode-transaction.d.ts +3 -0
  79. package/lib/esm/classes/utils/encode-decode-transaction.js +85 -0
  80. package/lib/esm/classes/utils/fetchers.d.ts +9 -0
  81. package/lib/esm/{rpc → classes}/utils/fetchers.js +8 -1
  82. package/lib/esm/{rpc → classes}/utils/hex-to-decimal.d.ts +0 -0
  83. package/lib/esm/{rpc → classes}/utils/hex-to-decimal.js +0 -0
  84. package/lib/esm/index.d.ts +10 -6
  85. package/lib/esm/index.js +7 -6
  86. package/lib/esm/{rpc/index.d.ts → providers/JsonRpcProvider.d.ts} +2 -1
  87. package/lib/esm/{rpc/index.js → providers/JsonRpcProvider.js} +8 -5
  88. package/lib/esm/shared/tiny-big/tiny-big.d.ts +2 -2
  89. package/lib/esm/types/Contract.types.d.ts +22 -0
  90. package/lib/esm/types/Contract.types.js +1 -0
  91. package/lib/esm/utils/ether-to-wei.d.ts +3 -0
  92. package/lib/esm/utils/ether-to-wei.js +7 -0
  93. package/lib/esm/{is-address.d.ts → utils/is-address.d.ts} +0 -0
  94. package/lib/esm/{is-address.js → utils/is-address.js} +2 -2
  95. package/lib/esm/utils/tests/ether-to-wei.test.d.ts +1 -0
  96. package/lib/esm/utils/tests/ether-to-wei.test.js +36 -0
  97. package/lib/esm/utils/tests/is-address.test.d.ts +1 -0
  98. package/lib/esm/utils/tests/is-address.test.js +49 -0
  99. package/lib/esm/utils/tests/to-checksum-address.test.d.ts +1 -0
  100. package/lib/esm/utils/tests/to-checksum-address.test.js +36 -0
  101. package/lib/esm/utils/tests/wei-to-ether.test.d.ts +1 -0
  102. package/lib/esm/utils/tests/wei-to-ether.test.js +38 -0
  103. package/lib/esm/{to-checksum-address.d.ts → utils/to-checksum-address.d.ts} +0 -0
  104. package/lib/esm/{to-checksum-address.js → utils/to-checksum-address.js} +1 -1
  105. package/lib/esm/utils/wei-to-ether.d.ts +3 -0
  106. package/lib/esm/utils/wei-to-ether.js +7 -0
  107. package/package.json +11 -11
  108. package/readme.md +68 -5
  109. package/lib/cjs/rpc/utils/fetchers.d.ts +0 -7
  110. package/lib/esm/ether-to-wei.d.ts +0 -2
  111. package/lib/esm/ether-to-wei.js +0 -8
  112. package/lib/esm/rpc/utils/fetchers.d.ts +0 -7
  113. package/lib/esm/wei-to-ether.d.ts +0 -1
  114. package/lib/esm/wei-to-ether.js +0 -8
@@ -0,0 +1,521 @@
1
+ export const feiABI = [
2
+ {
3
+ inputs: [
4
+ { internalType: 'address', name: '_core', type: 'address' },
5
+ { internalType: 'address', name: '_bondingcurve', type: 'address' },
6
+ { internalType: 'address', name: '_ido', type: 'address' },
7
+ { internalType: 'address', name: '_oracle', type: 'address' },
8
+ { internalType: 'uint256', name: '_duration', type: 'uint256' },
9
+ {
10
+ internalType: 'uint256',
11
+ name: '_exchangeRateDiscount',
12
+ type: 'uint256',
13
+ },
14
+ ],
15
+ stateMutability: 'nonpayable',
16
+ type: 'constructor',
17
+ },
18
+ {
19
+ anonymous: false,
20
+ inputs: [
21
+ {
22
+ indexed: true,
23
+ internalType: 'address',
24
+ name: 'owner',
25
+ type: 'address',
26
+ },
27
+ {
28
+ indexed: true,
29
+ internalType: 'address',
30
+ name: 'spender',
31
+ type: 'address',
32
+ },
33
+ {
34
+ indexed: false,
35
+ internalType: 'uint256',
36
+ name: 'value',
37
+ type: 'uint256',
38
+ },
39
+ ],
40
+ name: 'Approval',
41
+ type: 'event',
42
+ },
43
+ {
44
+ anonymous: false,
45
+ inputs: [
46
+ {
47
+ indexed: true,
48
+ internalType: 'address',
49
+ name: '_from',
50
+ type: 'address',
51
+ },
52
+ {
53
+ indexed: true,
54
+ internalType: 'address',
55
+ name: '_to',
56
+ type: 'address',
57
+ },
58
+ {
59
+ indexed: false,
60
+ internalType: 'uint256',
61
+ name: '_amount',
62
+ type: 'uint256',
63
+ },
64
+ ],
65
+ name: 'Commit',
66
+ type: 'event',
67
+ },
68
+ {
69
+ anonymous: false,
70
+ inputs: [
71
+ {
72
+ indexed: true,
73
+ internalType: 'address',
74
+ name: '_core',
75
+ type: 'address',
76
+ },
77
+ ],
78
+ name: 'CoreUpdate',
79
+ type: 'event',
80
+ },
81
+ {
82
+ anonymous: false,
83
+ inputs: [
84
+ {
85
+ indexed: false,
86
+ internalType: 'uint256',
87
+ name: '_duration',
88
+ type: 'uint256',
89
+ },
90
+ ],
91
+ name: 'DurationUpdate',
92
+ type: 'event',
93
+ },
94
+ {
95
+ anonymous: false,
96
+ inputs: [
97
+ {
98
+ indexed: false,
99
+ internalType: 'uint256',
100
+ name: '_timestamp',
101
+ type: 'uint256',
102
+ },
103
+ ],
104
+ name: 'Launch',
105
+ type: 'event',
106
+ },
107
+ {
108
+ anonymous: false,
109
+ inputs: [
110
+ {
111
+ indexed: false,
112
+ internalType: 'address',
113
+ name: 'account',
114
+ type: 'address',
115
+ },
116
+ ],
117
+ name: 'Paused',
118
+ type: 'event',
119
+ },
120
+ {
121
+ anonymous: false,
122
+ inputs: [
123
+ {
124
+ indexed: true,
125
+ internalType: 'address',
126
+ name: '_to',
127
+ type: 'address',
128
+ },
129
+ {
130
+ indexed: false,
131
+ internalType: 'uint256',
132
+ name: '_value',
133
+ type: 'uint256',
134
+ },
135
+ ],
136
+ name: 'Purchase',
137
+ type: 'event',
138
+ },
139
+ {
140
+ anonymous: false,
141
+ inputs: [
142
+ {
143
+ indexed: true,
144
+ internalType: 'address',
145
+ name: '_to',
146
+ type: 'address',
147
+ },
148
+ {
149
+ indexed: false,
150
+ internalType: 'uint256',
151
+ name: '_amountIn',
152
+ type: 'uint256',
153
+ },
154
+ {
155
+ indexed: false,
156
+ internalType: 'uint256',
157
+ name: '_amountFei',
158
+ type: 'uint256',
159
+ },
160
+ {
161
+ indexed: false,
162
+ internalType: 'uint256',
163
+ name: '_amountTribe',
164
+ type: 'uint256',
165
+ },
166
+ ],
167
+ name: 'Redeem',
168
+ type: 'event',
169
+ },
170
+ {
171
+ anonymous: false,
172
+ inputs: [
173
+ {
174
+ indexed: false,
175
+ internalType: 'uint256',
176
+ name: '_startTime',
177
+ type: 'uint256',
178
+ },
179
+ ],
180
+ name: 'TimerReset',
181
+ type: 'event',
182
+ },
183
+ {
184
+ anonymous: false,
185
+ inputs: [
186
+ {
187
+ indexed: true,
188
+ internalType: 'address',
189
+ name: 'from',
190
+ type: 'address',
191
+ },
192
+ { indexed: true, internalType: 'address', name: 'to', type: 'address' },
193
+ {
194
+ indexed: false,
195
+ internalType: 'uint256',
196
+ name: 'value',
197
+ type: 'uint256',
198
+ },
199
+ ],
200
+ name: 'Transfer',
201
+ type: 'event',
202
+ },
203
+ {
204
+ anonymous: false,
205
+ inputs: [
206
+ {
207
+ indexed: false,
208
+ internalType: 'address',
209
+ name: 'account',
210
+ type: 'address',
211
+ },
212
+ ],
213
+ name: 'Unpaused',
214
+ type: 'event',
215
+ },
216
+ {
217
+ inputs: [
218
+ { internalType: 'address', name: 'owner', type: 'address' },
219
+ { internalType: 'address', name: 'spender', type: 'address' },
220
+ ],
221
+ name: 'allowance',
222
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
223
+ stateMutability: 'view',
224
+ type: 'function',
225
+ },
226
+ {
227
+ inputs: [
228
+ { internalType: 'address', name: 'spender', type: 'address' },
229
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
230
+ ],
231
+ name: 'approve',
232
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
233
+ stateMutability: 'nonpayable',
234
+ type: 'function',
235
+ },
236
+ {
237
+ inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
238
+ name: 'balanceOf',
239
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
240
+ stateMutability: 'view',
241
+ type: 'function',
242
+ },
243
+ {
244
+ inputs: [
245
+ { internalType: 'address', name: 'from', type: 'address' },
246
+ { internalType: 'address', name: 'to', type: 'address' },
247
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
248
+ ],
249
+ name: 'commit',
250
+ outputs: [],
251
+ stateMutability: 'nonpayable',
252
+ type: 'function',
253
+ },
254
+ {
255
+ inputs: [{ internalType: 'address', name: '', type: 'address' }],
256
+ name: 'committedFGEN',
257
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
258
+ stateMutability: 'view',
259
+ type: 'function',
260
+ },
261
+ {
262
+ inputs: [],
263
+ name: 'core',
264
+ outputs: [{ internalType: 'contract ICore', name: '', type: 'address' }],
265
+ stateMutability: 'view',
266
+ type: 'function',
267
+ },
268
+ {
269
+ inputs: [],
270
+ name: 'decimals',
271
+ outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
272
+ stateMutability: 'view',
273
+ type: 'function',
274
+ },
275
+ {
276
+ inputs: [
277
+ { internalType: 'address', name: 'spender', type: 'address' },
278
+ { internalType: 'uint256', name: 'subtractedValue', type: 'uint256' },
279
+ ],
280
+ name: 'decreaseAllowance',
281
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
282
+ stateMutability: 'nonpayable',
283
+ type: 'function',
284
+ },
285
+ {
286
+ inputs: [],
287
+ name: 'duration',
288
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
289
+ stateMutability: 'view',
290
+ type: 'function',
291
+ },
292
+ {
293
+ inputs: [
294
+ { internalType: 'address', name: 'from', type: 'address' },
295
+ { internalType: 'address payable', name: 'to', type: 'address' },
296
+ ],
297
+ name: 'emergencyExit',
298
+ outputs: [],
299
+ stateMutability: 'nonpayable',
300
+ type: 'function',
301
+ },
302
+ {
303
+ inputs: [],
304
+ name: 'fei',
305
+ outputs: [{ internalType: 'contract IFei', name: '', type: 'address' }],
306
+ stateMutability: 'view',
307
+ type: 'function',
308
+ },
309
+ {
310
+ inputs: [],
311
+ name: 'feiBalance',
312
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
313
+ stateMutability: 'view',
314
+ type: 'function',
315
+ },
316
+ {
317
+ inputs: [
318
+ { internalType: 'uint256', name: 'amountIn', type: 'uint256' },
319
+ { internalType: 'bool', name: 'inclusive', type: 'bool' },
320
+ ],
321
+ name: 'getAmountOut',
322
+ outputs: [
323
+ { internalType: 'uint256', name: 'feiAmount', type: 'uint256' },
324
+ { internalType: 'uint256', name: 'tribeAmount', type: 'uint256' },
325
+ ],
326
+ stateMutability: 'view',
327
+ type: 'function',
328
+ },
329
+ {
330
+ inputs: [{ internalType: 'address', name: 'to', type: 'address' }],
331
+ name: 'getAmountsToRedeem',
332
+ outputs: [
333
+ { internalType: 'uint256', name: 'feiAmount', type: 'uint256' },
334
+ { internalType: 'uint256', name: 'genesisTribe', type: 'uint256' },
335
+ { internalType: 'uint256', name: 'idoTribe', type: 'uint256' },
336
+ ],
337
+ stateMutability: 'view',
338
+ type: 'function',
339
+ },
340
+ {
341
+ inputs: [
342
+ { internalType: 'address', name: 'spender', type: 'address' },
343
+ { internalType: 'uint256', name: 'addedValue', type: 'uint256' },
344
+ ],
345
+ name: 'increaseAllowance',
346
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
347
+ stateMutability: 'nonpayable',
348
+ type: 'function',
349
+ },
350
+ {
351
+ inputs: [],
352
+ name: 'initGenesis',
353
+ outputs: [],
354
+ stateMutability: 'nonpayable',
355
+ type: 'function',
356
+ },
357
+ {
358
+ inputs: [],
359
+ name: 'isTimeEnded',
360
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
361
+ stateMutability: 'view',
362
+ type: 'function',
363
+ },
364
+ {
365
+ inputs: [],
366
+ name: 'isTimeStarted',
367
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
368
+ stateMutability: 'view',
369
+ type: 'function',
370
+ },
371
+ {
372
+ inputs: [],
373
+ name: 'launch',
374
+ outputs: [],
375
+ stateMutability: 'nonpayable',
376
+ type: 'function',
377
+ },
378
+ {
379
+ inputs: [],
380
+ name: 'launchBlock',
381
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
382
+ stateMutability: 'view',
383
+ type: 'function',
384
+ },
385
+ {
386
+ inputs: [],
387
+ name: 'name',
388
+ outputs: [{ internalType: 'string', name: '', type: 'string' }],
389
+ stateMutability: 'view',
390
+ type: 'function',
391
+ },
392
+ {
393
+ inputs: [],
394
+ name: 'pause',
395
+ outputs: [],
396
+ stateMutability: 'nonpayable',
397
+ type: 'function',
398
+ },
399
+ {
400
+ inputs: [],
401
+ name: 'paused',
402
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
403
+ stateMutability: 'view',
404
+ type: 'function',
405
+ },
406
+ {
407
+ inputs: [
408
+ { internalType: 'address', name: 'to', type: 'address' },
409
+ { internalType: 'uint256', name: 'value', type: 'uint256' },
410
+ ],
411
+ name: 'purchase',
412
+ outputs: [],
413
+ stateMutability: 'payable',
414
+ type: 'function',
415
+ },
416
+ {
417
+ inputs: [{ internalType: 'address', name: 'to', type: 'address' }],
418
+ name: 'redeem',
419
+ outputs: [],
420
+ stateMutability: 'nonpayable',
421
+ type: 'function',
422
+ },
423
+ {
424
+ inputs: [],
425
+ name: 'remainingTime',
426
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
427
+ stateMutability: 'view',
428
+ type: 'function',
429
+ },
430
+ {
431
+ inputs: [{ internalType: 'address', name: 'core', type: 'address' }],
432
+ name: 'setCore',
433
+ outputs: [],
434
+ stateMutability: 'nonpayable',
435
+ type: 'function',
436
+ },
437
+ {
438
+ inputs: [],
439
+ name: 'startTime',
440
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
441
+ stateMutability: 'view',
442
+ type: 'function',
443
+ },
444
+ {
445
+ inputs: [],
446
+ name: 'symbol',
447
+ outputs: [{ internalType: 'string', name: '', type: 'string' }],
448
+ stateMutability: 'view',
449
+ type: 'function',
450
+ },
451
+ {
452
+ inputs: [],
453
+ name: 'timeSinceStart',
454
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
455
+ stateMutability: 'view',
456
+ type: 'function',
457
+ },
458
+ {
459
+ inputs: [],
460
+ name: 'totalCommittedFGEN',
461
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
462
+ stateMutability: 'view',
463
+ type: 'function',
464
+ },
465
+ {
466
+ inputs: [],
467
+ name: 'totalCommittedTribe',
468
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
469
+ stateMutability: 'view',
470
+ type: 'function',
471
+ },
472
+ {
473
+ inputs: [],
474
+ name: 'totalSupply',
475
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
476
+ stateMutability: 'view',
477
+ type: 'function',
478
+ },
479
+ {
480
+ inputs: [
481
+ { internalType: 'address', name: 'recipient', type: 'address' },
482
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
483
+ ],
484
+ name: 'transfer',
485
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
486
+ stateMutability: 'nonpayable',
487
+ type: 'function',
488
+ },
489
+ {
490
+ inputs: [
491
+ { internalType: 'address', name: 'sender', type: 'address' },
492
+ { internalType: 'address', name: 'recipient', type: 'address' },
493
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
494
+ ],
495
+ name: 'transferFrom',
496
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
497
+ stateMutability: 'nonpayable',
498
+ type: 'function',
499
+ },
500
+ {
501
+ inputs: [],
502
+ name: 'tribe',
503
+ outputs: [{ internalType: 'contract IERC20', name: '', type: 'address' }],
504
+ stateMutability: 'view',
505
+ type: 'function',
506
+ },
507
+ {
508
+ inputs: [],
509
+ name: 'tribeBalance',
510
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
511
+ stateMutability: 'view',
512
+ type: 'function',
513
+ },
514
+ {
515
+ inputs: [],
516
+ name: 'unpause',
517
+ outputs: [],
518
+ stateMutability: 'nonpayable',
519
+ type: 'function',
520
+ },
521
+ ];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Contract as EthersContract } from '@ethersproject/contracts';
11
+ import { getDefaultProvider } from 'ethers';
12
+ import { JsonRpcProvider } from '../../../providers/JsonRpcProvider';
13
+ import { Contract as EssentialEthContract } from '../../Contract';
14
+ import { feiABI } from './fei-abi';
15
+ const JSONABI = feiABI;
16
+ const rpcURL = 'https://free-eth-node.com/api/eth';
17
+ const ethersProvider = getDefaultProvider(rpcURL);
18
+ const essentialEthProvider = new JsonRpcProvider(rpcURL);
19
+ const contractAddress = '0xBFfB152b9392e38CdDc275D818a3Db7FE364596b';
20
+ const smartContractGetFeiAmountsToRedeem = (contract, address) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const merkleRoot = (yield contract.getAmountsToRedeem(address));
22
+ return merkleRoot;
23
+ });
24
+ const ethersContract = new EthersContract(contractAddress, JSONABI, ethersProvider);
25
+ const essentialEthContract = new EssentialEthContract(contractAddress, JSONABI, essentialEthProvider);
26
+ describe('FEI contract', () => {
27
+ it('should fetch unclaimed amounts "[uint256, uint256, uint256]" data-type', () => __awaiter(void 0, void 0, void 0, function* () {
28
+ const [ethersResponse, essentialEthResponse] = yield Promise.all([
29
+ smartContractGetFeiAmountsToRedeem(ethersContract, '0xf5dBA31743ea341057280bb3AdD5c2Fb505BDC4C'),
30
+ smartContractGetFeiAmountsToRedeem(essentialEthContract, '0xf5dBA31743ea341057280bb3AdD5c2Fb505BDC4C'),
31
+ ]);
32
+ expect(ethersResponse[0].toString()).toStrictEqual(essentialEthResponse[0].toString());
33
+ expect(ethersResponse[1].toString()).toStrictEqual(essentialEthResponse[1].toString());
34
+ expect(ethersResponse[2].toString()).toStrictEqual(essentialEthResponse[2].toString());
35
+ expect(essentialEthResponse[0].toNumber()).toStrictEqual(611330334598773765981);
36
+ expect(essentialEthResponse[1].toNumber()).toStrictEqual(46931053833712274879);
37
+ expect(essentialEthResponse[2].toNumber()).toStrictEqual(0);
38
+ }));
39
+ it('should fetch "uint8" data-type', () => __awaiter(void 0, void 0, void 0, function* () {
40
+ const [ethersResponse, essentialEthResponse] = yield Promise.all([
41
+ ethersContract.decimals(),
42
+ essentialEthContract.decimals(),
43
+ ]);
44
+ expect(ethersResponse).toStrictEqual(essentialEthResponse);
45
+ }));
46
+ });
@@ -0,0 +1,2 @@
1
+ import { JSONABI } from '../../..';
2
+ export declare const fooABI: JSONABI;
@@ -0,0 +1,33 @@
1
+ export const fooABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: 'bytes3[2]',
6
+ name: 'memory',
7
+ type: 'bytes3[2]',
8
+ },
9
+ ],
10
+ name: 'bar',
11
+ outputs: [],
12
+ type: 'function',
13
+ },
14
+ {
15
+ inputs: [
16
+ { internalType: 'uint32', name: 'x', type: 'uint32' },
17
+ { internalType: 'bool', name: 'y', type: 'bool' },
18
+ ],
19
+ name: 'baz',
20
+ outputs: [{ internalType: 'bool', name: 'r', type: 'bool' }],
21
+ type: 'function',
22
+ },
23
+ {
24
+ inputs: [
25
+ { internalType: 'bytes', name: 'memory', type: 'bytes' },
26
+ { internalType: 'bool', name: '', type: 'bool' },
27
+ { internalType: 'uint[]', name: 'memory', type: 'uint[]' },
28
+ ],
29
+ name: 'sam',
30
+ outputs: [],
31
+ type: 'function',
32
+ },
33
+ ];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { encodeData } from '../../utils/encode-decode-transaction';
2
+ import { fooABI } from './foo-abi';
3
+ describe('foo encode', () => {
4
+ it('encodes "baz" function', () => {
5
+ const jsonABIArgument = fooABI.find((abi) => abi.name === 'baz');
6
+ const encoded = encodeData(jsonABIArgument, [69, true]);
7
+ expect(encoded).toBe('0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001');
8
+ });
9
+ it('encodes "bar" function', () => {
10
+ const jsonABIArgument = fooABI.find((abi) => abi.name === 'bar');
11
+ const encoded = encodeData(jsonABIArgument, ['abc', 'def']);
12
+ expect(encoded).toBe('0xfce353f661626300000000000000000000000000000000000000000000000000000000006465660000000000000000000000000000000000000000000000000000000000');
13
+ });
14
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Contract as EthersContract } from '@ethersproject/contracts';
11
+ import { getDefaultProvider } from 'ethers';
12
+ import { JsonRpcProvider } from '../../../providers/JsonRpcProvider';
13
+ import { Contract as EssentialEthContract } from '../../Contract';
14
+ import { uniswapABI } from './uniswap-abi';
15
+ const JSONABI = uniswapABI;
16
+ const rpcURL = 'https://free-eth-node.com/api/eth';
17
+ const ethersProvider = getDefaultProvider(rpcURL);
18
+ const essentialEthProvider = new JsonRpcProvider(rpcURL);
19
+ const contractAddress = '0x090D4613473dEE047c3f2706764f49E0821D256e';
20
+ const smartContractIsUniClaimed = (contract, index) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const isClaimed = (yield contract.isClaimed(index));
22
+ return isClaimed;
23
+ });
24
+ const smartContractGetUniMerkleRoot = (contract) => __awaiter(void 0, void 0, void 0, function* () {
25
+ const merkleRoot = (yield contract.merkleRoot());
26
+ return merkleRoot;
27
+ });
28
+ const smartContractGetUniTokenAddress = (contract) => __awaiter(void 0, void 0, void 0, function* () {
29
+ const merkleRoot = (yield contract.token());
30
+ return merkleRoot;
31
+ });
32
+ const ethersContract = new EthersContract(contractAddress, JSONABI, ethersProvider);
33
+ const essentialEthContract = new EssentialEthContract(contractAddress, JSONABI, essentialEthProvider);
34
+ describe('UNI contract', () => {
35
+ it('should fetch "address" data-type', () => __awaiter(void 0, void 0, void 0, function* () {
36
+ const [ethersResponse, essentialEthResponse] = yield Promise.all([
37
+ smartContractGetUniTokenAddress(ethersContract),
38
+ smartContractGetUniTokenAddress(essentialEthContract),
39
+ ]);
40
+ expect(ethersResponse).toStrictEqual(essentialEthResponse);
41
+ }));
42
+ it('should fetch "bytes32" merkle root', () => __awaiter(void 0, void 0, void 0, function* () {
43
+ const [ethersResponse, essentialEthResponse] = yield Promise.all([
44
+ smartContractGetUniMerkleRoot(ethersContract),
45
+ smartContractGetUniMerkleRoot(essentialEthContract),
46
+ ]);
47
+ expect(ethersResponse).toStrictEqual(essentialEthResponse);
48
+ }));
49
+ it('should fetch isClaimed "boolean" for random airdrop indexes', () => __awaiter(void 0, void 0, void 0, function* () {
50
+ const randomIndexes = [0, 4, 102, 999, 999999];
51
+ for (const i of randomIndexes) {
52
+ const [ethersClaimed, essentialEthClaimed] = yield Promise.all([
53
+ smartContractIsUniClaimed(ethersContract, i),
54
+ smartContractIsUniClaimed(essentialEthContract, i),
55
+ ]);
56
+ expect(ethersClaimed).toStrictEqual(essentialEthClaimed);
57
+ }
58
+ }));
59
+ });
@@ -0,0 +1,2 @@
1
+ import { JSONABI } from '../../../types/Contract.types';
2
+ export declare const uniswapABI: JSONABI;