@merkl/api 0.10.198 → 0.10.200
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 +2 -6398
- package/dist/src/errors/HttpError.d.ts +5 -0
- package/dist/src/errors/HttpError.js +6 -0
- package/dist/src/errors/NotFound.error.d.ts +4 -0
- package/dist/src/errors/NotFound.error.js +5 -0
- package/dist/src/index.d.ts +1 -2464
- package/dist/src/index.js +56 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +15 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.d.ts +43 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GammaProcessor.js +63 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.d.ts +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GenericProcessor.js +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.d.ts +36 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/NoLinkVaultProcessor.js +51 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.d.ts +0 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +15 -7
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPrices.js +13 -572
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.d.ts +2 -21
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +197 -1174
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.d.ts +1 -5
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2.js +11 -634
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.d.ts +1 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3.js +10 -380
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.d.ts +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4.js +11 -312
- package/dist/src/libs/campaigns/campaignTypes/EulerDynamicData.js +8 -8
- package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +3 -4
- package/dist/src/libs/campaigns/campaignsDynamicData.js +0 -5
- package/dist/src/modules/v4/accounting/accounting.controller.js +1 -1
- package/dist/src/modules/v4/apr/apr.model.d.ts +26 -0
- package/dist/src/modules/v4/apr/apr.model.js +15 -1
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +4 -4
- package/dist/src/modules/v4/campaign/campaign.controller.js +14 -4
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +50 -5
- package/dist/src/modules/v4/campaign/campaign.model.js +47 -13
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.controller.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.controller.js +7 -2
- package/dist/src/modules/v4/chain/chain.model.d.ts +6 -1
- package/dist/src/modules/v4/chain/chain.model.js +8 -1
- package/dist/src/modules/v4/chain/chain.repository.js +1 -1
- package/dist/src/modules/v4/claims/claims.controller.js +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +4 -1
- package/dist/src/modules/v4/enso/enso.model.d.ts +1 -1
- package/dist/src/modules/v4/enso/enso.model.js +2 -1
- package/dist/src/modules/v4/enso/enso.service.d.ts +0 -1
- package/dist/src/modules/v4/enso/enso.service.js +4 -4
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +26 -17
- package/dist/src/modules/v4/interaction/interaction.controller.js +19 -28
- package/dist/src/modules/v4/interaction/interaction.model.d.ts +17 -5
- package/dist/src/modules/v4/interaction/interaction.model.js +3 -3
- package/dist/src/modules/v4/interaction/interaction.service.d.ts +18 -3
- package/dist/src/modules/v4/interaction/interaction.service.js +89 -11
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +72 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +79 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +15 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +84 -0
- package/dist/src/modules/v4/liquidity/liquidity.controller.js +1 -1
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +224 -213
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +39 -10
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +252 -22
- package/dist/src/modules/v4/opportunity/opportunity.model.js +58 -15
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +11 -11
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +12 -232
- package/dist/src/modules/v4/opportunity/opportunity.service.js +0 -32
- package/dist/src/modules/v4/price/price.controller.js +1 -1
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +23 -24
- package/dist/src/modules/v4/protocol/protocol.controller.js +15 -9
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +13 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +12 -8
- package/dist/src/modules/v4/reward/reward.controller.js +1 -1
- package/dist/src/modules/v4/reward/reward.model.d.ts +44 -1
- package/dist/src/modules/v4/reward/reward.model.js +15 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.service.d.ts +11 -11
- package/dist/src/modules/v4/reward/reward.service.js +1 -2
- package/dist/src/modules/v4/router.d.ts +287 -268
- package/dist/src/modules/v4/status/status.controller.js +2 -3
- package/dist/src/modules/v4/status/status.model.d.ts +12 -0
- package/dist/src/modules/v4/status/status.model.js +12 -0
- package/dist/src/modules/v4/status/status.service.js +0 -1
- package/dist/src/modules/v4/token/token.controller.d.ts +4 -4
- package/dist/src/modules/v4/token/token.controller.js +1 -1
- package/dist/src/modules/v4/token/token.model.d.ts +12 -0
- package/dist/src/modules/v4/token/token.model.js +12 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +2 -2
- package/dist/src/modules/v4/token/token.service.d.ts +7 -7
- package/dist/src/modules/v4/tvl/tvl.model.d.ts +24 -0
- package/dist/src/modules/v4/tvl/tvl.model.js +15 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +1 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +9 -8
- package/dist/src/modules/v4/user/user.controller.d.ts +4 -4
- package/dist/src/modules/v4/user/user.controller.js +20 -17
- package/dist/src/modules/v4/user/user.model.d.ts +30 -0
- package/dist/src/modules/v4/user/user.model.js +27 -0
- package/dist/src/modules/v4/zyfi/zyfi.model.d.ts +45 -0
- package/dist/src/modules/v4/zyfi/zyfi.model.js +1 -0
- package/dist/src/modules/v4/zyfi/zyfi.service.d.ts +30 -0
- package/dist/src/modules/v4/zyfi/zyfi.service.js +35 -0
- package/dist/src/plugins/error-handling.plugin.d.ts +2 -2
- package/dist/src/plugins/error-handling.plugin.js +9 -3
- package/dist/src/plugins/logger.plugin.js +1 -20
- package/dist/src/routes/v1/allowances.d.ts +1 -1
- package/dist/src/routes/v1/allowances.js +1 -1
- package/dist/src/routes/v1/balances.d.ts +1 -1
- package/dist/src/routes/v1/balances.js +1 -1
- package/dist/src/routes/v1/prices.d.ts +1 -1
- package/dist/src/routes/v1/prices.js +1 -1
- package/dist/src/routes/v1/router.d.ts +102 -0
- package/dist/src/routes/v1/router.js +6 -0
- package/dist/src/routes/v1/tokens.d.ts +1 -1
- package/dist/src/routes/v1/tokens.js +1 -1
- package/dist/src/routes/v2/merkl.d.ts +5 -5
- package/dist/src/routes/v2/merkl.js +1 -1
- package/dist/src/routes/v2/router.d.ts +46 -0
- package/dist/src/routes/v2/router.js +3 -0
- package/dist/src/routes/v3/app.d.ts +1 -1
- package/dist/src/routes/v3/app.js +1 -1
- package/dist/src/routes/v3/blacklist.d.ts +1 -2479
- package/dist/src/routes/v3/blacklist.js +1 -1
- package/dist/src/routes/v3/campaignClaims.d.ts +1 -1
- package/dist/src/routes/v3/campaignClaims.js +1 -1
- package/dist/src/routes/v3/campaignReport.d.ts +1 -1
- package/dist/src/routes/v3/campaignReport.js +1 -1
- package/dist/src/routes/v3/campaignUnclaimed.d.ts +1 -1
- package/dist/src/routes/v3/campaignUnclaimed.js +1 -1
- package/dist/src/routes/v3/campaigns.d.ts +1 -2483
- package/dist/src/routes/v3/campaigns.js +1 -1
- package/dist/src/routes/v3/campaignsForMainParameter.d.ts +1 -1
- package/dist/src/routes/v3/campaignsForMainParameter.js +1 -1
- package/dist/src/routes/v3/campaignsInfo.d.ts +1 -2481
- package/dist/src/routes/v3/campaignsInfo.js +1 -1
- package/dist/src/routes/v3/campaignsRewardsReport.d.ts +1 -1
- package/dist/src/routes/v3/campaignsRewardsReport.js +1 -1
- package/dist/src/routes/v3/claims.d.ts +1 -1
- package/dist/src/routes/v3/claims.js +1 -1
- package/dist/src/routes/v3/compoundV2.d.ts +1 -1
- package/dist/src/routes/v3/compoundV2.js +1 -1
- package/dist/src/routes/v3/createCampaign.d.ts +1 -1
- package/dist/src/routes/v3/createCampaign.js +1 -1
- package/dist/src/routes/v3/dolomite.d.ts +1 -1
- package/dist/src/routes/v3/dolomite.js +1 -1
- package/dist/src/routes/v3/euler.d.ts +1 -1
- package/dist/src/routes/v3/euler.js +1 -1
- package/dist/src/routes/v3/fetch.d.ts +1 -1
- package/dist/src/routes/v3/fetch.js +1 -1
- package/dist/src/routes/v3/health.d.ts +1 -1
- package/dist/src/routes/v3/health.js +1 -1
- package/dist/src/routes/v3/lostyield.d.ts +1 -1
- package/dist/src/routes/v3/lostyield.js +1 -1
- package/dist/src/routes/v3/merkl.d.ts +1 -1
- package/dist/src/routes/v3/merkl.js +1 -1
- package/dist/src/routes/v3/morphoMarkets.d.ts +1 -1
- package/dist/src/routes/v3/morphoMarkets.js +1 -1
- package/dist/src/routes/v3/morphoVaults.d.ts +1 -1
- package/dist/src/routes/v3/morphoVaults.js +1 -1
- package/dist/src/routes/v3/multiChainPositions.d.ts +1 -2480
- package/dist/src/routes/v3/multiChainPositions.js +1 -1
- package/dist/src/routes/v3/opportunity.d.ts +1 -2483
- package/dist/src/routes/v3/opportunity.js +1 -1
- package/dist/src/routes/v3/overview.d.ts +1 -1
- package/dist/src/routes/v3/overview.js +1 -1
- package/dist/src/routes/v3/parse.d.ts +1 -1
- package/dist/src/routes/v3/parse.js +1 -1
- package/dist/src/routes/v3/payload.d.ts +1 -1
- package/dist/src/routes/v3/payload.js +1 -1
- package/dist/src/routes/v3/poolInfo.js +1 -1
- package/dist/src/routes/v3/positions.d.ts +1 -2479
- package/dist/src/routes/v3/positions.js +1 -1
- package/dist/src/routes/v3/radiant.d.ts +1 -1
- package/dist/src/routes/v3/radiant.js +1 -1
- package/dist/src/routes/v3/recipients.d.ts +1 -1
- package/dist/src/routes/v3/recipients.js +1 -1
- package/dist/src/routes/v3/rewards.d.ts +1 -2508
- package/dist/src/routes/v3/rewards.js +1 -1
- package/dist/src/routes/v3/rewardsReport.d.ts +1 -1
- package/dist/src/routes/v3/rewardsReport.js +1 -1
- package/dist/src/routes/v3/router.d.ts +1 -0
- package/dist/src/routes/v3/router.js +74 -0
- package/dist/src/routes/v3/silo.d.ts +1 -1
- package/dist/src/routes/v3/silo.js +1 -1
- package/dist/src/routes/v3/token.d.ts +1 -1
- package/dist/src/routes/v3/token.js +1 -1
- package/dist/src/routes/v3/tokenUnclaimed.d.ts +1 -1
- package/dist/src/routes/v3/tokenUnclaimed.js +1 -1
- package/dist/src/routes/v3/updates.d.ts +1 -2483
- package/dist/src/routes/v3/updates.js +1 -1
- package/dist/src/routes/v3/userRewards.d.ts +1 -2499
- package/dist/src/routes/v3/userRewards.js +1 -1
- package/dist/src/utils/decodeCalls.js +12 -1
- package/dist/src/utils/encodeCalls.js +26 -3
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +0 -155
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesPricesRefactoFinal.js +0 -24
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +0 -230
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound2RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound3RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.d.ts +0 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound4RefactoFinal.js +0 -22
- package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.d.ts +0 -3
- package/dist/src/libs/campaigns/campaignsDynamicDataRefacto.js +0 -75
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
|
|
2
2
|
import Elysia from "elysia";
|
|
3
|
-
import { CampaignUniqueDto } from "
|
|
4
|
-
import { QueryCampaignStatusDto, UpdateCampaignStatusDto } from "./status.model";
|
|
3
|
+
import { CampaignUniqueDto, QueryCampaignStatusDto, UpdateCampaignStatusDto } from "./status.model";
|
|
5
4
|
import { StatusService } from "./status.service";
|
|
6
|
-
export const StatusController = new Elysia({ prefix: "/campaign-status", detail: { tags: ["Status"] } })
|
|
5
|
+
export const StatusController = new Elysia({ prefix: "/campaign-status", detail: { tags: ["Status"], hide: true } })
|
|
7
6
|
// ─── Update a Campaign Status ──────────────────────────────────────
|
|
8
7
|
.put("/engine/:campaignId", async ({ params, body }) => {
|
|
9
8
|
const [distributionChain, campaignId] = params.campaignId.split("-");
|
|
@@ -4,6 +4,18 @@ export type Status = Resource<"CampaignStatus", "campaignId">;
|
|
|
4
4
|
export type StatusWithCampaign = Status & {
|
|
5
5
|
campaign: Campaign["model"];
|
|
6
6
|
};
|
|
7
|
+
export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
|
8
|
+
distributionChain: import("@sinclair/typebox").TNumber;
|
|
9
|
+
campaignId: import("@sinclair/typebox").TString;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const CampaignStatusResourceDto: import("@sinclair/typebox").TObject<{
|
|
12
|
+
campaignId: import("@sinclair/typebox").TString;
|
|
13
|
+
computedUntil: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
14
|
+
processingStarted: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
15
|
+
status: import("@sinclair/typebox").TString;
|
|
16
|
+
error: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
17
|
+
details: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
18
|
+
}>;
|
|
7
19
|
export declare const UpdateCampaignStatusDto: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
8
20
|
value: import("@sinclair/typebox").TLiteral<"SUCCESS">;
|
|
9
21
|
computedUntil: import("@sinclair/typebox").TNumber;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { RunStatus } from "../../../../database/api/.generated";
|
|
2
2
|
import { t } from "elysia";
|
|
3
3
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
|
4
|
+
export const CampaignUniqueDto = t.Object({
|
|
5
|
+
distributionChain: t.Numeric(),
|
|
6
|
+
campaignId: t.String(),
|
|
7
|
+
});
|
|
8
|
+
export const CampaignStatusResourceDto = t.Object({
|
|
9
|
+
campaignId: t.String(),
|
|
10
|
+
computedUntil: t.Union([t.BigInt(), t.String()]),
|
|
11
|
+
processingStarted: t.Union([t.BigInt(), t.String()]),
|
|
12
|
+
status: t.String(),
|
|
13
|
+
error: t.Optional(t.String()),
|
|
14
|
+
details: t.Optional(t.Any()),
|
|
15
|
+
});
|
|
4
16
|
export const UpdateCampaignStatusDto = t.Union([
|
|
5
17
|
t.Object({ value: t.Literal(RunStatus.SUCCESS), computedUntil: t.Numeric() }),
|
|
6
18
|
t.Object({ value: t.Literal(RunStatus.PROCESSING) }),
|
|
@@ -18,7 +18,6 @@ export class StatusService {
|
|
|
18
18
|
return await StatusRepository.findUnique(campaignUnique);
|
|
19
19
|
}
|
|
20
20
|
static async update(campaignUnique, status) {
|
|
21
|
-
console.log(campaignUnique, status);
|
|
22
21
|
// Check if the status exists already, otherwise create it
|
|
23
22
|
const campaignExists = await StatusRepository.findUnique(campaignUnique);
|
|
24
23
|
if (!campaignExists) {
|
|
@@ -26,9 +26,9 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
|
26
26
|
symbol: string;
|
|
27
27
|
name: string | null;
|
|
28
28
|
id: string;
|
|
29
|
+
icon: string;
|
|
29
30
|
chainId: number;
|
|
30
31
|
address: string;
|
|
31
|
-
icon: string;
|
|
32
32
|
decimals: number;
|
|
33
33
|
verified: boolean;
|
|
34
34
|
isTest: boolean;
|
|
@@ -56,9 +56,9 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
|
56
56
|
symbol: string;
|
|
57
57
|
name: string | null;
|
|
58
58
|
id: string;
|
|
59
|
+
icon: string;
|
|
59
60
|
chainId: number;
|
|
60
61
|
address: string;
|
|
61
|
-
icon: string;
|
|
62
62
|
decimals: number;
|
|
63
63
|
verified: boolean;
|
|
64
64
|
isTest: boolean;
|
|
@@ -91,9 +91,9 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
|
91
91
|
symbol: string;
|
|
92
92
|
name: string | null;
|
|
93
93
|
id: string;
|
|
94
|
+
icon: string;
|
|
94
95
|
chainId: number;
|
|
95
96
|
address: string;
|
|
96
|
-
icon: string;
|
|
97
97
|
decimals: number;
|
|
98
98
|
verified: boolean;
|
|
99
99
|
isTest: boolean;
|
|
@@ -146,9 +146,9 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
|
146
146
|
symbol: string;
|
|
147
147
|
name: string | null;
|
|
148
148
|
id: string;
|
|
149
|
+
icon: string;
|
|
149
150
|
chainId: number;
|
|
150
151
|
address: string;
|
|
151
|
-
icon: string;
|
|
152
152
|
decimals: number;
|
|
153
153
|
displaySymbol: string;
|
|
154
154
|
verified: boolean;
|
|
@@ -4,7 +4,7 @@ import Elysia from "elysia";
|
|
|
4
4
|
import { FindUniqueTokenDto, GetTokenBalanceDto, GetTokenQueryDto, TokenIdDto, UpdateTokenDto } from "./token.model";
|
|
5
5
|
import { TokenService } from "./token.service";
|
|
6
6
|
// ─── Tokens Controller ───────────────────────────────────────────────────────
|
|
7
|
-
export const TokenController = new Elysia({ prefix: "/tokens", detail: { tags: ["Tokens"] } })
|
|
7
|
+
export const TokenController = new Elysia({ prefix: "/tokens", detail: { tags: ["Tokens"], hide: true } })
|
|
8
8
|
// ─── Get A Token By Id ───────────────────────────────────────────────
|
|
9
9
|
.get("/:id", async ({ params }) => {
|
|
10
10
|
try {
|
|
@@ -11,6 +11,18 @@ export type TokenUnique = {
|
|
|
11
11
|
chainId: number;
|
|
12
12
|
address: string;
|
|
13
13
|
};
|
|
14
|
+
export declare const TokenResourceDto: import("@sinclair/typebox").TObject<{
|
|
15
|
+
id: import("@sinclair/typebox").TString;
|
|
16
|
+
name: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
17
|
+
chainId: import("@sinclair/typebox").TNumber;
|
|
18
|
+
address: import("@sinclair/typebox").TString;
|
|
19
|
+
decimals: import("@sinclair/typebox").TNumber;
|
|
20
|
+
icon: import("@sinclair/typebox").TString;
|
|
21
|
+
verified: import("@sinclair/typebox").TBoolean;
|
|
22
|
+
isTest: import("@sinclair/typebox").TBoolean;
|
|
23
|
+
price: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>>;
|
|
24
|
+
symbol: import("@sinclair/typebox").TString;
|
|
25
|
+
}>;
|
|
14
26
|
export declare const FindUniqueTokenDto: import("@sinclair/typebox").TObject<{
|
|
15
27
|
id: import("@sinclair/typebox").TString;
|
|
16
28
|
}>;
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { ChainId } from "@sdk";
|
|
2
2
|
import { t } from "elysia";
|
|
3
3
|
// ─── Dtos ────────────────────────────────────────────────────────────────────
|
|
4
|
+
export const TokenResourceDto = t.Object({
|
|
5
|
+
id: t.String(),
|
|
6
|
+
name: t.Union([t.String(), t.Null()]),
|
|
7
|
+
chainId: t.Number(),
|
|
8
|
+
address: t.String(),
|
|
9
|
+
decimals: t.Number(),
|
|
10
|
+
icon: t.String(),
|
|
11
|
+
verified: t.Boolean(),
|
|
12
|
+
isTest: t.Boolean(),
|
|
13
|
+
price: t.Optional(t.Union([t.Union([t.Number(), t.Null()])])),
|
|
14
|
+
symbol: t.String(),
|
|
15
|
+
});
|
|
4
16
|
export const FindUniqueTokenDto = t.Object({
|
|
5
17
|
id: t.String(),
|
|
6
18
|
});
|
|
@@ -33,9 +33,9 @@ export declare abstract class TokenRepository {
|
|
|
33
33
|
symbol: string;
|
|
34
34
|
name: string | null;
|
|
35
35
|
id: string;
|
|
36
|
+
icon: string;
|
|
36
37
|
chainId: number;
|
|
37
38
|
address: string;
|
|
38
|
-
icon: string;
|
|
39
39
|
decimals: number;
|
|
40
40
|
displaySymbol: string;
|
|
41
41
|
verified: boolean;
|
|
@@ -72,9 +72,9 @@ export declare abstract class TokenRepository {
|
|
|
72
72
|
symbol: string;
|
|
73
73
|
name: string | null;
|
|
74
74
|
id: string;
|
|
75
|
+
icon: string;
|
|
75
76
|
chainId: number;
|
|
76
77
|
address: string;
|
|
77
|
-
icon: string;
|
|
78
78
|
decimals: number;
|
|
79
79
|
displaySymbol: string;
|
|
80
80
|
verified: boolean;
|
|
@@ -19,9 +19,9 @@ export declare abstract class TokenService {
|
|
|
19
19
|
symbol: string;
|
|
20
20
|
name: string | null;
|
|
21
21
|
id: string;
|
|
22
|
+
icon: string;
|
|
22
23
|
chainId: number;
|
|
23
24
|
address: string;
|
|
24
|
-
icon: string;
|
|
25
25
|
decimals: number;
|
|
26
26
|
verified: boolean;
|
|
27
27
|
isTest: boolean;
|
|
@@ -39,9 +39,9 @@ export declare abstract class TokenService {
|
|
|
39
39
|
symbol: string;
|
|
40
40
|
name: string | null;
|
|
41
41
|
id: string;
|
|
42
|
+
icon: string;
|
|
42
43
|
chainId: number;
|
|
43
44
|
address: string;
|
|
44
|
-
icon: string;
|
|
45
45
|
decimals: number;
|
|
46
46
|
verified: boolean;
|
|
47
47
|
isTest: boolean;
|
|
@@ -56,9 +56,9 @@ export declare abstract class TokenService {
|
|
|
56
56
|
symbol: string;
|
|
57
57
|
name: string | null;
|
|
58
58
|
id: string;
|
|
59
|
+
icon: string;
|
|
59
60
|
chainId: number;
|
|
60
61
|
address: string;
|
|
61
|
-
icon: string;
|
|
62
62
|
decimals: number;
|
|
63
63
|
verified: boolean;
|
|
64
64
|
isTest: boolean;
|
|
@@ -101,9 +101,9 @@ export declare abstract class TokenService {
|
|
|
101
101
|
symbol: string;
|
|
102
102
|
name: string | null;
|
|
103
103
|
id: string;
|
|
104
|
+
icon: string;
|
|
104
105
|
chainId: number;
|
|
105
106
|
address: string;
|
|
106
|
-
icon: string;
|
|
107
107
|
decimals: number;
|
|
108
108
|
verified: boolean;
|
|
109
109
|
isTest: boolean;
|
|
@@ -119,9 +119,9 @@ export declare abstract class TokenService {
|
|
|
119
119
|
symbol: string;
|
|
120
120
|
name: string | null;
|
|
121
121
|
id: string;
|
|
122
|
+
icon: string;
|
|
122
123
|
chainId: number;
|
|
123
124
|
address: string;
|
|
124
|
-
icon: string;
|
|
125
125
|
decimals: number;
|
|
126
126
|
verified: boolean;
|
|
127
127
|
isTest: boolean;
|
|
@@ -137,9 +137,9 @@ export declare abstract class TokenService {
|
|
|
137
137
|
symbol: string;
|
|
138
138
|
name: string | null;
|
|
139
139
|
id: string;
|
|
140
|
+
icon: string;
|
|
140
141
|
chainId: number;
|
|
141
142
|
address: string;
|
|
142
|
-
icon: string;
|
|
143
143
|
decimals: number;
|
|
144
144
|
verified: boolean;
|
|
145
145
|
isTest: boolean;
|
|
@@ -174,9 +174,9 @@ export declare abstract class TokenService {
|
|
|
174
174
|
symbol: string;
|
|
175
175
|
name: string | null;
|
|
176
176
|
id: string;
|
|
177
|
+
icon: string;
|
|
177
178
|
chainId: number;
|
|
178
179
|
address: string;
|
|
179
|
-
icon: string;
|
|
180
180
|
decimals: number;
|
|
181
181
|
displaySymbol: string;
|
|
182
182
|
verified: boolean;
|
|
@@ -13,3 +13,27 @@ export type TvlRecord = Resource<"TVLRecord", "id" | "opportunityId", {
|
|
|
13
13
|
* @see {@link Resource}
|
|
14
14
|
*/
|
|
15
15
|
export type TvlBreakdown = Resource<"TVLBreakdown", "id" | "tvlRecordId">;
|
|
16
|
+
export declare const TvlBreakdownResourceDto: import("@sinclair/typebox").TObject<{
|
|
17
|
+
id: import("@sinclair/typebox").TNumber;
|
|
18
|
+
type: import("@sinclair/typebox").TEnum<{
|
|
19
|
+
TOKEN: "TOKEN";
|
|
20
|
+
PROTOCOL: "PROTOCOL";
|
|
21
|
+
}>;
|
|
22
|
+
identifier: import("@sinclair/typebox").TString;
|
|
23
|
+
value: import("@sinclair/typebox").TNumber;
|
|
24
|
+
tvlRecordId: import("@sinclair/typebox").TString;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const TvlRecordResourceDto: import("@sinclair/typebox").TObject<{
|
|
27
|
+
total: import("@sinclair/typebox").TNumber;
|
|
28
|
+
timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
29
|
+
breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
30
|
+
id: import("@sinclair/typebox").TNumber;
|
|
31
|
+
type: import("@sinclair/typebox").TEnum<{
|
|
32
|
+
TOKEN: "TOKEN";
|
|
33
|
+
PROTOCOL: "PROTOCOL";
|
|
34
|
+
}>;
|
|
35
|
+
identifier: import("@sinclair/typebox").TString;
|
|
36
|
+
value: import("@sinclair/typebox").TNumber;
|
|
37
|
+
tvlRecordId: import("@sinclair/typebox").TString;
|
|
38
|
+
}>>;
|
|
39
|
+
}>;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { TvlType } from "../../../../database/api/.generated";
|
|
2
|
+
import { t } from "elysia";
|
|
3
|
+
// ─── Dtos ────────────────────────────────────────────────────────────────────
|
|
4
|
+
export const TvlBreakdownResourceDto = t.Object({
|
|
5
|
+
id: t.Number(),
|
|
6
|
+
type: t.Enum(TvlType),
|
|
7
|
+
identifier: t.String(),
|
|
8
|
+
value: t.Number(),
|
|
9
|
+
tvlRecordId: t.String(),
|
|
10
|
+
});
|
|
11
|
+
export const TvlRecordResourceDto = t.Object({
|
|
12
|
+
total: t.Number(),
|
|
13
|
+
timestamp: t.Union([t.BigInt(), t.String()]),
|
|
14
|
+
breakdowns: t.Array(TvlBreakdownResourceDto),
|
|
15
|
+
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import Elysia, { t } from "elysia";
|
|
2
2
|
import { UniswapV4Service } from "./uniswapV4.service";
|
|
3
|
-
export const uniswapV4Controller = new Elysia(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export const uniswapV4Controller = new Elysia({
|
|
4
|
+
prefix: "uniswap-v4",
|
|
5
|
+
detail: { tags: ["Uniswap V4"], hide: true },
|
|
6
|
+
}).get("/pools", async ({ query }) => {
|
|
7
|
+
return await UniswapV4Service.getPoolsByChain(query.chainId);
|
|
8
|
+
}, {
|
|
9
|
+
query: t.Object({
|
|
10
|
+
chainId: t.Numeric(),
|
|
11
|
+
}),
|
|
11
12
|
});
|
|
@@ -96,9 +96,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
|
96
96
|
symbol: string;
|
|
97
97
|
name: string | null;
|
|
98
98
|
id: string;
|
|
99
|
+
icon: string;
|
|
99
100
|
chainId: number;
|
|
100
101
|
address: string;
|
|
101
|
-
icon: string;
|
|
102
102
|
decimals: number;
|
|
103
103
|
displaySymbol: string;
|
|
104
104
|
verified: boolean;
|
|
@@ -117,9 +117,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
|
117
117
|
symbol: string;
|
|
118
118
|
name: string | null;
|
|
119
119
|
id: string;
|
|
120
|
+
icon: string;
|
|
120
121
|
chainId: number;
|
|
121
122
|
address: string;
|
|
122
|
-
icon: string;
|
|
123
123
|
decimals: number;
|
|
124
124
|
displaySymbol: string;
|
|
125
125
|
verified: boolean;
|
|
@@ -210,9 +210,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
|
210
210
|
symbol: string;
|
|
211
211
|
name: string | null;
|
|
212
212
|
id: string;
|
|
213
|
+
icon: string;
|
|
213
214
|
chainId: number;
|
|
214
215
|
address: string;
|
|
215
|
-
icon: string;
|
|
216
216
|
decimals: number;
|
|
217
217
|
displaySymbol: string;
|
|
218
218
|
verified: boolean;
|
|
@@ -231,9 +231,9 @@ export declare const UserController: Elysia<"/users", false, {
|
|
|
231
231
|
symbol: string;
|
|
232
232
|
name: string | null;
|
|
233
233
|
id: string;
|
|
234
|
+
icon: string;
|
|
234
235
|
chainId: number;
|
|
235
236
|
address: string;
|
|
236
|
-
icon: string;
|
|
237
237
|
decimals: number;
|
|
238
238
|
displaySymbol: string;
|
|
239
239
|
verified: boolean;
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
|
2
2
|
import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../../utils/throw";
|
|
3
|
-
import { Elysia } from "elysia";
|
|
3
|
+
import { Elysia, t } from "elysia";
|
|
4
4
|
import { ChainArrayDto } from "../chain";
|
|
5
5
|
import { RewardService } from "../reward";
|
|
6
|
-
import { GetManyUserQuery, OptionalChainIdDto, UpdateUserTagsDto, UserDto, UserUniqueDto } from "./user.model";
|
|
6
|
+
import { GetManyUserQuery, OptionalChainIdDto, UpdateUserTagsDto, UserDto, UserRewardsResourceDto, UserUniqueDto, } from "./user.model";
|
|
7
7
|
import { UserService } from "./user.service";
|
|
8
8
|
// ─── Users Controller ────────────────────────────────────────────────────────
|
|
9
9
|
export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["Users"] } })
|
|
10
10
|
// ─── Get Many Users ──────────────────────────────────────────────────
|
|
11
|
-
.get("/", async ({ query }) => {
|
|
12
|
-
return await UserService.findMany(query);
|
|
13
|
-
}, { query: GetManyUserQuery })
|
|
11
|
+
.get("/", async ({ query }) => await UserService.findMany(query), { query: GetManyUserQuery, detail: { hide: true } })
|
|
14
12
|
// ─── Get All Tagged Users ─────────────────────────────────────────────
|
|
15
13
|
.get("/tags", async () => {
|
|
16
14
|
return await UserService.findManyWithTags();
|
|
17
|
-
}, { headers: AuthorizationHeadersDto, beforeHandle: BackOfficeGuard })
|
|
15
|
+
}, { headers: AuthorizationHeadersDto, beforeHandle: BackOfficeGuard, detail: { hide: true } })
|
|
18
16
|
// ─── Get A User By Address ───────────────────────────────────────────
|
|
19
|
-
.get("/:address", async ({ params }) => {
|
|
20
|
-
|
|
17
|
+
.get("/:address", async ({ params }) => await UserService.findUnique(params.address), {
|
|
18
|
+
detail: { hide: true },
|
|
21
19
|
})
|
|
22
20
|
// ─── Get User's Rewards With Breakdown And Details for our FE ────────
|
|
23
21
|
.get("/:address/rewards/breakdowns", async ({ params, query }) => {
|
|
@@ -51,19 +49,24 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
},
|
|
52
|
+
response: t.Array(UserRewardsResourceDto),
|
|
53
|
+
detail: { description: "Get the rewards associated to a user on a given chain." },
|
|
54
54
|
})
|
|
55
55
|
// ─── Create A User ───────────────────────────────────────────────────
|
|
56
|
-
.post("/", async ({ body }) => {
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
.post("/", async ({ body }) => await UserService.create(body), {
|
|
57
|
+
headers: AuthorizationHeadersDto,
|
|
58
|
+
body: UserDto,
|
|
59
|
+
beforeHandle: BackOfficeGuard,
|
|
60
|
+
detail: { hide: true },
|
|
61
|
+
})
|
|
59
62
|
// ─── Sync Creator Tags with Engine DB ─────────────────────────────────
|
|
60
|
-
.post("/sync", async () => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
.post("/sync", async () => await UserService.syncTags(), {
|
|
64
|
+
headers: AuthorizationHeadersDto,
|
|
65
|
+
beforeHandle: BackOfficeGuard,
|
|
66
|
+
detail: { hide: true },
|
|
67
|
+
})
|
|
63
68
|
// ─── Update User's Tags ──────────────────────────────────────────────
|
|
64
|
-
.patch("/:address/tags", async ({ params, body }) => {
|
|
65
|
-
return await UserService.updateTags(params.address, body.tags);
|
|
66
|
-
}, {
|
|
69
|
+
.patch("/:address/tags", async ({ params, body }) => UserService.updateTags(params.address, body.tags), {
|
|
67
70
|
headers: AuthorizationHeadersDto,
|
|
68
71
|
params: UserUniqueDto,
|
|
69
72
|
body: UpdateUserTagsDto,
|
|
@@ -5,6 +5,36 @@ import type { Resource } from "../prisma";
|
|
|
5
5
|
* @see {@link Resource}
|
|
6
6
|
*/
|
|
7
7
|
export type User = Resource<"User">;
|
|
8
|
+
export declare const UserRewardsResourceDto: import("@sinclair/typebox").TObject<{
|
|
9
|
+
chain: import("@sinclair/typebox").TObject<{
|
|
10
|
+
id: import("@sinclair/typebox").TNumber;
|
|
11
|
+
name: import("@sinclair/typebox").TString;
|
|
12
|
+
icon: import("@sinclair/typebox").TString;
|
|
13
|
+
}>;
|
|
14
|
+
rewards: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
15
|
+
root: import("@sinclair/typebox").TString;
|
|
16
|
+
recipient: import("@sinclair/typebox").TString;
|
|
17
|
+
proofs: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
18
|
+
token: import("@sinclair/typebox").TObject<{
|
|
19
|
+
address: import("@sinclair/typebox").TString;
|
|
20
|
+
chainId: import("@sinclair/typebox").TNumber;
|
|
21
|
+
symbol: import("@sinclair/typebox").TString;
|
|
22
|
+
decimals: import("@sinclair/typebox").TNumber;
|
|
23
|
+
}>;
|
|
24
|
+
breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
25
|
+
reason: import("@sinclair/typebox").TString;
|
|
26
|
+
amount: import("@sinclair/typebox").TString;
|
|
27
|
+
claimed: import("@sinclair/typebox").TString;
|
|
28
|
+
pending: import("@sinclair/typebox").TString;
|
|
29
|
+
auxiliaryData1: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
30
|
+
auxiliaryData2: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
31
|
+
campaignId: import("@sinclair/typebox").TString;
|
|
32
|
+
}>>;
|
|
33
|
+
claimed: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
34
|
+
amount: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
35
|
+
pending: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
36
|
+
}>>;
|
|
37
|
+
}>;
|
|
8
38
|
export declare const UserUniqueDto: import("@sinclair/typebox").TObject<{
|
|
9
39
|
address: import("@sinclair/typebox").TString;
|
|
10
40
|
}>;
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import { t } from "elysia";
|
|
2
|
+
import { ChainResourceDto } from "../chain";
|
|
2
3
|
// ─── Dtos ────────────────────────────────────────────────────────────────────
|
|
4
|
+
export const UserRewardsResourceDto = t.Object({
|
|
5
|
+
chain: ChainResourceDto,
|
|
6
|
+
rewards: t.Array(t.Object({
|
|
7
|
+
root: t.String(),
|
|
8
|
+
recipient: t.String(),
|
|
9
|
+
proofs: t.Array(t.String()),
|
|
10
|
+
token: t.Object({
|
|
11
|
+
address: t.String(),
|
|
12
|
+
chainId: t.Number(),
|
|
13
|
+
symbol: t.String(),
|
|
14
|
+
decimals: t.Number(),
|
|
15
|
+
}),
|
|
16
|
+
breakdowns: t.Array(t.Object({
|
|
17
|
+
reason: t.String(),
|
|
18
|
+
amount: t.String(),
|
|
19
|
+
claimed: t.String(),
|
|
20
|
+
pending: t.String(),
|
|
21
|
+
auxiliaryData1: t.Union([t.String(), t.Null()]),
|
|
22
|
+
auxiliaryData2: t.Union([t.String(), t.Null()]),
|
|
23
|
+
campaignId: t.String(),
|
|
24
|
+
})),
|
|
25
|
+
claimed: t.Union([t.BigInt(), t.String()]),
|
|
26
|
+
amount: t.Union([t.BigInt(), t.String()]),
|
|
27
|
+
pending: t.Union([t.BigInt(), t.String()]),
|
|
28
|
+
})),
|
|
29
|
+
});
|
|
3
30
|
export const UserUniqueDto = t.Object({
|
|
4
31
|
address: t.String(),
|
|
5
32
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type ZyfiApi = {
|
|
2
|
+
"erc20_sponsored_paymaster/v1": {
|
|
3
|
+
payload: {
|
|
4
|
+
/**
|
|
5
|
+
* Defaults to ZKsync Era
|
|
6
|
+
*/
|
|
7
|
+
chainId?: number;
|
|
8
|
+
feeTokenAddress?: string;
|
|
9
|
+
/**
|
|
10
|
+
* [0-100] how much of the tx to sponsor
|
|
11
|
+
*/
|
|
12
|
+
sponsorshipRatio: number;
|
|
13
|
+
/**
|
|
14
|
+
* Defaults to 5, how many time can the user replay the tx
|
|
15
|
+
*/
|
|
16
|
+
replayLimit?: string;
|
|
17
|
+
txData: {
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
data: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
response: {
|
|
24
|
+
expirationTime: string;
|
|
25
|
+
expiresIn: string;
|
|
26
|
+
feeTokenAmount: string;
|
|
27
|
+
feeTokendecimals: string;
|
|
28
|
+
feeUSD: string;
|
|
29
|
+
gasLimit: string;
|
|
30
|
+
gasPrice: string;
|
|
31
|
+
markup: string;
|
|
32
|
+
maxNonce: string;
|
|
33
|
+
protocolAddress: string;
|
|
34
|
+
sponsorshipRatio: string;
|
|
35
|
+
tokenAddress: string;
|
|
36
|
+
tokenPrice: string;
|
|
37
|
+
txData: {
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
data: string;
|
|
41
|
+
};
|
|
42
|
+
warnings: string[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ZyfiApi } from "./zyfi.model";
|
|
2
|
+
export declare abstract class ZyfiService {
|
|
3
|
+
#private;
|
|
4
|
+
/**
|
|
5
|
+
* Get sponsored tx from raw payload
|
|
6
|
+
* @param transaction to wrap
|
|
7
|
+
* @returns query
|
|
8
|
+
*/
|
|
9
|
+
static wrapTx(transaction: ZyfiApi["erc20_sponsored_paymaster/v1"]["payload"]["txData"]): Promise<{
|
|
10
|
+
expirationTime: string;
|
|
11
|
+
expiresIn: string;
|
|
12
|
+
feeTokenAmount: string;
|
|
13
|
+
feeTokendecimals: string;
|
|
14
|
+
feeUSD: string;
|
|
15
|
+
gasLimit: string;
|
|
16
|
+
gasPrice: string;
|
|
17
|
+
markup: string;
|
|
18
|
+
maxNonce: string;
|
|
19
|
+
protocolAddress: string;
|
|
20
|
+
sponsorshipRatio: string;
|
|
21
|
+
tokenAddress: string;
|
|
22
|
+
tokenPrice: string;
|
|
23
|
+
txData: {
|
|
24
|
+
from: string;
|
|
25
|
+
to: string;
|
|
26
|
+
data: string;
|
|
27
|
+
};
|
|
28
|
+
warnings: string[];
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class ZyfiService {
|
|
2
|
+
static async #fetch(call, resource = "Paymaster") {
|
|
3
|
+
const { data, status } = await call();
|
|
4
|
+
if (status === 404)
|
|
5
|
+
throw new Response(`${resource} not found`, { status });
|
|
6
|
+
if (status === 500)
|
|
7
|
+
throw new Response(`${resource} unavailable`, { status });
|
|
8
|
+
if (data == null)
|
|
9
|
+
throw new Response(`${resource} unavailable`, { status });
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
static async #post(route, payload) {
|
|
13
|
+
const response = await fetch(`https://api.zyfi.org/api/${route}`, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers: {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
"X-API-Key": process.env.ZYFI_API_KEY ?? "",
|
|
18
|
+
},
|
|
19
|
+
body: JSON.stringify(payload),
|
|
20
|
+
});
|
|
21
|
+
return (await response.json());
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get sponsored tx from raw payload
|
|
25
|
+
* @param transaction to wrap
|
|
26
|
+
* @returns query
|
|
27
|
+
*/
|
|
28
|
+
static async wrapTx(transaction) {
|
|
29
|
+
const res = await ZyfiService.#post("erc20_sponsored_paymaster/v1", {
|
|
30
|
+
txData: transaction,
|
|
31
|
+
sponsorshipRatio: 100,
|
|
32
|
+
});
|
|
33
|
+
return res;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BadRequestError, ConflictError, HttpError, NotFoundError, UnauthorizedError } from "../errors";
|
|
2
|
-
import Elysia from "elysia";
|
|
3
|
-
export declare const ErrorHandler: Elysia<"", false, {
|
|
2
|
+
import type Elysia from "elysia";
|
|
3
|
+
export declare const ErrorHandler: (app: Elysia) => Elysia<"", false, {
|
|
4
4
|
decorator: {};
|
|
5
5
|
store: {};
|
|
6
6
|
derive: {};
|