@merkl/api 0.20.40 → 0.20.42
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 +84 -142
- package/dist/src/index.d.ts +16 -30
- package/dist/src/modules/v4/coingecko/coingecko.model.d.ts +0 -0
- package/dist/src/modules/v4/coingecko/coingecko.model.js +1 -0
- package/dist/src/modules/v4/coingecko/coingecko.repository.d.ts +14 -0
- package/dist/src/modules/v4/coingecko/coingecko.repository.js +9 -0
- package/dist/src/modules/v4/coingecko/coingecko.service.d.ts +16 -0
- package/dist/src/modules/v4/coingecko/coingecko.service.js +65 -0
- package/dist/src/modules/v4/router.d.ts +16 -30
- package/dist/src/modules/v4/token/token.controller.d.ts +3 -15
- package/dist/src/modules/v4/token/token.controller.js +0 -5
- package/dist/src/modules/v4/token/token.model.d.ts +1 -0
- package/dist/src/modules/v4/token/token.model.js +1 -0
- package/dist/src/modules/v4/token/token.repository.js +1 -0
- package/dist/src/modules/v4/token/token.service.d.ts +1 -2
- package/dist/src/modules/v4/token/token.service.js +21 -37
- package/dist/src/modules/v4/uniswap/uniswap.controller.d.ts +13 -15
- package/dist/src/modules/v4/uniswap/uniswap.controller.js +2 -2
- package/dist/src/scripts/fill-coingecko-data.d.ts +1 -0
- package/dist/src/scripts/fill-coingecko-data.js +3 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -1837,6 +1837,7 @@ declare const eden: {
|
|
1837
1837
|
isNative?: boolean | undefined;
|
1838
1838
|
test?: boolean | undefined;
|
1839
1839
|
missingIcons?: boolean | undefined;
|
1840
|
+
missingPrice?: boolean | undefined;
|
1840
1841
|
};
|
1841
1842
|
fetch?: RequestInit | undefined;
|
1842
1843
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -1883,7 +1884,7 @@ declare const eden: {
|
|
1883
1884
|
isPoint: boolean;
|
1884
1885
|
isNative: boolean;
|
1885
1886
|
price: number | null;
|
1886
|
-
}
|
1887
|
+
};
|
1887
1888
|
}>>;
|
1888
1889
|
};
|
1889
1890
|
count: {
|
@@ -1900,23 +1901,13 @@ declare const eden: {
|
|
1900
1901
|
isNative?: boolean | undefined;
|
1901
1902
|
test?: boolean | undefined;
|
1902
1903
|
missingIcons?: boolean | undefined;
|
1904
|
+
missingPrice?: boolean | undefined;
|
1903
1905
|
};
|
1904
1906
|
fetch?: RequestInit | undefined;
|
1905
1907
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1906
1908
|
200: number;
|
1907
1909
|
}>>;
|
1908
1910
|
};
|
1909
|
-
icons: {
|
1910
|
-
post: (body: unknown, options: {
|
1911
|
-
headers: {
|
1912
|
-
authorization: string;
|
1913
|
-
};
|
1914
|
-
query?: Record<string, unknown> | undefined;
|
1915
|
-
fetch?: RequestInit | undefined;
|
1916
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1917
|
-
200: void;
|
1918
|
-
}>>;
|
1919
|
-
};
|
1920
1911
|
webhooks: {
|
1921
1912
|
notion: {
|
1922
1913
|
post: (body: {
|
@@ -3868,22 +3859,20 @@ declare const eden: {
|
|
3868
3859
|
};
|
3869
3860
|
};
|
3870
3861
|
uniswap: {
|
3871
|
-
|
3872
|
-
|
3873
|
-
|
3874
|
-
|
3875
|
-
|
3876
|
-
|
3877
|
-
|
3878
|
-
|
3879
|
-
|
3880
|
-
|
3881
|
-
|
3882
|
-
|
3883
|
-
|
3884
|
-
|
3885
|
-
}>>;
|
3886
|
-
};
|
3862
|
+
reward: {
|
3863
|
+
get: (options: {
|
3864
|
+
headers?: Record<string, unknown> | undefined;
|
3865
|
+
query: {
|
3866
|
+
poolAddress?: string | undefined;
|
3867
|
+
positionId?: string | undefined;
|
3868
|
+
address: string;
|
3869
|
+
};
|
3870
|
+
fetch?: RequestInit | undefined;
|
3871
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
3872
|
+
200: {
|
3873
|
+
[x: string]: Record<string, any[]>;
|
3874
|
+
};
|
3875
|
+
}>>;
|
3887
3876
|
};
|
3888
3877
|
v4: {
|
3889
3878
|
pools: {
|
@@ -5658,6 +5647,7 @@ declare const eden: {
|
|
5658
5647
|
isNative?: boolean | undefined;
|
5659
5648
|
test?: boolean | undefined;
|
5660
5649
|
missingIcons?: boolean | undefined;
|
5650
|
+
missingPrice?: boolean | undefined;
|
5661
5651
|
};
|
5662
5652
|
fetch?: RequestInit | undefined;
|
5663
5653
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -5704,7 +5694,7 @@ declare const eden: {
|
|
5704
5694
|
isPoint: boolean;
|
5705
5695
|
isNative: boolean;
|
5706
5696
|
price: number | null;
|
5707
|
-
}
|
5697
|
+
};
|
5708
5698
|
}>>;
|
5709
5699
|
};
|
5710
5700
|
count: {
|
@@ -5721,23 +5711,13 @@ declare const eden: {
|
|
5721
5711
|
isNative?: boolean | undefined;
|
5722
5712
|
test?: boolean | undefined;
|
5723
5713
|
missingIcons?: boolean | undefined;
|
5714
|
+
missingPrice?: boolean | undefined;
|
5724
5715
|
};
|
5725
5716
|
fetch?: RequestInit | undefined;
|
5726
5717
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
5727
5718
|
200: number;
|
5728
5719
|
}>>;
|
5729
5720
|
};
|
5730
|
-
icons: {
|
5731
|
-
post: (body: unknown, options: {
|
5732
|
-
headers: {
|
5733
|
-
authorization: string;
|
5734
|
-
};
|
5735
|
-
query?: Record<string, unknown> | undefined;
|
5736
|
-
fetch?: RequestInit | undefined;
|
5737
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
5738
|
-
200: void;
|
5739
|
-
}>>;
|
5740
|
-
};
|
5741
5721
|
webhooks: {
|
5742
5722
|
notion: {
|
5743
5723
|
post: (body: {
|
@@ -7689,22 +7669,20 @@ declare const eden: {
|
|
7689
7669
|
};
|
7690
7670
|
};
|
7691
7671
|
uniswap: {
|
7692
|
-
|
7693
|
-
|
7694
|
-
|
7695
|
-
|
7696
|
-
|
7697
|
-
|
7698
|
-
|
7699
|
-
|
7700
|
-
|
7701
|
-
|
7702
|
-
|
7703
|
-
|
7704
|
-
|
7705
|
-
|
7706
|
-
}>>;
|
7707
|
-
};
|
7672
|
+
reward: {
|
7673
|
+
get: (options: {
|
7674
|
+
headers?: Record<string, unknown> | undefined;
|
7675
|
+
query: {
|
7676
|
+
poolAddress?: string | undefined;
|
7677
|
+
positionId?: string | undefined;
|
7678
|
+
address: string;
|
7679
|
+
};
|
7680
|
+
fetch?: RequestInit | undefined;
|
7681
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7682
|
+
200: {
|
7683
|
+
[x: string]: Record<string, any[]>;
|
7684
|
+
};
|
7685
|
+
}>>;
|
7708
7686
|
};
|
7709
7687
|
v4: {
|
7710
7688
|
pools: {
|
@@ -10548,6 +10526,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10548
10526
|
isNative?: boolean | undefined;
|
10549
10527
|
test?: boolean | undefined;
|
10550
10528
|
missingIcons?: boolean | undefined;
|
10529
|
+
missingPrice?: boolean | undefined;
|
10551
10530
|
};
|
10552
10531
|
headers: unknown;
|
10553
10532
|
response: {
|
@@ -10585,6 +10564,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10585
10564
|
isNative?: boolean | undefined;
|
10586
10565
|
test?: boolean | undefined;
|
10587
10566
|
missingIcons?: boolean | undefined;
|
10567
|
+
missingPrice?: boolean | undefined;
|
10588
10568
|
};
|
10589
10569
|
headers: unknown;
|
10590
10570
|
response: {
|
@@ -10622,7 +10602,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10622
10602
|
isPoint: boolean;
|
10623
10603
|
isNative: boolean;
|
10624
10604
|
price: number | null;
|
10625
|
-
}
|
10605
|
+
};
|
10626
10606
|
};
|
10627
10607
|
};
|
10628
10608
|
};
|
@@ -10663,20 +10643,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10663
10643
|
};
|
10664
10644
|
};
|
10665
10645
|
};
|
10666
|
-
} & {
|
10667
|
-
icons: {
|
10668
|
-
post: {
|
10669
|
-
body: unknown;
|
10670
|
-
params: {};
|
10671
|
-
query: unknown;
|
10672
|
-
headers: {
|
10673
|
-
authorization: string;
|
10674
|
-
};
|
10675
|
-
response: {
|
10676
|
-
200: void;
|
10677
|
-
};
|
10678
|
-
};
|
10679
|
-
};
|
10680
10646
|
} & {
|
10681
10647
|
webhooks: {
|
10682
10648
|
notion: {
|
@@ -13187,21 +13153,19 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13187
13153
|
} & {
|
13188
13154
|
v4: {
|
13189
13155
|
uniswap: {
|
13190
|
-
|
13191
|
-
|
13192
|
-
|
13193
|
-
|
13194
|
-
|
13195
|
-
|
13196
|
-
|
13197
|
-
|
13198
|
-
|
13199
|
-
|
13200
|
-
|
13201
|
-
|
13202
|
-
|
13203
|
-
[x: string]: Record<string, any[]>;
|
13204
|
-
};
|
13156
|
+
reward: {
|
13157
|
+
get: {
|
13158
|
+
body: unknown;
|
13159
|
+
params: {};
|
13160
|
+
query: {
|
13161
|
+
poolAddress?: string | undefined;
|
13162
|
+
positionId?: string | undefined;
|
13163
|
+
address: string;
|
13164
|
+
};
|
13165
|
+
headers: unknown;
|
13166
|
+
response: {
|
13167
|
+
200: {
|
13168
|
+
[x: string]: Record<string, any[]>;
|
13205
13169
|
};
|
13206
13170
|
};
|
13207
13171
|
};
|
@@ -15887,6 +15851,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
15887
15851
|
isNative?: boolean | undefined;
|
15888
15852
|
test?: boolean | undefined;
|
15889
15853
|
missingIcons?: boolean | undefined;
|
15854
|
+
missingPrice?: boolean | undefined;
|
15890
15855
|
};
|
15891
15856
|
fetch?: RequestInit | undefined;
|
15892
15857
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -15933,7 +15898,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
15933
15898
|
isPoint: boolean;
|
15934
15899
|
isNative: boolean;
|
15935
15900
|
price: number | null;
|
15936
|
-
}
|
15901
|
+
};
|
15937
15902
|
}>>;
|
15938
15903
|
};
|
15939
15904
|
count: {
|
@@ -15950,23 +15915,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
15950
15915
|
isNative?: boolean | undefined;
|
15951
15916
|
test?: boolean | undefined;
|
15952
15917
|
missingIcons?: boolean | undefined;
|
15918
|
+
missingPrice?: boolean | undefined;
|
15953
15919
|
};
|
15954
15920
|
fetch?: RequestInit | undefined;
|
15955
15921
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
15956
15922
|
200: number;
|
15957
15923
|
}>>;
|
15958
15924
|
};
|
15959
|
-
icons: {
|
15960
|
-
post: (body: unknown, options: {
|
15961
|
-
headers: {
|
15962
|
-
authorization: string;
|
15963
|
-
};
|
15964
|
-
query?: Record<string, unknown> | undefined;
|
15965
|
-
fetch?: RequestInit | undefined;
|
15966
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
15967
|
-
200: void;
|
15968
|
-
}>>;
|
15969
|
-
};
|
15970
15925
|
webhooks: {
|
15971
15926
|
notion: {
|
15972
15927
|
post: (body: {
|
@@ -17918,22 +17873,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17918
17873
|
};
|
17919
17874
|
};
|
17920
17875
|
uniswap: {
|
17921
|
-
|
17922
|
-
|
17923
|
-
|
17924
|
-
|
17925
|
-
|
17926
|
-
|
17927
|
-
|
17928
|
-
|
17929
|
-
|
17930
|
-
|
17931
|
-
|
17932
|
-
|
17933
|
-
|
17934
|
-
|
17935
|
-
}>>;
|
17936
|
-
};
|
17876
|
+
reward: {
|
17877
|
+
get: (options: {
|
17878
|
+
headers?: Record<string, unknown> | undefined;
|
17879
|
+
query: {
|
17880
|
+
poolAddress?: string | undefined;
|
17881
|
+
positionId?: string | undefined;
|
17882
|
+
address: string;
|
17883
|
+
};
|
17884
|
+
fetch?: RequestInit | undefined;
|
17885
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
17886
|
+
200: {
|
17887
|
+
[x: string]: Record<string, any[]>;
|
17888
|
+
};
|
17889
|
+
}>>;
|
17937
17890
|
};
|
17938
17891
|
v4: {
|
17939
17892
|
pools: {
|
@@ -19708,6 +19661,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
19708
19661
|
isNative?: boolean | undefined;
|
19709
19662
|
test?: boolean | undefined;
|
19710
19663
|
missingIcons?: boolean | undefined;
|
19664
|
+
missingPrice?: boolean | undefined;
|
19711
19665
|
};
|
19712
19666
|
fetch?: RequestInit | undefined;
|
19713
19667
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -19754,7 +19708,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
19754
19708
|
isPoint: boolean;
|
19755
19709
|
isNative: boolean;
|
19756
19710
|
price: number | null;
|
19757
|
-
}
|
19711
|
+
};
|
19758
19712
|
}>>;
|
19759
19713
|
};
|
19760
19714
|
count: {
|
@@ -19771,23 +19725,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
19771
19725
|
isNative?: boolean | undefined;
|
19772
19726
|
test?: boolean | undefined;
|
19773
19727
|
missingIcons?: boolean | undefined;
|
19728
|
+
missingPrice?: boolean | undefined;
|
19774
19729
|
};
|
19775
19730
|
fetch?: RequestInit | undefined;
|
19776
19731
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
19777
19732
|
200: number;
|
19778
19733
|
}>>;
|
19779
19734
|
};
|
19780
|
-
icons: {
|
19781
|
-
post: (body: unknown, options: {
|
19782
|
-
headers: {
|
19783
|
-
authorization: string;
|
19784
|
-
};
|
19785
|
-
query?: Record<string, unknown> | undefined;
|
19786
|
-
fetch?: RequestInit | undefined;
|
19787
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
19788
|
-
200: void;
|
19789
|
-
}>>;
|
19790
|
-
};
|
19791
19735
|
webhooks: {
|
19792
19736
|
notion: {
|
19793
19737
|
post: (body: {
|
@@ -21739,22 +21683,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
21739
21683
|
};
|
21740
21684
|
};
|
21741
21685
|
uniswap: {
|
21742
|
-
|
21743
|
-
|
21744
|
-
|
21745
|
-
|
21746
|
-
|
21747
|
-
|
21748
|
-
|
21749
|
-
|
21750
|
-
|
21751
|
-
|
21752
|
-
|
21753
|
-
|
21754
|
-
|
21755
|
-
|
21756
|
-
}>>;
|
21757
|
-
};
|
21686
|
+
reward: {
|
21687
|
+
get: (options: {
|
21688
|
+
headers?: Record<string, unknown> | undefined;
|
21689
|
+
query: {
|
21690
|
+
poolAddress?: string | undefined;
|
21691
|
+
positionId?: string | undefined;
|
21692
|
+
address: string;
|
21693
|
+
};
|
21694
|
+
fetch?: RequestInit | undefined;
|
21695
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
21696
|
+
200: {
|
21697
|
+
[x: string]: Record<string, any[]>;
|
21698
|
+
};
|
21699
|
+
}>>;
|
21758
21700
|
};
|
21759
21701
|
v4: {
|
21760
21702
|
pools: {
|
package/dist/src/index.d.ts
CHANGED
@@ -2195,6 +2195,7 @@ declare const app: Elysia<"", false, {
|
|
2195
2195
|
isNative?: boolean | undefined;
|
2196
2196
|
test?: boolean | undefined;
|
2197
2197
|
missingIcons?: boolean | undefined;
|
2198
|
+
missingPrice?: boolean | undefined;
|
2198
2199
|
};
|
2199
2200
|
headers: unknown;
|
2200
2201
|
response: {
|
@@ -2232,6 +2233,7 @@ declare const app: Elysia<"", false, {
|
|
2232
2233
|
isNative?: boolean | undefined;
|
2233
2234
|
test?: boolean | undefined;
|
2234
2235
|
missingIcons?: boolean | undefined;
|
2236
|
+
missingPrice?: boolean | undefined;
|
2235
2237
|
};
|
2236
2238
|
headers: unknown;
|
2237
2239
|
response: {
|
@@ -2269,7 +2271,7 @@ declare const app: Elysia<"", false, {
|
|
2269
2271
|
isPoint: boolean;
|
2270
2272
|
isNative: boolean;
|
2271
2273
|
price: number | null;
|
2272
|
-
}
|
2274
|
+
};
|
2273
2275
|
};
|
2274
2276
|
};
|
2275
2277
|
};
|
@@ -2310,20 +2312,6 @@ declare const app: Elysia<"", false, {
|
|
2310
2312
|
};
|
2311
2313
|
};
|
2312
2314
|
};
|
2313
|
-
} & {
|
2314
|
-
icons: {
|
2315
|
-
post: {
|
2316
|
-
body: unknown;
|
2317
|
-
params: {};
|
2318
|
-
query: unknown;
|
2319
|
-
headers: {
|
2320
|
-
authorization: string;
|
2321
|
-
};
|
2322
|
-
response: {
|
2323
|
-
200: void;
|
2324
|
-
};
|
2325
|
-
};
|
2326
|
-
};
|
2327
2315
|
} & {
|
2328
2316
|
webhooks: {
|
2329
2317
|
notion: {
|
@@ -4834,21 +4822,19 @@ declare const app: Elysia<"", false, {
|
|
4834
4822
|
} & {
|
4835
4823
|
v4: {
|
4836
4824
|
uniswap: {
|
4837
|
-
|
4838
|
-
|
4839
|
-
|
4840
|
-
|
4841
|
-
|
4842
|
-
|
4843
|
-
|
4844
|
-
|
4845
|
-
|
4846
|
-
|
4847
|
-
|
4848
|
-
|
4849
|
-
|
4850
|
-
[x: string]: Record<string, any[]>;
|
4851
|
-
};
|
4825
|
+
reward: {
|
4826
|
+
get: {
|
4827
|
+
body: unknown;
|
4828
|
+
params: {};
|
4829
|
+
query: {
|
4830
|
+
poolAddress?: string | undefined;
|
4831
|
+
positionId?: string | undefined;
|
4832
|
+
address: string;
|
4833
|
+
};
|
4834
|
+
headers: unknown;
|
4835
|
+
response: {
|
4836
|
+
200: {
|
4837
|
+
[x: string]: Record<string, any[]>;
|
4852
4838
|
};
|
4853
4839
|
};
|
4854
4840
|
};
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare class CoingeckoRepository {
|
2
|
+
static findList(): Promise<{
|
3
|
+
id: string;
|
4
|
+
symbol: string;
|
5
|
+
name: string;
|
6
|
+
}[]>;
|
7
|
+
static findMarkets(ids?: string[]): Promise<{
|
8
|
+
id: string;
|
9
|
+
symbol: string;
|
10
|
+
name: string;
|
11
|
+
image: string;
|
12
|
+
current_price: number;
|
13
|
+
}[]>;
|
14
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import axios from "axios";
|
2
|
+
export class CoingeckoRepository {
|
3
|
+
static async findList() {
|
4
|
+
return (await axios.get("https://api.coingecko.com/api/v3/coins/list")).data;
|
5
|
+
}
|
6
|
+
static async findMarkets(ids) {
|
7
|
+
return (await axios.get(`https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&per_page=250${!!ids ? `&ids=${ids.join(",")}` : ""}`)).data;
|
8
|
+
}
|
9
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export declare class CoingeckoService {
|
2
|
+
static findList(): Promise<{
|
3
|
+
id: string;
|
4
|
+
symbol: string;
|
5
|
+
name: string;
|
6
|
+
}[]>;
|
7
|
+
static findMarkets(ids?: string[]): Promise<{
|
8
|
+
id: string;
|
9
|
+
symbol: string;
|
10
|
+
name: string;
|
11
|
+
image: string;
|
12
|
+
current_price: number;
|
13
|
+
}[]>;
|
14
|
+
static createPriceSourceForSymbolIfMissing(symbol: string, ticker: string): Promise<void>;
|
15
|
+
static fillTokensWithCoingeckoData(): Promise<void>;
|
16
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { CacheService } from "@/modules/v4/cache";
|
2
|
+
import { PriceService } from "@/modules/v4/price/price.service";
|
3
|
+
import { log } from "@/utils/logger";
|
4
|
+
import { NETWORK_LABELS } from "@sdk";
|
5
|
+
import { TTLPresets } from "../cache/cache.model";
|
6
|
+
import { TokenService } from "../token/token.service";
|
7
|
+
import { CoingeckoRepository } from "./coingecko.repository";
|
8
|
+
export class CoingeckoService {
|
9
|
+
static findList() {
|
10
|
+
return CacheService.wrap(TTLPresets.HOUR_1, CoingeckoRepository.findList);
|
11
|
+
}
|
12
|
+
static findMarkets(ids) {
|
13
|
+
return CacheService.wrap(TTLPresets.MIN_5, CoingeckoRepository.findMarkets, ids);
|
14
|
+
}
|
15
|
+
static async createPriceSourceForSymbolIfMissing(symbol, ticker) {
|
16
|
+
try {
|
17
|
+
await PriceService.getPriceSourceBySymbol(symbol);
|
18
|
+
}
|
19
|
+
catch {
|
20
|
+
await PriceService.createPriceSource({
|
21
|
+
symbol: symbol,
|
22
|
+
method: "COINGECKO",
|
23
|
+
args: {
|
24
|
+
ticker,
|
25
|
+
},
|
26
|
+
});
|
27
|
+
log.info(`added coingecko price source for token ${symbol}: ${ticker}`);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
static async fillTokensWithCoingeckoData() {
|
31
|
+
// 1 - Get coingecko token list
|
32
|
+
const coingeckoData = CoingeckoService.findList();
|
33
|
+
// 2 - Find tokens with missing prices and try to add the sources
|
34
|
+
const missingPriceTokens = await TokenService.findMany({ missingPrice: true });
|
35
|
+
for (const token of missingPriceTokens) {
|
36
|
+
const coingeckoToken = (await coingeckoData).find(t => t.symbol === token.symbol && t.name === token.name);
|
37
|
+
if (!!coingeckoToken) {
|
38
|
+
await CoingeckoService.createPriceSourceForSymbolIfMissing(token.symbol, coingeckoToken.id);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
// 3 - Find tokens with missing logos and gather their ids
|
42
|
+
const missingIconsTokens = await TokenService.findMany({ missingIcons: true });
|
43
|
+
const coingeckoIds = [];
|
44
|
+
for (const token of missingIconsTokens) {
|
45
|
+
const coingeckoToken = (await coingeckoData).find(t => t.symbol === token.symbol && t.name === token.name);
|
46
|
+
if (!!coingeckoToken) {
|
47
|
+
coingeckoIds.push(coingeckoToken.id);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
// Avoid rate limits, wait 2 min
|
51
|
+
await new Promise(resolve => setTimeout(resolve, 120_000));
|
52
|
+
// 4 - Get images and fill them
|
53
|
+
const coingeckoMarkets = await CoingeckoService.findMarkets(coingeckoIds);
|
54
|
+
for (const market of coingeckoMarkets) {
|
55
|
+
for (const token of missingIconsTokens) {
|
56
|
+
if (token.symbol === market.symbol && token.name === market.name) {
|
57
|
+
await TokenService.update(token.id, {
|
58
|
+
icon: market.image,
|
59
|
+
});
|
60
|
+
log.info(`updated token ${token.symbol} on ${NETWORK_LABELS[token.chainId]} with icon ${market.image}`);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
@@ -2065,6 +2065,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2065
2065
|
isNative?: boolean | undefined;
|
2066
2066
|
test?: boolean | undefined;
|
2067
2067
|
missingIcons?: boolean | undefined;
|
2068
|
+
missingPrice?: boolean | undefined;
|
2068
2069
|
};
|
2069
2070
|
headers: unknown;
|
2070
2071
|
response: {
|
@@ -2102,6 +2103,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2102
2103
|
isNative?: boolean | undefined;
|
2103
2104
|
test?: boolean | undefined;
|
2104
2105
|
missingIcons?: boolean | undefined;
|
2106
|
+
missingPrice?: boolean | undefined;
|
2105
2107
|
};
|
2106
2108
|
headers: unknown;
|
2107
2109
|
response: {
|
@@ -2139,7 +2141,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2139
2141
|
isPoint: boolean;
|
2140
2142
|
isNative: boolean;
|
2141
2143
|
price: number | null;
|
2142
|
-
}
|
2144
|
+
};
|
2143
2145
|
};
|
2144
2146
|
};
|
2145
2147
|
};
|
@@ -2180,20 +2182,6 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2180
2182
|
};
|
2181
2183
|
};
|
2182
2184
|
};
|
2183
|
-
} & {
|
2184
|
-
icons: {
|
2185
|
-
post: {
|
2186
|
-
body: unknown;
|
2187
|
-
params: {};
|
2188
|
-
query: unknown;
|
2189
|
-
headers: {
|
2190
|
-
authorization: string;
|
2191
|
-
};
|
2192
|
-
response: {
|
2193
|
-
200: void;
|
2194
|
-
};
|
2195
|
-
};
|
2196
|
-
};
|
2197
2185
|
} & {
|
2198
2186
|
webhooks: {
|
2199
2187
|
notion: {
|
@@ -4704,21 +4692,19 @@ export declare const v4: Elysia<"/v4", false, {
|
|
4704
4692
|
} & {
|
4705
4693
|
v4: {
|
4706
4694
|
uniswap: {
|
4707
|
-
|
4708
|
-
|
4709
|
-
|
4710
|
-
|
4711
|
-
|
4712
|
-
|
4713
|
-
|
4714
|
-
|
4715
|
-
|
4716
|
-
|
4717
|
-
|
4718
|
-
|
4719
|
-
|
4720
|
-
[x: string]: Record<string, any[]>;
|
4721
|
-
};
|
4695
|
+
reward: {
|
4696
|
+
get: {
|
4697
|
+
body: unknown;
|
4698
|
+
params: {};
|
4699
|
+
query: {
|
4700
|
+
poolAddress?: string | undefined;
|
4701
|
+
positionId?: string | undefined;
|
4702
|
+
address: string;
|
4703
|
+
};
|
4704
|
+
headers: unknown;
|
4705
|
+
response: {
|
4706
|
+
200: {
|
4707
|
+
[x: string]: Record<string, any[]>;
|
4722
4708
|
};
|
4723
4709
|
};
|
4724
4710
|
};
|