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