@merkl/api 0.10.199 → 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 -1
- 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/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,9 @@
|
|
|
1
1
|
import type { Resource } from "../prisma";
|
|
2
|
-
import type
|
|
2
|
+
import { type Token } from "../token";
|
|
3
3
|
import { CampaignType } from "../../../../database/api/.generated";
|
|
4
4
|
import { type CampaignParameters } from "@sdk";
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
5
|
+
import { type Chain } from "../chain";
|
|
6
|
+
import { type Status } from "../status";
|
|
7
7
|
/**
|
|
8
8
|
* Campaign
|
|
9
9
|
* @description Target description of rewards campaigns
|
|
@@ -39,6 +39,51 @@ export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
|
|
39
39
|
distributionChain: import("@sinclair/typebox").TNumber;
|
|
40
40
|
campaignId: import("@sinclair/typebox").TString;
|
|
41
41
|
}>;
|
|
42
|
+
export declare const CampaignResourceDto: import("@sinclair/typebox").TObject<{
|
|
43
|
+
id: import("@sinclair/typebox").TString;
|
|
44
|
+
computeChainId: import("@sinclair/typebox").TNumber;
|
|
45
|
+
distributionChainId: import("@sinclair/typebox").TNumber;
|
|
46
|
+
campaignId: import("@sinclair/typebox").TString;
|
|
47
|
+
type: import("@sinclair/typebox").TString;
|
|
48
|
+
subType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>;
|
|
49
|
+
rewardTokenId: import("@sinclair/typebox").TString;
|
|
50
|
+
amount: import("@sinclair/typebox").TString;
|
|
51
|
+
opportunityId: import("@sinclair/typebox").TString;
|
|
52
|
+
startTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
53
|
+
endTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
54
|
+
creatorAddress: import("@sinclair/typebox").TString;
|
|
55
|
+
params: import("@sinclair/typebox").TAny;
|
|
56
|
+
chain: import("@sinclair/typebox").TObject<{
|
|
57
|
+
id: import("@sinclair/typebox").TNumber;
|
|
58
|
+
name: import("@sinclair/typebox").TString;
|
|
59
|
+
icon: import("@sinclair/typebox").TString;
|
|
60
|
+
}>;
|
|
61
|
+
rewardToken: import("@sinclair/typebox").TObject<{
|
|
62
|
+
id: import("@sinclair/typebox").TString;
|
|
63
|
+
name: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
64
|
+
chainId: import("@sinclair/typebox").TNumber;
|
|
65
|
+
address: import("@sinclair/typebox").TString;
|
|
66
|
+
decimals: import("@sinclair/typebox").TNumber;
|
|
67
|
+
icon: import("@sinclair/typebox").TString;
|
|
68
|
+
verified: import("@sinclair/typebox").TBoolean;
|
|
69
|
+
isTest: import("@sinclair/typebox").TBoolean;
|
|
70
|
+
price: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TNull]>>;
|
|
71
|
+
symbol: import("@sinclair/typebox").TString;
|
|
72
|
+
}>;
|
|
73
|
+
distributionChain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
74
|
+
id: import("@sinclair/typebox").TNumber;
|
|
75
|
+
name: import("@sinclair/typebox").TString;
|
|
76
|
+
icon: import("@sinclair/typebox").TString;
|
|
77
|
+
}>>;
|
|
78
|
+
campaignStatus: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
79
|
+
campaignId: import("@sinclair/typebox").TString;
|
|
80
|
+
computedUntil: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
81
|
+
processingStarted: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
|
|
82
|
+
status: import("@sinclair/typebox").TString;
|
|
83
|
+
error: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
84
|
+
details: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
85
|
+
}>>;
|
|
86
|
+
}>;
|
|
42
87
|
export declare const CreateCampaignDto: import("@sinclair/typebox").TObject<{
|
|
43
88
|
computeChainId: import("@sinclair/typebox").TNumber;
|
|
44
89
|
chainId: import("@sinclair/typebox").TNumber;
|
|
@@ -55,8 +100,6 @@ export declare const CreateCampaignDto: import("@sinclair/typebox").TObject<{
|
|
|
55
100
|
params: import("@sinclair/typebox").TString;
|
|
56
101
|
}>;
|
|
57
102
|
export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
|
|
58
|
-
page: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
59
|
-
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
60
103
|
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
61
104
|
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
|
|
62
105
|
INVALID: "INVALID";
|
|
@@ -83,6 +126,8 @@ export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
|
|
|
83
126
|
opportunityId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
84
127
|
startTimestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
85
128
|
endTimestamp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
129
|
+
page: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
130
|
+
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
86
131
|
}>;
|
|
87
132
|
export type CampaignUnique = typeof CampaignUniqueDto.static;
|
|
88
133
|
export type CreateCampaignModel = typeof CreateCampaignDto.static & {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { TokenResourceDto } from "../token";
|
|
1
2
|
import { CampaignType } from "../../../../database/api/.generated";
|
|
2
3
|
import { Campaign as CampaignTypeEnum } from "@sdk";
|
|
3
4
|
import { t } from "elysia";
|
|
5
|
+
import { ChainResourceDto } from "../chain";
|
|
6
|
+
import { CampaignStatusResourceDto } from "../status";
|
|
4
7
|
// ─── Utils ───────────────────────────────────────────────────────────────────
|
|
5
8
|
export const campaignTypeToEnumMap = {
|
|
6
9
|
INVALID: CampaignTypeEnum.INVALID,
|
|
@@ -23,6 +26,25 @@ export const CampaignUniqueDto = t.Object({
|
|
|
23
26
|
distributionChain: t.Numeric(),
|
|
24
27
|
campaignId: t.String(),
|
|
25
28
|
});
|
|
29
|
+
export const CampaignResourceDto = t.Object({
|
|
30
|
+
id: t.String(),
|
|
31
|
+
computeChainId: t.Number(),
|
|
32
|
+
distributionChainId: t.Number(),
|
|
33
|
+
campaignId: t.String(),
|
|
34
|
+
type: t.String(),
|
|
35
|
+
subType: t.Union([t.Number(), t.Null()]),
|
|
36
|
+
rewardTokenId: t.String(),
|
|
37
|
+
amount: t.String(),
|
|
38
|
+
opportunityId: t.String(),
|
|
39
|
+
startTimestamp: t.Union([t.BigInt(), t.String()]),
|
|
40
|
+
endTimestamp: t.Union([t.BigInt(), t.String()]),
|
|
41
|
+
creatorAddress: t.String(),
|
|
42
|
+
params: t.Any(),
|
|
43
|
+
chain: ChainResourceDto,
|
|
44
|
+
rewardToken: TokenResourceDto,
|
|
45
|
+
distributionChain: t.Optional(ChainResourceDto),
|
|
46
|
+
campaignStatus: t.Optional(CampaignStatusResourceDto),
|
|
47
|
+
});
|
|
26
48
|
export const CreateCampaignDto = t.Object({
|
|
27
49
|
computeChainId: t.Number(),
|
|
28
50
|
chainId: t.Number(),
|
|
@@ -39,17 +61,29 @@ export const CreateCampaignDto = t.Object({
|
|
|
39
61
|
params: t.String(),
|
|
40
62
|
});
|
|
41
63
|
export const GetCampaignQueryDto = t.Object({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
type: t.Optional(t.Enum(CampaignType)),
|
|
46
|
-
subType: t.Optional(t.Number(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
chainId: t.Optional(t.Numeric({
|
|
65
|
+
description: "Filter by chain.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
|
|
66
|
+
})),
|
|
67
|
+
type: t.Optional(t.Enum(CampaignType, { description: "Filter by type of campaign" })),
|
|
68
|
+
subType: t.Optional(t.Number({
|
|
69
|
+
description: "Silo, Radiant, Morpho, Dolomite, Compound, Ajna and Euler campaigns have a subtype attribute you can filter on",
|
|
70
|
+
})),
|
|
71
|
+
campaignId: t.Optional(t.String({
|
|
72
|
+
description: "Filter campaigns by campaignId. Some campaigns take place on different blockchains, one resource per chain will be returned, sharing the same campaignId",
|
|
73
|
+
})),
|
|
74
|
+
mainParameter: t.Optional(t.String({
|
|
75
|
+
description: "the mainParameter represents the address of the contract targeted by a campaign (e.g. a Uniswap pool)",
|
|
76
|
+
})),
|
|
77
|
+
tokenSymbol: t.Optional(t.String({ description: "Filter by reward token symbol (e.g. USDC for campaigns rewarding in USDC)" })),
|
|
78
|
+
tokenAddress: t.Optional(t.String({
|
|
79
|
+
description: "Filter results by the reward token address. Use in combination with chainId for accuracy",
|
|
80
|
+
})),
|
|
81
|
+
test: t.Optional(t.Boolean({ description: "Return campaigns rewarding in test tokens", default: false })),
|
|
82
|
+
opportunityId: t.Optional(t.String({
|
|
83
|
+
description: "Filter by opportunity. You can find opportunity ids by calling [GET /v4/opportunities](#tag/opportunities/GET/v4/opportunities)",
|
|
84
|
+
})),
|
|
85
|
+
startTimestamp: t.Optional(t.String({ pattern: "[0-9].*", description: "Returns campaigns starting *after* the given unix timestamp" })),
|
|
86
|
+
endTimestamp: t.Optional(t.String({ pattern: "[0-9].*", description: "Returns campaigns ending *after* the given unix timestamp" })),
|
|
87
|
+
page: t.Optional(t.Numeric({ description: "0-indexed page number", default: 0 })),
|
|
88
|
+
items: t.Optional(t.Numeric({ description: "Number of items returned by page", default: 20 })), // items per page
|
|
55
89
|
});
|
|
@@ -32,6 +32,7 @@ export declare abstract class CampaignRepository {
|
|
|
32
32
|
static getFromEngineDb(chainId: number, timestamp: number): Promise<CampaignParameters<CampaignV3>[]>;
|
|
33
33
|
static getFromEngineDbWithId(campaignIds: CampaignUnique[]): Promise<{
|
|
34
34
|
index: number;
|
|
35
|
+
creator: string;
|
|
35
36
|
chainId: number;
|
|
36
37
|
startTimestamp: number;
|
|
37
38
|
endTimestamp: number;
|
|
@@ -40,7 +41,6 @@ export declare abstract class CampaignRepository {
|
|
|
40
41
|
campaignId: string;
|
|
41
42
|
amount: string;
|
|
42
43
|
rewardToken: string;
|
|
43
|
-
creator: string;
|
|
44
44
|
campaignType: number;
|
|
45
45
|
campaignSubType: number;
|
|
46
46
|
campaignParameters: import("database/engine/.generated/runtime/library").JsonValue;
|
|
@@ -98,9 +98,9 @@ export declare abstract class CampaignRepository {
|
|
|
98
98
|
symbol: string;
|
|
99
99
|
name: string | null;
|
|
100
100
|
id: string;
|
|
101
|
+
icon: string;
|
|
101
102
|
chainId: number;
|
|
102
103
|
address: string;
|
|
103
|
-
icon: string;
|
|
104
104
|
decimals: number;
|
|
105
105
|
displaySymbol: string;
|
|
106
106
|
verified: boolean;
|
|
@@ -39,9 +39,9 @@ export declare abstract class CampaignService {
|
|
|
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;
|
|
@@ -173,9 +173,9 @@ export declare abstract class CampaignService {
|
|
|
173
173
|
symbol: string;
|
|
174
174
|
name: string | null;
|
|
175
175
|
id: string;
|
|
176
|
+
icon: string;
|
|
176
177
|
chainId: number;
|
|
177
178
|
address: string;
|
|
178
|
-
icon: string;
|
|
179
179
|
decimals: number;
|
|
180
180
|
verified: boolean;
|
|
181
181
|
isTest: boolean;
|
|
@@ -42,7 +42,7 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
|
42
42
|
body: unknown;
|
|
43
43
|
params: {};
|
|
44
44
|
query: {
|
|
45
|
-
|
|
45
|
+
name?: string | undefined;
|
|
46
46
|
};
|
|
47
47
|
headers: unknown;
|
|
48
48
|
response: {
|
|
@@ -66,7 +66,7 @@ export declare const ChainController: Elysia<"/chains", false, {
|
|
|
66
66
|
body: unknown;
|
|
67
67
|
params: {};
|
|
68
68
|
query: {
|
|
69
|
-
|
|
69
|
+
name?: string | undefined;
|
|
70
70
|
};
|
|
71
71
|
headers: unknown;
|
|
72
72
|
response: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
|
2
2
|
import { TokenAuthGuard } from "../../../guards/TokenAuth.guard";
|
|
3
|
-
import Elysia from "elysia";
|
|
3
|
+
import Elysia, { t } from "elysia";
|
|
4
4
|
import { ExplorerService } from "../explorer";
|
|
5
|
-
import { ChainUniqueDto, CreateChainExplorerDto, GetChainQueryDto, UpdateChainDto } from "./chain.model";
|
|
5
|
+
import { ChainResourceDto, ChainUniqueDto, CreateChainExplorerDto, GetChainQueryDto, UpdateChainDto, } from "./chain.model";
|
|
6
6
|
import { ChainService } from "./chain.service";
|
|
7
7
|
// ─── Chains Controller ───────────────────────────────────────────────────────
|
|
8
8
|
export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: ["Chains"] } })
|
|
@@ -15,6 +15,7 @@ export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: [
|
|
|
15
15
|
return { explorers: chain.Explorer, ...rest };
|
|
16
16
|
}, {
|
|
17
17
|
params: ChainUniqueDto,
|
|
18
|
+
detail: { hide: true },
|
|
18
19
|
})
|
|
19
20
|
// ─── Get All Supported Chains ────────────────────────────────────────
|
|
20
21
|
.get("/", async ({ query }) => {
|
|
@@ -22,10 +23,13 @@ export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: [
|
|
|
22
23
|
return chains.map(({ Explorer, ...chain }) => ({ explorers: Explorer, ...chain }));
|
|
23
24
|
}, {
|
|
24
25
|
query: GetChainQueryDto,
|
|
26
|
+
response: t.Array(ChainResourceDto),
|
|
27
|
+
detail: { description: "List chains supported and integrated by Merkl." },
|
|
25
28
|
})
|
|
26
29
|
// ─── Count Chains ────────────────────────────────────────
|
|
27
30
|
.get("/count", async ({ query }) => await ChainService.countMany(query), {
|
|
28
31
|
query: GetChainQueryDto,
|
|
32
|
+
detail: { hide: true },
|
|
29
33
|
})
|
|
30
34
|
.group("/explorers", app => {
|
|
31
35
|
// ─── Create An Explorer ──────────────────────────────────────
|
|
@@ -41,4 +45,5 @@ export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: [
|
|
|
41
45
|
body: UpdateChainDto,
|
|
42
46
|
headers: AuthorizationHeadersDto,
|
|
43
47
|
beforeHandle: BackOfficeGuard,
|
|
48
|
+
detail: { hide: true },
|
|
44
49
|
});
|
|
@@ -5,8 +5,13 @@ import type { Resource } from "../prisma";
|
|
|
5
5
|
* @see {@link Resource}
|
|
6
6
|
*/
|
|
7
7
|
export type Chain = Resource<"Chain">;
|
|
8
|
+
export declare const ChainResourceDto: import("@sinclair/typebox").TObject<{
|
|
9
|
+
id: import("@sinclair/typebox").TNumber;
|
|
10
|
+
name: import("@sinclair/typebox").TString;
|
|
11
|
+
icon: import("@sinclair/typebox").TString;
|
|
12
|
+
}>;
|
|
8
13
|
export declare const GetChainQueryDto: import("@sinclair/typebox").TObject<{
|
|
9
|
-
|
|
14
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
15
|
}>;
|
|
11
16
|
export declare const ChainUniqueDto: import("@sinclair/typebox").TObject<{
|
|
12
17
|
chainId: import("@sinclair/typebox").TNumber;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { ExplorerType } from "../../../../database/api/.generated";
|
|
2
2
|
import { t } from "elysia";
|
|
3
3
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
|
4
|
+
export const ChainResourceDto = t.Object({
|
|
5
|
+
id: t.Number(),
|
|
6
|
+
name: t.String(),
|
|
7
|
+
icon: t.String(),
|
|
8
|
+
});
|
|
4
9
|
export const GetChainQueryDto = t.Object({
|
|
5
|
-
|
|
10
|
+
name: t.Optional(t.String({ description: "Search by blockchain name" })),
|
|
6
11
|
});
|
|
7
12
|
export const ChainUniqueDto = t.Object({
|
|
8
13
|
chainId: t.Numeric(),
|
|
@@ -12,6 +17,8 @@ export const ChainArrayDto = t.Object({
|
|
|
12
17
|
.Transform(t.Union([t.String(), t.Array(t.Numeric())]))
|
|
13
18
|
.Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
|
|
14
19
|
.Encode(value => [...value]),
|
|
20
|
+
}, {
|
|
21
|
+
description: "A required comma separated list of chain ids.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
|
|
15
22
|
});
|
|
16
23
|
export const CreateChainExplorerDto = t.Object({
|
|
17
24
|
type: t.Enum(ExplorerType),
|
|
@@ -12,7 +12,7 @@ export class ChainRepository {
|
|
|
12
12
|
}
|
|
13
13
|
static #transformQueryToPrismaFilters(query) {
|
|
14
14
|
return {
|
|
15
|
-
where: { name: { contains: query.
|
|
15
|
+
where: { name: { contains: query.name, mode: "insensitive" } },
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
/** Returns many chains based on query
|
|
@@ -3,7 +3,7 @@ import Elysia from "elysia";
|
|
|
3
3
|
import { UserUniqueDto } from "../user";
|
|
4
4
|
import { ClaimService } from "./claims.service";
|
|
5
5
|
// ─── Claim Controller ───────────────────────────────────────────────────────
|
|
6
|
-
export const ClaimController = new Elysia({ prefix: "/claims", detail: { tags: ["Claims"] } })
|
|
6
|
+
export const ClaimController = new Elysia({ prefix: "/claims", detail: { tags: ["Claims"], hide: true } })
|
|
7
7
|
// ─── Get Historical Claims ────────────────────────────────────────────
|
|
8
8
|
.get("/:address", async ({ params }) => await ClaimService.getHistoricalClaims(params), {
|
|
9
9
|
params: UserUniqueDto,
|
|
@@ -4,7 +4,10 @@ import { throwOnUnsupportedChainId } from "src/utils/throw";
|
|
|
4
4
|
import { DynamicDataSourceIdentifier } from "./dynamicData.model";
|
|
5
5
|
import { DynamicDataService } from "./dynamicData.service";
|
|
6
6
|
// ─── DynamicDatas Controller ───────────────────────────────────────────────────────
|
|
7
|
-
export const DynamicDataController = new Elysia({
|
|
7
|
+
export const DynamicDataController = new Elysia({
|
|
8
|
+
prefix: "/dynamic-data",
|
|
9
|
+
detail: { tags: ["DynamicData"], hide: true },
|
|
10
|
+
})
|
|
8
11
|
// ─── Get type Info By Token Address ───────────────────────────────────────
|
|
9
12
|
.get("/", async ({ query }) => await DynamicDataService.queryERC20DynamicData(query.chainId, query.tokenAddress), {
|
|
10
13
|
query: DynamicDataSourceIdentifier,
|
|
@@ -11,7 +11,7 @@ export declare const slugToProtocolId: {
|
|
|
11
11
|
readonly "aura-lp": "aura";
|
|
12
12
|
readonly aura: "aura";
|
|
13
13
|
readonly beefy: "beefy";
|
|
14
|
-
readonly
|
|
14
|
+
readonly venus: "compound";
|
|
15
15
|
readonly "curve-gauge": "curve";
|
|
16
16
|
readonly "euler-v2": "euler";
|
|
17
17
|
readonly fluid: "fluid";
|
|
@@ -9,9 +9,10 @@ export class EnsoService {
|
|
|
9
9
|
"Content-Type": "application/json",
|
|
10
10
|
}),
|
|
11
11
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const json = await res.json();
|
|
13
|
+
if (res.status !== 200)
|
|
14
|
+
throw new Error(json?.message);
|
|
15
|
+
return json;
|
|
15
16
|
}
|
|
16
17
|
static getSlug(protocolId) {
|
|
17
18
|
const slug = Object.entries(slugToProtocolId).find(([_slug, id]) => id === protocolId)?.[0];
|
|
@@ -42,5 +43,4 @@ export class EnsoService {
|
|
|
42
43
|
static async getTransaction(query) {
|
|
43
44
|
return await EnsoService.#fetch("/v1/shortcuts/route", { query });
|
|
44
45
|
}
|
|
45
|
-
static getDepositSchema(protocolId) { }
|
|
46
46
|
}
|
|
@@ -18,13 +18,13 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
|
18
18
|
body: unknown;
|
|
19
19
|
params: {};
|
|
20
20
|
query: {
|
|
21
|
-
|
|
21
|
+
protocolId?: string | undefined;
|
|
22
|
+
identifier: string;
|
|
22
23
|
chainId: number;
|
|
23
|
-
protocolId: string;
|
|
24
24
|
};
|
|
25
25
|
headers: unknown;
|
|
26
26
|
response: {
|
|
27
|
-
200: import("./interaction.model").InteractionTarget[]
|
|
27
|
+
200: import("./interaction.model").InteractionTarget[];
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
};
|
|
@@ -54,7 +54,7 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
|
54
54
|
};
|
|
55
55
|
} & {
|
|
56
56
|
interaction: {
|
|
57
|
-
|
|
57
|
+
transaction: {
|
|
58
58
|
get: {
|
|
59
59
|
body: unknown;
|
|
60
60
|
params: {};
|
|
@@ -69,10 +69,11 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
|
69
69
|
headers: unknown;
|
|
70
70
|
response: {
|
|
71
71
|
200: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
amountIn: bigint;
|
|
73
|
+
allowance: bigint;
|
|
74
|
+
approved: boolean;
|
|
75
|
+
transaction: import("./interaction.model").UserTransaction;
|
|
76
|
+
approval: import("./interaction.model").UserTransaction;
|
|
76
77
|
} | undefined;
|
|
77
78
|
};
|
|
78
79
|
};
|
|
@@ -80,7 +81,7 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
|
80
81
|
};
|
|
81
82
|
} & {
|
|
82
83
|
interaction: {
|
|
83
|
-
|
|
84
|
+
sponsored: {
|
|
84
85
|
get: {
|
|
85
86
|
body: unknown;
|
|
86
87
|
params: {};
|
|
@@ -95,17 +96,25 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
|
95
96
|
headers: unknown;
|
|
96
97
|
response: {
|
|
97
98
|
200: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
expirationTime: string;
|
|
100
|
+
expiresIn: string;
|
|
101
|
+
feeTokenAmount: string;
|
|
102
|
+
feeTokendecimals: string;
|
|
103
|
+
feeUSD: string;
|
|
104
|
+
gasLimit: string;
|
|
105
|
+
gasPrice: string;
|
|
106
|
+
markup: string;
|
|
107
|
+
maxNonce: string;
|
|
108
|
+
protocolAddress: string;
|
|
109
|
+
sponsorshipRatio: string;
|
|
110
|
+
tokenAddress: string;
|
|
111
|
+
tokenPrice: string;
|
|
112
|
+
txData: {
|
|
105
113
|
from: string;
|
|
106
|
-
value: string;
|
|
107
114
|
to: string;
|
|
115
|
+
data: string;
|
|
108
116
|
};
|
|
117
|
+
warnings: string[];
|
|
109
118
|
} | undefined;
|
|
110
119
|
};
|
|
111
120
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { ChainId } from "@sdk";
|
|
1
2
|
import Elysia from "elysia";
|
|
2
3
|
import { EnsoService } from "../enso/enso.service";
|
|
4
|
+
import { ZyfiService } from "../zyfi/zyfi.service";
|
|
3
5
|
import { GetInteractionProtocolsQueryDto, GetInteractionQuoteQueryDto, GetInteractionTargetsQueryDto, } from "./interaction.model";
|
|
4
6
|
import { InteractionService } from "./interaction.service";
|
|
5
7
|
// ─── Interaction Controller ──────────────────────────────────────────────────
|
|
6
|
-
export const InteractionController = new Elysia({
|
|
8
|
+
export const InteractionController = new Elysia({
|
|
9
|
+
prefix: "/interaction",
|
|
10
|
+
detail: { tags: ["Interaction"], hide: true },
|
|
11
|
+
})
|
|
7
12
|
.get("/targets", async ({ query: { protocolId, chainId, identifier } }) => {
|
|
8
|
-
|
|
9
|
-
return await InteractionService.getTarget(chainId, protocolId, identifier);
|
|
10
|
-
return await InteractionService.getTargets(chainId, protocolId);
|
|
13
|
+
return await InteractionService.getTargets(chainId, protocolId, identifier);
|
|
11
14
|
}, {
|
|
12
15
|
query: GetInteractionTargetsQueryDto,
|
|
13
16
|
detail: {
|
|
@@ -23,45 +26,33 @@ export const InteractionController = new Elysia({ prefix: "/interaction", detail
|
|
|
23
26
|
description: "Retrieves protocols integrated by merkl which supports being interacted with",
|
|
24
27
|
},
|
|
25
28
|
})
|
|
26
|
-
// ─── Get
|
|
27
|
-
.get("/
|
|
28
|
-
const [target] =
|
|
29
|
+
// ─── Get Transaction ─────────────────────────────────────────────────
|
|
30
|
+
.get("/transaction", async ({ query: { protocolId, chainId, identifier, userAddress, fromAmount, fromTokenAddress } }) => {
|
|
31
|
+
const [target] = await InteractionService.getTargets(chainId, protocolId, identifier);
|
|
29
32
|
//TODO: throw error
|
|
30
33
|
if (!target)
|
|
31
34
|
return;
|
|
32
|
-
return await
|
|
33
|
-
fromAddress: userAddress,
|
|
34
|
-
tokenIn: [fromTokenAddress],
|
|
35
|
-
tokenOut: [target.identifier],
|
|
36
|
-
amountIn: [fromAmount],
|
|
37
|
-
routingStrategy: "router",
|
|
38
|
-
chainId,
|
|
39
|
-
});
|
|
35
|
+
return await InteractionService.getTransaction(target.provider, chainId, protocolId, identifier, userAddress, fromTokenAddress, BigInt(fromAmount));
|
|
40
36
|
}, {
|
|
41
37
|
query: GetInteractionQuoteQueryDto,
|
|
42
38
|
detail: {
|
|
43
|
-
summary: "
|
|
39
|
+
summary: "Get participate transaction",
|
|
44
40
|
description: "",
|
|
45
41
|
},
|
|
46
42
|
})
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
.get("/sponsored", async ({ query: { protocolId, chainId, identifier, userAddress, fromAmount, fromTokenAddress } }) => {
|
|
44
|
+
if (chainId !== ChainId.ZKSYNC)
|
|
45
|
+
return;
|
|
46
|
+
const [target] = await InteractionService.getTargets(chainId, protocolId, identifier);
|
|
50
47
|
//TODO: throw error
|
|
51
48
|
if (!target)
|
|
52
49
|
return;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
tokenIn: [fromTokenAddress],
|
|
56
|
-
tokenOut: [target.identifier],
|
|
57
|
-
amountIn: [fromAmount],
|
|
58
|
-
routingStrategy: "router",
|
|
59
|
-
chainId,
|
|
60
|
-
});
|
|
50
|
+
const { transaction: tx } = await InteractionService.getTransaction(target.provider, chainId, protocolId, identifier, userAddress, fromTokenAddress, BigInt(fromAmount));
|
|
51
|
+
return ZyfiService.wrapTx({ data: tx.data, to: tx.to, from: userAddress });
|
|
61
52
|
}, {
|
|
62
53
|
query: GetInteractionQuoteQueryDto,
|
|
63
54
|
detail: {
|
|
64
|
-
summary: "Get participate transaction",
|
|
55
|
+
summary: "Get participate transaction wrapped by paymaster",
|
|
65
56
|
description: "",
|
|
66
57
|
},
|
|
67
58
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Token } from "../token";
|
|
2
1
|
export declare const participateInputTypes: readonly ["tokenAmount", "token"];
|
|
3
2
|
export type InteractionInputType = (typeof participateInputTypes)[number];
|
|
4
3
|
export type InteractionInput<T extends InteractionInputType = InteractionInputType> = {
|
|
@@ -25,17 +24,30 @@ export type InteractionSchema<T extends InteractionType> = {
|
|
|
25
24
|
};
|
|
26
25
|
}[T];
|
|
27
26
|
export type InteractionTarget = {
|
|
27
|
+
provider: "enso" | "zap";
|
|
28
28
|
identifier: string;
|
|
29
|
-
|
|
30
|
-
tokens: Token["model"][];
|
|
29
|
+
chainId: number;
|
|
31
30
|
};
|
|
32
31
|
export type InteractionSchemas = {
|
|
33
32
|
[T in InteractionType]?: InteractionSchema<T>;
|
|
34
33
|
};
|
|
34
|
+
export type UserTransaction = {
|
|
35
|
+
data: string;
|
|
36
|
+
to: string;
|
|
37
|
+
from?: string;
|
|
38
|
+
value?: bigint;
|
|
39
|
+
};
|
|
40
|
+
export type InteractionQuote = {
|
|
41
|
+
amountIn: bigint;
|
|
42
|
+
allowance: bigint;
|
|
43
|
+
approved: boolean;
|
|
44
|
+
transaction: UserTransaction;
|
|
45
|
+
approval: UserTransaction;
|
|
46
|
+
};
|
|
35
47
|
export declare const GetInteractionTargetsQueryDto: import("@sinclair/typebox").TObject<{
|
|
36
48
|
chainId: import("@sinclair/typebox").TNumber;
|
|
37
|
-
protocolId: import("@sinclair/typebox").TString
|
|
38
|
-
identifier: import("@sinclair/typebox").
|
|
49
|
+
protocolId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
50
|
+
identifier: import("@sinclair/typebox").TString;
|
|
39
51
|
}>;
|
|
40
52
|
export declare const GetInteractionQuoteQueryDto: import("@sinclair/typebox").TObject<{
|
|
41
53
|
chainId: import("@sinclair/typebox").TNumber;
|
|
@@ -4,10 +4,10 @@ export const participateInputTypes = ["tokenAmount", "token"];
|
|
|
4
4
|
export const participateTypes = ["link", "deposit", "withdraw"];
|
|
5
5
|
export const GetInteractionTargetsQueryDto = t.Object({
|
|
6
6
|
chainId: t.Numeric(),
|
|
7
|
-
protocolId: t.String({
|
|
7
|
+
protocolId: t.Optional(t.String({
|
|
8
8
|
examples: Object.values(protocol).reduce((obj, i) => Object.assign(obj, { [i.name]: { value: i.id } }), {}),
|
|
9
|
-
}),
|
|
10
|
-
identifier: t.
|
|
9
|
+
})),
|
|
10
|
+
identifier: t.String(),
|
|
11
11
|
});
|
|
12
12
|
export const GetInteractionQuoteQueryDto = t.Object({
|
|
13
13
|
chainId: t.Numeric(),
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { EnsoService } from "../enso/enso.service";
|
|
2
2
|
import type { ProtocolId } from "../protocol";
|
|
3
|
-
import type { InteractionTarget } from "./interaction.model";
|
|
3
|
+
import type { InteractionQuote, InteractionTarget } from "./interaction.model";
|
|
4
4
|
export declare abstract class InteractionService {
|
|
5
|
-
static getTarget(chainId: number, protocolId: ProtocolId, identifier: string): Promise<InteractionTarget[]
|
|
5
|
+
static getTarget(chainId: number, protocolId: ProtocolId, identifier: string): Promise<InteractionTarget[]>;
|
|
6
|
+
static getTargetFromKyberZap(chainId: number, protocolId: ProtocolId, identifier: string): InteractionTarget | undefined;
|
|
7
|
+
static getTargetFromEnso(chainId: number, protocolId: ProtocolId, identifier: string): Promise<InteractionTarget | undefined>;
|
|
6
8
|
static getTargetsFromEnsoTokens(tokens: Awaited<ReturnType<typeof EnsoService.getTokens>>): Promise<InteractionTarget[]>;
|
|
7
|
-
static getTargets(chainId: number, protocolId: ProtocolId): Promise<InteractionTarget[]
|
|
9
|
+
static getTargets(chainId: number, protocolId: ProtocolId, identifier: string): Promise<InteractionTarget[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Gets approval information onchain
|
|
12
|
+
* @returns approved?, approval tx & allowance amount
|
|
13
|
+
*/
|
|
14
|
+
static getApproval(chainId: number, owner: string, spender: string, tokenAddress: string, amount: bigint): Promise<{
|
|
15
|
+
approved: boolean;
|
|
16
|
+
allowance: any;
|
|
17
|
+
approval: {
|
|
18
|
+
to: string;
|
|
19
|
+
data: `0x${string}`;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
static getTransaction(provider: InteractionTarget["provider"], chainId: number, protocolId: ProtocolId, identifier: string, userAddress: string, fromTokenAddress: string, fromTokenAmount: bigint): Promise<InteractionQuote>;
|
|
8
23
|
}
|