@gearbox-protocol/sdk 1.6.5 → 1.7.0

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 (31) hide show
  1. package/lib/types/contracts/interfaces/ICreditFacade.sol/ICreditFacade.d.ts +13 -5
  2. package/lib/types/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents.d.ts +4 -4
  3. package/lib/types/contracts/pathfinder/interfaces/IClosePathResolver.d.ts +1 -4
  4. package/lib/types/contracts/pathfinder/interfaces/IDepositor.sol/IDepositor.d.ts +3 -6
  5. package/lib/types/contracts/pathfinder/interfaces/IDepositor.sol/IDepositorOptions.d.ts +4 -7
  6. package/lib/types/contracts/pathfinder/interfaces/ILPWorker.sol/ILPWorker.d.ts +1 -4
  7. package/lib/types/contracts/pathfinder/interfaces/ILPWorker.sol/ILPWorkerOptions.d.ts +1 -4
  8. package/lib/types/contracts/pathfinder/interfaces/IPathResolver.d.ts +2 -5
  9. package/lib/types/contracts/pathfinder/interfaces/ISwapAggregator.d.ts +5 -8
  10. package/lib/types/contracts/pathfinder/interfaces/IWithdrawer.sol/IWithdrawer.d.ts +4 -7
  11. package/lib/types/contracts/pathfinder/interfaces/IWithdrawer.sol/IWithdrawerOptions.d.ts +4 -7
  12. package/lib/types/factories/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents__factory.js +4 -4
  13. package/lib/types/factories/contracts/interfaces/ICreditFacade.sol/ICreditFacade__factory.js +17 -4
  14. package/lib/types/factories/contracts/pathfinder/interfaces/IClosePathResolver__factory.js +0 -10
  15. package/lib/types/factories/contracts/pathfinder/interfaces/IDepositor.sol/IDepositorOptions__factory.js +0 -40
  16. package/lib/types/factories/contracts/pathfinder/interfaces/IDepositor.sol/IDepositor__factory.js +0 -30
  17. package/lib/types/factories/contracts/pathfinder/interfaces/ILPWorker.sol/ILPWorkerOptions__factory.js +0 -10
  18. package/lib/types/factories/contracts/pathfinder/interfaces/ILPWorker.sol/ILPWorker__factory.js +0 -10
  19. package/lib/types/factories/contracts/pathfinder/interfaces/IPathResolver__factory.js +0 -20
  20. package/lib/types/factories/contracts/pathfinder/interfaces/ISwapAggregator__factory.js +0 -50
  21. package/lib/types/factories/contracts/pathfinder/interfaces/IWithdrawer.sol/IWithdrawerOptions__factory.js +0 -40
  22. package/lib/types/factories/contracts/pathfinder/interfaces/IWithdrawer.sol/IWithdrawer__factory.js +0 -40
  23. package/lib/watchers/creditAccountWatcher.d.ts +30 -0
  24. package/lib/watchers/creditAccountWatcher.js +255 -0
  25. package/lib/watchers/creditAccountWatcher.spec.d.ts +1 -0
  26. package/lib/watchers/creditAccountWatcher.spec.js +177 -0
  27. package/lib/watchers/creditManagerWatcher.d.ts +8 -0
  28. package/lib/watchers/creditManagerWatcher.js +86 -0
  29. package/lib/watchers/creditManagerWatcher.spec.d.ts +1 -0
  30. package/lib/watchers/creditManagerWatcher.spec.js +110 -0
  31. package/package.json +1 -1
@@ -104,11 +104,6 @@ var _abi = [
104
104
  name: "gasUsage",
105
105
  type: "uint256",
106
106
  },
107
- {
108
- internalType: "uint256",
109
- name: "slippageMultiplier",
110
- type: "uint256",
111
- },
112
107
  {
113
108
  internalType: "uint256",
114
109
  name: "initTargetBalance",
@@ -230,11 +225,6 @@ var _abi = [
230
225
  name: "gasUsage",
231
226
  type: "uint256",
232
227
  },
233
- {
234
- internalType: "uint256",
235
- name: "slippageMultiplier",
236
- type: "uint256",
237
- },
238
228
  {
239
229
  internalType: "uint256",
240
230
  name: "initTargetBalance",
@@ -359,11 +349,6 @@ var _abi = [
359
349
  name: "gasUsage",
360
350
  type: "uint256",
361
351
  },
362
- {
363
- internalType: "uint256",
364
- name: "slippageMultiplier",
365
- type: "uint256",
366
- },
367
352
  {
368
353
  internalType: "uint256",
369
354
  name: "initTargetBalance",
@@ -485,11 +470,6 @@ var _abi = [
485
470
  name: "gasUsage",
486
471
  type: "uint256",
487
472
  },
488
- {
489
- internalType: "uint256",
490
- name: "slippageMultiplier",
491
- type: "uint256",
492
- },
493
473
  {
494
474
  internalType: "uint256",
495
475
  name: "initTargetBalance",
@@ -627,11 +607,6 @@ var _abi = [
627
607
  name: "gasUsage",
628
608
  type: "uint256",
629
609
  },
630
- {
631
- internalType: "uint256",
632
- name: "slippageMultiplier",
633
- type: "uint256",
634
- },
635
610
  {
636
611
  internalType: "uint256",
637
612
  name: "initTargetBalance",
@@ -753,11 +728,6 @@ var _abi = [
753
728
  name: "gasUsage",
754
729
  type: "uint256",
755
730
  },
756
- {
757
- internalType: "uint256",
758
- name: "slippageMultiplier",
759
- type: "uint256",
760
- },
761
731
  {
762
732
  internalType: "uint256",
763
733
  name: "initTargetBalance",
@@ -117,11 +117,6 @@ var _abi = [
117
117
  name: "gasUsage",
118
118
  type: "uint256",
119
119
  },
120
- {
121
- internalType: "uint256",
122
- name: "slippageMultiplier",
123
- type: "uint256",
124
- },
125
120
  {
126
121
  internalType: "uint256",
127
122
  name: "initTargetBalance",
@@ -243,11 +238,6 @@ var _abi = [
243
238
  name: "gasUsage",
244
239
  type: "uint256",
245
240
  },
246
- {
247
- internalType: "uint256",
248
- name: "slippageMultiplier",
249
- type: "uint256",
250
- },
251
241
  {
252
242
  internalType: "uint256",
253
243
  name: "initTargetBalance",
@@ -112,11 +112,6 @@ var _abi = [
112
112
  name: "gasUsage",
113
113
  type: "uint256",
114
114
  },
115
- {
116
- internalType: "uint256",
117
- name: "slippageMultiplier",
118
- type: "uint256",
119
- },
120
115
  {
121
116
  internalType: "uint256",
122
117
  name: "initTargetBalance",
@@ -238,11 +233,6 @@ var _abi = [
238
233
  name: "gasUsage",
239
234
  type: "uint256",
240
235
  },
241
- {
242
- internalType: "uint256",
243
- name: "slippageMultiplier",
244
- type: "uint256",
245
- },
246
236
  {
247
237
  internalType: "uint256",
248
238
  name: "initTargetBalance",
@@ -109,11 +109,6 @@ var _abi = [
109
109
  name: "gasUsage",
110
110
  type: "uint256",
111
111
  },
112
- {
113
- internalType: "uint256",
114
- name: "slippageMultiplier",
115
- type: "uint256",
116
- },
117
112
  {
118
113
  internalType: "uint256",
119
114
  name: "initTargetBalance",
@@ -230,11 +225,6 @@ var _abi = [
230
225
  name: "gasUsage",
231
226
  type: "uint256",
232
227
  },
233
- {
234
- internalType: "uint256",
235
- name: "slippageMultiplier",
236
- type: "uint256",
237
- },
238
228
  {
239
229
  internalType: "uint256",
240
230
  name: "initTargetBalance",
@@ -354,11 +344,6 @@ var _abi = [
354
344
  name: "gasUsage",
355
345
  type: "uint256",
356
346
  },
357
- {
358
- internalType: "uint256",
359
- name: "slippageMultiplier",
360
- type: "uint256",
361
- },
362
347
  {
363
348
  internalType: "uint256",
364
349
  name: "initTargetBalance",
@@ -475,11 +460,6 @@ var _abi = [
475
460
  name: "gasUsage",
476
461
  type: "uint256",
477
462
  },
478
- {
479
- internalType: "uint256",
480
- name: "slippageMultiplier",
481
- type: "uint256",
482
- },
483
463
  {
484
464
  internalType: "uint256",
485
465
  name: "initTargetBalance",
@@ -204,11 +204,6 @@ var _abi = [
204
204
  name: "gasUsage",
205
205
  type: "uint256",
206
206
  },
207
- {
208
- internalType: "uint256",
209
- name: "slippageMultiplier",
210
- type: "uint256",
211
- },
212
207
  {
213
208
  internalType: "uint256",
214
209
  name: "initTargetBalance",
@@ -330,11 +325,6 @@ var _abi = [
330
325
  name: "gasUsage",
331
326
  type: "uint256",
332
327
  },
333
- {
334
- internalType: "uint256",
335
- name: "slippageMultiplier",
336
- type: "uint256",
337
- },
338
328
  {
339
329
  internalType: "uint256",
340
330
  name: "initTargetBalance",
@@ -464,11 +454,6 @@ var _abi = [
464
454
  name: "gasUsage",
465
455
  type: "uint256",
466
456
  },
467
- {
468
- internalType: "uint256",
469
- name: "slippageMultiplier",
470
- type: "uint256",
471
- },
472
457
  {
473
458
  internalType: "uint256",
474
459
  name: "initTargetBalance",
@@ -590,11 +575,6 @@ var _abi = [
590
575
  name: "gasUsage",
591
576
  type: "uint256",
592
577
  },
593
- {
594
- internalType: "uint256",
595
- name: "slippageMultiplier",
596
- type: "uint256",
597
- },
598
578
  {
599
579
  internalType: "uint256",
600
580
  name: "initTargetBalance",
@@ -729,11 +709,6 @@ var _abi = [
729
709
  name: "gasUsage",
730
710
  type: "uint256",
731
711
  },
732
- {
733
- internalType: "uint256",
734
- name: "slippageMultiplier",
735
- type: "uint256",
736
- },
737
712
  {
738
713
  internalType: "uint256",
739
714
  name: "initTargetBalance",
@@ -855,11 +830,6 @@ var _abi = [
855
830
  name: "gasUsage",
856
831
  type: "uint256",
857
832
  },
858
- {
859
- internalType: "uint256",
860
- name: "slippageMultiplier",
861
- type: "uint256",
862
- },
863
833
  {
864
834
  internalType: "uint256",
865
835
  name: "initTargetBalance",
@@ -994,11 +964,6 @@ var _abi = [
994
964
  name: "gasUsage",
995
965
  type: "uint256",
996
966
  },
997
- {
998
- internalType: "uint256",
999
- name: "slippageMultiplier",
1000
- type: "uint256",
1001
- },
1002
967
  {
1003
968
  internalType: "uint256",
1004
969
  name: "initTargetBalance",
@@ -1120,11 +1085,6 @@ var _abi = [
1120
1085
  name: "gasUsage",
1121
1086
  type: "uint256",
1122
1087
  },
1123
- {
1124
- internalType: "uint256",
1125
- name: "slippageMultiplier",
1126
- type: "uint256",
1127
- },
1128
1088
  {
1129
1089
  internalType: "uint256",
1130
1090
  name: "initTargetBalance",
@@ -1462,11 +1422,6 @@ var _abi = [
1462
1422
  name: "gasUsage",
1463
1423
  type: "uint256",
1464
1424
  },
1465
- {
1466
- internalType: "uint256",
1467
- name: "slippageMultiplier",
1468
- type: "uint256",
1469
- },
1470
1425
  {
1471
1426
  internalType: "uint256",
1472
1427
  name: "initTargetBalance",
@@ -1588,11 +1543,6 @@ var _abi = [
1588
1543
  name: "gasUsage",
1589
1544
  type: "uint256",
1590
1545
  },
1591
- {
1592
- internalType: "uint256",
1593
- name: "slippageMultiplier",
1594
- type: "uint256",
1595
- },
1596
1546
  {
1597
1547
  internalType: "uint256",
1598
1548
  name: "initTargetBalance",
@@ -117,11 +117,6 @@ var _abi = [
117
117
  name: "gasUsage",
118
118
  type: "uint256",
119
119
  },
120
- {
121
- internalType: "uint256",
122
- name: "slippageMultiplier",
123
- type: "uint256",
124
- },
125
120
  {
126
121
  internalType: "uint256",
127
122
  name: "initTargetBalance",
@@ -243,11 +238,6 @@ var _abi = [
243
238
  name: "gasUsage",
244
239
  type: "uint256",
245
240
  },
246
- {
247
- internalType: "uint256",
248
- name: "slippageMultiplier",
249
- type: "uint256",
250
- },
251
241
  {
252
242
  internalType: "uint256",
253
243
  name: "initTargetBalance",
@@ -400,11 +390,6 @@ var _abi = [
400
390
  name: "gasUsage",
401
391
  type: "uint256",
402
392
  },
403
- {
404
- internalType: "uint256",
405
- name: "slippageMultiplier",
406
- type: "uint256",
407
- },
408
393
  {
409
394
  internalType: "uint256",
410
395
  name: "initTargetBalance",
@@ -526,11 +511,6 @@ var _abi = [
526
511
  name: "gasUsage",
527
512
  type: "uint256",
528
513
  },
529
- {
530
- internalType: "uint256",
531
- name: "slippageMultiplier",
532
- type: "uint256",
533
- },
534
514
  {
535
515
  internalType: "uint256",
536
516
  name: "initTargetBalance",
@@ -665,11 +645,6 @@ var _abi = [
665
645
  name: "gasUsage",
666
646
  type: "uint256",
667
647
  },
668
- {
669
- internalType: "uint256",
670
- name: "slippageMultiplier",
671
- type: "uint256",
672
- },
673
648
  {
674
649
  internalType: "uint256",
675
650
  name: "initTargetBalance",
@@ -791,11 +766,6 @@ var _abi = [
791
766
  name: "gasUsage",
792
767
  type: "uint256",
793
768
  },
794
- {
795
- internalType: "uint256",
796
- name: "slippageMultiplier",
797
- type: "uint256",
798
- },
799
769
  {
800
770
  internalType: "uint256",
801
771
  name: "initTargetBalance",
@@ -915,11 +885,6 @@ var _abi = [
915
885
  name: "gasUsage",
916
886
  type: "uint256",
917
887
  },
918
- {
919
- internalType: "uint256",
920
- name: "slippageMultiplier",
921
- type: "uint256",
922
- },
923
888
  {
924
889
  internalType: "uint256",
925
890
  name: "initTargetBalance",
@@ -1058,11 +1023,6 @@ var _abi = [
1058
1023
  name: "gasUsage",
1059
1024
  type: "uint256",
1060
1025
  },
1061
- {
1062
- internalType: "uint256",
1063
- name: "slippageMultiplier",
1064
- type: "uint256",
1065
- },
1066
1026
  {
1067
1027
  internalType: "uint256",
1068
1028
  name: "initTargetBalance",
@@ -112,11 +112,6 @@ var _abi = [
112
112
  name: "gasUsage",
113
113
  type: "uint256",
114
114
  },
115
- {
116
- internalType: "uint256",
117
- name: "slippageMultiplier",
118
- type: "uint256",
119
- },
120
115
  {
121
116
  internalType: "uint256",
122
117
  name: "initTargetBalance",
@@ -238,11 +233,6 @@ var _abi = [
238
233
  name: "gasUsage",
239
234
  type: "uint256",
240
235
  },
241
- {
242
- internalType: "uint256",
243
- name: "slippageMultiplier",
244
- type: "uint256",
245
- },
246
236
  {
247
237
  internalType: "uint256",
248
238
  name: "initTargetBalance",
@@ -385,11 +375,6 @@ var _abi = [
385
375
  name: "gasUsage",
386
376
  type: "uint256",
387
377
  },
388
- {
389
- internalType: "uint256",
390
- name: "slippageMultiplier",
391
- type: "uint256",
392
- },
393
378
  {
394
379
  internalType: "uint256",
395
380
  name: "initTargetBalance",
@@ -511,11 +496,6 @@ var _abi = [
511
496
  name: "gasUsage",
512
497
  type: "uint256",
513
498
  },
514
- {
515
- internalType: "uint256",
516
- name: "slippageMultiplier",
517
- type: "uint256",
518
- },
519
499
  {
520
500
  internalType: "uint256",
521
501
  name: "initTargetBalance",
@@ -640,11 +620,6 @@ var _abi = [
640
620
  name: "gasUsage",
641
621
  type: "uint256",
642
622
  },
643
- {
644
- internalType: "uint256",
645
- name: "slippageMultiplier",
646
- type: "uint256",
647
- },
648
623
  {
649
624
  internalType: "uint256",
650
625
  name: "initTargetBalance",
@@ -766,11 +741,6 @@ var _abi = [
766
741
  name: "gasUsage",
767
742
  type: "uint256",
768
743
  },
769
- {
770
- internalType: "uint256",
771
- name: "slippageMultiplier",
772
- type: "uint256",
773
- },
774
744
  {
775
745
  internalType: "uint256",
776
746
  name: "initTargetBalance",
@@ -890,11 +860,6 @@ var _abi = [
890
860
  name: "gasUsage",
891
861
  type: "uint256",
892
862
  },
893
- {
894
- internalType: "uint256",
895
- name: "slippageMultiplier",
896
- type: "uint256",
897
- },
898
863
  {
899
864
  internalType: "uint256",
900
865
  name: "initTargetBalance",
@@ -1011,11 +976,6 @@ var _abi = [
1011
976
  name: "gasUsage",
1012
977
  type: "uint256",
1013
978
  },
1014
- {
1015
- internalType: "uint256",
1016
- name: "slippageMultiplier",
1017
- type: "uint256",
1018
- },
1019
979
  {
1020
980
  internalType: "uint256",
1021
981
  name: "initTargetBalance",
@@ -0,0 +1,30 @@
1
+ import { providers, Signer } from "ethers";
2
+ import { CreditAccountData } from "../core/creditAccount";
3
+ import { CreditManagerData } from "../core/creditManager";
4
+ export declare type CreditAccountHash = string;
5
+ export interface CreditManagerUpdate {
6
+ updated: Array<CreditAccountHash>;
7
+ deleted: Array<CreditAccountHash>;
8
+ }
9
+ export declare class CreditAccountWatcher {
10
+ static IERC20: import("../types/@openzeppelin/contracts/token/ERC20/IERC20").IERC20Interface;
11
+ static creditManagerInterface: import("../types/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2").ICreditManagerV2Interface;
12
+ static creditFacadeInterface: import("../types/contracts/interfaces/ICreditFacade.sol/ICreditFacade").ICreditFacadeInterface;
13
+ /**
14
+ * Gets hashes of all opened credit accounts at toBlock (or "latest" by default)
15
+ * @param creditManager CreditManagerData of desired CreditManager to check
16
+ * @param provider Ethers provider or signer to get an access
17
+ * @param toBlock Optional. Set the last block you;d like to get opened accounts
18
+ * @returns Arrays of hashes for opened accounts
19
+ */
20
+ static getOpenAccounts(creditManager: CreditManagerData, provider: providers.Provider | Signer, toBlock?: number): Promise<Array<CreditAccountHash>>;
21
+ static batchCreditAccountLoad(accs: Array<CreditAccountHash>, dataCompressor: string, signer: Signer | providers.Provider, atBlock?: number): Promise<Array<CreditAccountData>>;
22
+ /**
23
+ * Tracks block logs and detects whichj acccounts were changed (created / modified) and which were deleted
24
+ * @param logs Logs from last N blocks
25
+ * @param creditManagers Array of CreditManager data which account it should track
26
+ * @returns CreditManagerUpdate which contains updated (created / modified) and deleted accounts
27
+ */
28
+ static detectChanges(logs: Array<providers.Log>, creditManagers: Array<CreditManagerData>): CreditManagerUpdate;
29
+ static trackDirectTransfers(freshLogs: Array<providers.Log>, tokensToTrack: Array<string>, accounts: Array<CreditAccountData>): Array<CreditAccountHash>;
30
+ }