@merkl/api 0.17.42 → 0.18.1
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 +120 -5
- package/dist/src/errors/VoidString.error.d.ts +4 -0
- package/dist/src/errors/VoidString.error.js +7 -0
- package/dist/src/factories/metadataFactory/factory.js +2 -1
- package/dist/src/factories/metadataFactory/implementations/{UniswapV4Metadata.js → UniswapV4.js} +1 -1
- package/dist/src/index.d.ts +28 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +7 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +7 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +28 -0
- package/dist/src/modules/v4/router.d.ts +28 -1
- package/dist/src/modules/v4/status/status.controller.d.ts +20 -0
- package/dist/src/modules/v4/status/status.controller.js +11 -1
- package/dist/src/modules/v4/status/status.model.d.ts +3 -0
- package/dist/src/modules/v4/status/status.model.js +1 -0
- package/dist/src/modules/v4/status/status.repository.d.ts +8 -0
- package/dist/src/modules/v4/status/status.repository.js +12 -2
- package/dist/src/modules/v4/status/status.service.d.ts +1 -0
- package/dist/src/modules/v4/status/status.service.js +13 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/modules/v4/status/index.d.ts +0 -2
- package/dist/src/modules/v4/status/index.js +0 -2
- /package/dist/src/factories/metadataFactory/implementations/{UniswapV4Metadata.d.ts → UniswapV4.d.ts} +0 -0
package/dist/src/eden/index.d.ts
CHANGED
@@ -616,6 +616,13 @@ declare const eden: {
|
|
616
616
|
price?: number | null | undefined;
|
617
617
|
})[];
|
618
618
|
chain: {
|
619
|
+
Explorer: {
|
620
|
+
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
621
|
+
url: string;
|
622
|
+
id: string;
|
623
|
+
chainId: number;
|
624
|
+
}[];
|
625
|
+
} & {
|
619
626
|
name: string;
|
620
627
|
id: number;
|
621
628
|
icon: string;
|
@@ -2935,6 +2942,21 @@ declare const eden: {
|
|
2935
2942
|
}>>;
|
2936
2943
|
};
|
2937
2944
|
};
|
2945
|
+
error: ((params: {
|
2946
|
+
campaignId: string | number;
|
2947
|
+
}) => {
|
2948
|
+
put: (body: {
|
2949
|
+
error: string;
|
2950
|
+
}, options: {
|
2951
|
+
headers: {
|
2952
|
+
authorization: string;
|
2953
|
+
};
|
2954
|
+
query?: Record<string, unknown> | undefined;
|
2955
|
+
fetch?: RequestInit | undefined;
|
2956
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
2957
|
+
200: void;
|
2958
|
+
}>>;
|
2959
|
+
}) & {};
|
2938
2960
|
index: {
|
2939
2961
|
get: (options: {
|
2940
2962
|
headers?: Record<string, unknown> | undefined;
|
@@ -3012,7 +3034,7 @@ declare const eden: {
|
|
3012
3034
|
endOfDisputePeriod: number;
|
3013
3035
|
disputer: string;
|
3014
3036
|
liveCampaigns: number;
|
3015
|
-
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService["findManyDelay"]>>;
|
3037
|
+
delayed: Awaited<ReturnType<typeof import("../modules/v4/status/status.service").StatusService["findManyDelay"]>>;
|
3016
3038
|
};
|
3017
3039
|
};
|
3018
3040
|
}>>;
|
@@ -4033,6 +4055,13 @@ declare const eden: {
|
|
4033
4055
|
price?: number | null | undefined;
|
4034
4056
|
})[];
|
4035
4057
|
chain: {
|
4058
|
+
Explorer: {
|
4059
|
+
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
4060
|
+
url: string;
|
4061
|
+
id: string;
|
4062
|
+
chainId: number;
|
4063
|
+
}[];
|
4064
|
+
} & {
|
4036
4065
|
name: string;
|
4037
4066
|
id: number;
|
4038
4067
|
icon: string;
|
@@ -6352,6 +6381,21 @@ declare const eden: {
|
|
6352
6381
|
}>>;
|
6353
6382
|
};
|
6354
6383
|
};
|
6384
|
+
error: ((params: {
|
6385
|
+
campaignId: string | number;
|
6386
|
+
}) => {
|
6387
|
+
put: (body: {
|
6388
|
+
error: string;
|
6389
|
+
}, options: {
|
6390
|
+
headers: {
|
6391
|
+
authorization: string;
|
6392
|
+
};
|
6393
|
+
query?: Record<string, unknown> | undefined;
|
6394
|
+
fetch?: RequestInit | undefined;
|
6395
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6396
|
+
200: void;
|
6397
|
+
}>>;
|
6398
|
+
}) & {};
|
6355
6399
|
index: {
|
6356
6400
|
get: (options: {
|
6357
6401
|
headers?: Record<string, unknown> | undefined;
|
@@ -6429,7 +6473,7 @@ declare const eden: {
|
|
6429
6473
|
endOfDisputePeriod: number;
|
6430
6474
|
disputer: string;
|
6431
6475
|
liveCampaigns: number;
|
6432
|
-
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService["findManyDelay"]>>;
|
6476
|
+
delayed: Awaited<ReturnType<typeof import("../modules/v4/status/status.service").StatusService["findManyDelay"]>>;
|
6433
6477
|
};
|
6434
6478
|
};
|
6435
6479
|
}>>;
|
@@ -7911,6 +7955,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7911
7955
|
price?: number | null | undefined;
|
7912
7956
|
})[];
|
7913
7957
|
chain: {
|
7958
|
+
Explorer: {
|
7959
|
+
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
7960
|
+
url: string;
|
7961
|
+
id: string;
|
7962
|
+
chainId: number;
|
7963
|
+
}[];
|
7964
|
+
} & {
|
7914
7965
|
name: string;
|
7915
7966
|
id: number;
|
7916
7967
|
icon: string;
|
@@ -11018,6 +11069,26 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
11018
11069
|
};
|
11019
11070
|
};
|
11020
11071
|
};
|
11072
|
+
} & {
|
11073
|
+
error: {
|
11074
|
+
":campaignId": {
|
11075
|
+
put: {
|
11076
|
+
body: {
|
11077
|
+
error: string;
|
11078
|
+
};
|
11079
|
+
params: {
|
11080
|
+
campaignId: string;
|
11081
|
+
};
|
11082
|
+
query: unknown;
|
11083
|
+
headers: {
|
11084
|
+
authorization: string;
|
11085
|
+
};
|
11086
|
+
response: {
|
11087
|
+
200: void;
|
11088
|
+
};
|
11089
|
+
};
|
11090
|
+
};
|
11091
|
+
};
|
11021
11092
|
} & {
|
11022
11093
|
engine: {
|
11023
11094
|
overlaps: {
|
@@ -11152,7 +11223,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
11152
11223
|
endOfDisputePeriod: number;
|
11153
11224
|
disputer: string;
|
11154
11225
|
liveCampaigns: number;
|
11155
|
-
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService["findManyDelay"]>>;
|
11226
|
+
delayed: Awaited<ReturnType<typeof import("../modules/v4/status/status.service").StatusService["findManyDelay"]>>;
|
11156
11227
|
};
|
11157
11228
|
};
|
11158
11229
|
};
|
@@ -13150,6 +13221,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13150
13221
|
price?: number | null | undefined;
|
13151
13222
|
})[];
|
13152
13223
|
chain: {
|
13224
|
+
Explorer: {
|
13225
|
+
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
13226
|
+
url: string;
|
13227
|
+
id: string;
|
13228
|
+
chainId: number;
|
13229
|
+
}[];
|
13230
|
+
} & {
|
13153
13231
|
name: string;
|
13154
13232
|
id: number;
|
13155
13233
|
icon: string;
|
@@ -15469,6 +15547,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
15469
15547
|
}>>;
|
15470
15548
|
};
|
15471
15549
|
};
|
15550
|
+
error: ((params: {
|
15551
|
+
campaignId: string | number;
|
15552
|
+
}) => {
|
15553
|
+
put: (body: {
|
15554
|
+
error: string;
|
15555
|
+
}, options: {
|
15556
|
+
headers: {
|
15557
|
+
authorization: string;
|
15558
|
+
};
|
15559
|
+
query?: Record<string, unknown> | undefined;
|
15560
|
+
fetch?: RequestInit | undefined;
|
15561
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
15562
|
+
200: void;
|
15563
|
+
}>>;
|
15564
|
+
}) & {};
|
15472
15565
|
index: {
|
15473
15566
|
get: (options: {
|
15474
15567
|
headers?: Record<string, unknown> | undefined;
|
@@ -15546,7 +15639,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
15546
15639
|
endOfDisputePeriod: number;
|
15547
15640
|
disputer: string;
|
15548
15641
|
liveCampaigns: number;
|
15549
|
-
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService["findManyDelay"]>>;
|
15642
|
+
delayed: Awaited<ReturnType<typeof import("../modules/v4/status/status.service").StatusService["findManyDelay"]>>;
|
15550
15643
|
};
|
15551
15644
|
};
|
15552
15645
|
}>>;
|
@@ -16567,6 +16660,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
16567
16660
|
price?: number | null | undefined;
|
16568
16661
|
})[];
|
16569
16662
|
chain: {
|
16663
|
+
Explorer: {
|
16664
|
+
type: import("../../database/api/.generated").$Enums.ExplorerType;
|
16665
|
+
url: string;
|
16666
|
+
id: string;
|
16667
|
+
chainId: number;
|
16668
|
+
}[];
|
16669
|
+
} & {
|
16570
16670
|
name: string;
|
16571
16671
|
id: number;
|
16572
16672
|
icon: string;
|
@@ -18886,6 +18986,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
18886
18986
|
}>>;
|
18887
18987
|
};
|
18888
18988
|
};
|
18989
|
+
error: ((params: {
|
18990
|
+
campaignId: string | number;
|
18991
|
+
}) => {
|
18992
|
+
put: (body: {
|
18993
|
+
error: string;
|
18994
|
+
}, options: {
|
18995
|
+
headers: {
|
18996
|
+
authorization: string;
|
18997
|
+
};
|
18998
|
+
query?: Record<string, unknown> | undefined;
|
18999
|
+
fetch?: RequestInit | undefined;
|
19000
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
19001
|
+
200: void;
|
19002
|
+
}>>;
|
19003
|
+
}) & {};
|
18889
19004
|
index: {
|
18890
19005
|
get: (options: {
|
18891
19006
|
headers?: Record<string, unknown> | undefined;
|
@@ -18963,7 +19078,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
18963
19078
|
endOfDisputePeriod: number;
|
18964
19079
|
disputer: string;
|
18965
19080
|
liveCampaigns: number;
|
18966
|
-
delayed: Awaited<ReturnType<typeof import("../modules/v4/status").StatusService["findManyDelay"]>>;
|
19081
|
+
delayed: Awaited<ReturnType<typeof import("../modules/v4/status/status.service").StatusService["findManyDelay"]>>;
|
18967
19082
|
};
|
18968
19083
|
};
|
18969
19084
|
}>>;
|
@@ -18,7 +18,7 @@ import { JsonAirdropMetadata } from "./implementations/JsonAirdrop";
|
|
18
18
|
import { MorphoMetadata } from "./implementations/Morpho";
|
19
19
|
import { RadiantMetadata } from "./implementations/Radiant";
|
20
20
|
import { SiloMetadata } from "./implementations/Silo";
|
21
|
-
import { UniswapV4Metadata } from "./implementations/
|
21
|
+
import { UniswapV4Metadata } from "./implementations/UniswapV4";
|
22
22
|
import { VestMetadata } from "./implementations/Vest";
|
23
23
|
// @dev Casts are made to enforce type safety
|
24
24
|
// @dev A type error must be thrown if a new campaign type is added and the corresponding metadata builder is not implemented
|
@@ -52,5 +52,6 @@ const map = {
|
|
52
52
|
[Campaign.AMBIENTPROCESSOR]: new AmbientMetadata(),
|
53
53
|
[Campaign.ENCOMPASSING]: new EncompassingMetadata(),
|
54
54
|
[Campaign.EVENT_BASED]: new EventBasedMetadata(),
|
55
|
+
[Campaign.ERC20REBASEFIXAPR]: new Erc20Metadata(),
|
55
56
|
};
|
56
57
|
export const metadataBuilderFactory = (campaignType) => map[campaignType];
|
package/dist/src/factories/metadataFactory/implementations/{UniswapV4Metadata.js → UniswapV4.js}
RENAMED
@@ -16,7 +16,7 @@ export class UniswapV4Metadata {
|
|
16
16
|
// }
|
17
17
|
// }
|
18
18
|
return {
|
19
|
-
name: `Provide liquidity to ${whitelistNameString} UniswapV4 ${params.symbolCurrency0}-${params.symbolCurrency1}${params.lpFee ? ` ${params.lpFee}%` : ""}`,
|
19
|
+
name: `Provide liquidity to ${whitelistNameString} UniswapV4 ${params.symbolCurrency0}-${params.symbolCurrency1}${params.lpFee ? ` ${params.lpFee / 10_000}%` : ""}`,
|
20
20
|
action: OpportunityAction.POOL,
|
21
21
|
tokens: [
|
22
22
|
{ chainId: computeChainId, address: params.currency0 },
|
package/dist/src/index.d.ts
CHANGED
@@ -408,6 +408,13 @@ declare const app: Elysia<"", false, {
|
|
408
408
|
price?: number | null | undefined;
|
409
409
|
})[];
|
410
410
|
chain: {
|
411
|
+
Explorer: {
|
412
|
+
type: import("../database/api/.generated").$Enums.ExplorerType;
|
413
|
+
url: string;
|
414
|
+
id: string;
|
415
|
+
chainId: number;
|
416
|
+
}[];
|
417
|
+
} & {
|
411
418
|
name: string;
|
412
419
|
id: number;
|
413
420
|
icon: string;
|
@@ -3515,6 +3522,26 @@ declare const app: Elysia<"", false, {
|
|
3515
3522
|
};
|
3516
3523
|
};
|
3517
3524
|
};
|
3525
|
+
} & {
|
3526
|
+
error: {
|
3527
|
+
":campaignId": {
|
3528
|
+
put: {
|
3529
|
+
body: {
|
3530
|
+
error: string;
|
3531
|
+
};
|
3532
|
+
params: {
|
3533
|
+
campaignId: string;
|
3534
|
+
};
|
3535
|
+
query: unknown;
|
3536
|
+
headers: {
|
3537
|
+
authorization: string;
|
3538
|
+
};
|
3539
|
+
response: {
|
3540
|
+
200: void;
|
3541
|
+
};
|
3542
|
+
};
|
3543
|
+
};
|
3544
|
+
};
|
3518
3545
|
} & {
|
3519
3546
|
engine: {
|
3520
3547
|
overlaps: {
|
@@ -3649,7 +3676,7 @@ declare const app: Elysia<"", false, {
|
|
3649
3676
|
endOfDisputePeriod: number;
|
3650
3677
|
disputer: string;
|
3651
3678
|
liveCampaigns: number;
|
3652
|
-
delayed: Awaited<ReturnType<typeof import("./modules/v4/status").StatusService["findManyDelay"]>>;
|
3679
|
+
delayed: Awaited<ReturnType<typeof import("./modules/v4/status/status.service").StatusService["findManyDelay"]>>;
|
3653
3680
|
};
|
3654
3681
|
};
|
3655
3682
|
};
|
@@ -263,6 +263,13 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
263
263
|
price?: number | null | undefined;
|
264
264
|
})[];
|
265
265
|
chain: {
|
266
|
+
Explorer: {
|
267
|
+
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
268
|
+
url: string;
|
269
|
+
id: string;
|
270
|
+
chainId: number;
|
271
|
+
}[];
|
272
|
+
} & {
|
266
273
|
name: string;
|
267
274
|
id: number;
|
268
275
|
icon: string;
|
@@ -175,6 +175,13 @@ export declare abstract class OpportunityRepository {
|
|
175
175
|
}) | null>;
|
176
176
|
static findUniqueOrThrow(id: string, withTest?: boolean, withCampaigns?: boolean): Promise<{
|
177
177
|
Chain: {
|
178
|
+
Explorer: {
|
179
|
+
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
180
|
+
url: string;
|
181
|
+
id: string;
|
182
|
+
chainId: number;
|
183
|
+
}[];
|
184
|
+
} & {
|
178
185
|
name: string;
|
179
186
|
id: number;
|
180
187
|
icon: string;
|
@@ -197,7 +197,7 @@ export class OpportunityRepository {
|
|
197
197
|
include: {
|
198
198
|
...OpportunityRepository.#getRecordInclusion(withTest),
|
199
199
|
Campaigns: withCampaigns ? OpportunityRepository.#getCampaignInclusion(withTest) : undefined,
|
200
|
-
Chain: true,
|
200
|
+
Chain: { include: { Explorer: true } },
|
201
201
|
MainProtocol: true,
|
202
202
|
Protocols: true,
|
203
203
|
Tokens: {
|
@@ -551,6 +551,13 @@ export declare abstract class OpportunityService {
|
|
551
551
|
price?: number | null | undefined;
|
552
552
|
})[];
|
553
553
|
chain: {
|
554
|
+
Explorer: {
|
555
|
+
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
556
|
+
url: string;
|
557
|
+
id: string;
|
558
|
+
chainId: number;
|
559
|
+
}[];
|
560
|
+
} & {
|
554
561
|
name: string;
|
555
562
|
id: number;
|
556
563
|
icon: string;
|
@@ -716,6 +723,13 @@ export declare abstract class OpportunityService {
|
|
716
723
|
price?: number | null | undefined;
|
717
724
|
})[];
|
718
725
|
chain: {
|
726
|
+
Explorer: {
|
727
|
+
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
728
|
+
url: string;
|
729
|
+
id: string;
|
730
|
+
chainId: number;
|
731
|
+
}[];
|
732
|
+
} & {
|
719
733
|
name: string;
|
720
734
|
id: number;
|
721
735
|
icon: string;
|
@@ -877,6 +891,13 @@ export declare abstract class OpportunityService {
|
|
877
891
|
price?: number | null | undefined;
|
878
892
|
})[];
|
879
893
|
chain: {
|
894
|
+
Explorer: {
|
895
|
+
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
896
|
+
url: string;
|
897
|
+
id: string;
|
898
|
+
chainId: number;
|
899
|
+
}[];
|
900
|
+
} & {
|
880
901
|
name: string;
|
881
902
|
id: number;
|
882
903
|
icon: string;
|
@@ -917,6 +938,13 @@ export declare abstract class OpportunityService {
|
|
917
938
|
price?: number | null | undefined;
|
918
939
|
})[];
|
919
940
|
chain: {
|
941
|
+
Explorer: {
|
942
|
+
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
943
|
+
url: string;
|
944
|
+
id: string;
|
945
|
+
chainId: number;
|
946
|
+
}[];
|
947
|
+
} & {
|
920
948
|
name: string;
|
921
949
|
id: number;
|
922
950
|
icon: string;
|
@@ -278,6 +278,13 @@ export declare const v4: Elysia<"/v4", false, {
|
|
278
278
|
price?: number | null | undefined;
|
279
279
|
})[];
|
280
280
|
chain: {
|
281
|
+
Explorer: {
|
282
|
+
type: import("../../../database/api/.generated").$Enums.ExplorerType;
|
283
|
+
url: string;
|
284
|
+
id: string;
|
285
|
+
chainId: number;
|
286
|
+
}[];
|
287
|
+
} & {
|
281
288
|
name: string;
|
282
289
|
id: number;
|
283
290
|
icon: string;
|
@@ -3385,6 +3392,26 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3385
3392
|
};
|
3386
3393
|
};
|
3387
3394
|
};
|
3395
|
+
} & {
|
3396
|
+
error: {
|
3397
|
+
":campaignId": {
|
3398
|
+
put: {
|
3399
|
+
body: {
|
3400
|
+
error: string;
|
3401
|
+
};
|
3402
|
+
params: {
|
3403
|
+
campaignId: string;
|
3404
|
+
};
|
3405
|
+
query: unknown;
|
3406
|
+
headers: {
|
3407
|
+
authorization: string;
|
3408
|
+
};
|
3409
|
+
response: {
|
3410
|
+
200: void;
|
3411
|
+
};
|
3412
|
+
};
|
3413
|
+
};
|
3414
|
+
};
|
3388
3415
|
} & {
|
3389
3416
|
engine: {
|
3390
3417
|
overlaps: {
|
@@ -3519,7 +3546,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3519
3546
|
endOfDisputePeriod: number;
|
3520
3547
|
disputer: string;
|
3521
3548
|
liveCampaigns: number;
|
3522
|
-
delayed: Awaited<ReturnType<typeof import("./status").StatusService["findManyDelay"]>>;
|
3549
|
+
delayed: Awaited<ReturnType<typeof import("./status/status.service").StatusService["findManyDelay"]>>;
|
3523
3550
|
};
|
3524
3551
|
};
|
3525
3552
|
};
|
@@ -66,6 +66,26 @@ export declare const StatusController: Elysia<"/campaign-status", false, {
|
|
66
66
|
};
|
67
67
|
};
|
68
68
|
};
|
69
|
+
} & {
|
70
|
+
error: {
|
71
|
+
":campaignId": {
|
72
|
+
put: {
|
73
|
+
body: {
|
74
|
+
error: string;
|
75
|
+
};
|
76
|
+
params: {
|
77
|
+
campaignId: string;
|
78
|
+
};
|
79
|
+
query: unknown;
|
80
|
+
headers: {
|
81
|
+
authorization: string;
|
82
|
+
};
|
83
|
+
response: {
|
84
|
+
200: void;
|
85
|
+
};
|
86
|
+
};
|
87
|
+
};
|
88
|
+
};
|
69
89
|
} & {
|
70
90
|
engine: {
|
71
91
|
overlaps: {
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import { BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
1
2
|
import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
|
2
3
|
import { throwOnUnsupportedChainId } from "../../../utils/throw";
|
3
4
|
import Elysia from "elysia";
|
4
|
-
import { CampaignUniqueDto, ComputedUntilDto, DelayDto, QueryCampaignStatusDto, UpdateCampaignStatusDto, } from "./status.model";
|
5
|
+
import { CampaignUniqueDto, ComputedUntilDto, DelayDto, QueryCampaignStatusDto, StatusErrorDto, UpdateCampaignStatusDto, } from "./status.model";
|
5
6
|
import { StatusService } from "./status.service";
|
6
7
|
export const StatusController = new Elysia({ prefix: "/campaign-status", detail: { tags: ["Status"], hide: true } })
|
7
8
|
// ─── Update a Campaign Status ──────────────────────────────────────
|
@@ -21,6 +22,15 @@ export const StatusController = new Elysia({ prefix: "/campaign-status", detail:
|
|
21
22
|
beforeHandle: EngineGuard,
|
22
23
|
headers: AuthorizationHeadersDto,
|
23
24
|
body: ComputedUntilDto,
|
25
|
+
})
|
26
|
+
// ─── Updates only the computed until field ───────────────────────────
|
27
|
+
.put("/error/:campaignId", async ({ params, body }) => {
|
28
|
+
const [distributionChain, campaignId] = params.campaignId.split("-");
|
29
|
+
return await StatusService.updateErrorMessage({ distributionChain: +distributionChain, campaignId }, body.error);
|
30
|
+
}, {
|
31
|
+
beforeHandle: BackOfficeGuard,
|
32
|
+
headers: AuthorizationHeadersDto,
|
33
|
+
body: StatusErrorDto,
|
24
34
|
})
|
25
35
|
// ─── Is Safe For Overlaps ───────────────────────────────────────────
|
26
36
|
.get("/engine/overlaps", async ({ query }) => await StatusService.isSafeForOverlaps(query), {
|
@@ -41,6 +41,9 @@ export declare const UpdateCampaignStatusDto: import("@sinclair/typebox").TUnion
|
|
41
41
|
export declare const ComputedUntilDto: import("@sinclair/typebox").TObject<{
|
42
42
|
computedUntil: import("@sinclair/typebox").TNumber;
|
43
43
|
}>;
|
44
|
+
export declare const StatusErrorDto: import("@sinclair/typebox").TObject<{
|
45
|
+
error: import("@sinclair/typebox").TString;
|
46
|
+
}>;
|
44
47
|
export declare const QueryCampaignStatusDto: import("@sinclair/typebox").TObject<{
|
45
48
|
computeChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
46
49
|
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TArray<import("@sinclair/typebox").TEnum<{
|
@@ -27,6 +27,7 @@ export const UpdateCampaignStatusDto = t.Union([
|
|
27
27
|
t.Object({ value: t.Literal(RunStatus.FAILED), error: t.String(), details: t.String() }),
|
28
28
|
]);
|
29
29
|
export const ComputedUntilDto = t.Object({ computedUntil: t.Numeric() });
|
30
|
+
export const StatusErrorDto = t.Object({ error: t.String() });
|
30
31
|
export const QueryCampaignStatusDto = t.Object({
|
31
32
|
computeChainId: t.Optional(t.Numeric()),
|
32
33
|
status: t.Optional(t.Union([t.Array(t.Enum(RunStatus)), t.Enum(RunStatus)])),
|
@@ -68,6 +68,14 @@ export declare abstract class StatusRepository {
|
|
68
68
|
computedUntil: bigint;
|
69
69
|
processingStarted: bigint;
|
70
70
|
}>;
|
71
|
+
static updateErrorMessage(campaignUnique: CampaignUnique, error: string): Promise<{
|
72
|
+
error: string;
|
73
|
+
details: Prisma.JsonValue;
|
74
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
75
|
+
campaignId: string;
|
76
|
+
computedUntil: bigint;
|
77
|
+
processingStarted: bigint;
|
78
|
+
}>;
|
71
79
|
static findManyDelay(query: DelayModel): Promise<{
|
72
80
|
startTimestamp: bigint;
|
73
81
|
endTimestamp: bigint;
|
@@ -65,7 +65,7 @@ export class StatusRepository {
|
|
65
65
|
},
|
66
66
|
data: {
|
67
67
|
status,
|
68
|
-
error,
|
68
|
+
error: error?.length > 0 ? error : undefined,
|
69
69
|
details,
|
70
70
|
},
|
71
71
|
});
|
@@ -98,12 +98,22 @@ export class StatusRepository {
|
|
98
98
|
},
|
99
99
|
});
|
100
100
|
}
|
101
|
+
static async updateErrorMessage(campaignUnique, error) {
|
102
|
+
return await apiDbClient.campaignStatus.update({
|
103
|
+
where: {
|
104
|
+
campaignId: CampaignService.hashId(campaignUnique),
|
105
|
+
},
|
106
|
+
data: {
|
107
|
+
error,
|
108
|
+
},
|
109
|
+
});
|
110
|
+
}
|
101
111
|
static async findManyDelay(query) {
|
102
112
|
return await apiDbClient.campaign.findMany({
|
103
113
|
where: {
|
104
114
|
distributionChainId: !!query.chainId ? query.chainId : undefined,
|
105
115
|
endTimestamp: {
|
106
|
-
gte: !!query.endTimestampLowerBound ? query.endTimestampLowerBound : moment().subtract(
|
116
|
+
gte: !!query.endTimestampLowerBound ? query.endTimestampLowerBound : moment().subtract(2, "week").unix(),
|
107
117
|
},
|
108
118
|
},
|
109
119
|
select: {
|
@@ -43,6 +43,7 @@ export declare abstract class StatusService {
|
|
43
43
|
} | null>;
|
44
44
|
static update(campaignUnique: CampaignUnique, status: UpdateStatusModel): Promise<void>;
|
45
45
|
static updateComputedUntil(campaignUnique: CampaignUnique, computedUntil: number): Promise<void>;
|
46
|
+
static updateErrorMessage(campaignUnique: CampaignUnique, error: string): Promise<void>;
|
46
47
|
static isSafeForOverlaps(campaignUnique: CampaignUnique): Promise<boolean>;
|
47
48
|
static findUpdatesAndDelays(): Promise<Record<number, {
|
48
49
|
live: string;
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { NotFoundError } from "../../../errors";
|
2
|
+
import { VoidString } from "../../../errors/VoidString.error";
|
1
3
|
import { log } from "../../../utils/logger";
|
2
4
|
import { RunStatus } from "../../../../database/api/.generated";
|
3
5
|
import { HOUR, MAX_COMPUTE_JOB_TIME, NETWORK_LABELS, getMultisigURL, registry } from "@sdk";
|
@@ -66,6 +68,17 @@ export class StatusService {
|
|
66
68
|
}
|
67
69
|
await StatusRepository.updateComputedUntil(campaignUnique, computedUntil);
|
68
70
|
}
|
71
|
+
static async updateErrorMessage(campaignUnique, error) {
|
72
|
+
// Check if the status exists already, otherwise thros
|
73
|
+
const campaignStatus = await StatusRepository.findUnique(campaignUnique);
|
74
|
+
if (!(error?.length > 0)) {
|
75
|
+
throw new VoidString("Error message is empty");
|
76
|
+
}
|
77
|
+
if (!campaignStatus) {
|
78
|
+
throw new NotFoundError("CampaignStatus not found");
|
79
|
+
}
|
80
|
+
await StatusRepository.updateErrorMessage(campaignUnique, error);
|
81
|
+
}
|
69
82
|
static async isSafeForOverlaps(campaignUnique) {
|
70
83
|
const status = await StatusRepository.findUnique(campaignUnique);
|
71
84
|
if (!status) {
|
@@ -106,7 +119,6 @@ export class StatusService {
|
|
106
119
|
delayed: delayedCampaigns,
|
107
120
|
};
|
108
121
|
}
|
109
|
-
console.log(res[146]);
|
110
122
|
return res;
|
111
123
|
}
|
112
124
|
static async findManyDelay(query) {
|