@merkl/api 0.10.361 → 0.10.377

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 (91) hide show
  1. package/README.md +78 -14
  2. package/dist/database/api/.generated/edge.js +21 -6
  3. package/dist/database/api/.generated/index-browser.js +18 -3
  4. package/dist/database/api/.generated/index.d.ts +1746 -256
  5. package/dist/database/api/.generated/index.js +21 -6
  6. package/dist/database/api/.generated/package.json +1 -1
  7. package/dist/database/api/.generated/schema.prisma +12 -2
  8. package/dist/database/api/.generated/wasm.js +18 -3
  9. package/dist/src/eden/index.d.ts +1260 -127
  10. package/dist/src/entities/campaign.js +2 -1
  11. package/dist/src/entities/opportunity.js +169 -3
  12. package/dist/src/index.d.ts +432 -5
  13. package/dist/src/jobs/etl/pendings.js +2 -1
  14. package/dist/src/jobs/etl/reward-breakdowns.js +2 -1
  15. package/dist/src/jobs/etl/rewards.js +2 -1
  16. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +45 -54
  17. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
  18. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
  19. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ERC4626Processor.d.ts +34 -0
  20. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ERC4626Processor.js +36 -0
  21. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +3 -0
  22. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +4 -1
  23. package/dist/src/libs/campaigns/campaignTypes/HyperdriveDynamicData.d.ts +5 -0
  24. package/dist/src/libs/campaigns/campaignTypes/HyperdriveDynamicData.js +76 -0
  25. package/dist/src/libs/campaigns/campaignsDynamicData.js +8 -0
  26. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +2 -0
  27. package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
  28. package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
  29. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +63 -1
  30. package/dist/src/modules/v4/campaign/campaign.repository.js +15 -10
  31. package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +8 -5
  32. package/dist/src/modules/v4/computedValue/computedValue.controller.js +8 -6
  33. package/dist/src/modules/v4/computedValue/computedValue.model.js +12 -4
  34. package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +8 -5
  35. package/dist/src/modules/v4/computedValue/computedValue.repository.js +7 -3
  36. package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +7 -4
  37. package/dist/src/modules/v4/computedValue/computedValue.service.js +10 -0
  38. package/dist/src/modules/v4/creator/creator.controller.d.ts +118 -0
  39. package/dist/src/modules/v4/creator/creator.controller.js +30 -0
  40. package/dist/src/modules/v4/creator/creator.model.d.ts +29 -0
  41. package/dist/src/modules/v4/creator/creator.model.js +18 -0
  42. package/dist/src/modules/v4/creator/creator.repository.d.ts +40 -0
  43. package/dist/src/modules/v4/creator/creator.repository.js +63 -0
  44. package/dist/src/modules/v4/creator/creator.service.d.ts +61 -0
  45. package/dist/src/modules/v4/creator/creator.service.js +44 -0
  46. package/dist/src/modules/v4/creator/index.d.ts +3 -0
  47. package/dist/src/modules/v4/creator/index.js +3 -0
  48. package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +3 -4
  49. package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +1 -1
  50. package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +1 -0
  51. package/dist/src/modules/v4/dynamicData/dynamicData.model.js +1 -0
  52. package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +6 -3
  53. package/dist/src/modules/v4/dynamicData/dynamicData.service.js +50 -9
  54. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +171 -1
  55. package/dist/src/modules/v4/opportunity/opportunity.controller.js +14 -0
  56. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +0 -1
  57. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +185 -0
  58. package/dist/src/modules/v4/opportunity/opportunity.repository.js +41 -0
  59. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +151 -1
  60. package/dist/src/modules/v4/opportunity/opportunity.service.js +45 -2
  61. package/dist/src/modules/v4/opportunity/subservices/getHyperdriveMetadata.service.d.ts +1 -1
  62. package/dist/src/modules/v4/opportunity/subservices/getHyperdriveMetadata.service.js +2 -2
  63. package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +30 -0
  64. package/dist/src/modules/v4/programPayload/programPayload.controller.js +12 -1
  65. package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +21 -1
  66. package/dist/src/modules/v4/programPayload/programPayload.model.js +12 -0
  67. package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +3 -2
  68. package/dist/src/modules/v4/programPayload/programPayload.repository.js +28 -2
  69. package/dist/src/modules/v4/programPayload/programPayload.service.d.ts +2 -1
  70. package/dist/src/modules/v4/programPayload/programPayload.service.js +42 -2
  71. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +1 -0
  72. package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
  73. package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
  74. package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -1
  75. package/dist/src/modules/v4/reward/reward.repository.js +12 -1
  76. package/dist/src/modules/v4/reward/reward.service.js +5 -2
  77. package/dist/src/modules/v4/router.d.ts +432 -5
  78. package/dist/src/modules/v4/router.js +5 -1
  79. package/dist/src/modules/v4/user/user.controller.d.ts +28 -0
  80. package/dist/src/modules/v4/user/user.controller.js +5 -0
  81. package/dist/src/modules/v4/user/user.repository.d.ts +5 -0
  82. package/dist/src/modules/v4/user/user.service.d.ts +5 -0
  83. package/dist/src/utils/decodeCalls.js +7 -1
  84. package/dist/src/utils/encodeCalls.js +19 -1
  85. package/dist/src/utils/generateCardName.js +3 -0
  86. package/dist/tsconfig.package.tsbuildinfo +1 -1
  87. package/package.json +6 -2
  88. package/dist/src/jobs/breakdowns.d.ts +0 -1
  89. package/dist/src/jobs/breakdowns.js +0 -55
  90. package/dist/src/jobs/rewards.d.ts +0 -1
  91. package/dist/src/jobs/rewards.js +0 -74
@@ -160,7 +160,7 @@ declare const app: Elysia<"", false, {
160
160
  status: "NONE" | "PAST" | "LIVE" | "SOON";
161
161
  identifier: string;
162
162
  chainId: number;
163
- action: "INVALID" | "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LP" | "LONG" | "SHORT";
163
+ action: "INVALID" | "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT";
164
164
  };
165
165
  params: {};
166
166
  query: unknown;
@@ -485,6 +485,176 @@ declare const app: Elysia<"", false, {
485
485
  };
486
486
  };
487
487
  };
488
+ } & {
489
+ opportunities: {
490
+ campaigns: {
491
+ get: {
492
+ body: unknown;
493
+ params: {};
494
+ query: {
495
+ type?: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | "ERC20TRANSFERS" | "ERC20LOGPROCESSOR" | "ERC20REBASELOGPROCESSOR" | "VEST" | "ERC20_FIX_APR" | "HYPERDRIVELOGPROCESSOR" | "HYPERDRIVELOGFIXPROCESSOR" | undefined;
496
+ items?: number | undefined;
497
+ subType?: number | undefined;
498
+ page?: number | undefined;
499
+ chainId?: number | undefined;
500
+ startTimestamp?: string | undefined;
501
+ endTimestamp?: string | undefined;
502
+ tokenAddress?: string | undefined;
503
+ mainParameter?: string | undefined;
504
+ campaignId?: string | undefined;
505
+ opportunityId?: string | undefined;
506
+ creatorId?: string | undefined;
507
+ test?: boolean | undefined;
508
+ creatorTag?: string | undefined;
509
+ tokenSymbol?: string | undefined;
510
+ };
511
+ headers: unknown;
512
+ response: {
513
+ 200: ({
514
+ protocol?: {
515
+ name: string;
516
+ url: string;
517
+ description: string;
518
+ id: string;
519
+ tags: string[];
520
+ icon: string;
521
+ } | null | undefined;
522
+ depositUrl?: string | undefined;
523
+ aprRecord?: {
524
+ timestamp: string | bigint;
525
+ cumulated: number;
526
+ breakdowns: {
527
+ type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
528
+ id: number;
529
+ identifier: string;
530
+ value: number;
531
+ aprRecordId: string;
532
+ }[];
533
+ } | undefined;
534
+ tvlRecord?: {
535
+ total: number;
536
+ timestamp: string | bigint;
537
+ breakdowns: {
538
+ type: "TOKEN" | "PROTOCOL";
539
+ id: number;
540
+ identifier: string;
541
+ value: number;
542
+ tvlRecordId: string;
543
+ }[];
544
+ } | undefined;
545
+ rewardsRecord?: {
546
+ total: number;
547
+ id: string;
548
+ timestamp: string | bigint;
549
+ breakdowns: {
550
+ token: {
551
+ price?: number | null | undefined;
552
+ symbol: string;
553
+ name: string | null;
554
+ id: string;
555
+ icon: string;
556
+ chainId: number;
557
+ address: string;
558
+ decimals: number;
559
+ verified: boolean;
560
+ isTest: boolean;
561
+ };
562
+ id: number;
563
+ value: number;
564
+ campaignId: string;
565
+ amount: string | bigint;
566
+ dailyRewardsRecordId: string;
567
+ }[];
568
+ } | undefined;
569
+ name: string;
570
+ type: string;
571
+ tokens: {
572
+ price?: number | null | undefined;
573
+ symbol: string;
574
+ name: string | null;
575
+ id: string;
576
+ icon: string;
577
+ chainId: number;
578
+ address: string;
579
+ decimals: number;
580
+ verified: boolean;
581
+ isTest: boolean;
582
+ }[];
583
+ id: string;
584
+ status: string;
585
+ tags: string[];
586
+ identifier: string;
587
+ chain: {
588
+ name: string;
589
+ id: number;
590
+ icon: string;
591
+ };
592
+ chainId: number;
593
+ action: string;
594
+ tvl: number;
595
+ apr: number;
596
+ dailyRewards: number;
597
+ } & {
598
+ campaigns: {
599
+ params: any;
600
+ chain: {
601
+ name: string;
602
+ id: number;
603
+ icon: string;
604
+ };
605
+ rewardToken: {
606
+ symbol: string;
607
+ name: string | null;
608
+ id: string;
609
+ icon: string;
610
+ chainId: number;
611
+ address: string;
612
+ decimals: number;
613
+ verified: boolean;
614
+ isTest: boolean;
615
+ } & {
616
+ price?: number | null | undefined;
617
+ };
618
+ distributionChain: {
619
+ name: string;
620
+ id: number;
621
+ icon: string;
622
+ } | undefined;
623
+ campaignStatus: {
624
+ error: string;
625
+ details: import("database/api/.generated/runtime/library").JsonValue;
626
+ status: import("../database/api/.generated").$Enums.RunStatus;
627
+ campaignId: string;
628
+ computedUntil: bigint;
629
+ processingStarted: bigint;
630
+ };
631
+ type: import("../database/api/.generated").$Enums.CampaignType;
632
+ id: string;
633
+ subType: number | null;
634
+ startTimestamp: bigint;
635
+ endTimestamp: bigint;
636
+ computeChainId: number;
637
+ distributionChainId: number;
638
+ campaignId: string;
639
+ rewardTokenId: string;
640
+ amount: string;
641
+ opportunityId: string;
642
+ creatorAddress: string;
643
+ }[];
644
+ })[];
645
+ readonly 404: {
646
+ message: string;
647
+ name: string;
648
+ };
649
+ readonly 500: {
650
+ code: string;
651
+ info: string;
652
+ httpCode: number;
653
+ };
654
+ };
655
+ };
656
+ };
657
+ };
488
658
  } & {
489
659
  opportunities: {
490
660
  ":id": {
@@ -901,6 +1071,7 @@ declare const app: Elysia<"", false, {
901
1071
  mainParameter?: string | undefined;
902
1072
  campaignId?: string | undefined;
903
1073
  opportunityId?: string | undefined;
1074
+ creatorId?: string | undefined;
904
1075
  test?: boolean | undefined;
905
1076
  creatorTag?: string | undefined;
906
1077
  tokenSymbol?: string | undefined;
@@ -973,6 +1144,7 @@ declare const app: Elysia<"", false, {
973
1144
  mainParameter?: string | undefined;
974
1145
  campaignId?: string | undefined;
975
1146
  opportunityId?: string | undefined;
1147
+ creatorId?: string | undefined;
976
1148
  test?: boolean | undefined;
977
1149
  creatorTag?: string | undefined;
978
1150
  tokenSymbol?: string | undefined;
@@ -1112,6 +1284,7 @@ declare const app: Elysia<"", false, {
1112
1284
  ":id": {
1113
1285
  patch: {
1114
1286
  body: {
1287
+ name?: string | undefined;
1115
1288
  url?: string | undefined;
1116
1289
  description?: string | undefined;
1117
1290
  icon?: string | undefined;
@@ -2100,6 +2273,7 @@ declare const app: Elysia<"", false, {
2100
2273
  200: {
2101
2274
  tags: string[];
2102
2275
  address: string;
2276
+ creatorId: string | null;
2103
2277
  }[];
2104
2278
  };
2105
2279
  };
@@ -2119,6 +2293,7 @@ declare const app: Elysia<"", false, {
2119
2293
  200: {
2120
2294
  tags: string[];
2121
2295
  address: string;
2296
+ creatorId: string | null;
2122
2297
  }[];
2123
2298
  };
2124
2299
  };
@@ -2138,11 +2313,35 @@ declare const app: Elysia<"", false, {
2138
2313
  200: {
2139
2314
  tags: string[];
2140
2315
  address: string;
2316
+ creatorId: string | null;
2141
2317
  } | null;
2142
2318
  };
2143
2319
  };
2144
2320
  };
2145
2321
  };
2322
+ } & {
2323
+ users: {
2324
+ ":address": {
2325
+ creator: {
2326
+ get: {
2327
+ body: unknown;
2328
+ params: {
2329
+ address: string;
2330
+ };
2331
+ query: unknown;
2332
+ headers: unknown;
2333
+ response: {
2334
+ 200: {
2335
+ name: string;
2336
+ id: string;
2337
+ addresses: string[];
2338
+ icon?: string | undefined;
2339
+ } | null;
2340
+ };
2341
+ };
2342
+ };
2343
+ };
2344
+ };
2146
2345
  } & {
2147
2346
  users: {
2148
2347
  ":address": {
@@ -2394,6 +2593,7 @@ declare const app: Elysia<"", false, {
2394
2593
  200: {
2395
2594
  tags: string[];
2396
2595
  address: string;
2596
+ creatorId: string | null;
2397
2597
  };
2398
2598
  };
2399
2599
  };
@@ -2434,6 +2634,7 @@ declare const app: Elysia<"", false, {
2434
2634
  200: {
2435
2635
  tags: string[];
2436
2636
  address: string;
2637
+ creatorId: string | null;
2437
2638
  };
2438
2639
  };
2439
2640
  };
@@ -2832,8 +3033,7 @@ declare const app: Elysia<"", false, {
2832
3033
  authorization: string;
2833
3034
  };
2834
3035
  response: {
2835
- [x: string]: any;
2836
- 200: any;
3036
+ 200: any[];
2837
3037
  };
2838
3038
  };
2839
3039
  };
@@ -2856,6 +3056,7 @@ declare const app: Elysia<"", false, {
2856
3056
  mainParameter?: string | undefined;
2857
3057
  campaignId?: string | undefined;
2858
3058
  opportunityId?: string | undefined;
3059
+ creatorId?: string | undefined;
2859
3060
  test?: boolean | undefined;
2860
3061
  creatorTag?: string | undefined;
2861
3062
  tokenSymbol?: string | undefined;
@@ -2864,8 +3065,7 @@ declare const app: Elysia<"", false, {
2864
3065
  authorization: string;
2865
3066
  };
2866
3067
  response: {
2867
- [x: string]: any;
2868
- 200: any;
3068
+ 200: any[];
2869
3069
  };
2870
3070
  };
2871
3071
  };
@@ -3285,6 +3485,36 @@ declare const app: Elysia<"", false, {
3285
3485
  };
3286
3486
  };
3287
3487
  };
3488
+ } & {
3489
+ "program-payload": {
3490
+ parse: {
3491
+ "from-campaign-data": {
3492
+ post: {
3493
+ body: {
3494
+ chainId: number;
3495
+ startTimestamp: number;
3496
+ endTimestamp: number;
3497
+ computeChainId: number;
3498
+ amount: string;
3499
+ rewardToken: string;
3500
+ campaignType: number;
3501
+ campaignData: string;
3502
+ symbolRewardToken: string;
3503
+ decimalsRewardToken: number;
3504
+ };
3505
+ params: {};
3506
+ query: unknown;
3507
+ headers: {
3508
+ authorization: string;
3509
+ };
3510
+ response: {
3511
+ [x: string]: any;
3512
+ 200: any;
3513
+ };
3514
+ };
3515
+ };
3516
+ };
3517
+ };
3288
3518
  };
3289
3519
  } & {
3290
3520
  v4: {
@@ -3327,6 +3557,203 @@ declare const app: Elysia<"", false, {
3327
3557
  };
3328
3558
  };
3329
3559
  };
3560
+ } & {
3561
+ v4: {
3562
+ value: {
3563
+ campaign: {
3564
+ ":campaignId": {
3565
+ ":field": {
3566
+ get: {
3567
+ body: unknown;
3568
+ params: {
3569
+ campaignId: string;
3570
+ field: string;
3571
+ };
3572
+ query: unknown;
3573
+ headers: unknown;
3574
+ response: {
3575
+ 200: {
3576
+ averageBoost: number | null;
3577
+ totalDistributedInUSD: number | null;
3578
+ forfeitingBoost: number | null;
3579
+ } | null;
3580
+ };
3581
+ };
3582
+ };
3583
+ };
3584
+ };
3585
+ };
3586
+ } & {
3587
+ value: {
3588
+ user: {
3589
+ ":address": {
3590
+ ":field": {
3591
+ get: {
3592
+ body: unknown;
3593
+ params: {
3594
+ address: string;
3595
+ field: string;
3596
+ };
3597
+ query: unknown;
3598
+ headers: unknown;
3599
+ response: {
3600
+ 200: {
3601
+ reason: string;
3602
+ id: number;
3603
+ campaignId: string;
3604
+ boost: number | null;
3605
+ }[];
3606
+ };
3607
+ };
3608
+ };
3609
+ };
3610
+ };
3611
+ };
3612
+ } & {
3613
+ value: {
3614
+ engine: {
3615
+ campaign: {
3616
+ post: {
3617
+ body: {
3618
+ value: number;
3619
+ campaignId: string;
3620
+ field: string;
3621
+ };
3622
+ params: {};
3623
+ query: unknown;
3624
+ headers: {
3625
+ authorization: string;
3626
+ };
3627
+ response: {
3628
+ 200: void;
3629
+ };
3630
+ };
3631
+ };
3632
+ };
3633
+ };
3634
+ } & {
3635
+ value: {
3636
+ engine: {
3637
+ user: {
3638
+ post: {
3639
+ body: {
3640
+ reason: string;
3641
+ value: number;
3642
+ address: string;
3643
+ campaignId: string;
3644
+ field: string;
3645
+ }[];
3646
+ params: {};
3647
+ query: unknown;
3648
+ headers: {
3649
+ authorization: string;
3650
+ };
3651
+ response: {
3652
+ 200: void;
3653
+ };
3654
+ };
3655
+ };
3656
+ };
3657
+ };
3658
+ };
3659
+ } & {
3660
+ v4: {
3661
+ creators: {
3662
+ index: {
3663
+ get: {
3664
+ body: unknown;
3665
+ params: {};
3666
+ query: {
3667
+ items?: number | undefined;
3668
+ page?: number | undefined;
3669
+ address?: string | undefined;
3670
+ };
3671
+ headers: unknown;
3672
+ response: {
3673
+ 200: ({
3674
+ name: string;
3675
+ id: string;
3676
+ addresses: string[];
3677
+ } & {
3678
+ icon?: string | undefined;
3679
+ })[];
3680
+ };
3681
+ };
3682
+ };
3683
+ };
3684
+ } & {
3685
+ creators: {
3686
+ ":id": {
3687
+ get: {
3688
+ body: unknown;
3689
+ params: {
3690
+ id: string;
3691
+ };
3692
+ query: unknown;
3693
+ headers: unknown;
3694
+ response: {
3695
+ 200: {
3696
+ name: string;
3697
+ id: string;
3698
+ addresses: string[];
3699
+ icon?: string | undefined;
3700
+ };
3701
+ };
3702
+ };
3703
+ };
3704
+ };
3705
+ } & {
3706
+ creators: {
3707
+ index: {
3708
+ post: {
3709
+ body: {
3710
+ icon?: string | undefined;
3711
+ name: string;
3712
+ id: string;
3713
+ addresses: string[];
3714
+ };
3715
+ params: {};
3716
+ query: unknown;
3717
+ headers: {
3718
+ authorization: string;
3719
+ };
3720
+ response: {
3721
+ 200: {
3722
+ name: string;
3723
+ id: string;
3724
+ icon: string | null;
3725
+ };
3726
+ };
3727
+ };
3728
+ };
3729
+ };
3730
+ } & {
3731
+ creators: {
3732
+ ":id": {
3733
+ patch: {
3734
+ body: {
3735
+ icon?: string | undefined;
3736
+ name: string;
3737
+ addresses: string[];
3738
+ };
3739
+ params: {
3740
+ id: string;
3741
+ };
3742
+ query: unknown;
3743
+ headers: {
3744
+ authorization: string;
3745
+ };
3746
+ response: {
3747
+ 200: {
3748
+ name: string;
3749
+ id: string;
3750
+ icon: string | null;
3751
+ };
3752
+ };
3753
+ };
3754
+ };
3755
+ };
3756
+ };
3330
3757
  } & {
3331
3758
  v3: {
3332
3759
  app: {
@@ -3,6 +3,7 @@ if (!process.env.ENV || !process.env.FILENAME)
3
3
  throw new Error("[ENV]: missing variable");
4
4
  import { BucketService } from "../../modules/v4/bucket/bucket.service";
5
5
  import { RewardService } from "../../modules/v4/reward";
6
+ import { withRetry } from "@sdk";
6
7
  import moment from "moment";
7
8
  import { log } from "../../utils/logger";
8
9
  // ─── Constants ───────────────────────────────────────────────
@@ -20,7 +21,7 @@ const extract = async () => {
20
21
  pendingsToCreate[currentBatchIndex].push(transform(JSON.parse(x)));
21
22
  if (pendingsToCreate[currentBatchIndex].length >= BATCH_SIZE) {
22
23
  try {
23
- count += await load(pendingsToCreate[currentBatchIndex]);
24
+ count += await withRetry(load, [pendingsToCreate[currentBatchIndex]], 5, 10_000);
24
25
  log.info(`Successfully inserted a batch of ${count} rewards`);
25
26
  }
26
27
  catch (err) {
@@ -4,6 +4,7 @@ if (!process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
4
4
  import { BucketService } from "../../modules/v4/bucket/bucket.service";
5
5
  import { log } from "../../utils/logger";
6
6
  import { apiDbClient } from "../../utils/prisma";
7
+ import { withRetry } from "@sdk";
7
8
  import moment from "moment";
8
9
  // ─── Constants ───────────────────────────────────────────────
9
10
  const BATCH_SIZE = 30_000;
@@ -20,7 +21,7 @@ const extract = async () => {
20
21
  rewardBreakdownsToCreate[currentBatchIndex].push(transform(breakdown));
21
22
  if (rewardBreakdownsToCreate[currentBatchIndex].length >= BATCH_SIZE) {
22
23
  try {
23
- count += await load(rewardBreakdownsToCreate[currentBatchIndex]);
24
+ count += await withRetry(load, [rewardBreakdownsToCreate[currentBatchIndex]], 5, 10_000);
24
25
  }
25
26
  catch (err) {
26
27
  console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
@@ -4,6 +4,7 @@ if (!process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
4
4
  import { BucketService } from "../../modules/v4/bucket/bucket.service";
5
5
  import { log } from "../../utils/logger";
6
6
  import { apiDbClient } from "../../utils/prisma";
7
+ import { withRetry } from "@sdk";
7
8
  import moment from "moment";
8
9
  // ─── Constants ───────────────────────────────────────────────
9
10
  const BATCH_SIZE = 20_000;
@@ -18,7 +19,7 @@ const extract = async () => {
18
19
  rewardsToCreate[currentBatchIndex].push(transform(JSON.parse(x)));
19
20
  if (rewardsToCreate[currentBatchIndex].length >= BATCH_SIZE) {
20
21
  try {
21
- count += await load(rewardsToCreate[currentBatchIndex]);
22
+ count += await withRetry(load, [rewardsToCreate[currentBatchIndex]], 5, 10_000);
22
23
  log.info(`Successfully inserted a batch of ${count} rewards`);
23
24
  }
24
25
  catch (err) {