@merkl/api 1.20.0 → 1.20.21

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 (163) hide show
  1. package/dist/src/constants.d.ts +2 -0
  2. package/dist/src/constants.js.map +1 -1
  3. package/dist/src/eden/index.d.ts +1104 -72
  4. package/dist/src/engine/deprecated/dynamicData/implementations/Erc20.d.ts +153 -63
  5. package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/ownerFinder.js.map +1 -1
  6. package/dist/src/engine/implementations/Erc20/subTypes/implementations/pendleYT/tvl.js.map +1 -1
  7. package/dist/src/engine/implementations/EulerMultiBorrowFromCollateral/metadata.d.ts +25 -0
  8. package/dist/src/engine/implementations/EulerMultiBorrowFromCollateral/metadata.js.map +1 -0
  9. package/dist/src/engine/implementations/Exactly/metadata.d.ts +19 -0
  10. package/dist/src/engine/implementations/Exactly/metadata.js.map +1 -0
  11. package/dist/src/engine/implementations/FeeWrapper4626/metadata.d.ts +18 -0
  12. package/dist/src/engine/implementations/FeeWrapper4626/metadata.js.map +1 -0
  13. package/dist/src/engine/implementations/JsonAirdrop/metadata.d.ts +1 -1
  14. package/dist/src/engine/metadata/factory.js.map +1 -1
  15. package/dist/src/engine/tvl/factory.js.map +1 -1
  16. package/dist/src/guards/{KeyStoreAuth.guard.d.ts → KeyValueStoreAuth.guard.d.ts} +4 -4
  17. package/dist/src/guards/KeyValueStoreAuth.guard.js.map +1 -0
  18. package/dist/src/guards/PrivateAccess.guard.d.ts +25 -0
  19. package/dist/src/guards/PrivateAccess.guard.js.map +1 -0
  20. package/dist/src/index.d.ts +1143 -2
  21. package/dist/src/index.js.map +1 -1
  22. package/dist/src/jobs/claim-etl/load.d.ts +2 -2
  23. package/dist/src/jobs/claim-etl/load.js.map +1 -1
  24. package/dist/src/jobs/claim-etl/types.d.ts +5 -5
  25. package/dist/src/jobs/deposit-credit-etl/load.js.map +1 -1
  26. package/dist/src/jobs/merge-etl/load.js.map +1 -1
  27. package/dist/src/jobs/refresh-materialized-views.js.map +1 -1
  28. package/dist/src/jobs/sync-campaigns-to-hubspot.js.map +1 -1
  29. package/dist/src/modules/graphql/context.d.ts +14 -0
  30. package/dist/src/modules/graphql/context.js.map +1 -0
  31. package/dist/src/modules/graphql/errors.d.ts +7 -0
  32. package/dist/src/modules/graphql/errors.js.map +1 -0
  33. package/dist/src/modules/graphql/guards.d.ts +26 -0
  34. package/dist/src/modules/graphql/guards.js.map +1 -0
  35. package/dist/src/modules/graphql/resolvers.d.ts +593 -0
  36. package/dist/src/modules/graphql/resolvers.js.map +1 -0
  37. package/dist/src/modules/graphql/router.d.ts +87 -0
  38. package/dist/src/modules/graphql/router.js.map +1 -0
  39. package/dist/src/modules/graphql/scalars.d.ts +3 -0
  40. package/dist/src/modules/graphql/scalars.js.map +1 -0
  41. package/dist/src/modules/graphql/schema.d.ts +2 -0
  42. package/dist/src/modules/graphql/schema.js.map +1 -0
  43. package/dist/src/modules/graphql/translator.d.ts +25 -0
  44. package/dist/src/modules/graphql/translator.js.map +1 -0
  45. package/dist/src/modules/graphql/yoga.d.ts +2 -0
  46. package/dist/src/modules/graphql/yoga.js.map +1 -0
  47. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +10 -2
  48. package/dist/src/modules/v4/campaign/campaign.controller.js.map +1 -1
  49. package/dist/src/modules/v4/campaign/campaign.formatter.d.ts +24 -0
  50. package/dist/src/modules/v4/campaign/campaign.formatter.js.map +1 -1
  51. package/dist/src/modules/v4/campaign/campaign.model.d.ts +5 -0
  52. package/dist/src/modules/v4/campaign/campaign.model.js.map +1 -1
  53. package/dist/src/modules/v4/campaign/campaign.query-transformer.d.ts +6 -6
  54. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +11 -0
  55. package/dist/src/modules/v4/campaign/campaign.repository.js.map +1 -1
  56. package/dist/src/modules/v4/campaign/campaign.service.d.ts +1 -1
  57. package/dist/src/modules/v4/campaignToProcess/campaignToProcess.controller.d.ts +1 -1
  58. package/dist/src/modules/v4/campaignToProcess/campaignToProcess.controller.js.map +1 -1
  59. package/dist/src/modules/v4/chain/chain.model.js.map +1 -1
  60. package/dist/src/modules/v4/claims/claims.model.js.map +1 -1
  61. package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +29 -0
  62. package/dist/src/modules/v4/computedValue/computedValue.controller.js.map +1 -1
  63. package/dist/src/modules/v4/computedValue/computedValue.model.d.ts +5 -0
  64. package/dist/src/modules/v4/computedValue/computedValue.model.js.map +1 -1
  65. package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +2 -1
  66. package/dist/src/modules/v4/computedValue/computedValue.repository.js.map +1 -1
  67. package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +2 -1
  68. package/dist/src/modules/v4/computedValue/computedValue.service.js.map +1 -1
  69. package/dist/src/modules/v4/credit/credit.controller.d.ts +98 -0
  70. package/dist/src/modules/v4/credit/credit.controller.js.map +1 -1
  71. package/dist/src/modules/v4/credit/credit.model.d.ts +5 -0
  72. package/dist/src/modules/v4/credit/credit.model.js.map +1 -1
  73. package/dist/src/modules/v4/credit/credit.repository.d.ts +21 -1
  74. package/dist/src/modules/v4/credit/credit.repository.js.map +1 -1
  75. package/dist/src/modules/v4/credit/credit.service.d.ts +20 -1
  76. package/dist/src/modules/v4/credit/credit.service.js.map +1 -1
  77. package/dist/src/modules/v4/enum/enum.service.d.ts +68 -0
  78. package/dist/src/modules/v4/enum/enum.service.js.map +1 -1
  79. package/dist/src/modules/v4/historical/historical.controller.js.map +1 -1
  80. package/dist/src/modules/v4/historical/historical.service.js.map +1 -1
  81. package/dist/src/modules/v4/{keyStore/keyStore.controller.d.ts → keyValueStore/keyValueStore.controller.d.ts} +1 -1
  82. package/dist/src/modules/v4/keyValueStore/keyValueStore.controller.js.map +1 -0
  83. package/dist/src/modules/v4/keyValueStore/keyValueStore.formatter.d.ts +27 -0
  84. package/dist/src/modules/v4/keyValueStore/keyValueStore.formatter.js.map +1 -0
  85. package/dist/src/modules/v4/keyValueStore/keyValueStore.model.js.map +1 -0
  86. package/dist/src/modules/v4/{keyStore/keyStore.repository.d.ts → keyValueStore/keyValueStore.repository.d.ts} +1 -1
  87. package/dist/src/modules/v4/keyValueStore/keyValueStore.repository.js.map +1 -0
  88. package/dist/src/modules/v4/{keyStore/keyStore.service.d.ts → keyValueStore/keyValueStore.service.d.ts} +1 -1
  89. package/dist/src/modules/v4/keyValueStore/keyValueStore.service.js.map +1 -0
  90. package/dist/src/modules/v4/leaf/latestCompute.repository.js.map +1 -1
  91. package/dist/src/modules/v4/leaf/leaf.model.d.ts +0 -95
  92. package/dist/src/modules/v4/leaf/leaf.repository.d.ts +98 -124
  93. package/dist/src/modules/v4/leaf/leaf.repository.js.map +1 -1
  94. package/dist/src/modules/v4/leaf/leaf.service.d.ts +84 -514
  95. package/dist/src/modules/v4/leaf/leaf.service.js.map +1 -1
  96. package/dist/src/modules/v4/leaf/leafTemp.repository.js.map +1 -1
  97. package/dist/src/modules/v4/leaf/leafView.repository.d.ts +3 -17
  98. package/dist/src/modules/v4/leaf/leafView.repository.js.map +1 -1
  99. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -0
  100. package/dist/src/modules/v4/opportunity/opportunity.controller.js.map +1 -1
  101. package/dist/src/modules/v4/opportunity/opportunity.formatter.js.map +1 -1
  102. package/dist/src/modules/v4/opportunity/opportunity.model.js.map +1 -1
  103. package/dist/src/modules/v4/opportunity/opportunity.query-transformer.d.ts +7 -7
  104. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +573 -1
  105. package/dist/src/modules/v4/opportunity/opportunity.repository.js.map +1 -1
  106. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +4 -2
  107. package/dist/src/modules/v4/opportunity/opportunity.service.js.map +1 -1
  108. package/dist/src/modules/v4/programPayload/subPayloads/ethena.d.ts +48 -48
  109. package/dist/src/modules/v4/protocol/protocol.model.js.map +1 -1
  110. package/dist/src/modules/v4/reallocation/reallocation.controller.d.ts +67 -0
  111. package/dist/src/modules/v4/reallocation/reallocation.controller.js.map +1 -0
  112. package/dist/src/modules/v4/reallocation/reallocation.model.d.ts +38 -0
  113. package/dist/src/modules/v4/reallocation/reallocation.model.js.map +1 -0
  114. package/dist/src/modules/v4/reallocation/reallocation.repository.d.ts +25 -0
  115. package/dist/src/modules/v4/reallocation/reallocation.repository.js.map +1 -0
  116. package/dist/src/modules/v4/reallocation/reallocation.service.d.ts +21 -0
  117. package/dist/src/modules/v4/reallocation/reallocation.service.js.map +1 -0
  118. package/dist/src/modules/v4/reward/reward.controller.js.map +1 -1
  119. package/dist/src/modules/v4/reward/reward.model.js.map +1 -1
  120. package/dist/src/modules/v4/reward/reward.service.d.ts +3 -287
  121. package/dist/src/modules/v4/reward/reward.service.js.map +1 -1
  122. package/dist/src/modules/v4/router.d.ts +1100 -2
  123. package/dist/src/modules/v4/router.js.map +1 -1
  124. package/dist/src/modules/v4/schema/schema.controller.d.ts +141 -0
  125. package/dist/src/modules/v4/schema/schema.controller.js.map +1 -0
  126. package/dist/src/modules/v4/schema/schema.model.d.ts +56 -0
  127. package/dist/src/modules/v4/schema/schema.model.js.map +1 -0
  128. package/dist/src/modules/v4/schema/schema.service.d.ts +20 -0
  129. package/dist/src/modules/v4/schema/schema.service.js.map +1 -0
  130. package/dist/src/modules/v4/slack/slack.service.js.map +1 -1
  131. package/dist/src/modules/v4/token/token.model.js.map +1 -1
  132. package/dist/src/modules/v4/transaction/transaction.service.d.ts +1333 -579
  133. package/dist/src/modules/v4/uniswap/uniswap.controller.d.ts +13 -0
  134. package/dist/src/modules/v4/uniswap/uniswap.service.d.ts +14 -0
  135. package/dist/src/modules/v4/user/user.controller.d.ts +812 -0
  136. package/dist/src/modules/v4/user/user.controller.js.map +1 -1
  137. package/dist/src/modules/v4/user/user.model.d.ts +969 -0
  138. package/dist/src/modules/v4/user/user.model.js.map +1 -1
  139. package/dist/src/modules/v4/user/user.pending.test.d.ts +1 -0
  140. package/dist/src/modules/v4/user/user.pending.test.js.map +1 -0
  141. package/dist/src/modules/v4/user/user.service.d.ts +324 -5
  142. package/dist/src/modules/v4/user/user.service.js.map +1 -1
  143. package/dist/src/plugins/errorHandler.d.ts +15 -0
  144. package/dist/src/plugins/errorHandler.js.map +1 -1
  145. package/dist/src/scripts/extract-stellar-pk.d.ts +1 -0
  146. package/dist/src/scripts/extract-stellar-pk.js.map +1 -0
  147. package/dist/src/scripts/test-reallocations.d.ts +9 -0
  148. package/dist/src/scripts/test-reallocations.js.map +1 -0
  149. package/dist/src/utils/getAPR.d.ts +1102 -725
  150. package/dist/src/utils/parseDistributionType.d.ts +476 -99
  151. package/dist/src/utils/providers.d.ts +2 -0
  152. package/dist/src/utils/safeEngineQuery.d.ts +14 -0
  153. package/dist/src/utils/safeEngineQuery.js.map +1 -0
  154. package/dist/src/utils/throw.d.ts +17 -0
  155. package/dist/src/utils/throw.js.map +1 -1
  156. package/dist/tsconfig.tsbuildinfo +1 -1
  157. package/package.json +1 -1
  158. package/dist/src/guards/KeyStoreAuth.guard.js.map +0 -1
  159. package/dist/src/modules/v4/keyStore/keyStore.controller.js.map +0 -1
  160. package/dist/src/modules/v4/keyStore/keyStore.model.js.map +0 -1
  161. package/dist/src/modules/v4/keyStore/keyStore.repository.js.map +0 -1
  162. package/dist/src/modules/v4/keyStore/keyStore.service.js.map +0 -1
  163. /package/dist/src/modules/v4/{keyStore/keyStore.model.d.ts → keyValueStore/keyValueStore.model.d.ts} +0 -0
@@ -728,6 +728,96 @@ export declare abstract class OpportunityRepository {
728
728
  latestCampaignEnd: bigint | null;
729
729
  hidden: boolean;
730
730
  }>;
731
+ /**
732
+ * Fetches opportunities by id. When {@link liveOnly} is `true` (default), only
733
+ * LIVE opportunities are returned; set to `false` for reward breakdowns where
734
+ * ended opportunities must still be shown.
735
+ */
736
+ static findByIds(ids: string[], withTestTokens?: boolean, liveOnly?: boolean): Promise<{
737
+ chainId: number;
738
+ type: string;
739
+ identifier: string;
740
+ name: string;
741
+ description: string;
742
+ howToSteps: string[];
743
+ status: import("@package/databases").Status;
744
+ action: import("@package/databases").OpportunityAction;
745
+ tvl: number;
746
+ apr: number;
747
+ maxApr: number | null;
748
+ dailyRewards: number;
749
+ maxDailyRewards: number;
750
+ tags: string[];
751
+ liveCampaigns: number;
752
+ tokens: {
753
+ id: string;
754
+ name: string | null;
755
+ chainId: number;
756
+ address: string;
757
+ decimals: number;
758
+ symbol: string;
759
+ icon: string;
760
+ verified: boolean;
761
+ isNative: boolean;
762
+ isTest: boolean;
763
+ type: "POINT" | "PRETGE" | "TOKEN";
764
+ price?: number | null | undefined;
765
+ updatedAt?: number | null | undefined;
766
+ priceSource?: string | null | undefined;
767
+ displaySymbol?: string | undefined;
768
+ underlyingTokenId?: string | undefined;
769
+ priceAlertDismissedAt?: number | undefined;
770
+ priceAlertCount?: number | undefined;
771
+ }[];
772
+ chain: {
773
+ id: number;
774
+ name: string;
775
+ icon: string;
776
+ liveCampaigns: number;
777
+ endOfDisputePeriod: number;
778
+ explorers?: {
779
+ type: "BLOCKSCOUT" | "ETHERSCAN" | "SOLSCAN";
780
+ url: string;
781
+ chainId: number;
782
+ }[] | undefined;
783
+ lastClaimsOnchainFetchTimestamp: string | null;
784
+ };
785
+ protocol: {
786
+ id: string;
787
+ tags: string[];
788
+ name: string;
789
+ description: string;
790
+ url: string;
791
+ icon: string;
792
+ banner: string | null;
793
+ opportunityBannerLight: string | null;
794
+ opportunityBannerDark: string | null;
795
+ } | undefined;
796
+ activePrograms: {
797
+ icon: string;
798
+ id: string;
799
+ name: string;
800
+ slug: string | null;
801
+ }[];
802
+ depositUrls: {
803
+ id: string;
804
+ title: string;
805
+ url: string;
806
+ subtitle?: string | undefined;
807
+ icon?: string | undefined;
808
+ priority: number;
809
+ }[] | undefined;
810
+ id: string;
811
+ hidden: true | undefined;
812
+ nativeApr: number | undefined;
813
+ depositUrl: string | undefined;
814
+ explorerAddress: string | undefined;
815
+ lastCampaignCreatedAt: number;
816
+ earliestCampaignStart: bigint | undefined;
817
+ latestCampaignStart: bigint | undefined;
818
+ earliestCampaignEnd: bigint | undefined;
819
+ latestCampaignEnd: bigint | undefined;
820
+ }[]>;
731
821
  /**
732
822
  * Gets opportunities and campaigns based on a campaign filter
733
823
  */
@@ -1336,6 +1426,486 @@ export declare abstract class OpportunityRepository {
1336
1426
  latestCampaignEnd: bigint | null;
1337
1427
  hidden: boolean;
1338
1428
  }[]>;
1429
+ /**
1430
+ * Fetches opportunities using a pre-built Prisma where clause and orderBy.
1431
+ * Used by GraphQL endpoint to support arbitrary filter expressions.
1432
+ * Uses split-query pattern to avoid lateral join explosion.
1433
+ */
1434
+ static findManyByWhere(params: {
1435
+ where: Prisma.OpportunityWhereInput;
1436
+ orderBy?: Prisma.OpportunityOrderByWithRelationInput | Prisma.OpportunityOrderByWithRelationInput[];
1437
+ take: number;
1438
+ skip: number;
1439
+ withCampaigns: boolean;
1440
+ }): Promise<({
1441
+ ActivePrograms: {
1442
+ icon: string;
1443
+ id: string;
1444
+ name: string;
1445
+ slug: string | null;
1446
+ }[];
1447
+ AprRecords: ({
1448
+ AprBreakdown: {
1449
+ Campaign: {
1450
+ distributionType: import("@package/databases").DistributionType;
1451
+ } | null;
1452
+ identifier: string;
1453
+ timestamp: bigint;
1454
+ type: import("@package/databases").AprType;
1455
+ value: number;
1456
+ }[];
1457
+ } & {
1458
+ id: string;
1459
+ timestamp: bigint;
1460
+ cumulated: number;
1461
+ opportunityId: string;
1462
+ })[];
1463
+ Campaigns: {
1464
+ id: string;
1465
+ computeChainId: number;
1466
+ distributionChainId: number;
1467
+ campaignId: string;
1468
+ type: string;
1469
+ distributionType: import("@package/databases").DistributionType;
1470
+ subType: number | null;
1471
+ rewardTokenId: string;
1472
+ amount: string;
1473
+ opportunityId: string;
1474
+ startTimestamp: bigint;
1475
+ endTimestamp: bigint;
1476
+ params: import("@prisma/client/runtime/client").JsonValue;
1477
+ description: string | null;
1478
+ pauseCompute: string | null;
1479
+ pausePrecompute: string | null;
1480
+ dailyRewards: number;
1481
+ apr: number;
1482
+ creatorAddress: string;
1483
+ manualOverrides: import("@package/databases").CampaignManualOverride[];
1484
+ createdAt: Date;
1485
+ rootCampaignId: string | null;
1486
+ parentCampaignId: string | null;
1487
+ isPrivate: boolean;
1488
+ campaignEncodingHash: string | null;
1489
+ }[];
1490
+ Chain: {
1491
+ Explorer: {
1492
+ id: string;
1493
+ type: import("@package/databases").ExplorerType;
1494
+ url: string;
1495
+ chainId: number;
1496
+ }[];
1497
+ } & {
1498
+ id: number;
1499
+ name: string;
1500
+ icon: string;
1501
+ liveCampaigns: number;
1502
+ endOfDisputePeriod: number;
1503
+ lastClaimsOnchainFetchTimestamp: string | null;
1504
+ };
1505
+ DailyRewardsRecords: ({
1506
+ DailyRewardsBreakdown: ({
1507
+ Campaign: {
1508
+ CampaignStatus: {
1509
+ campaignId: string;
1510
+ computedUntil: bigint;
1511
+ processingStarted: bigint;
1512
+ status: import("@package/databases").RunStatus;
1513
+ preComputeStatus: import("@package/databases").RunStatus;
1514
+ preComputeProcessingStarted: bigint;
1515
+ error: string;
1516
+ details: import("@prisma/client/runtime/client").JsonValue;
1517
+ }[];
1518
+ RewardToken: {
1519
+ id: string;
1520
+ name: string | null;
1521
+ chainId: number;
1522
+ address: string;
1523
+ decimals: number;
1524
+ symbol: string;
1525
+ displaySymbol: string;
1526
+ icon: string;
1527
+ verified: boolean;
1528
+ isTest: boolean;
1529
+ type: import("@package/databases").TokenType;
1530
+ isNative: boolean;
1531
+ underlyingTokenId: string | null;
1532
+ price: number | null;
1533
+ updatedAt: number | null;
1534
+ priceSource: string | null;
1535
+ priceAlertDismissedAt: number | null;
1536
+ priceAlertCount: number;
1537
+ };
1538
+ amount: string;
1539
+ campaignId: string;
1540
+ distributionType: import("@package/databases").DistributionType;
1541
+ endTimestamp: bigint;
1542
+ startTimestamp: bigint;
1543
+ };
1544
+ } & {
1545
+ id: string;
1546
+ value: number;
1547
+ maxValue: number;
1548
+ timestamp: bigint;
1549
+ campaignId: string;
1550
+ dailyRewardsRecordId: string;
1551
+ })[];
1552
+ } & {
1553
+ id: string;
1554
+ timestamp: bigint;
1555
+ total: number;
1556
+ opportunityId: string;
1557
+ })[];
1558
+ DepositUrls: {
1559
+ id: string;
1560
+ title: string;
1561
+ url: string;
1562
+ subtitle: string | null;
1563
+ icon: string | null;
1564
+ priority: number;
1565
+ opportunityId: string;
1566
+ }[];
1567
+ MainProtocol: {
1568
+ id: string;
1569
+ tags: string[];
1570
+ name: string;
1571
+ description: string;
1572
+ url: string;
1573
+ icon: string;
1574
+ banner: string | null;
1575
+ opportunityBannerLight: string | null;
1576
+ opportunityBannerDark: string | null;
1577
+ } | null;
1578
+ NativeAprRecords: ({
1579
+ RewardToken: {
1580
+ id: string;
1581
+ name: string | null;
1582
+ chainId: number;
1583
+ address: string;
1584
+ decimals: number;
1585
+ symbol: string;
1586
+ displaySymbol: string;
1587
+ icon: string;
1588
+ verified: boolean;
1589
+ isTest: boolean;
1590
+ type: import("@package/databases").TokenType;
1591
+ isNative: boolean;
1592
+ underlyingTokenId: string | null;
1593
+ price: number | null;
1594
+ updatedAt: number | null;
1595
+ priceSource: string | null;
1596
+ priceAlertDismissedAt: number | null;
1597
+ priceAlertCount: number;
1598
+ } | null;
1599
+ } & {
1600
+ id: string;
1601
+ title: string;
1602
+ description: string | null;
1603
+ timestamp: bigint;
1604
+ value: number;
1605
+ amount: bigint | null;
1606
+ rewardTokenId: string | null;
1607
+ opportunityId: string;
1608
+ })[];
1609
+ Tokens: {
1610
+ id: string;
1611
+ name: string | null;
1612
+ chainId: number;
1613
+ address: string;
1614
+ decimals: number;
1615
+ symbol: string;
1616
+ displaySymbol: string;
1617
+ icon: string;
1618
+ verified: boolean;
1619
+ isTest: boolean;
1620
+ type: import("@package/databases").TokenType;
1621
+ isNative: boolean;
1622
+ underlyingTokenId: string | null;
1623
+ price: number | null;
1624
+ updatedAt: number | null;
1625
+ priceSource: string | null;
1626
+ priceAlertDismissedAt: number | null;
1627
+ priceAlertCount: number;
1628
+ }[];
1629
+ TvlRecords: ({
1630
+ TvlBreakdown: {
1631
+ identifier: string;
1632
+ type: import("@package/databases").TvlType;
1633
+ value: number;
1634
+ }[];
1635
+ } & {
1636
+ id: string;
1637
+ timestamp: bigint;
1638
+ total: number;
1639
+ opportunityId: string;
1640
+ })[];
1641
+ } & {
1642
+ id: string;
1643
+ chainId: number;
1644
+ type: string;
1645
+ identifier: string;
1646
+ name: string;
1647
+ description: string;
1648
+ howToSteps: string[];
1649
+ depositUrl: string | null;
1650
+ explorerAddress: string | null;
1651
+ status: import("@package/databases").Status;
1652
+ action: import("@package/databases").OpportunityAction;
1653
+ mainProtocolId: string | null;
1654
+ tvl: number;
1655
+ apr: number;
1656
+ nativeApr: number | null;
1657
+ maxApr: number | null;
1658
+ dailyRewards: number;
1659
+ maxDailyRewards: number;
1660
+ tags: string[];
1661
+ lastCampaignCreatedAt: Date;
1662
+ manualOverrides: import("@package/databases").OpportunityManualOverride[];
1663
+ liveCampaigns: number;
1664
+ earliestCampaignStart: bigint | null;
1665
+ latestCampaignStart: bigint | null;
1666
+ earliestCampaignEnd: bigint | null;
1667
+ latestCampaignEnd: bigint | null;
1668
+ hidden: boolean;
1669
+ })[]>;
1670
+ /**
1671
+ * Fetches a single opportunity by ID for GraphQL.
1672
+ * Includes all relations and nested data.
1673
+ */
1674
+ static findUniqueForGraphQL(id: string, withCampaigns: boolean): Promise<({
1675
+ ActivePrograms: {
1676
+ icon: string;
1677
+ id: string;
1678
+ name: string;
1679
+ slug: string | null;
1680
+ }[];
1681
+ AprRecords: ({
1682
+ AprBreakdown: {
1683
+ Campaign: {
1684
+ distributionType: import("@package/databases").DistributionType;
1685
+ } | null;
1686
+ identifier: string;
1687
+ timestamp: bigint;
1688
+ type: import("@package/databases").AprType;
1689
+ value: number;
1690
+ }[];
1691
+ } & {
1692
+ id: string;
1693
+ timestamp: bigint;
1694
+ cumulated: number;
1695
+ opportunityId: string;
1696
+ })[];
1697
+ Campaigns: {
1698
+ id: string;
1699
+ computeChainId: number;
1700
+ distributionChainId: number;
1701
+ campaignId: string;
1702
+ type: string;
1703
+ distributionType: import("@package/databases").DistributionType;
1704
+ subType: number | null;
1705
+ rewardTokenId: string;
1706
+ amount: string;
1707
+ opportunityId: string;
1708
+ startTimestamp: bigint;
1709
+ endTimestamp: bigint;
1710
+ params: import("@prisma/client/runtime/client").JsonValue;
1711
+ description: string | null;
1712
+ pauseCompute: string | null;
1713
+ pausePrecompute: string | null;
1714
+ dailyRewards: number;
1715
+ apr: number;
1716
+ creatorAddress: string;
1717
+ manualOverrides: import("@package/databases").CampaignManualOverride[];
1718
+ createdAt: Date;
1719
+ rootCampaignId: string | null;
1720
+ parentCampaignId: string | null;
1721
+ isPrivate: boolean;
1722
+ campaignEncodingHash: string | null;
1723
+ }[];
1724
+ Chain: {
1725
+ Explorer: {
1726
+ id: string;
1727
+ type: import("@package/databases").ExplorerType;
1728
+ url: string;
1729
+ chainId: number;
1730
+ }[];
1731
+ } & {
1732
+ id: number;
1733
+ name: string;
1734
+ icon: string;
1735
+ liveCampaigns: number;
1736
+ endOfDisputePeriod: number;
1737
+ lastClaimsOnchainFetchTimestamp: string | null;
1738
+ };
1739
+ DailyRewardsRecords: ({
1740
+ DailyRewardsBreakdown: ({
1741
+ Campaign: {
1742
+ CampaignStatus: {
1743
+ campaignId: string;
1744
+ computedUntil: bigint;
1745
+ processingStarted: bigint;
1746
+ status: import("@package/databases").RunStatus;
1747
+ preComputeStatus: import("@package/databases").RunStatus;
1748
+ preComputeProcessingStarted: bigint;
1749
+ error: string;
1750
+ details: import("@prisma/client/runtime/client").JsonValue;
1751
+ }[];
1752
+ RewardToken: {
1753
+ id: string;
1754
+ name: string | null;
1755
+ chainId: number;
1756
+ address: string;
1757
+ decimals: number;
1758
+ symbol: string;
1759
+ displaySymbol: string;
1760
+ icon: string;
1761
+ verified: boolean;
1762
+ isTest: boolean;
1763
+ type: import("@package/databases").TokenType;
1764
+ isNative: boolean;
1765
+ underlyingTokenId: string | null;
1766
+ price: number | null;
1767
+ updatedAt: number | null;
1768
+ priceSource: string | null;
1769
+ priceAlertDismissedAt: number | null;
1770
+ priceAlertCount: number;
1771
+ };
1772
+ amount: string;
1773
+ campaignId: string;
1774
+ distributionType: import("@package/databases").DistributionType;
1775
+ endTimestamp: bigint;
1776
+ startTimestamp: bigint;
1777
+ };
1778
+ } & {
1779
+ id: string;
1780
+ value: number;
1781
+ maxValue: number;
1782
+ timestamp: bigint;
1783
+ campaignId: string;
1784
+ dailyRewardsRecordId: string;
1785
+ })[];
1786
+ } & {
1787
+ id: string;
1788
+ timestamp: bigint;
1789
+ total: number;
1790
+ opportunityId: string;
1791
+ })[];
1792
+ DepositUrls: {
1793
+ id: string;
1794
+ title: string;
1795
+ url: string;
1796
+ subtitle: string | null;
1797
+ icon: string | null;
1798
+ priority: number;
1799
+ opportunityId: string;
1800
+ }[];
1801
+ MainProtocol: {
1802
+ id: string;
1803
+ tags: string[];
1804
+ name: string;
1805
+ description: string;
1806
+ url: string;
1807
+ icon: string;
1808
+ banner: string | null;
1809
+ opportunityBannerLight: string | null;
1810
+ opportunityBannerDark: string | null;
1811
+ } | null;
1812
+ NativeAprRecords: ({
1813
+ RewardToken: {
1814
+ id: string;
1815
+ name: string | null;
1816
+ chainId: number;
1817
+ address: string;
1818
+ decimals: number;
1819
+ symbol: string;
1820
+ displaySymbol: string;
1821
+ icon: string;
1822
+ verified: boolean;
1823
+ isTest: boolean;
1824
+ type: import("@package/databases").TokenType;
1825
+ isNative: boolean;
1826
+ underlyingTokenId: string | null;
1827
+ price: number | null;
1828
+ updatedAt: number | null;
1829
+ priceSource: string | null;
1830
+ priceAlertDismissedAt: number | null;
1831
+ priceAlertCount: number;
1832
+ } | null;
1833
+ } & {
1834
+ id: string;
1835
+ title: string;
1836
+ description: string | null;
1837
+ timestamp: bigint;
1838
+ value: number;
1839
+ amount: bigint | null;
1840
+ rewardTokenId: string | null;
1841
+ opportunityId: string;
1842
+ })[];
1843
+ Tokens: {
1844
+ id: string;
1845
+ name: string | null;
1846
+ chainId: number;
1847
+ address: string;
1848
+ decimals: number;
1849
+ symbol: string;
1850
+ displaySymbol: string;
1851
+ icon: string;
1852
+ verified: boolean;
1853
+ isTest: boolean;
1854
+ type: import("@package/databases").TokenType;
1855
+ isNative: boolean;
1856
+ underlyingTokenId: string | null;
1857
+ price: number | null;
1858
+ updatedAt: number | null;
1859
+ priceSource: string | null;
1860
+ priceAlertDismissedAt: number | null;
1861
+ priceAlertCount: number;
1862
+ }[];
1863
+ TvlRecords: ({
1864
+ TvlBreakdown: {
1865
+ identifier: string;
1866
+ type: import("@package/databases").TvlType;
1867
+ value: number;
1868
+ }[];
1869
+ } & {
1870
+ id: string;
1871
+ timestamp: bigint;
1872
+ total: number;
1873
+ opportunityId: string;
1874
+ })[];
1875
+ } & {
1876
+ id: string;
1877
+ chainId: number;
1878
+ type: string;
1879
+ identifier: string;
1880
+ name: string;
1881
+ description: string;
1882
+ howToSteps: string[];
1883
+ depositUrl: string | null;
1884
+ explorerAddress: string | null;
1885
+ status: import("@package/databases").Status;
1886
+ action: import("@package/databases").OpportunityAction;
1887
+ mainProtocolId: string | null;
1888
+ tvl: number;
1889
+ apr: number;
1890
+ nativeApr: number | null;
1891
+ maxApr: number | null;
1892
+ dailyRewards: number;
1893
+ maxDailyRewards: number;
1894
+ tags: string[];
1895
+ lastCampaignCreatedAt: Date;
1896
+ manualOverrides: import("@package/databases").OpportunityManualOverride[];
1897
+ liveCampaigns: number;
1898
+ earliestCampaignStart: bigint | null;
1899
+ latestCampaignStart: bigint | null;
1900
+ earliestCampaignEnd: bigint | null;
1901
+ latestCampaignEnd: bigint | null;
1902
+ hidden: boolean;
1903
+ }) | null>;
1904
+ /**
1905
+ * Counts opportunities matching the given Prisma where clause.
1906
+ * Used by GraphQL endpoint.
1907
+ */
1908
+ static countByWhere(where: Prisma.OpportunityWhereInput): Promise<number>;
1339
1909
  static countMany(query: FindManyOpportunityModel, authOptions?: AuthenticationOptions): Promise<number>;
1340
1910
  /**
1341
1911
  * Finds opportunities that need dynamic data updates for a given chain.
@@ -1765,9 +2335,11 @@ export declare abstract class OpportunityRepository {
1765
2335
  static aggregateMax(field: keyof Prisma.OpportunityMaxAggregateInputType, query: FindManyOpportunityModel, authOptions?: AuthenticationOptions): Promise<{
1766
2336
  max: string;
1767
2337
  }>;
1768
- static getAprRecords(opportunityId: string, pagination?: {
2338
+ static getAprRecords(opportunityId: string, options?: {
1769
2339
  page?: number;
1770
2340
  items?: number;
2341
+ from?: number;
2342
+ to?: number;
1771
2343
  }): Promise<{
1772
2344
  timestamp: bigint;
1773
2345
  date: string;