@merkl/api 0.10.252 → 0.10.254
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 +130 -12
- package/dist/src/index.d.ts +48 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/RfxProcessor.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.controller.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +18 -1
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -3
- package/dist/src/modules/v4/campaign/campaign.repository.js +9 -70
- package/dist/src/modules/v4/campaign/campaign.service.js +6 -23
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +46 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +23 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +4 -2
- package/dist/src/modules/v4/opportunity/opportunity.model.js +4 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +148 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +45 -25
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +54 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.js +55 -4
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +40 -50
- package/dist/src/modules/v4/router.d.ts +48 -4
- package/dist/src/utils/generateCardName.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -97,6 +97,39 @@ declare const eden: {
|
|
97
97
|
opportunities: ((params: {
|
98
98
|
id: string | number;
|
99
99
|
}) => {
|
100
|
+
post: (body: unknown, options: {
|
101
|
+
headers: {
|
102
|
+
authorization: string;
|
103
|
+
};
|
104
|
+
query?: Record<string, unknown> | undefined;
|
105
|
+
fetch?: RequestInit | undefined;
|
106
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
107
|
+
200: {
|
108
|
+
id: string;
|
109
|
+
chainId: number;
|
110
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
111
|
+
identifier: string;
|
112
|
+
name: string;
|
113
|
+
status: "PAST" | "LIVE" | "SOON";
|
114
|
+
action: import("../../database/api/.generated").$Enums.OpportunityAction;
|
115
|
+
tokens: ({
|
116
|
+
symbol: string;
|
117
|
+
name: string | null;
|
118
|
+
id: string;
|
119
|
+
icon: string;
|
120
|
+
chainId: number;
|
121
|
+
address: string;
|
122
|
+
decimals: number;
|
123
|
+
verified: boolean;
|
124
|
+
isTest: boolean;
|
125
|
+
} & {
|
126
|
+
price?: number | null | undefined;
|
127
|
+
})[];
|
128
|
+
mainProtocol: "morpho" | "aura" | "poolside" | "gearbox" | "fluid" | "compound" | "ionic" | "layerbank" | "moonwell" | "fenix" | "syncswap" | "beefy" | "aerodrome" | "velodrome" | "curve" | "akron" | "dragonswap" | "koi" | "baseswap" | "zkswap" | "rfx" | "woofi" | "zkSwapThreePool" | "venus" | "reactor_fusion" | "balancer" | "aave" | "arthswap" | "camelot" | "crust" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "supswap-v3" | "thirdtrade" | "uniswap-v2" | "syncswap-v3" | "neptune" | "radiant" | "euler" | "sturdy" | "frax" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "ion" | "eigenlayer" | undefined;
|
129
|
+
depositUrl: any;
|
130
|
+
tags: string[];
|
131
|
+
};
|
132
|
+
}>>;
|
100
133
|
get: (options?: {
|
101
134
|
headers?: Record<string, unknown> | undefined;
|
102
135
|
query?: Record<string, unknown> | undefined;
|
@@ -374,6 +407,10 @@ declare const eden: {
|
|
374
407
|
index: {
|
375
408
|
post: (body: {
|
376
409
|
name?: string | undefined;
|
410
|
+
tags?: string[] | undefined;
|
411
|
+
depositUrl?: string | undefined;
|
412
|
+
protocols?: string[] | undefined;
|
413
|
+
mainProtocol?: string | undefined;
|
377
414
|
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
378
415
|
tokens: {
|
379
416
|
chainId: number;
|
@@ -383,8 +420,6 @@ declare const eden: {
|
|
383
420
|
identifier: string;
|
384
421
|
chainId: number;
|
385
422
|
action: "INVALID" | "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW";
|
386
|
-
protocols: string[];
|
387
|
-
mainProtocol: string;
|
388
423
|
}, options: {
|
389
424
|
headers: {
|
390
425
|
authorization: string;
|
@@ -558,12 +593,12 @@ declare const eden: {
|
|
558
593
|
}) & {};
|
559
594
|
};
|
560
595
|
campaigns: {
|
561
|
-
|
596
|
+
engine: {
|
562
597
|
post: (body: {
|
563
598
|
tags?: string[] | undefined;
|
564
599
|
identifier?: string | undefined;
|
565
600
|
subType?: number | undefined;
|
566
|
-
type:
|
601
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
567
602
|
params: string;
|
568
603
|
creator: string;
|
569
604
|
chainId: number;
|
@@ -597,6 +632,8 @@ declare const eden: {
|
|
597
632
|
creatorAddress: string;
|
598
633
|
} | undefined;
|
599
634
|
}>>;
|
635
|
+
};
|
636
|
+
index: {
|
600
637
|
get: (options: {
|
601
638
|
headers?: Record<string, unknown> | undefined;
|
602
639
|
query: {
|
@@ -2894,6 +2931,10 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2894
2931
|
post: {
|
2895
2932
|
body: {
|
2896
2933
|
name?: string | undefined;
|
2934
|
+
tags?: string[] | undefined;
|
2935
|
+
depositUrl?: string | undefined;
|
2936
|
+
protocols?: string[] | undefined;
|
2937
|
+
mainProtocol?: string | undefined;
|
2897
2938
|
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
2898
2939
|
tokens: {
|
2899
2940
|
chainId: number;
|
@@ -2903,8 +2944,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2903
2944
|
identifier: string;
|
2904
2945
|
chainId: number;
|
2905
2946
|
action: "INVALID" | "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW";
|
2906
|
-
protocols: string[];
|
2907
|
-
mainProtocol: string;
|
2908
2947
|
};
|
2909
2948
|
params: {};
|
2910
2949
|
query: unknown;
|
@@ -2917,6 +2956,48 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2917
2956
|
};
|
2918
2957
|
};
|
2919
2958
|
};
|
2959
|
+
} & {
|
2960
|
+
opportunities: {
|
2961
|
+
":id": {
|
2962
|
+
post: {
|
2963
|
+
body: unknown;
|
2964
|
+
params: {
|
2965
|
+
id: string;
|
2966
|
+
};
|
2967
|
+
query: unknown;
|
2968
|
+
headers: {
|
2969
|
+
authorization: string;
|
2970
|
+
};
|
2971
|
+
response: {
|
2972
|
+
200: {
|
2973
|
+
id: string;
|
2974
|
+
chainId: number;
|
2975
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
2976
|
+
identifier: string;
|
2977
|
+
name: string;
|
2978
|
+
status: "PAST" | "LIVE" | "SOON";
|
2979
|
+
action: import("../../database/api/.generated").$Enums.OpportunityAction;
|
2980
|
+
tokens: ({
|
2981
|
+
symbol: string;
|
2982
|
+
name: string | null;
|
2983
|
+
id: string;
|
2984
|
+
icon: string;
|
2985
|
+
chainId: number;
|
2986
|
+
address: string;
|
2987
|
+
decimals: number;
|
2988
|
+
verified: boolean;
|
2989
|
+
isTest: boolean;
|
2990
|
+
} & {
|
2991
|
+
price?: number | null | undefined;
|
2992
|
+
})[];
|
2993
|
+
mainProtocol: "morpho" | "aura" | "poolside" | "gearbox" | "fluid" | "compound" | "ionic" | "layerbank" | "moonwell" | "fenix" | "syncswap" | "beefy" | "aerodrome" | "velodrome" | "curve" | "akron" | "dragonswap" | "koi" | "baseswap" | "zkswap" | "rfx" | "woofi" | "zkSwapThreePool" | "venus" | "reactor_fusion" | "balancer" | "aave" | "arthswap" | "camelot" | "crust" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "supswap-v3" | "thirdtrade" | "uniswap-v2" | "syncswap-v3" | "neptune" | "radiant" | "euler" | "sturdy" | "frax" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "ion" | "eigenlayer" | undefined;
|
2994
|
+
depositUrl: any;
|
2995
|
+
tags: string[];
|
2996
|
+
};
|
2997
|
+
};
|
2998
|
+
};
|
2999
|
+
};
|
3000
|
+
};
|
2920
3001
|
} & {
|
2921
3002
|
opportunities: {
|
2922
3003
|
index: {
|
@@ -3401,13 +3482,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3401
3482
|
} & {
|
3402
3483
|
v4: {
|
3403
3484
|
campaigns: {
|
3404
|
-
|
3485
|
+
engine: {
|
3405
3486
|
post: {
|
3406
3487
|
body: {
|
3407
3488
|
tags?: string[] | undefined;
|
3408
3489
|
identifier?: string | undefined;
|
3409
3490
|
subType?: number | undefined;
|
3410
|
-
type:
|
3491
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
3411
3492
|
params: string;
|
3412
3493
|
creator: string;
|
3413
3494
|
chainId: number;
|
@@ -6297,6 +6378,39 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6297
6378
|
opportunities: ((params: {
|
6298
6379
|
id: string | number;
|
6299
6380
|
}) => {
|
6381
|
+
post: (body: unknown, options: {
|
6382
|
+
headers: {
|
6383
|
+
authorization: string;
|
6384
|
+
};
|
6385
|
+
query?: Record<string, unknown> | undefined;
|
6386
|
+
fetch?: RequestInit | undefined;
|
6387
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6388
|
+
200: {
|
6389
|
+
id: string;
|
6390
|
+
chainId: number;
|
6391
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
6392
|
+
identifier: string;
|
6393
|
+
name: string;
|
6394
|
+
status: "PAST" | "LIVE" | "SOON";
|
6395
|
+
action: import("../../database/api/.generated").$Enums.OpportunityAction;
|
6396
|
+
tokens: ({
|
6397
|
+
symbol: string;
|
6398
|
+
name: string | null;
|
6399
|
+
id: string;
|
6400
|
+
icon: string;
|
6401
|
+
chainId: number;
|
6402
|
+
address: string;
|
6403
|
+
decimals: number;
|
6404
|
+
verified: boolean;
|
6405
|
+
isTest: boolean;
|
6406
|
+
} & {
|
6407
|
+
price?: number | null | undefined;
|
6408
|
+
})[];
|
6409
|
+
mainProtocol: "morpho" | "aura" | "poolside" | "gearbox" | "fluid" | "compound" | "ionic" | "layerbank" | "moonwell" | "fenix" | "syncswap" | "beefy" | "aerodrome" | "velodrome" | "curve" | "akron" | "dragonswap" | "koi" | "baseswap" | "zkswap" | "rfx" | "woofi" | "zkSwapThreePool" | "venus" | "reactor_fusion" | "balancer" | "aave" | "arthswap" | "camelot" | "crust" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "supswap-v3" | "thirdtrade" | "uniswap-v2" | "syncswap-v3" | "neptune" | "radiant" | "euler" | "sturdy" | "frax" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "ion" | "eigenlayer" | undefined;
|
6410
|
+
depositUrl: any;
|
6411
|
+
tags: string[];
|
6412
|
+
};
|
6413
|
+
}>>;
|
6300
6414
|
get: (options?: {
|
6301
6415
|
headers?: Record<string, unknown> | undefined;
|
6302
6416
|
query?: Record<string, unknown> | undefined;
|
@@ -6574,6 +6688,10 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6574
6688
|
index: {
|
6575
6689
|
post: (body: {
|
6576
6690
|
name?: string | undefined;
|
6691
|
+
tags?: string[] | undefined;
|
6692
|
+
depositUrl?: string | undefined;
|
6693
|
+
protocols?: string[] | undefined;
|
6694
|
+
mainProtocol?: string | undefined;
|
6577
6695
|
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
6578
6696
|
tokens: {
|
6579
6697
|
chainId: number;
|
@@ -6583,8 +6701,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6583
6701
|
identifier: string;
|
6584
6702
|
chainId: number;
|
6585
6703
|
action: "INVALID" | "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW";
|
6586
|
-
protocols: string[];
|
6587
|
-
mainProtocol: string;
|
6588
6704
|
}, options: {
|
6589
6705
|
headers: {
|
6590
6706
|
authorization: string;
|
@@ -6758,12 +6874,12 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6758
6874
|
}) & {};
|
6759
6875
|
};
|
6760
6876
|
campaigns: {
|
6761
|
-
|
6877
|
+
engine: {
|
6762
6878
|
post: (body: {
|
6763
6879
|
tags?: string[] | undefined;
|
6764
6880
|
identifier?: string | undefined;
|
6765
6881
|
subType?: number | undefined;
|
6766
|
-
type:
|
6882
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
6767
6883
|
params: string;
|
6768
6884
|
creator: string;
|
6769
6885
|
chainId: number;
|
@@ -6797,6 +6913,8 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6797
6913
|
creatorAddress: string;
|
6798
6914
|
} | undefined;
|
6799
6915
|
}>>;
|
6916
|
+
};
|
6917
|
+
index: {
|
6800
6918
|
get: (options: {
|
6801
6919
|
headers?: Record<string, unknown> | undefined;
|
6802
6920
|
query: {
|
package/dist/src/index.d.ts
CHANGED
@@ -148,6 +148,10 @@ declare const app: Elysia<"", false, {
|
|
148
148
|
post: {
|
149
149
|
body: {
|
150
150
|
name?: string | undefined;
|
151
|
+
tags?: string[] | undefined;
|
152
|
+
depositUrl?: string | undefined;
|
153
|
+
protocols?: string[] | undefined;
|
154
|
+
mainProtocol?: string | undefined;
|
151
155
|
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
152
156
|
tokens: {
|
153
157
|
chainId: number;
|
@@ -157,8 +161,6 @@ declare const app: Elysia<"", false, {
|
|
157
161
|
identifier: string;
|
158
162
|
chainId: number;
|
159
163
|
action: "INVALID" | "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW";
|
160
|
-
protocols: string[];
|
161
|
-
mainProtocol: string;
|
162
164
|
};
|
163
165
|
params: {};
|
164
166
|
query: unknown;
|
@@ -171,6 +173,48 @@ declare const app: Elysia<"", false, {
|
|
171
173
|
};
|
172
174
|
};
|
173
175
|
};
|
176
|
+
} & {
|
177
|
+
opportunities: {
|
178
|
+
":id": {
|
179
|
+
post: {
|
180
|
+
body: unknown;
|
181
|
+
params: {
|
182
|
+
id: string;
|
183
|
+
};
|
184
|
+
query: unknown;
|
185
|
+
headers: {
|
186
|
+
authorization: string;
|
187
|
+
};
|
188
|
+
response: {
|
189
|
+
200: {
|
190
|
+
id: string;
|
191
|
+
chainId: number;
|
192
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
193
|
+
identifier: string;
|
194
|
+
name: string;
|
195
|
+
status: "PAST" | "LIVE" | "SOON";
|
196
|
+
action: import("../database/api/.generated").$Enums.OpportunityAction;
|
197
|
+
tokens: ({
|
198
|
+
symbol: string;
|
199
|
+
name: string | null;
|
200
|
+
id: string;
|
201
|
+
icon: string;
|
202
|
+
chainId: number;
|
203
|
+
address: string;
|
204
|
+
decimals: number;
|
205
|
+
verified: boolean;
|
206
|
+
isTest: boolean;
|
207
|
+
} & {
|
208
|
+
price?: number | null | undefined;
|
209
|
+
})[];
|
210
|
+
mainProtocol: "morpho" | "aura" | "poolside" | "gearbox" | "fluid" | "compound" | "ionic" | "layerbank" | "moonwell" | "fenix" | "syncswap" | "beefy" | "aerodrome" | "velodrome" | "curve" | "akron" | "dragonswap" | "koi" | "baseswap" | "zkswap" | "rfx" | "woofi" | "zkSwapThreePool" | "venus" | "reactor_fusion" | "balancer" | "aave" | "arthswap" | "camelot" | "crust" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "supswap-v3" | "thirdtrade" | "uniswap-v2" | "syncswap-v3" | "neptune" | "radiant" | "euler" | "sturdy" | "frax" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "ion" | "eigenlayer" | undefined;
|
211
|
+
depositUrl: any;
|
212
|
+
tags: string[];
|
213
|
+
};
|
214
|
+
};
|
215
|
+
};
|
216
|
+
};
|
217
|
+
};
|
174
218
|
} & {
|
175
219
|
opportunities: {
|
176
220
|
index: {
|
@@ -655,13 +699,13 @@ declare const app: Elysia<"", false, {
|
|
655
699
|
} & {
|
656
700
|
v4: {
|
657
701
|
campaigns: {
|
658
|
-
|
702
|
+
engine: {
|
659
703
|
post: {
|
660
704
|
body: {
|
661
705
|
tags?: string[] | undefined;
|
662
706
|
identifier?: string | undefined;
|
663
707
|
subType?: number | undefined;
|
664
|
-
type:
|
708
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
665
709
|
params: string;
|
666
710
|
creator: string;
|
667
711
|
chainId: number;
|
@@ -52,6 +52,7 @@ export class RfxProcessor extends GenericProcessor {
|
|
52
52
|
}
|
53
53
|
const priceTargetToken = tvl / BN2Number(typeInfo.totalSupply, Number(typeInfo.decimalsToken));
|
54
54
|
return {
|
55
|
+
...typeInfo,
|
55
56
|
tokenAddress: typeInfo.tokenAddress,
|
56
57
|
totalSupply,
|
57
58
|
whitelistedSupplyTargetToken,
|
@@ -13,13 +13,13 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
13
13
|
macroFn: {};
|
14
14
|
}, {
|
15
15
|
campaigns: {
|
16
|
-
|
16
|
+
engine: {
|
17
17
|
post: {
|
18
18
|
body: {
|
19
19
|
tags?: string[] | undefined;
|
20
20
|
identifier?: string | undefined;
|
21
21
|
subType?: number | undefined;
|
22
|
-
type:
|
22
|
+
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER";
|
23
23
|
params: string;
|
24
24
|
creator: string;
|
25
25
|
chainId: number;
|
@@ -7,7 +7,7 @@ import { CampaignService } from "./campaign.service";
|
|
7
7
|
// ─── Campaigns Controller ────────────────────────────────────────────────────
|
8
8
|
export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { tags: ["Campaigns"] } })
|
9
9
|
// ─── Create A Campaign ───────────────────────────────────────────────
|
10
|
-
.post("/", async ({ body }) => await CampaignService.create(body), {
|
10
|
+
.post("/engine", async ({ body }) => await CampaignService.create(body), {
|
11
11
|
beforeHandle: EngineGuard,
|
12
12
|
headers: AuthorizationHeadersDto,
|
13
13
|
body: CreateCampaignDto,
|
@@ -92,7 +92,24 @@ export declare const CreateCampaignDto: import("@sinclair/typebox").TObject<{
|
|
92
92
|
campaignId: import("@sinclair/typebox").TString;
|
93
93
|
identifier: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
94
94
|
creator: import("@sinclair/typebox").TString;
|
95
|
-
type: import("@sinclair/typebox").
|
95
|
+
type: import("@sinclair/typebox").TEnum<{
|
96
|
+
INVALID: "INVALID";
|
97
|
+
ERC20: "ERC20";
|
98
|
+
CLAMM: "CLAMM";
|
99
|
+
ERC20_SNAPSHOT: "ERC20_SNAPSHOT";
|
100
|
+
JSON_AIRDROP: "JSON_AIRDROP";
|
101
|
+
SILO: "SILO";
|
102
|
+
RADIANT: "RADIANT";
|
103
|
+
MORPHO: "MORPHO";
|
104
|
+
DOLOMITE: "DOLOMITE";
|
105
|
+
BADGER: "BADGER";
|
106
|
+
COMPOUND: "COMPOUND";
|
107
|
+
AJNA: "AJNA";
|
108
|
+
EULER: "EULER";
|
109
|
+
UNISWAP_V4: "UNISWAP_V4";
|
110
|
+
ION: "ION";
|
111
|
+
EIGENLAYER: "EIGENLAYER";
|
112
|
+
}>;
|
96
113
|
subType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
97
114
|
rewardTokenAddress: import("@sinclair/typebox").TString;
|
98
115
|
amount: import("@sinclair/typebox").TString;
|
@@ -53,7 +53,7 @@ export const CreateCampaignDto = t.Object({
|
|
53
53
|
campaignId: t.String(),
|
54
54
|
identifier: t.Optional(t.String()),
|
55
55
|
creator: t.String(),
|
56
|
-
type: t.
|
56
|
+
type: t.Enum(CampaignType),
|
57
57
|
subType: t.Optional(t.Number()),
|
58
58
|
rewardTokenAddress: t.String(),
|
59
59
|
amount: t.String(),
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import type { CampaignUnique, CreateCampaignModel, GetCampaignQueryModel } from "./";
|
2
2
|
import { Prisma } from "../../../../database/api/.generated";
|
3
3
|
import { type ChainId } from "@sdk";
|
4
|
-
import { type OpportunityMetadata } from "../opportunity";
|
5
4
|
export declare abstract class CampaignRepository {
|
6
5
|
#private;
|
7
|
-
static upsert(campaign: CreateCampaignModel
|
6
|
+
static upsert(campaign: CreateCampaignModel): Promise<{
|
8
7
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
9
8
|
id: string;
|
10
9
|
params: Prisma.JsonValue;
|
@@ -19,7 +18,7 @@ export declare abstract class CampaignRepository {
|
|
19
18
|
opportunityId: string;
|
20
19
|
creatorAddress: string;
|
21
20
|
} | undefined>;
|
22
|
-
static upsertMany(campaigns: CreateCampaignModel[]
|
21
|
+
static upsertMany(campaigns: CreateCampaignModel[]): Promise<{
|
23
22
|
success: number;
|
24
23
|
fail: number;
|
25
24
|
}>;
|
@@ -2,7 +2,7 @@ import { CampaignService } from "./";
|
|
2
2
|
import { log } from "../../../utils/logger";
|
3
3
|
import { apiDbClient, engineDbClient } from "../../../utils/prisma";
|
4
4
|
import { ALL_CAMPAIGNS_FOR_CHAIN_AFTER } from "../../../utils/queries/allCampaigns";
|
5
|
-
import { Prisma, RunStatus
|
5
|
+
import { Prisma, RunStatus } from "../../../../database/api/.generated";
|
6
6
|
import { MAX_COMPUTE_JOB_TIME, WEEK } from "@sdk";
|
7
7
|
import moment from "moment";
|
8
8
|
import { OpportunityService } from "../opportunity";
|
@@ -43,27 +43,19 @@ export class CampaignRepository {
|
|
43
43
|
};
|
44
44
|
}
|
45
45
|
// ─── Public Methods ──────────────────────────────────────────────────
|
46
|
-
static async upsert(campaign
|
47
|
-
const campaignType = CampaignService.getTypeFromV3(campaign.type);
|
46
|
+
static async upsert(campaign) {
|
48
47
|
try {
|
49
|
-
let tokens = await TokenService.getManyOrCreate(metadata.tokens);
|
50
48
|
const [rewardToken] = await TokenService.getManyOrCreate([
|
51
49
|
{ chainId: campaign.chainId, address: campaign.rewardTokenAddress },
|
52
50
|
]);
|
53
51
|
if (!rewardToken) {
|
54
52
|
throw new Error(`unable to fetch data for token ${campaign.rewardTokenAddress}`);
|
55
53
|
}
|
56
|
-
tokens = tokens.filter(t => t !== undefined);
|
57
54
|
const params = JSON.parse(campaign.params);
|
58
55
|
const opportunityId = OpportunityService.hashId({
|
59
56
|
chainId: campaign.computeChainId,
|
60
57
|
identifier: campaign.opportunityIdentifier,
|
61
|
-
type:
|
62
|
-
});
|
63
|
-
const opportunityTokens = tokens.map(t => {
|
64
|
-
return {
|
65
|
-
chainId_address: { chainId: t.chainId, address: t.address }, //TODO: use id
|
66
|
-
};
|
58
|
+
type: campaign.type,
|
67
59
|
});
|
68
60
|
const data = {
|
69
61
|
id: campaign.id,
|
@@ -72,7 +64,7 @@ export class CampaignRepository {
|
|
72
64
|
endTimestamp: BigInt(campaign.endTimestamp),
|
73
65
|
params,
|
74
66
|
startTimestamp: BigInt(campaign.startTimestamp),
|
75
|
-
type:
|
67
|
+
type: campaign.type,
|
76
68
|
ComputeChain: {
|
77
69
|
connect: {
|
78
70
|
id: campaign.computeChainId,
|
@@ -87,28 +79,7 @@ export class CampaignRepository {
|
|
87
79
|
},
|
88
80
|
},
|
89
81
|
Opportunity: {
|
90
|
-
|
91
|
-
where: { id: opportunityId },
|
92
|
-
create: {
|
93
|
-
id: opportunityId,
|
94
|
-
Chain: { connect: { id: campaign.computeChainId } },
|
95
|
-
type: campaignType,
|
96
|
-
identifier: campaign.opportunityIdentifier, // mainParameter
|
97
|
-
name: metadata.name,
|
98
|
-
status: +campaign.startTimestamp >= new Date().getTime() * 1000
|
99
|
-
? Status.LIVE
|
100
|
-
: +campaign.endTimestamp < new Date().getTime() * 1000
|
101
|
-
? Status.PAST
|
102
|
-
: Status.SOON,
|
103
|
-
action: metadata.action,
|
104
|
-
Tokens: { connect: opportunityTokens },
|
105
|
-
MainProtocol: {
|
106
|
-
connect: metadata.mainProtocol && { id: metadata.mainProtocol },
|
107
|
-
},
|
108
|
-
depositUrl: !!params.url ? params.url : undefined,
|
109
|
-
tags: metadata.tags,
|
110
|
-
},
|
111
|
-
},
|
82
|
+
connect: { id: opportunityId },
|
112
83
|
},
|
113
84
|
RewardToken: {
|
114
85
|
connectOrCreate: { where: { id: rewardToken?.id }, create: rewardToken },
|
@@ -128,22 +99,16 @@ export class CampaignRepository {
|
|
128
99
|
log.error(`Failed to upsert campaign ${campaign.campaignId}`, err);
|
129
100
|
}
|
130
101
|
}
|
131
|
-
static async upsertMany(campaigns
|
102
|
+
static async upsertMany(campaigns) {
|
132
103
|
const data = [];
|
133
104
|
for (const campaign of campaigns) {
|
134
|
-
const campaignType = CampaignService.getTypeFromV3(campaign.type);
|
135
|
-
let tokens = await TokenService.getManyOrCreate(campaignToOpp[campaign.id].tokens);
|
136
105
|
const [rewardToken] = await TokenService.getManyOrCreate([
|
137
106
|
{ chainId: campaign.chainId, address: campaign.rewardTokenAddress },
|
138
107
|
]);
|
139
|
-
tokens = tokens.filter(t => t !== undefined);
|
140
108
|
const opportunityId = OpportunityService.hashId({
|
141
109
|
chainId: campaign.computeChainId,
|
142
110
|
identifier: campaign.opportunityIdentifier,
|
143
|
-
type:
|
144
|
-
});
|
145
|
-
const opportunityTokens = tokens.map(t => {
|
146
|
-
return { id: t?.id };
|
111
|
+
type: campaign.type,
|
147
112
|
});
|
148
113
|
data.push({
|
149
114
|
id: campaign.id,
|
@@ -152,7 +117,7 @@ export class CampaignRepository {
|
|
152
117
|
endTimestamp: BigInt(campaign.endTimestamp),
|
153
118
|
params: JSON.parse(campaign.params),
|
154
119
|
startTimestamp: BigInt(campaign.startTimestamp),
|
155
|
-
type:
|
120
|
+
type: campaign.type,
|
156
121
|
ComputeChain: {
|
157
122
|
connect: {
|
158
123
|
id: campaign.computeChainId,
|
@@ -165,33 +130,7 @@ export class CampaignRepository {
|
|
165
130
|
},
|
166
131
|
},
|
167
132
|
Opportunity: {
|
168
|
-
|
169
|
-
where: { id: opportunityId },
|
170
|
-
create: {
|
171
|
-
id: opportunityId,
|
172
|
-
Chain: {
|
173
|
-
connect: {
|
174
|
-
id: campaign.computeChainId,
|
175
|
-
},
|
176
|
-
},
|
177
|
-
type: campaignType,
|
178
|
-
identifier: campaign.opportunityIdentifier, // mainParameter
|
179
|
-
name: campaignToOpp[campaign.id].name,
|
180
|
-
status: +campaign.startTimestamp >= new Date().getTime() * 1000
|
181
|
-
? Status.LIVE
|
182
|
-
: +campaign.endTimestamp < new Date().getTime() * 1000
|
183
|
-
? Status.PAST
|
184
|
-
: Status.SOON,
|
185
|
-
action: campaignToOpp[campaign.id].action,
|
186
|
-
Tokens: { connect: opportunityTokens },
|
187
|
-
MainProtocol: {
|
188
|
-
connect: campaignToOpp[campaign.id].mainProtocol && {
|
189
|
-
id: campaignToOpp[campaign.id].mainProtocol,
|
190
|
-
},
|
191
|
-
},
|
192
|
-
tags: campaignToOpp[campaign.id].tags,
|
193
|
-
},
|
194
|
-
},
|
133
|
+
connect: { id: opportunityId },
|
195
134
|
},
|
196
135
|
RewardToken: {
|
197
136
|
connect: rewardToken ? { id: TokenService.hashId(rewardToken) } : undefined,
|
@@ -9,48 +9,31 @@ import { NETWORK_LABELS } from "@sdk";
|
|
9
9
|
import moment from "moment";
|
10
10
|
import { StatusService } from "../status";
|
11
11
|
import { TokenService } from "../token";
|
12
|
-
import { UserService } from "../user";
|
13
12
|
export class CampaignService {
|
14
13
|
static hashId(campaign) {
|
15
14
|
return Bun.hash(`${campaign.distributionChain}${campaign.campaignId}`).toString();
|
16
15
|
}
|
17
16
|
static async create(campaign) {
|
18
17
|
const id = CampaignService.hashId({ distributionChain: campaign.chainId, campaignId: campaign.campaignId });
|
19
|
-
|
20
|
-
|
21
|
-
...campaign,
|
22
|
-
});
|
23
|
-
opportunityMetadata.tags = [
|
24
|
-
...((await UserService.findUnique(campaign.creator))?.tags ?? []),
|
25
|
-
...(campaign?.tags ?? []),
|
26
|
-
];
|
27
|
-
return await CampaignRepository.upsert({ id, ...campaign }, opportunityMetadata);
|
18
|
+
await OpportunityService.createFromCampaign(campaign);
|
19
|
+
return await CampaignRepository.upsert({ id, ...campaign });
|
28
20
|
}
|
29
21
|
static async createMany(campaigns) {
|
30
|
-
const campaignToOppMetadata = {};
|
31
22
|
const failedToFetchMetadata = [];
|
32
23
|
const campaignsToInsert = [];
|
33
24
|
await Promise.all(campaigns.map(async (campaign) => {
|
34
25
|
const id = CampaignService.hashId({ distributionChain: campaign.chainId, campaignId: campaign.campaignId });
|
35
26
|
campaign.computeChainId = campaign.computeChainId === 0 ? campaign.chainId : campaign.computeChainId;
|
36
27
|
try {
|
37
|
-
|
38
|
-
id,
|
39
|
-
...campaign,
|
40
|
-
});
|
41
|
-
oppMetadata.tags = [
|
42
|
-
...((await UserService.findUnique(campaign.creator))?.tags ?? []),
|
43
|
-
...(campaign?.tags ?? []),
|
44
|
-
];
|
45
|
-
campaignToOppMetadata[id] = oppMetadata;
|
28
|
+
await OpportunityService.createFromCampaign(campaign);
|
46
29
|
campaignsToInsert.push({ id, ...campaign });
|
47
30
|
}
|
48
31
|
catch (err) {
|
49
|
-
log.error(`Cannot get Opportunity metadata for campaign ${campaign.campaignId} of type ${
|
32
|
+
log.error(`Cannot get Opportunity metadata for campaign ${campaign.campaignId} of type ${campaign.type}`, err);
|
50
33
|
failedToFetchMetadata.push(campaign);
|
51
34
|
}
|
52
35
|
}));
|
53
|
-
let { success, fail } = await CampaignRepository.upsertMany(campaignsToInsert
|
36
|
+
let { success, fail } = await CampaignRepository.upsertMany(campaignsToInsert);
|
54
37
|
fail += failedToFetchMetadata.length;
|
55
38
|
return { success, fail };
|
56
39
|
}
|
@@ -123,7 +106,7 @@ export class CampaignService {
|
|
123
106
|
params: JSON.stringify(campaign.campaignParameters),
|
124
107
|
rewardTokenAddress: campaign.rewardToken,
|
125
108
|
startTimestamp: campaign.startTimestamp.toString(),
|
126
|
-
type: campaign.campaignType,
|
109
|
+
type: CampaignService.getTypeFromV3(campaign.campaignType),
|
127
110
|
subType: campaign.campaignSubType,
|
128
111
|
};
|
129
112
|
}));
|