@merkl/api 0.10.393 → 0.10.396
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/database/api/.generated/drizzle/schema.d.ts +2806 -0
- package/dist/database/api/.generated/drizzle/schema.js +849 -0
- package/dist/database/api/.generated/drizzle/schema.ts +906 -0
- package/dist/database/api/.generated/edge.js +3 -7
- package/dist/database/api/.generated/index-browser.js +0 -4
- package/dist/database/api/.generated/index.d.ts +1 -99
- package/dist/database/api/.generated/index.js +3 -7
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +16 -13
- package/dist/database/api/.generated/wasm.js +0 -4
- package/dist/database/engine/.generated/edge.js +3 -7
- package/dist/database/engine/.generated/index-browser.js +0 -4
- package/dist/database/engine/.generated/index.d.ts +2 -218
- package/dist/database/engine/.generated/index.js +3 -7
- package/dist/database/engine/.generated/package.json +1 -1
- package/dist/database/engine/.generated/schema.prisma +6 -10
- package/dist/database/engine/.generated/wasm.js +0 -4
- package/dist/src/eden/index.d.ts +314 -78
- package/dist/src/index.d.ts +120 -26
- package/dist/src/jobs/etl/reward-breakdowns.js +0 -2
- package/dist/src/modules/v4/cache/cache.service.js +2 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +10 -10
- package/dist/src/modules/v4/campaign/campaign.repository.js +2 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +3 -2
- package/dist/src/modules/v4/campaign/campaign.service.js +9 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -3
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +5 -5
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +72 -72
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.controller.d.ts +109 -5
- package/dist/src/modules/v4/reward/reward.controller.js +29 -21
- package/dist/src/modules/v4/reward/reward.model.d.ts +5 -8
- package/dist/src/modules/v4/reward/reward.model.js +8 -6
- package/dist/src/modules/v4/reward/reward.repository.d.ts +12 -16
- package/dist/src/modules/v4/reward/reward.repository.js +13 -20
- package/dist/src/modules/v4/reward/reward.service.d.ts +10 -23
- package/dist/src/modules/v4/reward/reward.service.js +0 -2
- package/dist/src/modules/v4/reward/subservices/converter.js +0 -2
- package/dist/src/modules/v4/router.d.ts +120 -24
- package/dist/src/modules/v4/status/status.controller.d.ts +6 -6
- package/dist/src/modules/v4/status/status.repository.d.ts +6 -6
- package/dist/src/modules/v4/status/status.service.d.ts +6 -6
- package/dist/src/modules/v4/token/token.repository.d.ts +2 -2
- package/dist/src/modules/v4/token/token.service.d.ts +3 -4
- package/dist/src/modules/v4/token/token.service.js +2 -1
- package/dist/src/modules/v4/user/user.controller.d.ts +0 -8
- package/dist/src/modules/v4/user/user.model.d.ts +5 -2
- package/dist/src/modules/v4/user/user.model.js +4 -2
- package/dist/src/modules/v4/user/user.repository.d.ts +1 -1
- package/dist/src/modules/v4/user/user.service.d.ts +1 -1
- package/dist/src/routes/v3/rewards.d.ts +0 -2
- package/dist/src/routes/v3/router.d.ts +0 -2
- package/dist/src/utils/prisma.d.ts +16 -3
- package/dist/src/utils/prisma.js +2 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +4 -2
package/dist/src/index.d.ts
CHANGED
@@ -467,7 +467,6 @@ declare const app: Elysia<"", {
|
|
467
467
|
tags: string[];
|
468
468
|
icon: string;
|
469
469
|
} | null | undefined;
|
470
|
-
depositUrl?: string | undefined;
|
471
470
|
aprRecord?: {
|
472
471
|
timestamp: string | bigint;
|
473
472
|
cumulated: number;
|
@@ -479,6 +478,7 @@ declare const app: Elysia<"", {
|
|
479
478
|
aprRecordId: string;
|
480
479
|
}[];
|
481
480
|
} | undefined;
|
481
|
+
depositUrl?: string | undefined;
|
482
482
|
tvlRecord?: {
|
483
483
|
total: number;
|
484
484
|
timestamp: string | bigint;
|
@@ -600,7 +600,6 @@ declare const app: Elysia<"", {
|
|
600
600
|
tags: string[];
|
601
601
|
icon: string;
|
602
602
|
} | null | undefined;
|
603
|
-
depositUrl?: string | undefined;
|
604
603
|
aprRecord?: {
|
605
604
|
timestamp: string | bigint;
|
606
605
|
cumulated: number;
|
@@ -612,6 +611,7 @@ declare const app: Elysia<"", {
|
|
612
611
|
aprRecordId: string;
|
613
612
|
}[];
|
614
613
|
} | undefined;
|
614
|
+
depositUrl?: string | undefined;
|
615
615
|
tvlRecord?: {
|
616
616
|
total: number;
|
617
617
|
timestamp: string | bigint;
|
@@ -768,7 +768,6 @@ declare const app: Elysia<"", {
|
|
768
768
|
tags: string[];
|
769
769
|
icon: string;
|
770
770
|
} | null | undefined;
|
771
|
-
depositUrl?: string | undefined;
|
772
771
|
aprRecord?: {
|
773
772
|
timestamp: string | bigint;
|
774
773
|
cumulated: number;
|
@@ -780,6 +779,7 @@ declare const app: Elysia<"", {
|
|
780
779
|
aprRecordId: string;
|
781
780
|
}[];
|
782
781
|
} | undefined;
|
782
|
+
depositUrl?: string | undefined;
|
783
783
|
tvlRecord?: {
|
784
784
|
total: number;
|
785
785
|
timestamp: string | bigint;
|
@@ -1350,10 +1350,10 @@ declare const app: Elysia<"", {
|
|
1350
1350
|
response: {
|
1351
1351
|
200: {
|
1352
1352
|
endTimestamp: bigint;
|
1353
|
-
campaignId: string;
|
1354
1353
|
CampaignStatus: {
|
1355
1354
|
computedUntil: bigint;
|
1356
1355
|
}[];
|
1356
|
+
campaignId: string;
|
1357
1357
|
}[];
|
1358
1358
|
422: {
|
1359
1359
|
type: "validation";
|
@@ -2028,6 +2028,106 @@ declare const app: Elysia<"", {
|
|
2028
2028
|
};
|
2029
2029
|
};
|
2030
2030
|
};
|
2031
|
+
} & {
|
2032
|
+
campaign: {
|
2033
|
+
":campaignId": {
|
2034
|
+
index: {
|
2035
|
+
get: {
|
2036
|
+
body: unknown;
|
2037
|
+
params: {
|
2038
|
+
campaignId: string;
|
2039
|
+
};
|
2040
|
+
query: {
|
2041
|
+
items?: number | undefined;
|
2042
|
+
page?: number | undefined;
|
2043
|
+
};
|
2044
|
+
headers: unknown;
|
2045
|
+
response: {
|
2046
|
+
200: {
|
2047
|
+
amount: string;
|
2048
|
+
claimed: string;
|
2049
|
+
pending: string;
|
2050
|
+
recipient: string;
|
2051
|
+
}[];
|
2052
|
+
422: {
|
2053
|
+
type: "validation";
|
2054
|
+
on: string;
|
2055
|
+
summary?: string;
|
2056
|
+
message?: string;
|
2057
|
+
found?: unknown;
|
2058
|
+
property?: string;
|
2059
|
+
expected?: string;
|
2060
|
+
};
|
2061
|
+
};
|
2062
|
+
};
|
2063
|
+
};
|
2064
|
+
};
|
2065
|
+
};
|
2066
|
+
} & {
|
2067
|
+
campaign: {
|
2068
|
+
":campaignId": {
|
2069
|
+
total: {
|
2070
|
+
get: {
|
2071
|
+
body: unknown;
|
2072
|
+
params: {
|
2073
|
+
campaignId: string;
|
2074
|
+
};
|
2075
|
+
query: {
|
2076
|
+
items?: number | undefined;
|
2077
|
+
page?: number | undefined;
|
2078
|
+
};
|
2079
|
+
headers: unknown;
|
2080
|
+
response: {
|
2081
|
+
200: {
|
2082
|
+
tokenId: string;
|
2083
|
+
amount: bigint;
|
2084
|
+
};
|
2085
|
+
422: {
|
2086
|
+
type: "validation";
|
2087
|
+
on: string;
|
2088
|
+
summary?: string;
|
2089
|
+
message?: string;
|
2090
|
+
found?: unknown;
|
2091
|
+
property?: string;
|
2092
|
+
expected?: string;
|
2093
|
+
};
|
2094
|
+
};
|
2095
|
+
};
|
2096
|
+
};
|
2097
|
+
};
|
2098
|
+
};
|
2099
|
+
} & {
|
2100
|
+
campaign: {
|
2101
|
+
":campaignId": {
|
2102
|
+
count: {
|
2103
|
+
get: {
|
2104
|
+
body: unknown;
|
2105
|
+
params: {
|
2106
|
+
campaignId: string;
|
2107
|
+
};
|
2108
|
+
query: {
|
2109
|
+
items?: number | undefined;
|
2110
|
+
page?: number | undefined;
|
2111
|
+
};
|
2112
|
+
headers: unknown;
|
2113
|
+
response: {
|
2114
|
+
200: {
|
2115
|
+
count: number;
|
2116
|
+
};
|
2117
|
+
422: {
|
2118
|
+
type: "validation";
|
2119
|
+
on: string;
|
2120
|
+
summary?: string;
|
2121
|
+
message?: string;
|
2122
|
+
found?: unknown;
|
2123
|
+
property?: string;
|
2124
|
+
expected?: string;
|
2125
|
+
};
|
2126
|
+
};
|
2127
|
+
};
|
2128
|
+
};
|
2129
|
+
};
|
2130
|
+
};
|
2031
2131
|
} & {
|
2032
2132
|
token: {
|
2033
2133
|
index: {
|
@@ -2037,12 +2137,18 @@ declare const app: Elysia<"", {
|
|
2037
2137
|
query: {
|
2038
2138
|
items?: number | undefined;
|
2039
2139
|
page?: number | undefined;
|
2140
|
+
campaignIds?: string[] | undefined;
|
2040
2141
|
chainId: number;
|
2041
2142
|
address: string;
|
2042
2143
|
};
|
2043
2144
|
headers: unknown;
|
2044
2145
|
response: {
|
2045
|
-
200:
|
2146
|
+
200: {
|
2147
|
+
amount: string;
|
2148
|
+
claimed: string;
|
2149
|
+
pending: string;
|
2150
|
+
recipient: string;
|
2151
|
+
}[];
|
2046
2152
|
422: {
|
2047
2153
|
type: "validation";
|
2048
2154
|
on: string;
|
@@ -2065,6 +2171,7 @@ declare const app: Elysia<"", {
|
|
2065
2171
|
query: {
|
2066
2172
|
items?: number | undefined;
|
2067
2173
|
page?: number | undefined;
|
2174
|
+
campaignIds?: string[] | undefined;
|
2068
2175
|
chainId: number;
|
2069
2176
|
address: string;
|
2070
2177
|
};
|
@@ -2096,6 +2203,7 @@ declare const app: Elysia<"", {
|
|
2096
2203
|
query: {
|
2097
2204
|
items?: number | undefined;
|
2098
2205
|
page?: number | undefined;
|
2206
|
+
campaignIds?: string[] | undefined;
|
2099
2207
|
chainId: number;
|
2100
2208
|
address: string;
|
2101
2209
|
};
|
@@ -2164,8 +2272,6 @@ declare const app: Elysia<"", {
|
|
2164
2272
|
rewardToken: string;
|
2165
2273
|
breakdowns: {
|
2166
2274
|
protocolId?: string | undefined;
|
2167
|
-
auxiliaryData1?: string | undefined;
|
2168
|
-
auxiliaryData2?: string | undefined;
|
2169
2275
|
reason: string;
|
2170
2276
|
pending: string;
|
2171
2277
|
recipient: string;
|
@@ -2231,8 +2337,6 @@ declare const app: Elysia<"", {
|
|
2231
2337
|
post: {
|
2232
2338
|
body: {
|
2233
2339
|
data: {
|
2234
|
-
auxiliaryData1?: string | undefined;
|
2235
|
-
auxiliaryData2?: string | undefined;
|
2236
2340
|
reason: string;
|
2237
2341
|
pending: string;
|
2238
2342
|
recipient: string;
|
@@ -3011,8 +3115,6 @@ declare const app: Elysia<"", {
|
|
3011
3115
|
pending: string;
|
3012
3116
|
amount: string;
|
3013
3117
|
claimed: string;
|
3014
|
-
auxiliaryData1: string | null;
|
3015
|
-
auxiliaryData2: string | null;
|
3016
3118
|
}[];
|
3017
3119
|
claimed: bigint;
|
3018
3120
|
amount: bigint;
|
@@ -3026,8 +3128,6 @@ declare const app: Elysia<"", {
|
|
3026
3128
|
claimed: bigint;
|
3027
3129
|
amount: bigint;
|
3028
3130
|
pending: bigint;
|
3029
|
-
auxiliaryData1: string | null;
|
3030
|
-
auxiliaryData2: string | null;
|
3031
3131
|
}[];
|
3032
3132
|
})[];
|
3033
3133
|
distributor: string;
|
@@ -3137,8 +3237,6 @@ declare const app: Elysia<"", {
|
|
3137
3237
|
pending: string;
|
3138
3238
|
amount: string;
|
3139
3239
|
claimed: string;
|
3140
|
-
auxiliaryData1: string | null;
|
3141
|
-
auxiliaryData2: string | null;
|
3142
3240
|
}[];
|
3143
3241
|
claimed: bigint;
|
3144
3242
|
amount: bigint;
|
@@ -3153,8 +3251,6 @@ declare const app: Elysia<"", {
|
|
3153
3251
|
pending: string;
|
3154
3252
|
amount: string;
|
3155
3253
|
claimed: string;
|
3156
|
-
auxiliaryData1: string | null;
|
3157
|
-
auxiliaryData2: string | null;
|
3158
3254
|
}[];
|
3159
3255
|
})[];
|
3160
3256
|
})[];
|
@@ -3758,13 +3854,13 @@ declare const app: Elysia<"", {
|
|
3758
3854
|
chainId?: number | undefined;
|
3759
3855
|
startTimestamp?: string | undefined;
|
3760
3856
|
endTimestamp?: string | undefined;
|
3857
|
+
campaignStatus?: {} | undefined;
|
3761
3858
|
distributionChainId?: number | undefined;
|
3762
3859
|
campaignId?: string | undefined;
|
3763
3860
|
rewardTokenId?: string | undefined;
|
3764
3861
|
amount?: string | undefined;
|
3765
3862
|
opportunityId?: string | undefined;
|
3766
3863
|
creatorAddress?: string | undefined;
|
3767
|
-
campaignStatus?: {} | undefined;
|
3768
3864
|
rewardToken?: {} | undefined;
|
3769
3865
|
rewardTokenAddress?: string | undefined;
|
3770
3866
|
distributionChain?: {} | undefined;
|
@@ -3992,12 +4088,6 @@ declare const app: Elysia<"", {
|
|
3992
4088
|
delayFormatted: string;
|
3993
4089
|
startTimestamp: bigint;
|
3994
4090
|
endTimestamp: bigint;
|
3995
|
-
computeChainId: number;
|
3996
|
-
distributionChainId: number;
|
3997
|
-
campaignId: string;
|
3998
|
-
Opportunity: {
|
3999
|
-
name: string;
|
4000
|
-
};
|
4001
4091
|
CampaignStatus: {
|
4002
4092
|
error: string;
|
4003
4093
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
@@ -4006,6 +4096,12 @@ declare const app: Elysia<"", {
|
|
4006
4096
|
computedUntil: bigint;
|
4007
4097
|
processingStarted: bigint;
|
4008
4098
|
}[];
|
4099
|
+
Opportunity: {
|
4100
|
+
name: string;
|
4101
|
+
};
|
4102
|
+
computeChainId: number;
|
4103
|
+
distributionChainId: number;
|
4104
|
+
campaignId: string;
|
4009
4105
|
}[];
|
4010
4106
|
422: {
|
4011
4107
|
type: "validation";
|
@@ -5574,8 +5670,6 @@ declare const app: Elysia<"", {
|
|
5574
5670
|
token: string;
|
5575
5671
|
mainParameter: string;
|
5576
5672
|
decimals: number;
|
5577
|
-
auxiliaryData1: string;
|
5578
|
-
auxiliaryData2: string;
|
5579
5673
|
unclaimed: string;
|
5580
5674
|
accumulated: string;
|
5581
5675
|
};
|
@@ -56,8 +56,6 @@ const transform = (rewardBreakdowns) => {
|
|
56
56
|
amount: rewardBreakdown.amount,
|
57
57
|
claimed: rewardBreakdown.claimed,
|
58
58
|
pending: rewardBreakdown.pending,
|
59
|
-
auxiliaryData1: rewardBreakdown.auxiliaryData1 ?? "",
|
60
|
-
auxiliaryData2: rewardBreakdown.auxiliaryData2 ?? "",
|
61
59
|
});
|
62
60
|
}
|
63
61
|
return transformedRewardBreakdowns;
|
@@ -18,6 +18,8 @@ export class CacheService {
|
|
18
18
|
return JSON.parse(decoded);
|
19
19
|
}
|
20
20
|
static async wrap(ttl, fn, ...args) {
|
21
|
+
if (Bun.env.NODE_ENV === "local")
|
22
|
+
return (await fn(...args));
|
21
23
|
const key = CacheService.#hashKey(fn, args);
|
22
24
|
const cached = await CacheRepository.get(key);
|
23
25
|
if (cached !== null)
|
@@ -268,10 +268,10 @@ export declare const CampaignController: Elysia<"/campaigns", {
|
|
268
268
|
response: {
|
269
269
|
200: {
|
270
270
|
endTimestamp: bigint;
|
271
|
-
campaignId: string;
|
272
271
|
CampaignStatus: {
|
273
272
|
computedUntil: bigint;
|
274
273
|
}[];
|
274
|
+
campaignId: string;
|
275
275
|
}[];
|
276
276
|
422: {
|
277
277
|
type: "validation";
|
@@ -124,7 +124,7 @@ export declare abstract class CampaignRepository {
|
|
124
124
|
opportunityId: string;
|
125
125
|
creatorAddress: string;
|
126
126
|
} | null>;
|
127
|
-
static findUniqueOrThrow(
|
127
|
+
static findUniqueOrThrow(id: string): Promise<{
|
128
128
|
params: Prisma.JsonValue;
|
129
129
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
130
130
|
id: string;
|
@@ -141,12 +141,20 @@ export declare abstract class CampaignRepository {
|
|
141
141
|
}>;
|
142
142
|
static findCampaignsToProcess(distributionChainId: ChainId): Promise<{
|
143
143
|
endTimestamp: bigint;
|
144
|
-
campaignId: string;
|
145
144
|
CampaignStatus: {
|
146
145
|
computedUntil: bigint;
|
147
146
|
}[];
|
147
|
+
campaignId: string;
|
148
148
|
}[]>;
|
149
149
|
static findMany(query: GetCampaignQueryModel): Promise<({
|
150
|
+
CampaignStatus: {
|
151
|
+
error: string;
|
152
|
+
details: Prisma.JsonValue;
|
153
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
154
|
+
campaignId: string;
|
155
|
+
computedUntil: bigint;
|
156
|
+
processingStarted: bigint;
|
157
|
+
}[];
|
150
158
|
ComputeChain: {
|
151
159
|
name: string;
|
152
160
|
id: number;
|
@@ -170,14 +178,6 @@ export declare abstract class CampaignRepository {
|
|
170
178
|
isTest: boolean;
|
171
179
|
price: number | null;
|
172
180
|
};
|
173
|
-
CampaignStatus: {
|
174
|
-
error: string;
|
175
|
-
details: Prisma.JsonValue;
|
176
|
-
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
177
|
-
campaignId: string;
|
178
|
-
computedUntil: bigint;
|
179
|
-
processingStarted: bigint;
|
180
|
-
}[];
|
181
181
|
} & {
|
182
182
|
params: Prisma.JsonValue;
|
183
183
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
@@ -222,10 +222,10 @@ export class CampaignRepository {
|
|
222
222
|
},
|
223
223
|
});
|
224
224
|
}
|
225
|
-
static async findUniqueOrThrow(
|
225
|
+
static async findUniqueOrThrow(id) {
|
226
226
|
return await apiDbClient.campaign.findUniqueOrThrow({
|
227
227
|
where: {
|
228
|
-
id
|
228
|
+
id,
|
229
229
|
},
|
230
230
|
});
|
231
231
|
}
|
@@ -4,6 +4,7 @@ import type { CampaignType } from "../../../../database/api/.generated";
|
|
4
4
|
import { type CampaignParameters, type Campaign as CampaignTypeV3, type ChainId } from "@sdk";
|
5
5
|
export declare abstract class CampaignService {
|
6
6
|
static hashId(campaign: CampaignUnique): string;
|
7
|
+
static splitIdOrThrow(chainAndCampaignId: `${number}-${string}` | string): CampaignUnique;
|
7
8
|
static create(campaign: Omit<CreateCampaignModel, "id">): Promise<{
|
8
9
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
9
10
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
@@ -114,7 +115,7 @@ export declare abstract class CampaignService {
|
|
114
115
|
opportunityId: string;
|
115
116
|
creatorAddress: string;
|
116
117
|
} | null>;
|
117
|
-
static findUniqueOrThrow(campaign: CampaignUnique): Promise<{
|
118
|
+
static findUniqueOrThrow(campaign: CampaignUnique | string): Promise<{
|
118
119
|
params: import("database/api/.generated/runtime/library").JsonValue;
|
119
120
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
120
121
|
id: string;
|
@@ -131,10 +132,10 @@ export declare abstract class CampaignService {
|
|
131
132
|
}>;
|
132
133
|
static findCampaignsToProcess(distributionChainId: ChainId): Promise<{
|
133
134
|
endTimestamp: bigint;
|
134
|
-
campaignId: string;
|
135
135
|
CampaignStatus: {
|
136
136
|
computedUntil: bigint;
|
137
137
|
}[];
|
138
|
+
campaignId: string;
|
138
139
|
}[]>;
|
139
140
|
static pickCampaignToProcess(chainId: ChainId): Promise<string>;
|
140
141
|
static fill(campaigns: CampaignUnique[]): Promise<{
|
@@ -3,6 +3,7 @@ import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicDa
|
|
3
3
|
import { campaignTypeToEnumMap, } from "./";
|
4
4
|
import { CampaignRepository } from "./campaign.repository";
|
5
5
|
import { OpportunityService } from "../opportunity";
|
6
|
+
import { InvalidParameter } from "../../../utils/error";
|
6
7
|
import { executeSimple } from "../../../utils/execute";
|
7
8
|
import { log } from "../../../utils/logger";
|
8
9
|
import { NETWORK_LABELS, } from "@sdk";
|
@@ -15,6 +16,12 @@ export class CampaignService {
|
|
15
16
|
static hashId(campaign) {
|
16
17
|
return Bun.hash(`${campaign.distributionChain}${campaign.campaignId}`).toString();
|
17
18
|
}
|
19
|
+
static splitIdOrThrow(chainAndCampaignId) {
|
20
|
+
if (!chainAndCampaignId.includes("-"))
|
21
|
+
throw new InvalidParameter("Campaign id should be formatted as chainId-campaignId");
|
22
|
+
const [chainId, campaignId] = chainAndCampaignId.split("-");
|
23
|
+
return { distributionChain: +chainId, campaignId };
|
24
|
+
}
|
18
25
|
static async create(campaign) {
|
19
26
|
const id = CampaignService.hashId({ distributionChain: campaign.chainId, campaignId: campaign.campaignId });
|
20
27
|
await OpportunityService.createFromCampaign(campaign);
|
@@ -140,7 +147,8 @@ export class CampaignService {
|
|
140
147
|
return await CampaignRepository.findUnique(campaign);
|
141
148
|
}
|
142
149
|
static async findUniqueOrThrow(campaign) {
|
143
|
-
|
150
|
+
const id = typeof campaign === "string" ? campaign : CampaignService.hashId(campaign);
|
151
|
+
return await CampaignRepository.findUniqueOrThrow(id);
|
144
152
|
}
|
145
153
|
static async findCampaignsToProcess(distributionChainId) {
|
146
154
|
return (await CampaignRepository.findCampaignsToProcess(distributionChainId)).filter(campaign => campaign.endTimestamp > campaign?.CampaignStatus?.[0]?.computedUntil);
|
@@ -61,13 +61,13 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", {
|
|
61
61
|
chainId?: number | undefined;
|
62
62
|
startTimestamp?: string | undefined;
|
63
63
|
endTimestamp?: string | undefined;
|
64
|
+
campaignStatus?: {} | undefined;
|
64
65
|
distributionChainId?: number | undefined;
|
65
66
|
campaignId?: string | undefined;
|
66
67
|
rewardTokenId?: string | undefined;
|
67
68
|
amount?: string | undefined;
|
68
69
|
opportunityId?: string | undefined;
|
69
70
|
creatorAddress?: string | undefined;
|
70
|
-
campaignStatus?: {} | undefined;
|
71
71
|
rewardToken?: {} | undefined;
|
72
72
|
rewardTokenAddress?: string | undefined;
|
73
73
|
distributionChain?: {} | undefined;
|
@@ -303,7 +303,6 @@ export declare const OpportunityController: Elysia<"/opportunities", {
|
|
303
303
|
tags: string[];
|
304
304
|
icon: string;
|
305
305
|
} | null | undefined;
|
306
|
-
depositUrl?: string | undefined;
|
307
306
|
aprRecord?: {
|
308
307
|
timestamp: string | bigint;
|
309
308
|
cumulated: number;
|
@@ -315,6 +314,7 @@ export declare const OpportunityController: Elysia<"/opportunities", {
|
|
315
314
|
aprRecordId: string;
|
316
315
|
}[];
|
317
316
|
} | undefined;
|
317
|
+
depositUrl?: string | undefined;
|
318
318
|
tvlRecord?: {
|
319
319
|
total: number;
|
320
320
|
timestamp: string | bigint;
|
@@ -436,7 +436,6 @@ export declare const OpportunityController: Elysia<"/opportunities", {
|
|
436
436
|
tags: string[];
|
437
437
|
icon: string;
|
438
438
|
} | null | undefined;
|
439
|
-
depositUrl?: string | undefined;
|
440
439
|
aprRecord?: {
|
441
440
|
timestamp: string | bigint;
|
442
441
|
cumulated: number;
|
@@ -448,6 +447,7 @@ export declare const OpportunityController: Elysia<"/opportunities", {
|
|
448
447
|
aprRecordId: string;
|
449
448
|
}[];
|
450
449
|
} | undefined;
|
450
|
+
depositUrl?: string | undefined;
|
451
451
|
tvlRecord?: {
|
452
452
|
total: number;
|
453
453
|
timestamp: string | bigint;
|
@@ -604,7 +604,6 @@ export declare const OpportunityController: Elysia<"/opportunities", {
|
|
604
604
|
tags: string[];
|
605
605
|
icon: string;
|
606
606
|
} | null | undefined;
|
607
|
-
depositUrl?: string | undefined;
|
608
607
|
aprRecord?: {
|
609
608
|
timestamp: string | bigint;
|
610
609
|
cumulated: number;
|
@@ -616,6 +615,7 @@ export declare const OpportunityController: Elysia<"/opportunities", {
|
|
616
615
|
aprRecordId: string;
|
617
616
|
}[];
|
618
617
|
} | undefined;
|
618
|
+
depositUrl?: string | undefined;
|
619
619
|
tvlRecord?: {
|
620
620
|
total: number;
|
621
621
|
timestamp: string | bigint;
|
@@ -165,11 +165,6 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
165
165
|
icon: import("@sinclair/typebox").TString;
|
166
166
|
}>;
|
167
167
|
chainId: import("@sinclair/typebox").TNumber;
|
168
|
-
action: import("@sinclair/typebox").TString;
|
169
|
-
depositUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
170
|
-
tvl: import("@sinclair/typebox").TNumber;
|
171
|
-
apr: import("@sinclair/typebox").TNumber;
|
172
|
-
dailyRewards: import("@sinclair/typebox").TNumber;
|
173
168
|
aprRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
174
169
|
cumulated: import("@sinclair/typebox").TNumber;
|
175
170
|
timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
@@ -185,6 +180,11 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
185
180
|
aprRecordId: import("@sinclair/typebox").TString;
|
186
181
|
}>>;
|
187
182
|
}>>;
|
183
|
+
action: import("@sinclair/typebox").TString;
|
184
|
+
depositUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
185
|
+
tvl: import("@sinclair/typebox").TNumber;
|
186
|
+
apr: import("@sinclair/typebox").TNumber;
|
187
|
+
dailyRewards: import("@sinclair/typebox").TNumber;
|
188
188
|
tvlRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
189
189
|
total: import("@sinclair/typebox").TNumber;
|
190
190
|
timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|