@merkl/api 0.19.34 → 0.19.36
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.
- package/dist/src/eden/index.d.ts +482 -69
- package/dist/src/index.d.ts +158 -45
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +50 -46
- package/dist/src/modules/v4/campaign/campaign.controller.js +14 -7
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.js +2 -2
- package/dist/src/modules/v4/reward/reward.controller.d.ts +123 -1
- package/dist/src/modules/v4/reward/reward.controller.js +14 -2
- package/dist/src/modules/v4/reward/reward.model.d.ts +7 -0
- package/dist/src/modules/v4/reward/reward.model.js +6 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +9 -1
- package/dist/src/modules/v4/reward/reward.repository.js +27 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +165 -0
- package/dist/src/modules/v4/reward/reward.service.js +50 -0
- package/dist/src/modules/v4/router.d.ts +158 -45
- package/dist/src/modules/v4/token/token.service.js +9 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -1273,48 +1273,44 @@ declare const app: Elysia<"", false, {
|
|
1273
1273
|
};
|
1274
1274
|
} & {
|
1275
1275
|
"dry-run": {
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1276
|
+
metadata: {
|
1277
|
+
get: {
|
1278
|
+
body: unknown;
|
1279
|
+
params: {};
|
1280
|
+
query: {
|
1281
|
+
campaignId: string;
|
1282
|
+
distributionChain: number;
|
1283
|
+
};
|
1284
|
+
headers: {
|
1285
|
+
authorization: string;
|
1286
|
+
};
|
1287
|
+
response: {
|
1288
|
+
200: {
|
1289
|
+
id: string;
|
1290
|
+
chainId: number;
|
1291
|
+
type: string;
|
1292
|
+
identifier: string;
|
1293
|
+
name: string;
|
1294
|
+
status: "PAST" | "LIVE" | "SOON";
|
1295
|
+
action: any;
|
1296
|
+
tokens: ({
|
1297
|
+
symbol: string;
|
1292
1298
|
id: string;
|
1299
|
+
name: string | null;
|
1300
|
+
icon: string;
|
1301
|
+
address: string;
|
1293
1302
|
chainId: number;
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
chainId: number;
|
1306
|
-
decimals: number;
|
1307
|
-
verified: boolean;
|
1308
|
-
isTest: boolean;
|
1309
|
-
isPoint: boolean;
|
1310
|
-
isNative: boolean;
|
1311
|
-
} & {
|
1312
|
-
price?: number | null | undefined;
|
1313
|
-
})[];
|
1314
|
-
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
1315
|
-
depositUrl: any;
|
1316
|
-
tags: string[];
|
1317
|
-
};
|
1303
|
+
decimals: number;
|
1304
|
+
verified: boolean;
|
1305
|
+
isTest: boolean;
|
1306
|
+
isPoint: boolean;
|
1307
|
+
isNative: boolean;
|
1308
|
+
} & {
|
1309
|
+
price?: number | null | undefined;
|
1310
|
+
})[];
|
1311
|
+
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
1312
|
+
depositUrl: any;
|
1313
|
+
tags: string[];
|
1318
1314
|
};
|
1319
1315
|
};
|
1320
1316
|
};
|
@@ -1756,7 +1752,9 @@ declare const app: Elysia<"", false, {
|
|
1756
1752
|
withOpportunity?: boolean | undefined;
|
1757
1753
|
createdAfter?: Date | null | undefined;
|
1758
1754
|
};
|
1759
|
-
headers:
|
1755
|
+
headers: {
|
1756
|
+
authorization: string;
|
1757
|
+
};
|
1760
1758
|
response: {
|
1761
1759
|
200: {
|
1762
1760
|
[x: string]: number;
|
@@ -1768,7 +1766,7 @@ declare const app: Elysia<"", false, {
|
|
1768
1766
|
} & {
|
1769
1767
|
campaigns: {
|
1770
1768
|
count: {
|
1771
|
-
"by-
|
1769
|
+
"by-types": {
|
1772
1770
|
get: {
|
1773
1771
|
body: unknown;
|
1774
1772
|
params: {};
|
@@ -1796,7 +1794,9 @@ declare const app: Elysia<"", false, {
|
|
1796
1794
|
withOpportunity?: boolean | undefined;
|
1797
1795
|
createdAfter?: Date | null | undefined;
|
1798
1796
|
};
|
1799
|
-
headers:
|
1797
|
+
headers: {
|
1798
|
+
authorization: string;
|
1799
|
+
};
|
1800
1800
|
response: {
|
1801
1801
|
200: {
|
1802
1802
|
[x: string]: number;
|
@@ -1809,7 +1809,7 @@ declare const app: Elysia<"", false, {
|
|
1809
1809
|
} & {
|
1810
1810
|
campaigns: {
|
1811
1811
|
count: {
|
1812
|
-
"by-
|
1812
|
+
"by-protocols": {
|
1813
1813
|
get: {
|
1814
1814
|
body: unknown;
|
1815
1815
|
params: {};
|
@@ -1837,7 +1837,9 @@ declare const app: Elysia<"", false, {
|
|
1837
1837
|
withOpportunity?: boolean | undefined;
|
1838
1838
|
createdAfter?: Date | null | undefined;
|
1839
1839
|
};
|
1840
|
-
headers:
|
1840
|
+
headers: {
|
1841
|
+
authorization: string;
|
1842
|
+
};
|
1841
1843
|
response: {
|
1842
1844
|
200: {
|
1843
1845
|
[x: string]: number;
|
@@ -2665,6 +2667,117 @@ declare const app: Elysia<"", false, {
|
|
2665
2667
|
};
|
2666
2668
|
};
|
2667
2669
|
};
|
2670
|
+
} & {
|
2671
|
+
rewards: {
|
2672
|
+
total: {
|
2673
|
+
distributed: {
|
2674
|
+
get: {
|
2675
|
+
body: unknown;
|
2676
|
+
params: {};
|
2677
|
+
query: {
|
2678
|
+
since: Date;
|
2679
|
+
};
|
2680
|
+
headers: {
|
2681
|
+
authorization: string;
|
2682
|
+
};
|
2683
|
+
response: {
|
2684
|
+
200: number;
|
2685
|
+
};
|
2686
|
+
};
|
2687
|
+
};
|
2688
|
+
};
|
2689
|
+
};
|
2690
|
+
} & {
|
2691
|
+
rewards: {
|
2692
|
+
total: {
|
2693
|
+
distributed: {
|
2694
|
+
"by-opportunities": {
|
2695
|
+
get: {
|
2696
|
+
body: unknown;
|
2697
|
+
params: {};
|
2698
|
+
query: {
|
2699
|
+
since: Date;
|
2700
|
+
};
|
2701
|
+
headers: {
|
2702
|
+
authorization: string;
|
2703
|
+
};
|
2704
|
+
response: {
|
2705
|
+
200: string;
|
2706
|
+
};
|
2707
|
+
};
|
2708
|
+
};
|
2709
|
+
};
|
2710
|
+
};
|
2711
|
+
};
|
2712
|
+
} & {
|
2713
|
+
rewards: {
|
2714
|
+
total: {
|
2715
|
+
distributed: {
|
2716
|
+
"by-chains": {
|
2717
|
+
get: {
|
2718
|
+
body: unknown;
|
2719
|
+
params: {};
|
2720
|
+
query: {
|
2721
|
+
since: Date;
|
2722
|
+
};
|
2723
|
+
headers: {
|
2724
|
+
authorization: string;
|
2725
|
+
};
|
2726
|
+
response: {
|
2727
|
+
[x: string]: any;
|
2728
|
+
200: any;
|
2729
|
+
};
|
2730
|
+
};
|
2731
|
+
};
|
2732
|
+
};
|
2733
|
+
};
|
2734
|
+
};
|
2735
|
+
} & {
|
2736
|
+
rewards: {
|
2737
|
+
total: {
|
2738
|
+
distributed: {
|
2739
|
+
"by-types": {
|
2740
|
+
get: {
|
2741
|
+
body: unknown;
|
2742
|
+
params: {};
|
2743
|
+
query: {
|
2744
|
+
since: Date;
|
2745
|
+
};
|
2746
|
+
headers: {
|
2747
|
+
authorization: string;
|
2748
|
+
};
|
2749
|
+
response: {
|
2750
|
+
[x: string]: any;
|
2751
|
+
200: any;
|
2752
|
+
};
|
2753
|
+
};
|
2754
|
+
};
|
2755
|
+
};
|
2756
|
+
};
|
2757
|
+
};
|
2758
|
+
} & {
|
2759
|
+
rewards: {
|
2760
|
+
total: {
|
2761
|
+
distributed: {
|
2762
|
+
"by-protocols": {
|
2763
|
+
get: {
|
2764
|
+
body: unknown;
|
2765
|
+
params: {};
|
2766
|
+
query: {
|
2767
|
+
since: Date;
|
2768
|
+
};
|
2769
|
+
headers: {
|
2770
|
+
authorization: string;
|
2771
|
+
};
|
2772
|
+
response: {
|
2773
|
+
[x: string]: any;
|
2774
|
+
200: any;
|
2775
|
+
};
|
2776
|
+
};
|
2777
|
+
};
|
2778
|
+
};
|
2779
|
+
};
|
2780
|
+
};
|
2668
2781
|
};
|
2669
2782
|
} & {
|
2670
2783
|
v4: {
|
@@ -185,48 +185,44 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
185
185
|
};
|
186
186
|
} & {
|
187
187
|
"dry-run": {
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
188
|
+
metadata: {
|
189
|
+
get: {
|
190
|
+
body: unknown;
|
191
|
+
params: {};
|
192
|
+
query: {
|
193
|
+
campaignId: string;
|
194
|
+
distributionChain: number;
|
195
|
+
};
|
196
|
+
headers: {
|
197
|
+
authorization: string;
|
198
|
+
};
|
199
|
+
response: {
|
200
|
+
200: {
|
201
|
+
id: string;
|
202
|
+
chainId: number;
|
203
|
+
type: string;
|
204
|
+
identifier: string;
|
205
|
+
name: string;
|
206
|
+
status: "PAST" | "LIVE" | "SOON";
|
207
|
+
action: any;
|
208
|
+
tokens: ({
|
209
|
+
symbol: string;
|
204
210
|
id: string;
|
211
|
+
name: string | null;
|
212
|
+
icon: string;
|
213
|
+
address: string;
|
205
214
|
chainId: number;
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
chainId: number;
|
218
|
-
decimals: number;
|
219
|
-
verified: boolean;
|
220
|
-
isTest: boolean;
|
221
|
-
isPoint: boolean;
|
222
|
-
isNative: boolean;
|
223
|
-
} & {
|
224
|
-
price?: number | null | undefined;
|
225
|
-
})[];
|
226
|
-
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
227
|
-
depositUrl: any;
|
228
|
-
tags: string[];
|
229
|
-
};
|
215
|
+
decimals: number;
|
216
|
+
verified: boolean;
|
217
|
+
isTest: boolean;
|
218
|
+
isPoint: boolean;
|
219
|
+
isNative: boolean;
|
220
|
+
} & {
|
221
|
+
price?: number | null | undefined;
|
222
|
+
})[];
|
223
|
+
mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
|
224
|
+
depositUrl: any;
|
225
|
+
tags: string[];
|
230
226
|
};
|
231
227
|
};
|
232
228
|
};
|
@@ -668,7 +664,9 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
668
664
|
withOpportunity?: boolean | undefined;
|
669
665
|
createdAfter?: Date | null | undefined;
|
670
666
|
};
|
671
|
-
headers:
|
667
|
+
headers: {
|
668
|
+
authorization: string;
|
669
|
+
};
|
672
670
|
response: {
|
673
671
|
200: {
|
674
672
|
[x: string]: number;
|
@@ -680,7 +678,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
680
678
|
} & {
|
681
679
|
campaigns: {
|
682
680
|
count: {
|
683
|
-
"by-
|
681
|
+
"by-types": {
|
684
682
|
get: {
|
685
683
|
body: unknown;
|
686
684
|
params: {};
|
@@ -708,7 +706,9 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
708
706
|
withOpportunity?: boolean | undefined;
|
709
707
|
createdAfter?: Date | null | undefined;
|
710
708
|
};
|
711
|
-
headers:
|
709
|
+
headers: {
|
710
|
+
authorization: string;
|
711
|
+
};
|
712
712
|
response: {
|
713
713
|
200: {
|
714
714
|
[x: string]: number;
|
@@ -721,7 +721,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
721
721
|
} & {
|
722
722
|
campaigns: {
|
723
723
|
count: {
|
724
|
-
"by-
|
724
|
+
"by-protocols": {
|
725
725
|
get: {
|
726
726
|
body: unknown;
|
727
727
|
params: {};
|
@@ -749,7 +749,9 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
749
749
|
withOpportunity?: boolean | undefined;
|
750
750
|
createdAfter?: Date | null | undefined;
|
751
751
|
};
|
752
|
-
headers:
|
752
|
+
headers: {
|
753
|
+
authorization: string;
|
754
|
+
};
|
753
755
|
response: {
|
754
756
|
200: {
|
755
757
|
[x: string]: number;
|
@@ -768,7 +770,9 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
768
770
|
resolve: {};
|
769
771
|
schema: {
|
770
772
|
body: unknown;
|
771
|
-
headers:
|
773
|
+
headers: {
|
774
|
+
authorization: string;
|
775
|
+
};
|
772
776
|
query: {
|
773
777
|
type?: string | undefined;
|
774
778
|
status?: "NONE" | "PAST" | "LIVE" | "SOON" | undefined;
|
@@ -58,7 +58,7 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
58
58
|
.group("/dry-run", app => app
|
59
59
|
// ─── Test Dynamic data computation given a campaignId ───────────────────────
|
60
60
|
.get("/:campaignId/dynamic-data", async ({ params }) => {
|
61
|
-
const id = (await CampaignService.findMany({ campaignId: params.campaignId, test: true }))[0]
|
61
|
+
const id = (await CampaignService.findMany({ campaignId: params.campaignId, test: true }))?.[0]?.id;
|
62
62
|
if (!id)
|
63
63
|
throw new NotFoundError();
|
64
64
|
const campaign = await CampaignService.findUniqueOrThrow(id, true);
|
@@ -67,14 +67,16 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
67
67
|
}, { beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto, detail: { hide: true } })
|
68
68
|
// ─── Test Opportunity creation through a campaign Id and a chain ───────────────────────
|
69
69
|
// @dev Starts from the engine db to debug opportunity creation failing and preventing the api db to be filled
|
70
|
-
.get("
|
71
|
-
const
|
70
|
+
.get("/metadata", async ({ query }) => {
|
71
|
+
const engineCampaigns = await CampaignService.findEngineCampaigns([
|
72
72
|
{
|
73
73
|
distributionChain: query.distributionChain,
|
74
74
|
campaignId: query.campaignId,
|
75
75
|
},
|
76
76
|
]);
|
77
|
-
|
77
|
+
if (!engineCampaigns.length)
|
78
|
+
throw new NotFoundError("Campaign not found in engine db");
|
79
|
+
return await OpportunityService.createFromCampaign(engineCampaigns[0], false, false);
|
78
80
|
}, {
|
79
81
|
beforeHandle: BackOfficeGuard,
|
80
82
|
headers: AuthorizationHeadersDto,
|
@@ -171,7 +173,12 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
171
173
|
<p>This endpoint enables you to count campaigns corresponding to filters specified in the query params.</p>`,
|
172
174
|
},
|
173
175
|
})
|
174
|
-
.guard({
|
176
|
+
.guard({
|
177
|
+
response: t.Record(t.String(), t.Number()),
|
178
|
+
headers: AuthorizationHeadersDto,
|
179
|
+
beforeHandle: BackOfficeGuard,
|
180
|
+
detail: { hide: true },
|
181
|
+
})
|
175
182
|
.get("count/by-chains", async ({ query }) => await CampaignService.countByChains(query))
|
176
|
-
.get("/count/by-
|
177
|
-
.get("/count/by-
|
183
|
+
.get("/count/by-types", async ({ query }) => await CampaignService.countByType(query))
|
184
|
+
.get("/count/by-protocols", async ({ query }) => await CampaignService.countByProtocol(query));
|
@@ -313,13 +313,13 @@ export class OpportunityRepository {
|
|
313
313
|
// pagination by offset; might have to change to cursor based for performance
|
314
314
|
const { page: _page, items: _items } = query;
|
315
315
|
const page = _page ? _page : 0;
|
316
|
-
const items = _items ? _items : 20;
|
316
|
+
const items = _items !== undefined ? _items : 20;
|
317
317
|
const withTest = query.test ?? false;
|
318
318
|
const withPoints = query.point ?? false;
|
319
319
|
const withCampaigns = query.campaigns ?? false;
|
320
320
|
const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
|
321
321
|
return await apiDbClient.opportunity.findMany({
|
322
|
-
take: items,
|
322
|
+
take: items === 0 ? undefined : items,
|
323
323
|
skip: page * items,
|
324
324
|
include: {
|
325
325
|
...OpportunityRepository.#getRecordInclusion(withTest, withPoints),
|
@@ -75,8 +75,8 @@ export class OpportunityService {
|
|
75
75
|
? params.url
|
76
76
|
: !!metadata.depositUrl
|
77
77
|
? metadata.depositUrl
|
78
|
-
: !!metadata.mainProtocol && !!protocol
|
79
|
-
? protocol
|
78
|
+
: !!metadata.mainProtocol && !!protocol?.url
|
79
|
+
? protocol?.url
|
80
80
|
: undefined,
|
81
81
|
tags,
|
82
82
|
};
|
@@ -327,6 +327,117 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
327
327
|
};
|
328
328
|
};
|
329
329
|
};
|
330
|
+
} & {
|
331
|
+
rewards: {
|
332
|
+
total: {
|
333
|
+
distributed: {
|
334
|
+
get: {
|
335
|
+
body: unknown;
|
336
|
+
params: {};
|
337
|
+
query: {
|
338
|
+
since: Date;
|
339
|
+
};
|
340
|
+
headers: {
|
341
|
+
authorization: string;
|
342
|
+
};
|
343
|
+
response: {
|
344
|
+
200: number;
|
345
|
+
};
|
346
|
+
};
|
347
|
+
};
|
348
|
+
};
|
349
|
+
};
|
350
|
+
} & {
|
351
|
+
rewards: {
|
352
|
+
total: {
|
353
|
+
distributed: {
|
354
|
+
"by-opportunities": {
|
355
|
+
get: {
|
356
|
+
body: unknown;
|
357
|
+
params: {};
|
358
|
+
query: {
|
359
|
+
since: Date;
|
360
|
+
};
|
361
|
+
headers: {
|
362
|
+
authorization: string;
|
363
|
+
};
|
364
|
+
response: {
|
365
|
+
200: string;
|
366
|
+
};
|
367
|
+
};
|
368
|
+
};
|
369
|
+
};
|
370
|
+
};
|
371
|
+
};
|
372
|
+
} & {
|
373
|
+
rewards: {
|
374
|
+
total: {
|
375
|
+
distributed: {
|
376
|
+
"by-chains": {
|
377
|
+
get: {
|
378
|
+
body: unknown;
|
379
|
+
params: {};
|
380
|
+
query: {
|
381
|
+
since: Date;
|
382
|
+
};
|
383
|
+
headers: {
|
384
|
+
authorization: string;
|
385
|
+
};
|
386
|
+
response: {
|
387
|
+
[x: string]: any;
|
388
|
+
200: any;
|
389
|
+
};
|
390
|
+
};
|
391
|
+
};
|
392
|
+
};
|
393
|
+
};
|
394
|
+
};
|
395
|
+
} & {
|
396
|
+
rewards: {
|
397
|
+
total: {
|
398
|
+
distributed: {
|
399
|
+
"by-types": {
|
400
|
+
get: {
|
401
|
+
body: unknown;
|
402
|
+
params: {};
|
403
|
+
query: {
|
404
|
+
since: Date;
|
405
|
+
};
|
406
|
+
headers: {
|
407
|
+
authorization: string;
|
408
|
+
};
|
409
|
+
response: {
|
410
|
+
[x: string]: any;
|
411
|
+
200: any;
|
412
|
+
};
|
413
|
+
};
|
414
|
+
};
|
415
|
+
};
|
416
|
+
};
|
417
|
+
};
|
418
|
+
} & {
|
419
|
+
rewards: {
|
420
|
+
total: {
|
421
|
+
distributed: {
|
422
|
+
"by-protocols": {
|
423
|
+
get: {
|
424
|
+
body: unknown;
|
425
|
+
params: {};
|
426
|
+
query: {
|
427
|
+
since: Date;
|
428
|
+
};
|
429
|
+
headers: {
|
430
|
+
authorization: string;
|
431
|
+
};
|
432
|
+
response: {
|
433
|
+
[x: string]: any;
|
434
|
+
200: any;
|
435
|
+
};
|
436
|
+
};
|
437
|
+
};
|
438
|
+
};
|
439
|
+
};
|
440
|
+
};
|
330
441
|
}, {
|
331
442
|
derive: {};
|
332
443
|
resolve: {};
|
@@ -334,5 +445,16 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
334
445
|
}, {
|
335
446
|
derive: {};
|
336
447
|
resolve: {};
|
337
|
-
schema: {
|
448
|
+
schema: {
|
449
|
+
body: unknown;
|
450
|
+
headers: {
|
451
|
+
authorization: string;
|
452
|
+
};
|
453
|
+
query: {
|
454
|
+
since: Date;
|
455
|
+
};
|
456
|
+
params: unknown;
|
457
|
+
cookie: unknown;
|
458
|
+
response: {};
|
459
|
+
};
|
338
460
|
}>;
|
@@ -3,8 +3,9 @@ import { AuthorizationHeadersDto, EngineGuard } from "@/guards/Engine.guard";
|
|
3
3
|
import { ChainDto } from "@/modules/v4/accounting/accounting.model";
|
4
4
|
import { CampaignService } from "@/modules/v4/campaign/campaign.service";
|
5
5
|
import { TokenService } from "@/modules/v4/token/token.service";
|
6
|
+
import bigintToString from "@/utils/bigintToString";
|
6
7
|
import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "@/utils/throw";
|
7
|
-
import Elysia from "elysia";
|
8
|
+
import Elysia, { t } from "elysia";
|
8
9
|
import { CampaignIdDto, CampaignIdWithoutPageDto, CampaignRewardsDto, CreateManyBreakdownDto, CreateManyRewardDto, RegisterClaimsDto, TokenIdDto, } from "./reward.model";
|
9
10
|
import { RewardService } from "./reward.service";
|
10
11
|
// ─── Rewards Controller ──────────────────────────────────────────────────────
|
@@ -121,4 +122,15 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
|
|
121
122
|
},
|
122
123
|
detail: { description: "Returns the total of unclaimed rewards for given campaigns" },
|
123
124
|
});
|
124
|
-
})
|
125
|
+
})
|
126
|
+
.guard({
|
127
|
+
query: t.Object({ since: t.Date() }),
|
128
|
+
headers: AuthorizationHeadersDto,
|
129
|
+
beforeHandle: BackOfficeGuard,
|
130
|
+
detail: { hide: true },
|
131
|
+
})
|
132
|
+
.get("/total/distributed", async ({ query }) => await RewardService.getTotalDistributed(query.since.getTime() / 1000))
|
133
|
+
.get("/total/distributed/by-opportunities", async ({ query }) => JSON.stringify(bigintToString(Array.from((await RewardService.getTotalDistributedByOpportunities(query.since.getTime() / 1000)).entries()))))
|
134
|
+
.get("/total/distributed/by-chains", async ({ query }) => await RewardService.getTotalDistributedByChains(query.since.getTime() / 1000))
|
135
|
+
.get("/total/distributed/by-types", async ({ query }) => await RewardService.getTotalDistributedByType(query.since.getTime() / 1000))
|
136
|
+
.get("/total/distributed/by-protocols", async ({ query }) => await RewardService.getTotalDistributedByProtocol(query.since.getTime() / 1000));
|
@@ -210,6 +210,13 @@ export declare const RewardV3Dto: import("@sinclair/typebox").TRecord<import("@s
|
|
210
210
|
symbol: import("@sinclair/typebox").TString;
|
211
211
|
}>>;
|
212
212
|
}>>;
|
213
|
+
export declare const QueryTotalDailyRewardsSinceDto: import("@sinclair/typebox").TObject<{
|
214
|
+
since: import("@sinclair/typebox").TDate;
|
215
|
+
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
216
|
+
protocol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
217
|
+
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
218
|
+
}>;
|
219
|
+
export type QueryTotalDailyRewardsSinceModel = typeof QueryTotalDailyRewardsSinceDto.static;
|
213
220
|
export type CreateManyRewardModel = typeof CreateManyRewardDto.static;
|
214
221
|
export type CreateManyBreakdownModel = typeof CreateManyBreakdownDto.static;
|
215
222
|
export type RewardEntity = typeof RewardDto.static;
|