@merkl/api 0.20.37 → 0.20.39
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 +243 -0
- package/dist/src/engine/dynamicData/implementations/UniswapV4.js +2 -1
- package/dist/src/index.d.ts +55 -0
- package/dist/src/jobs/update-uniswap-v4-pools.js +2 -2
- package/dist/src/libs/merklChainData.js +0 -2
- package/dist/src/modules/v4/price/price.repository.d.ts +1 -1
- package/dist/src/modules/v4/price/price.service.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.repository.js +19 -1
- package/dist/src/modules/v4/reward/reward.service.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.service.js +2 -2
- package/dist/src/modules/v4/router.d.ts +55 -0
- package/dist/src/modules/v4/router.js +3 -1
- package/dist/src/modules/v4/token/token.service.js +3 -3
- package/dist/src/modules/v4/uniswap/uniswap.controller.d.ts +75 -0
- package/dist/src/modules/v4/uniswap/uniswap.controller.js +34 -0
- package/dist/src/modules/v4/{uniswapV4/uniswapV4.model.d.ts → uniswap/uniswap.model.d.ts} +6 -0
- package/dist/src/modules/v4/{uniswapV4/uniswapV4.model.js → uniswap/uniswap.model.js} +9 -0
- package/dist/src/modules/v4/{uniswapV4/uniswapV4.repository.d.ts → uniswap/uniswap.repository.d.ts} +2 -2
- package/dist/src/modules/v4/{uniswapV4/uniswapV4.repository.js → uniswap/uniswap.repository.js} +1 -1
- package/dist/src/modules/v4/{uniswapV4/uniswapV4.service.d.ts → uniswap/uniswap.service.d.ts} +3 -2
- package/dist/src/modules/v4/{uniswapV4/uniswapV4.service.js → uniswap/uniswap.service.js} +48 -4
- package/dist/src/routes/v1/prices.js +1 -1
- package/dist/src/routes/v3/uniswapv4.js +1 -1
- package/dist/src/scripts/fill-unknown-tokens.js +58 -0
- package/dist/src/scripts/reparse-opportunities.d.ts +1 -0
- package/dist/src/{jobs → scripts}/reparse-opportunities.js +1 -0
- package/dist/src/utils/prices/priceService.js +1 -1
- package/dist/src/utils/prices/services/erc4626Service.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/modules/v4/price/index.d.ts +0 -3
- package/dist/src/modules/v4/price/index.js +0 -3
- package/dist/src/modules/v4/uniswapV4/index.d.ts +0 -4
- package/dist/src/modules/v4/uniswapV4/index.js +0 -4
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +0 -53
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +0 -12
- /package/dist/src/{jobs/reparse-opportunities.d.ts → scripts/fill-unknown-tokens.d.ts} +0 -0
package/dist/src/eden/index.d.ts
CHANGED
@@ -3867,6 +3867,53 @@ declare const eden: {
|
|
3867
3867
|
}>>;
|
3868
3868
|
};
|
3869
3869
|
};
|
3870
|
+
uniswap: {
|
3871
|
+
v3: {
|
3872
|
+
reward: {
|
3873
|
+
get: (options: {
|
3874
|
+
headers?: Record<string, unknown> | undefined;
|
3875
|
+
query: {
|
3876
|
+
poolAddress?: string | undefined;
|
3877
|
+
positionId?: string | undefined;
|
3878
|
+
address: string;
|
3879
|
+
};
|
3880
|
+
fetch?: RequestInit | undefined;
|
3881
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
3882
|
+
200: {
|
3883
|
+
[x: string]: Record<string, any[]>;
|
3884
|
+
};
|
3885
|
+
}>>;
|
3886
|
+
};
|
3887
|
+
};
|
3888
|
+
v4: {
|
3889
|
+
pools: {
|
3890
|
+
get: (options: {
|
3891
|
+
headers?: Record<string, unknown> | undefined;
|
3892
|
+
query: {
|
3893
|
+
chainId: number;
|
3894
|
+
};
|
3895
|
+
fetch?: RequestInit | undefined;
|
3896
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
3897
|
+
200: {
|
3898
|
+
[x: string]: {
|
3899
|
+
poolId: string;
|
3900
|
+
poolKey: {
|
3901
|
+
hooks: string;
|
3902
|
+
fee: number;
|
3903
|
+
tickSpacing: number;
|
3904
|
+
currency0: string;
|
3905
|
+
currency1: string;
|
3906
|
+
};
|
3907
|
+
decimalsCurrency0: number;
|
3908
|
+
decimalsCurrency1: number;
|
3909
|
+
symbolCurrency0: string;
|
3910
|
+
symbolCurrency1: string;
|
3911
|
+
};
|
3912
|
+
};
|
3913
|
+
}>>;
|
3914
|
+
};
|
3915
|
+
};
|
3916
|
+
};
|
3870
3917
|
} | {
|
3871
3918
|
derive: {};
|
3872
3919
|
resolve: {};
|
@@ -7641,6 +7688,53 @@ declare const eden: {
|
|
7641
7688
|
}>>;
|
7642
7689
|
};
|
7643
7690
|
};
|
7691
|
+
uniswap: {
|
7692
|
+
v3: {
|
7693
|
+
reward: {
|
7694
|
+
get: (options: {
|
7695
|
+
headers?: Record<string, unknown> | undefined;
|
7696
|
+
query: {
|
7697
|
+
poolAddress?: string | undefined;
|
7698
|
+
positionId?: string | undefined;
|
7699
|
+
address: string;
|
7700
|
+
};
|
7701
|
+
fetch?: RequestInit | undefined;
|
7702
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7703
|
+
200: {
|
7704
|
+
[x: string]: Record<string, any[]>;
|
7705
|
+
};
|
7706
|
+
}>>;
|
7707
|
+
};
|
7708
|
+
};
|
7709
|
+
v4: {
|
7710
|
+
pools: {
|
7711
|
+
get: (options: {
|
7712
|
+
headers?: Record<string, unknown> | undefined;
|
7713
|
+
query: {
|
7714
|
+
chainId: number;
|
7715
|
+
};
|
7716
|
+
fetch?: RequestInit | undefined;
|
7717
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7718
|
+
200: {
|
7719
|
+
[x: string]: {
|
7720
|
+
poolId: string;
|
7721
|
+
poolKey: {
|
7722
|
+
hooks: string;
|
7723
|
+
fee: number;
|
7724
|
+
tickSpacing: number;
|
7725
|
+
currency0: string;
|
7726
|
+
currency1: string;
|
7727
|
+
};
|
7728
|
+
decimalsCurrency0: number;
|
7729
|
+
decimalsCurrency1: number;
|
7730
|
+
symbolCurrency0: string;
|
7731
|
+
symbolCurrency1: string;
|
7732
|
+
};
|
7733
|
+
};
|
7734
|
+
}>>;
|
7735
|
+
};
|
7736
|
+
};
|
7737
|
+
};
|
7644
7738
|
};
|
7645
7739
|
v3: {
|
7646
7740
|
app: {
|
@@ -13090,6 +13184,61 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13090
13184
|
};
|
13091
13185
|
};
|
13092
13186
|
};
|
13187
|
+
} & {
|
13188
|
+
v4: {
|
13189
|
+
uniswap: {
|
13190
|
+
v3: {
|
13191
|
+
reward: {
|
13192
|
+
get: {
|
13193
|
+
body: unknown;
|
13194
|
+
params: {};
|
13195
|
+
query: {
|
13196
|
+
poolAddress?: string | undefined;
|
13197
|
+
positionId?: string | undefined;
|
13198
|
+
address: string;
|
13199
|
+
};
|
13200
|
+
headers: unknown;
|
13201
|
+
response: {
|
13202
|
+
200: {
|
13203
|
+
[x: string]: Record<string, any[]>;
|
13204
|
+
};
|
13205
|
+
};
|
13206
|
+
};
|
13207
|
+
};
|
13208
|
+
};
|
13209
|
+
} & {
|
13210
|
+
v4: {
|
13211
|
+
pools: {
|
13212
|
+
get: {
|
13213
|
+
body: unknown;
|
13214
|
+
params: {};
|
13215
|
+
query: {
|
13216
|
+
chainId: number;
|
13217
|
+
};
|
13218
|
+
headers: unknown;
|
13219
|
+
response: {
|
13220
|
+
200: {
|
13221
|
+
[x: string]: {
|
13222
|
+
poolId: string;
|
13223
|
+
poolKey: {
|
13224
|
+
hooks: string;
|
13225
|
+
fee: number;
|
13226
|
+
tickSpacing: number;
|
13227
|
+
currency0: string;
|
13228
|
+
currency1: string;
|
13229
|
+
};
|
13230
|
+
decimalsCurrency0: number;
|
13231
|
+
decimalsCurrency1: number;
|
13232
|
+
symbolCurrency0: string;
|
13233
|
+
symbolCurrency1: string;
|
13234
|
+
};
|
13235
|
+
};
|
13236
|
+
};
|
13237
|
+
};
|
13238
|
+
};
|
13239
|
+
};
|
13240
|
+
};
|
13241
|
+
};
|
13093
13242
|
} & {
|
13094
13243
|
v3: {
|
13095
13244
|
app: {
|
@@ -17768,6 +17917,53 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17768
17917
|
}>>;
|
17769
17918
|
};
|
17770
17919
|
};
|
17920
|
+
uniswap: {
|
17921
|
+
v3: {
|
17922
|
+
reward: {
|
17923
|
+
get: (options: {
|
17924
|
+
headers?: Record<string, unknown> | undefined;
|
17925
|
+
query: {
|
17926
|
+
poolAddress?: string | undefined;
|
17927
|
+
positionId?: string | undefined;
|
17928
|
+
address: string;
|
17929
|
+
};
|
17930
|
+
fetch?: RequestInit | undefined;
|
17931
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
17932
|
+
200: {
|
17933
|
+
[x: string]: Record<string, any[]>;
|
17934
|
+
};
|
17935
|
+
}>>;
|
17936
|
+
};
|
17937
|
+
};
|
17938
|
+
v4: {
|
17939
|
+
pools: {
|
17940
|
+
get: (options: {
|
17941
|
+
headers?: Record<string, unknown> | undefined;
|
17942
|
+
query: {
|
17943
|
+
chainId: number;
|
17944
|
+
};
|
17945
|
+
fetch?: RequestInit | undefined;
|
17946
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
17947
|
+
200: {
|
17948
|
+
[x: string]: {
|
17949
|
+
poolId: string;
|
17950
|
+
poolKey: {
|
17951
|
+
hooks: string;
|
17952
|
+
fee: number;
|
17953
|
+
tickSpacing: number;
|
17954
|
+
currency0: string;
|
17955
|
+
currency1: string;
|
17956
|
+
};
|
17957
|
+
decimalsCurrency0: number;
|
17958
|
+
decimalsCurrency1: number;
|
17959
|
+
symbolCurrency0: string;
|
17960
|
+
symbolCurrency1: string;
|
17961
|
+
};
|
17962
|
+
};
|
17963
|
+
}>>;
|
17964
|
+
};
|
17965
|
+
};
|
17966
|
+
};
|
17771
17967
|
} | {
|
17772
17968
|
derive: {};
|
17773
17969
|
resolve: {};
|
@@ -21542,6 +21738,53 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
21542
21738
|
}>>;
|
21543
21739
|
};
|
21544
21740
|
};
|
21741
|
+
uniswap: {
|
21742
|
+
v3: {
|
21743
|
+
reward: {
|
21744
|
+
get: (options: {
|
21745
|
+
headers?: Record<string, unknown> | undefined;
|
21746
|
+
query: {
|
21747
|
+
poolAddress?: string | undefined;
|
21748
|
+
positionId?: string | undefined;
|
21749
|
+
address: string;
|
21750
|
+
};
|
21751
|
+
fetch?: RequestInit | undefined;
|
21752
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
21753
|
+
200: {
|
21754
|
+
[x: string]: Record<string, any[]>;
|
21755
|
+
};
|
21756
|
+
}>>;
|
21757
|
+
};
|
21758
|
+
};
|
21759
|
+
v4: {
|
21760
|
+
pools: {
|
21761
|
+
get: (options: {
|
21762
|
+
headers?: Record<string, unknown> | undefined;
|
21763
|
+
query: {
|
21764
|
+
chainId: number;
|
21765
|
+
};
|
21766
|
+
fetch?: RequestInit | undefined;
|
21767
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
21768
|
+
200: {
|
21769
|
+
[x: string]: {
|
21770
|
+
poolId: string;
|
21771
|
+
poolKey: {
|
21772
|
+
hooks: string;
|
21773
|
+
fee: number;
|
21774
|
+
tickSpacing: number;
|
21775
|
+
currency0: string;
|
21776
|
+
currency1: string;
|
21777
|
+
};
|
21778
|
+
decimalsCurrency0: number;
|
21779
|
+
decimalsCurrency1: number;
|
21780
|
+
symbolCurrency0: string;
|
21781
|
+
symbolCurrency1: string;
|
21782
|
+
};
|
21783
|
+
};
|
21784
|
+
}>>;
|
21785
|
+
};
|
21786
|
+
};
|
21787
|
+
};
|
21545
21788
|
};
|
21546
21789
|
v3: {
|
21547
21790
|
app: {
|
@@ -172,7 +172,8 @@ export class UniswapV4DynamicData {
|
|
172
172
|
const poolBalanceToken0WithoutBlacklist = poolBalanceToken0;
|
173
173
|
const poolBalanceToken1WithoutBlacklist = poolBalanceToken1;
|
174
174
|
// const poolLiquidityWithoutBlacklist = poolTotalLiquidity - (blacklistedLiquidity ?? 0);
|
175
|
-
const tvl =
|
175
|
+
const tvl = (!!priceToken0 ? poolBalanceToken0 * priceToken0 : 0) +
|
176
|
+
(!!priceToken1 ? poolBalanceToken1 * priceToken1 : 0);
|
176
177
|
distributionMeanAPR = (yearlyToken0Rewards + yearlyToken1Rewards + yearlyFeeRewards) / tvl;
|
177
178
|
distributionMeanAPR = !distributionMeanAPR || Number.isNaN(distributionMeanAPR) ? 0 : distributionMeanAPR;
|
178
179
|
/**
|
package/dist/src/index.d.ts
CHANGED
@@ -4831,6 +4831,61 @@ declare const app: Elysia<"", false, {
|
|
4831
4831
|
};
|
4832
4832
|
};
|
4833
4833
|
};
|
4834
|
+
} & {
|
4835
|
+
v4: {
|
4836
|
+
uniswap: {
|
4837
|
+
v3: {
|
4838
|
+
reward: {
|
4839
|
+
get: {
|
4840
|
+
body: unknown;
|
4841
|
+
params: {};
|
4842
|
+
query: {
|
4843
|
+
poolAddress?: string | undefined;
|
4844
|
+
positionId?: string | undefined;
|
4845
|
+
address: string;
|
4846
|
+
};
|
4847
|
+
headers: unknown;
|
4848
|
+
response: {
|
4849
|
+
200: {
|
4850
|
+
[x: string]: Record<string, any[]>;
|
4851
|
+
};
|
4852
|
+
};
|
4853
|
+
};
|
4854
|
+
};
|
4855
|
+
};
|
4856
|
+
} & {
|
4857
|
+
v4: {
|
4858
|
+
pools: {
|
4859
|
+
get: {
|
4860
|
+
body: unknown;
|
4861
|
+
params: {};
|
4862
|
+
query: {
|
4863
|
+
chainId: number;
|
4864
|
+
};
|
4865
|
+
headers: unknown;
|
4866
|
+
response: {
|
4867
|
+
200: {
|
4868
|
+
[x: string]: {
|
4869
|
+
poolId: string;
|
4870
|
+
poolKey: {
|
4871
|
+
hooks: string;
|
4872
|
+
fee: number;
|
4873
|
+
tickSpacing: number;
|
4874
|
+
currency0: string;
|
4875
|
+
currency1: string;
|
4876
|
+
};
|
4877
|
+
decimalsCurrency0: number;
|
4878
|
+
decimalsCurrency1: number;
|
4879
|
+
symbolCurrency0: string;
|
4880
|
+
symbolCurrency1: string;
|
4881
|
+
};
|
4882
|
+
};
|
4883
|
+
};
|
4884
|
+
};
|
4885
|
+
};
|
4886
|
+
};
|
4887
|
+
};
|
4888
|
+
};
|
4834
4889
|
} & {
|
4835
4890
|
v3: {
|
4836
4891
|
app: {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Redis } from "@/cache";
|
2
|
-
import {
|
2
|
+
import { UniswapService } from "@/modules/v4/uniswap/uniswap.service";
|
3
3
|
async function main() {
|
4
4
|
try {
|
5
|
-
await Redis.safeSet("UniswapV4Pools", await
|
5
|
+
await Redis.safeSet("UniswapV4Pools", await UniswapService.getPools());
|
6
6
|
process.exit(0);
|
7
7
|
}
|
8
8
|
catch (err) {
|
@@ -91,8 +91,6 @@ export async function merklChainData(chainId) {
|
|
91
91
|
return acc;
|
92
92
|
}, []);
|
93
93
|
const validRewardTokenRes = await batchMulticallCallWithRetry(chainId, { calls: validRewardTokensCalls });
|
94
|
-
if (chainId === 1101)
|
95
|
-
console.log(validRewardTokenRes);
|
96
94
|
for (let index = 0; index < validRewardTokens.length; index++) {
|
97
95
|
try {
|
98
96
|
if (validRewardTokenRes[2 * index][0] &&
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { PriceSourceMethod } from "@db/api";
|
2
|
-
import type { CreatePriceSourceModel, UpdatePriceSourceModel } from ".";
|
2
|
+
import type { CreatePriceSourceModel, UpdatePriceSourceModel } from "./price.model";
|
3
3
|
export declare class PriceRepository {
|
4
4
|
static findBySymbolOrThrow(symbol: string): Promise<{
|
5
5
|
symbol: string;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { PriceSourceMethod } from "@db/api";
|
2
|
-
import type { CreatePriceSourceModel, UpdatePriceSourceModel } from ".";
|
2
|
+
import type { CreatePriceSourceModel, UpdatePriceSourceModel } from "./price.model";
|
3
3
|
export declare class PriceService {
|
4
4
|
static findMany(): Promise<{
|
5
5
|
[token: string]: number;
|
@@ -3,7 +3,7 @@ import type { BreakdownForCampaignsRaw, CampaignIdModel, CampaignIdWithoutPageMo
|
|
3
3
|
export declare abstract class RewardRepository {
|
4
4
|
static createManyReward(rewards: CreateManyRewardModel): Promise<import("database/api/.generated/runtime/library").GetBatchResult>;
|
5
5
|
static createManyBreakdown(data: CreateManyBreakdownModel): Promise<import("database/api/.generated/runtime/library").GetBatchResult>;
|
6
|
-
static getByRecipient(recipient: string, roots: string[], withToken: boolean, withTestTokens: boolean, chainFilter?: ChainId[]): Promise<({
|
6
|
+
static getByRecipient(recipient: string, roots: string[], withToken: boolean, withTestTokens: boolean, chainFilter?: ChainId[] | null, reasonFilter?: string): Promise<({
|
7
7
|
RewardToken: {
|
8
8
|
symbol: string;
|
9
9
|
id: string;
|
@@ -56,7 +56,7 @@ export class RewardRepository {
|
|
56
56
|
data: breakdownsToCreate,
|
57
57
|
});
|
58
58
|
}
|
59
|
-
static async getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter) {
|
59
|
+
static async getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter, reasonFilter) {
|
60
60
|
return await apiDbClient.reward.findMany({
|
61
61
|
where: {
|
62
62
|
root: {
|
@@ -69,9 +69,27 @@ export class RewardRepository {
|
|
69
69
|
isTest: withTestTokens ? undefined : false,
|
70
70
|
}
|
71
71
|
: undefined,
|
72
|
+
Breakdown: reasonFilter
|
73
|
+
? {
|
74
|
+
some: {
|
75
|
+
reason: {
|
76
|
+
contains: reasonFilter,
|
77
|
+
mode: "insensitive",
|
78
|
+
},
|
79
|
+
},
|
80
|
+
}
|
81
|
+
: undefined,
|
72
82
|
},
|
73
83
|
include: {
|
74
84
|
Breakdown: {
|
85
|
+
where: reasonFilter
|
86
|
+
? {
|
87
|
+
reason: {
|
88
|
+
contains: reasonFilter,
|
89
|
+
mode: "insensitive",
|
90
|
+
},
|
91
|
+
}
|
92
|
+
: undefined,
|
75
93
|
include: {
|
76
94
|
Campaign: {
|
77
95
|
select: {
|
@@ -330,7 +330,7 @@ export declare abstract class RewardService {
|
|
330
330
|
proofs: string[];
|
331
331
|
}[];
|
332
332
|
static createManyBreakdown(data: CreateManyBreakdownModel): Promise<import("database/api/.generated/runtime/library").GetBatchResult | undefined>;
|
333
|
-
static getByRecipient(recipient: string, roots: string[], withToken?: boolean, withTestTokens?: boolean, chainFilter?: ChainId[]): Promise<({
|
333
|
+
static getByRecipient(recipient: string, roots: string[], withToken?: boolean, withTestTokens?: boolean, chainFilter?: ChainId[] | null, reasonFilter?: string): Promise<({
|
334
334
|
RewardToken: {
|
335
335
|
symbol: string;
|
336
336
|
id: string;
|
@@ -133,8 +133,8 @@ export class RewardService {
|
|
133
133
|
log.error(`createManyBreakdown - error creating many breakdowns for campaigns ${foundCampaigns.join(", ")}`, e);
|
134
134
|
}
|
135
135
|
}
|
136
|
-
static async getByRecipient(recipient, roots, withToken = false, withTestTokens = false, chainFilter) {
|
137
|
-
return RewardRepository.getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter);
|
136
|
+
static async getByRecipient(recipient, roots, withToken = false, withTestTokens = false, chainFilter, reasonFilter) {
|
137
|
+
return RewardRepository.getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter, reasonFilter);
|
138
138
|
}
|
139
139
|
/**
|
140
140
|
* Groups a breakdown array by their corresponding opportunities
|
@@ -4701,6 +4701,61 @@ export declare const v4: Elysia<"/v4", false, {
|
|
4701
4701
|
};
|
4702
4702
|
};
|
4703
4703
|
};
|
4704
|
+
} & {
|
4705
|
+
v4: {
|
4706
|
+
uniswap: {
|
4707
|
+
v3: {
|
4708
|
+
reward: {
|
4709
|
+
get: {
|
4710
|
+
body: unknown;
|
4711
|
+
params: {};
|
4712
|
+
query: {
|
4713
|
+
poolAddress?: string | undefined;
|
4714
|
+
positionId?: string | undefined;
|
4715
|
+
address: string;
|
4716
|
+
};
|
4717
|
+
headers: unknown;
|
4718
|
+
response: {
|
4719
|
+
200: {
|
4720
|
+
[x: string]: Record<string, any[]>;
|
4721
|
+
};
|
4722
|
+
};
|
4723
|
+
};
|
4724
|
+
};
|
4725
|
+
};
|
4726
|
+
} & {
|
4727
|
+
v4: {
|
4728
|
+
pools: {
|
4729
|
+
get: {
|
4730
|
+
body: unknown;
|
4731
|
+
params: {};
|
4732
|
+
query: {
|
4733
|
+
chainId: number;
|
4734
|
+
};
|
4735
|
+
headers: unknown;
|
4736
|
+
response: {
|
4737
|
+
200: {
|
4738
|
+
[x: string]: {
|
4739
|
+
poolId: string;
|
4740
|
+
poolKey: {
|
4741
|
+
hooks: string;
|
4742
|
+
fee: number;
|
4743
|
+
tickSpacing: number;
|
4744
|
+
currency0: string;
|
4745
|
+
currency1: string;
|
4746
|
+
};
|
4747
|
+
decimalsCurrency0: number;
|
4748
|
+
decimalsCurrency1: number;
|
4749
|
+
symbolCurrency0: string;
|
4750
|
+
symbolCurrency1: string;
|
4751
|
+
};
|
4752
|
+
};
|
4753
|
+
};
|
4754
|
+
};
|
4755
|
+
};
|
4756
|
+
};
|
4757
|
+
};
|
4758
|
+
};
|
4704
4759
|
}, {
|
4705
4760
|
derive: {};
|
4706
4761
|
resolve: {};
|
@@ -18,6 +18,7 @@ import { ProtocolController } from "@/modules/v4/protocol/protocol.controller";
|
|
18
18
|
import { RewardController } from "@/modules/v4/reward/reward.controller";
|
19
19
|
import { StatusController } from "@/modules/v4/status/status.controller";
|
20
20
|
import { TokenController } from "@/modules/v4/token/token.controller";
|
21
|
+
import { UniswapController } from "@/modules/v4/uniswap/uniswap.controller";
|
21
22
|
import { UserController } from "@/modules/v4/user/user.controller";
|
22
23
|
import { ErrorHandler } from "@/plugins/error-handling.plugin";
|
23
24
|
import bigintToString from "@/utils/bigintToString";
|
@@ -73,4 +74,5 @@ export const v4 = new Elysia({ tags: ["v4"], prefix: "/v4" })
|
|
73
74
|
.use(BoostController)
|
74
75
|
.use(ComputedValueController)
|
75
76
|
.use(CreatorController)
|
76
|
-
.use(ReferralController)
|
77
|
+
.use(ReferralController)
|
78
|
+
.use(UniswapController);
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { HttpError } from "@/errors";
|
2
2
|
import { getTokensListWithCache } from "@/libs/getTokensList";
|
3
3
|
import { getOnlyUserBalance } from "@/libs/tokens/balances";
|
4
|
+
import { BucketService } from "@/modules/v4/bucket/bucket.service";
|
5
|
+
import { IconService } from "@/modules/v4/icon/icon.service";
|
6
|
+
import { PriceService } from "@/modules/v4/price/price.service";
|
4
7
|
import { log } from "@/utils/logger";
|
5
8
|
import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "@/utils/throw";
|
6
9
|
import { apiDbClient } from "@db";
|
7
10
|
import { Prisma } from "@db/api";
|
8
11
|
import { ChainInteractionService, DistributionCreatorService, NETWORK_LABELS, bigIntToNumber, } from "@sdk";
|
9
12
|
import { getAddress, parseUnits } from "viem";
|
10
|
-
import { BucketService } from "../bucket/bucket.service";
|
11
|
-
import { IconService } from "../icon/icon.service";
|
12
|
-
import { PriceService } from "../price";
|
13
13
|
import { TokenRepository } from "./token.repository";
|
14
14
|
export class TokenService {
|
15
15
|
static hashId(token) {
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import Elysia from "elysia";
|
2
|
+
export declare const UniswapController: Elysia<"uniswap", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
macroFn: {};
|
14
|
+
}, {
|
15
|
+
uniswap: {
|
16
|
+
v3: {
|
17
|
+
reward: {
|
18
|
+
get: {
|
19
|
+
body: unknown;
|
20
|
+
params: {};
|
21
|
+
query: {
|
22
|
+
poolAddress?: string | undefined;
|
23
|
+
positionId?: string | undefined;
|
24
|
+
address: string;
|
25
|
+
};
|
26
|
+
headers: unknown;
|
27
|
+
response: {
|
28
|
+
200: {
|
29
|
+
[x: string]: Record<string, any[]>;
|
30
|
+
};
|
31
|
+
};
|
32
|
+
};
|
33
|
+
};
|
34
|
+
};
|
35
|
+
} & {
|
36
|
+
v4: {
|
37
|
+
pools: {
|
38
|
+
get: {
|
39
|
+
body: unknown;
|
40
|
+
params: {};
|
41
|
+
query: {
|
42
|
+
chainId: number;
|
43
|
+
};
|
44
|
+
headers: unknown;
|
45
|
+
response: {
|
46
|
+
200: {
|
47
|
+
[x: string]: {
|
48
|
+
poolId: string;
|
49
|
+
poolKey: {
|
50
|
+
hooks: string;
|
51
|
+
fee: number;
|
52
|
+
tickSpacing: number;
|
53
|
+
currency0: string;
|
54
|
+
currency1: string;
|
55
|
+
};
|
56
|
+
decimalsCurrency0: number;
|
57
|
+
decimalsCurrency1: number;
|
58
|
+
symbolCurrency0: string;
|
59
|
+
symbolCurrency1: string;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
};
|
63
|
+
};
|
64
|
+
};
|
65
|
+
};
|
66
|
+
};
|
67
|
+
}, {
|
68
|
+
derive: {};
|
69
|
+
resolve: {};
|
70
|
+
schema: {};
|
71
|
+
}, {
|
72
|
+
derive: {};
|
73
|
+
resolve: {};
|
74
|
+
schema: {};
|
75
|
+
}>;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { throwOnInvalidAddress, throwOnInvalidRequiredAddress } from "@/utils/throw";
|
2
|
+
import Elysia, { t } from "elysia";
|
3
|
+
import { RewardsPerV3PositionDto } from "./uniswap.model";
|
4
|
+
import { UniswapService } from "./uniswap.service";
|
5
|
+
export const UniswapController = new Elysia({
|
6
|
+
prefix: "uniswap",
|
7
|
+
detail: { tags: ["Uniswap"], hide: true },
|
8
|
+
})
|
9
|
+
.group("/v3", app => {
|
10
|
+
return app.get("/reward", async ({ query }) => {
|
11
|
+
return await UniswapService.findV3RewardsPerPosition(query);
|
12
|
+
}, {
|
13
|
+
query: RewardsPerV3PositionDto,
|
14
|
+
beforeHandle: ({ query }) => {
|
15
|
+
query.address = throwOnInvalidRequiredAddress(query.address);
|
16
|
+
query.poolAddress = throwOnInvalidAddress(query.poolAddress);
|
17
|
+
},
|
18
|
+
detail: {
|
19
|
+
description: "Get rewards earned grouped by pool and uniswap v3 position",
|
20
|
+
},
|
21
|
+
});
|
22
|
+
})
|
23
|
+
.group("/v4", app => {
|
24
|
+
return app.get("/pools", async ({ query }) => {
|
25
|
+
return await UniswapService.getPoolsByChain(query.chainId);
|
26
|
+
}, {
|
27
|
+
query: t.Object({
|
28
|
+
chainId: t.Numeric(),
|
29
|
+
}),
|
30
|
+
detail: {
|
31
|
+
description: "Get Uniswap V4 pools by chain",
|
32
|
+
},
|
33
|
+
});
|
34
|
+
});
|