@merkl/api 0.18.5 → 0.18.7
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 +39 -54
- package/dist/src/factories/opportunityMetadata/implementations/Ajna.js +1 -1
- package/dist/src/factories/opportunityMetadata/implementations/Badger.js +1 -1
- package/dist/src/index.d.ts +7 -10
- package/dist/src/modules/v4/campaign/campaign.repository.js +1 -1
- package/dist/src/modules/v4/enso/enso.service.js +5 -5
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +5 -5
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +0 -7
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +0 -7
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +0 -28
- package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
- package/dist/src/modules/v4/price/price.controller.js +1 -1
- package/dist/src/modules/v4/price/price.repository.d.ts +4 -1
- package/dist/src/modules/v4/price/price.repository.js +6 -2
- package/dist/src/modules/v4/price/price.service.d.ts +4 -1
- package/dist/src/modules/v4/price/price.service.js +2 -2
- package/dist/src/modules/v4/reward/reward.service.js +1 -1
- package/dist/src/modules/v4/router.d.ts +7 -10
- package/dist/src/modules/v4/token/token.controller.d.ts +7 -3
- package/dist/src/modules/v4/token/token.controller.js +5 -1
- 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.d.ts +2 -0
- package/dist/src/modules/v4/token/token.repository.js +42 -28
- package/dist/src/modules/v4/token/token.service.d.ts +29 -46
- package/dist/src/modules/v4/token/token.service.js +120 -106
- package/dist/src/routes/v3/app.js +1 -1
- package/dist/src/utils/prices/priceService.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -616,13 +616,6 @@ declare const eden: {
|
|
616
616
|
price?: number | null | undefined;
|
617
617
|
})[];
|
618
618
|
chain: {
|
619
|
-
Explorer: {
|
620
|
-
id: string;
|
621
|
-
type: import("@db/api").$Enums.ExplorerType;
|
622
|
-
url: string;
|
623
|
-
chainId: number;
|
624
|
-
}[];
|
625
|
-
} & {
|
626
619
|
id: number;
|
627
620
|
name: string;
|
628
621
|
icon: string;
|
@@ -1605,6 +1598,7 @@ declare const eden: {
|
|
1605
1598
|
verified?: boolean | undefined;
|
1606
1599
|
isNative?: boolean | undefined;
|
1607
1600
|
test?: boolean | undefined;
|
1601
|
+
missingIcons?: boolean | undefined;
|
1608
1602
|
};
|
1609
1603
|
fetch?: RequestInit | undefined;
|
1610
1604
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -1664,18 +1658,21 @@ declare const eden: {
|
|
1664
1658
|
verified?: boolean | undefined;
|
1665
1659
|
isNative?: boolean | undefined;
|
1666
1660
|
test?: boolean | undefined;
|
1661
|
+
missingIcons?: boolean | undefined;
|
1667
1662
|
};
|
1668
1663
|
fetch?: RequestInit | undefined;
|
1669
1664
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1670
1665
|
200: number;
|
1671
1666
|
}>>;
|
1672
1667
|
};
|
1673
|
-
|
1674
|
-
|
1675
|
-
headers
|
1668
|
+
icons: {
|
1669
|
+
post: (body: unknown, options: {
|
1670
|
+
headers: {
|
1671
|
+
authorization: string;
|
1672
|
+
};
|
1676
1673
|
query?: Record<string, unknown> | undefined;
|
1677
1674
|
fetch?: RequestInit | undefined;
|
1678
|
-
}
|
1675
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1679
1676
|
200: void;
|
1680
1677
|
}>>;
|
1681
1678
|
};
|
@@ -4071,13 +4068,6 @@ declare const eden: {
|
|
4071
4068
|
price?: number | null | undefined;
|
4072
4069
|
})[];
|
4073
4070
|
chain: {
|
4074
|
-
Explorer: {
|
4075
|
-
id: string;
|
4076
|
-
type: import("@db/api").$Enums.ExplorerType;
|
4077
|
-
url: string;
|
4078
|
-
chainId: number;
|
4079
|
-
}[];
|
4080
|
-
} & {
|
4081
4071
|
id: number;
|
4082
4072
|
name: string;
|
4083
4073
|
icon: string;
|
@@ -5060,6 +5050,7 @@ declare const eden: {
|
|
5060
5050
|
verified?: boolean | undefined;
|
5061
5051
|
isNative?: boolean | undefined;
|
5062
5052
|
test?: boolean | undefined;
|
5053
|
+
missingIcons?: boolean | undefined;
|
5063
5054
|
};
|
5064
5055
|
fetch?: RequestInit | undefined;
|
5065
5056
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -5119,18 +5110,21 @@ declare const eden: {
|
|
5119
5110
|
verified?: boolean | undefined;
|
5120
5111
|
isNative?: boolean | undefined;
|
5121
5112
|
test?: boolean | undefined;
|
5113
|
+
missingIcons?: boolean | undefined;
|
5122
5114
|
};
|
5123
5115
|
fetch?: RequestInit | undefined;
|
5124
5116
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
5125
5117
|
200: number;
|
5126
5118
|
}>>;
|
5127
5119
|
};
|
5128
|
-
|
5129
|
-
|
5130
|
-
headers
|
5120
|
+
icons: {
|
5121
|
+
post: (body: unknown, options: {
|
5122
|
+
headers: {
|
5123
|
+
authorization: string;
|
5124
|
+
};
|
5131
5125
|
query?: Record<string, unknown> | undefined;
|
5132
5126
|
fetch?: RequestInit | undefined;
|
5133
|
-
}
|
5127
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
5134
5128
|
200: void;
|
5135
5129
|
}>>;
|
5136
5130
|
};
|
@@ -7992,13 +7986,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7992
7986
|
price?: number | null | undefined;
|
7993
7987
|
})[];
|
7994
7988
|
chain: {
|
7995
|
-
Explorer: {
|
7996
|
-
id: string;
|
7997
|
-
type: import("@db/api").$Enums.ExplorerType;
|
7998
|
-
url: string;
|
7999
|
-
chainId: number;
|
8000
|
-
}[];
|
8001
|
-
} & {
|
8002
7989
|
id: number;
|
8003
7990
|
name: string;
|
8004
7991
|
icon: string;
|
@@ -9410,6 +9397,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9410
9397
|
verified?: boolean | undefined;
|
9411
9398
|
isNative?: boolean | undefined;
|
9412
9399
|
test?: boolean | undefined;
|
9400
|
+
missingIcons?: boolean | undefined;
|
9413
9401
|
};
|
9414
9402
|
headers: unknown;
|
9415
9403
|
response: {
|
@@ -9445,6 +9433,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9445
9433
|
verified?: boolean | undefined;
|
9446
9434
|
isNative?: boolean | undefined;
|
9447
9435
|
test?: boolean | undefined;
|
9436
|
+
missingIcons?: boolean | undefined;
|
9448
9437
|
};
|
9449
9438
|
headers: unknown;
|
9450
9439
|
response: {
|
@@ -9520,12 +9509,14 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9520
9509
|
};
|
9521
9510
|
};
|
9522
9511
|
} & {
|
9523
|
-
|
9524
|
-
|
9512
|
+
icons: {
|
9513
|
+
post: {
|
9525
9514
|
body: unknown;
|
9526
9515
|
params: {};
|
9527
9516
|
query: unknown;
|
9528
|
-
headers:
|
9517
|
+
headers: {
|
9518
|
+
authorization: string;
|
9519
|
+
};
|
9529
9520
|
response: {
|
9530
9521
|
200: void;
|
9531
9522
|
};
|
@@ -13279,13 +13270,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13279
13270
|
price?: number | null | undefined;
|
13280
13271
|
})[];
|
13281
13272
|
chain: {
|
13282
|
-
Explorer: {
|
13283
|
-
id: string;
|
13284
|
-
type: import("@db/api").$Enums.ExplorerType;
|
13285
|
-
url: string;
|
13286
|
-
chainId: number;
|
13287
|
-
}[];
|
13288
|
-
} & {
|
13289
13273
|
id: number;
|
13290
13274
|
name: string;
|
13291
13275
|
icon: string;
|
@@ -14268,6 +14252,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14268
14252
|
verified?: boolean | undefined;
|
14269
14253
|
isNative?: boolean | undefined;
|
14270
14254
|
test?: boolean | undefined;
|
14255
|
+
missingIcons?: boolean | undefined;
|
14271
14256
|
};
|
14272
14257
|
fetch?: RequestInit | undefined;
|
14273
14258
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -14327,18 +14312,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14327
14312
|
verified?: boolean | undefined;
|
14328
14313
|
isNative?: boolean | undefined;
|
14329
14314
|
test?: boolean | undefined;
|
14315
|
+
missingIcons?: boolean | undefined;
|
14330
14316
|
};
|
14331
14317
|
fetch?: RequestInit | undefined;
|
14332
14318
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
14333
14319
|
200: number;
|
14334
14320
|
}>>;
|
14335
14321
|
};
|
14336
|
-
|
14337
|
-
|
14338
|
-
headers
|
14322
|
+
icons: {
|
14323
|
+
post: (body: unknown, options: {
|
14324
|
+
headers: {
|
14325
|
+
authorization: string;
|
14326
|
+
};
|
14339
14327
|
query?: Record<string, unknown> | undefined;
|
14340
14328
|
fetch?: RequestInit | undefined;
|
14341
|
-
}
|
14329
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
14342
14330
|
200: void;
|
14343
14331
|
}>>;
|
14344
14332
|
};
|
@@ -16734,13 +16722,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
16734
16722
|
price?: number | null | undefined;
|
16735
16723
|
})[];
|
16736
16724
|
chain: {
|
16737
|
-
Explorer: {
|
16738
|
-
id: string;
|
16739
|
-
type: import("@db/api").$Enums.ExplorerType;
|
16740
|
-
url: string;
|
16741
|
-
chainId: number;
|
16742
|
-
}[];
|
16743
|
-
} & {
|
16744
16725
|
id: number;
|
16745
16726
|
name: string;
|
16746
16727
|
icon: string;
|
@@ -17723,6 +17704,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17723
17704
|
verified?: boolean | undefined;
|
17724
17705
|
isNative?: boolean | undefined;
|
17725
17706
|
test?: boolean | undefined;
|
17707
|
+
missingIcons?: boolean | undefined;
|
17726
17708
|
};
|
17727
17709
|
fetch?: RequestInit | undefined;
|
17728
17710
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -17782,18 +17764,21 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
17782
17764
|
verified?: boolean | undefined;
|
17783
17765
|
isNative?: boolean | undefined;
|
17784
17766
|
test?: boolean | undefined;
|
17767
|
+
missingIcons?: boolean | undefined;
|
17785
17768
|
};
|
17786
17769
|
fetch?: RequestInit | undefined;
|
17787
17770
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
17788
17771
|
200: number;
|
17789
17772
|
}>>;
|
17790
17773
|
};
|
17791
|
-
|
17792
|
-
|
17793
|
-
headers
|
17774
|
+
icons: {
|
17775
|
+
post: (body: unknown, options: {
|
17776
|
+
headers: {
|
17777
|
+
authorization: string;
|
17778
|
+
};
|
17794
17779
|
query?: Record<string, unknown> | undefined;
|
17795
17780
|
fetch?: RequestInit | undefined;
|
17796
|
-
}
|
17781
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
17797
17782
|
200: void;
|
17798
17783
|
}>>;
|
17799
17784
|
};
|
@@ -3,7 +3,7 @@ import { OpportunityAction } from "@db/api";
|
|
3
3
|
export class AjnaMetadata {
|
4
4
|
async build(computeChainId, params, subType) {
|
5
5
|
try {
|
6
|
-
const [collateral, quote] = await TokenService.
|
6
|
+
const [collateral, quote] = await TokenService.findManyOrCreate([
|
7
7
|
{
|
8
8
|
chainId: computeChainId,
|
9
9
|
address: params.collateralToken,
|
@@ -3,7 +3,7 @@ import { OpportunityAction } from "@db/api";
|
|
3
3
|
export class BadgerMetadata {
|
4
4
|
async build(computeChainId, params) {
|
5
5
|
try {
|
6
|
-
const [token] = await TokenService.
|
6
|
+
const [token] = await TokenService.findManyOrCreate([{ chainId: computeChainId, address: params.targetToken }]);
|
7
7
|
if (!token)
|
8
8
|
throw new Error("Failed to fetch tokens");
|
9
9
|
return {
|
package/dist/src/index.d.ts
CHANGED
@@ -408,13 +408,6 @@ declare const app: Elysia<"", false, {
|
|
408
408
|
price?: number | null | undefined;
|
409
409
|
})[];
|
410
410
|
chain: {
|
411
|
-
Explorer: {
|
412
|
-
id: string;
|
413
|
-
type: import("@db/api").$Enums.ExplorerType;
|
414
|
-
url: string;
|
415
|
-
chainId: number;
|
416
|
-
}[];
|
417
|
-
} & {
|
418
411
|
id: number;
|
419
412
|
name: string;
|
420
413
|
icon: string;
|
@@ -1826,6 +1819,7 @@ declare const app: Elysia<"", false, {
|
|
1826
1819
|
verified?: boolean | undefined;
|
1827
1820
|
isNative?: boolean | undefined;
|
1828
1821
|
test?: boolean | undefined;
|
1822
|
+
missingIcons?: boolean | undefined;
|
1829
1823
|
};
|
1830
1824
|
headers: unknown;
|
1831
1825
|
response: {
|
@@ -1861,6 +1855,7 @@ declare const app: Elysia<"", false, {
|
|
1861
1855
|
verified?: boolean | undefined;
|
1862
1856
|
isNative?: boolean | undefined;
|
1863
1857
|
test?: boolean | undefined;
|
1858
|
+
missingIcons?: boolean | undefined;
|
1864
1859
|
};
|
1865
1860
|
headers: unknown;
|
1866
1861
|
response: {
|
@@ -1936,12 +1931,14 @@ declare const app: Elysia<"", false, {
|
|
1936
1931
|
};
|
1937
1932
|
};
|
1938
1933
|
} & {
|
1939
|
-
|
1940
|
-
|
1934
|
+
icons: {
|
1935
|
+
post: {
|
1941
1936
|
body: unknown;
|
1942
1937
|
params: {};
|
1943
1938
|
query: unknown;
|
1944
|
-
headers:
|
1939
|
+
headers: {
|
1940
|
+
authorization: string;
|
1941
|
+
};
|
1945
1942
|
response: {
|
1946
1943
|
200: void;
|
1947
1944
|
};
|
@@ -183,7 +183,7 @@ export class CampaignRepository {
|
|
183
183
|
static async upsert(campaign) {
|
184
184
|
const campaignType = CampaignService.getTypeFromV3(campaign.type);
|
185
185
|
try {
|
186
|
-
const [rewardToken] = await TokenService.
|
186
|
+
const [rewardToken] = await TokenService.findManyOrCreate([
|
187
187
|
{ chainId: campaign.chainId, address: campaign.rewardTokenAddress },
|
188
188
|
]);
|
189
189
|
if (!rewardToken) {
|
@@ -51,8 +51,8 @@ export class EnsoService {
|
|
51
51
|
return await Promise.all(route.map(async (r) => {
|
52
52
|
switch (r.action) {
|
53
53
|
case "deposit": {
|
54
|
-
const tokensIn = await TokenService.
|
55
|
-
const [tokenOut] = await TokenService.
|
54
|
+
const tokensIn = await TokenService.findManyOrCreate(r.tokenIn.map(t => ({ address: t, chainId })));
|
55
|
+
const [tokenOut] = await TokenService.findManyOrCreate(r.tokenOut.map(t => ({ address: t, chainId })));
|
56
56
|
return {
|
57
57
|
action: "deposit",
|
58
58
|
tokens: tokensIn.filter(a => !!a),
|
@@ -60,8 +60,8 @@ export class EnsoService {
|
|
60
60
|
};
|
61
61
|
}
|
62
62
|
case "swap": {
|
63
|
-
const [from] = await TokenService.
|
64
|
-
const [to] = await TokenService.
|
63
|
+
const [from] = await TokenService.findManyOrCreate(r.tokenIn.map(t => ({ address: t, chainId })));
|
64
|
+
const [to] = await TokenService.findManyOrCreate(r.tokenOut.map(t => ({ address: t, chainId })));
|
65
65
|
return { action: "swap", from: from, to: to };
|
66
66
|
}
|
67
67
|
}
|
@@ -106,7 +106,7 @@ export class EnsoService {
|
|
106
106
|
amountIn: [fromTokenAmount.toString()],
|
107
107
|
slippage: options.slippage?.toString(),
|
108
108
|
});
|
109
|
-
const [LpToken] = await TokenService.
|
109
|
+
const [LpToken] = await TokenService.findManyOrCreate([{ address: identifier, chainId }]);
|
110
110
|
const depositValue = await TokenService.getValue([{ ...LpToken, amount: BigInt(quote.amountOut) }]);
|
111
111
|
const actions = await EnsoService.getActions(chainId, quote.route, BigInt(quote.amountOut));
|
112
112
|
return { transaction: tx, depositValue: depositValue, actions };
|
@@ -54,7 +54,7 @@ export class KyberZapService {
|
|
54
54
|
const actions = [];
|
55
55
|
const processors = {
|
56
56
|
ACTION_TYPE_PROTOCOL_FEE: async ({ protocolFee: { tokens: zapTokens } }) => {
|
57
|
-
const tokens = await TokenService.
|
57
|
+
const tokens = await TokenService.findManyOrCreate(zapTokens.map(({ address }) => ({ address, chainId })));
|
58
58
|
return [
|
59
59
|
{
|
60
60
|
action: "fee",
|
@@ -65,7 +65,7 @@ export class KyberZapService {
|
|
65
65
|
ACTION_TYPE_AGGREGATOR_SWAP: async ({ aggregatorSwap: { swaps } }) => {
|
66
66
|
const swapActions = [];
|
67
67
|
for (const { tokenIn, tokenOut } of swaps) {
|
68
|
-
const [from, to] = await TokenService.
|
68
|
+
const [from, to] = await TokenService.findManyOrCreate([
|
69
69
|
{ address: tokenIn.address, chainId },
|
70
70
|
{ address: tokenOut.address, chainId },
|
71
71
|
]);
|
@@ -80,7 +80,7 @@ export class KyberZapService {
|
|
80
80
|
ACTION_TYPE_POOL_SWAP: async ({ poolSwap: { swaps } }) => {
|
81
81
|
const swapActions = [];
|
82
82
|
for (const { tokenIn, tokenOut } of swaps) {
|
83
|
-
const [from, to] = await TokenService.
|
83
|
+
const [from, to] = await TokenService.findManyOrCreate([
|
84
84
|
{ address: tokenIn.address, chainId },
|
85
85
|
{ address: tokenOut.address, chainId },
|
86
86
|
]);
|
@@ -93,7 +93,7 @@ export class KyberZapService {
|
|
93
93
|
return swapActions;
|
94
94
|
},
|
95
95
|
ACTION_TYPE_ADD_LIQUIDITY: async ({ addLiquidity: { tokens: zapTokens } }) => {
|
96
|
-
const tokens = await TokenService.
|
96
|
+
const tokens = await TokenService.findManyOrCreate(zapTokens.map(({ address }) => ({ address, chainId })));
|
97
97
|
return [
|
98
98
|
{
|
99
99
|
action: "deposit",
|
@@ -124,7 +124,7 @@ export class KyberZapService {
|
|
124
124
|
chainId,
|
125
125
|
});
|
126
126
|
const actions = await KyberZapService.getActions(chainId, route.zapDetails.actions);
|
127
|
-
const [tokenIn] = await TokenService.
|
127
|
+
const [tokenIn] = await TokenService.findManyOrCreate([{ address: fromTokenAddress, chainId }]);
|
128
128
|
const deposit = actions.findLast(({ action }) => action === "deposit");
|
129
129
|
const tokenInValue = await TokenService.getValue([{ ...tokenIn, amount: fromTokenAmount }]);
|
130
130
|
const depositValue = await TokenService.getValue(deposit.tokens);
|
@@ -263,13 +263,6 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
263
263
|
price?: number | null | undefined;
|
264
264
|
})[];
|
265
265
|
chain: {
|
266
|
-
Explorer: {
|
267
|
-
id: string;
|
268
|
-
type: import("@db/api").$Enums.ExplorerType;
|
269
|
-
url: string;
|
270
|
-
chainId: number;
|
271
|
-
}[];
|
272
|
-
} & {
|
273
266
|
id: number;
|
274
267
|
name: string;
|
275
268
|
icon: string;
|
@@ -175,13 +175,6 @@ export declare abstract class OpportunityRepository {
|
|
175
175
|
}) | null>;
|
176
176
|
static findUniqueOrThrow(id: string, withTest?: boolean, withCampaigns?: boolean): Promise<{
|
177
177
|
Chain: {
|
178
|
-
Explorer: {
|
179
|
-
id: string;
|
180
|
-
type: import("@db/api").$Enums.ExplorerType;
|
181
|
-
url: string;
|
182
|
-
chainId: number;
|
183
|
-
}[];
|
184
|
-
} & {
|
185
178
|
id: number;
|
186
179
|
name: string;
|
187
180
|
icon: string;
|
@@ -551,13 +551,6 @@ export declare abstract class OpportunityService {
|
|
551
551
|
price?: number | null | undefined;
|
552
552
|
})[];
|
553
553
|
chain: {
|
554
|
-
Explorer: {
|
555
|
-
id: string;
|
556
|
-
type: import("@db/api").$Enums.ExplorerType;
|
557
|
-
url: string;
|
558
|
-
chainId: number;
|
559
|
-
}[];
|
560
|
-
} & {
|
561
554
|
id: number;
|
562
555
|
name: string;
|
563
556
|
icon: string;
|
@@ -723,13 +716,6 @@ export declare abstract class OpportunityService {
|
|
723
716
|
price?: number | null | undefined;
|
724
717
|
})[];
|
725
718
|
chain: {
|
726
|
-
Explorer: {
|
727
|
-
id: string;
|
728
|
-
type: import("@db/api").$Enums.ExplorerType;
|
729
|
-
url: string;
|
730
|
-
chainId: number;
|
731
|
-
}[];
|
732
|
-
} & {
|
733
719
|
id: number;
|
734
720
|
name: string;
|
735
721
|
icon: string;
|
@@ -891,13 +877,6 @@ export declare abstract class OpportunityService {
|
|
891
877
|
price?: number | null | undefined;
|
892
878
|
})[];
|
893
879
|
chain: {
|
894
|
-
Explorer: {
|
895
|
-
id: string;
|
896
|
-
type: import("@db/api").$Enums.ExplorerType;
|
897
|
-
url: string;
|
898
|
-
chainId: number;
|
899
|
-
}[];
|
900
|
-
} & {
|
901
880
|
id: number;
|
902
881
|
name: string;
|
903
882
|
icon: string;
|
@@ -938,13 +917,6 @@ export declare abstract class OpportunityService {
|
|
938
917
|
price?: number | null | undefined;
|
939
918
|
})[];
|
940
919
|
chain: {
|
941
|
-
Explorer: {
|
942
|
-
id: string;
|
943
|
-
type: import("@db/api").$Enums.ExplorerType;
|
944
|
-
url: string;
|
945
|
-
chainId: number;
|
946
|
-
}[];
|
947
|
-
} & {
|
948
920
|
id: number;
|
949
921
|
name: string;
|
950
922
|
icon: string;
|
@@ -69,7 +69,7 @@ export class OpportunityService {
|
|
69
69
|
identifier: campaign.opportunityIdentifier,
|
70
70
|
type: campaignType,
|
71
71
|
});
|
72
|
-
const tokens = (await TokenService.
|
72
|
+
const tokens = (await TokenService.findManyOrCreate(metadata.tokens)).filter(t => t !== undefined);
|
73
73
|
const params = JSON.parse(campaign.params);
|
74
74
|
const now = moment().unix();
|
75
75
|
const opportunity = {
|
@@ -16,7 +16,7 @@ export const PriceController = new Elysia({ prefix: "/prices", detail: { tags: [
|
|
16
16
|
.group("/sources", app => {
|
17
17
|
return (app
|
18
18
|
// ─── Get All Price Sources ───────────────────
|
19
|
-
.get("/", async () => await PriceService.
|
19
|
+
.get("/", async () => await PriceService.findManyPriceSources({}))
|
20
20
|
// ─── Get Price Source By Token Symbol ────────
|
21
21
|
.get("/symbol/:symbol", async ({ params }) => await PriceService.getPriceSourceBySymbol(params.symbol), {
|
22
22
|
params: PriceSourceIdentifier,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { PriceSourceMethod } from "@db/api";
|
1
2
|
import type { CreatePriceSourceModel, UpdatePriceSourceModel } from ".";
|
2
3
|
export declare class PriceRepository {
|
3
4
|
static findBySymbolOrThrow(symbol: string): Promise<{
|
@@ -6,7 +7,9 @@ export declare class PriceRepository {
|
|
6
7
|
id: number;
|
7
8
|
args: import("database/api/.generated/runtime/library").JsonValue | null;
|
8
9
|
}>;
|
9
|
-
static
|
10
|
+
static findManyPriceSources(query: {
|
11
|
+
method?: PriceSourceMethod;
|
12
|
+
}): Promise<{
|
10
13
|
symbol: string;
|
11
14
|
method: import("@db/api").$Enums.PriceSourceMethod;
|
12
15
|
id: number;
|
@@ -3,8 +3,12 @@ export class PriceRepository {
|
|
3
3
|
static async findBySymbolOrThrow(symbol) {
|
4
4
|
return await apiDbClient.priceSource.findUniqueOrThrow({ where: { symbol } });
|
5
5
|
}
|
6
|
-
static async
|
7
|
-
return await apiDbClient.priceSource.findMany(
|
6
|
+
static async findManyPriceSources(query) {
|
7
|
+
return await apiDbClient.priceSource.findMany({
|
8
|
+
where: {
|
9
|
+
method: query?.method ?? undefined,
|
10
|
+
},
|
11
|
+
});
|
8
12
|
}
|
9
13
|
static async create(priceSource) {
|
10
14
|
return await apiDbClient.priceSource.create({ data: priceSource });
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { PriceSourceMethod } from "@db/api";
|
1
2
|
import type { CreatePriceSourceModel, UpdatePriceSourceModel } from ".";
|
2
3
|
export declare class PriceService {
|
3
4
|
static findMany(): Promise<{
|
@@ -15,7 +16,9 @@ export declare class PriceService {
|
|
15
16
|
id: number;
|
16
17
|
args: import("database/api/.generated/runtime/library").JsonValue | null;
|
17
18
|
}>;
|
18
|
-
static
|
19
|
+
static findManyPriceSources(query: {
|
20
|
+
method?: PriceSourceMethod;
|
21
|
+
}): Promise<{
|
19
22
|
symbol: string;
|
20
23
|
method: import("@db/api").$Enums.PriceSourceMethod;
|
21
24
|
id: number;
|
@@ -28,8 +28,8 @@ export class PriceService {
|
|
28
28
|
static async getPriceSourceBySymbol(symbol) {
|
29
29
|
return await PriceRepository.findBySymbolOrThrow(symbol);
|
30
30
|
}
|
31
|
-
static async
|
32
|
-
return await PriceRepository.
|
31
|
+
static async findManyPriceSources(query) {
|
32
|
+
return await PriceRepository.findManyPriceSources(query);
|
33
33
|
}
|
34
34
|
static async createPriceSource(priceSource) {
|
35
35
|
const created = await PriceRepository.create(priceSource);
|
@@ -321,7 +321,7 @@ export class RewardService {
|
|
321
321
|
token = await TokenService.findUniqueOrThrow({ address: rewardToken, chainId });
|
322
322
|
}
|
323
323
|
catch {
|
324
|
-
await TokenService.
|
324
|
+
await TokenService.findManyOrCreate([{ address: rewardToken, chainId }]);
|
325
325
|
token = await TokenService.findUniqueOrThrow({ address: rewardToken, chainId });
|
326
326
|
}
|
327
327
|
const campaignDailyValue = await TokenService.getValueByTokenId(tokenToAmount);
|
@@ -278,13 +278,6 @@ export declare const v4: Elysia<"/v4", false, {
|
|
278
278
|
price?: number | null | undefined;
|
279
279
|
})[];
|
280
280
|
chain: {
|
281
|
-
Explorer: {
|
282
|
-
id: string;
|
283
|
-
type: import("@db/api").$Enums.ExplorerType;
|
284
|
-
url: string;
|
285
|
-
chainId: number;
|
286
|
-
}[];
|
287
|
-
} & {
|
288
281
|
id: number;
|
289
282
|
name: string;
|
290
283
|
icon: string;
|
@@ -1696,6 +1689,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1696
1689
|
verified?: boolean | undefined;
|
1697
1690
|
isNative?: boolean | undefined;
|
1698
1691
|
test?: boolean | undefined;
|
1692
|
+
missingIcons?: boolean | undefined;
|
1699
1693
|
};
|
1700
1694
|
headers: unknown;
|
1701
1695
|
response: {
|
@@ -1731,6 +1725,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1731
1725
|
verified?: boolean | undefined;
|
1732
1726
|
isNative?: boolean | undefined;
|
1733
1727
|
test?: boolean | undefined;
|
1728
|
+
missingIcons?: boolean | undefined;
|
1734
1729
|
};
|
1735
1730
|
headers: unknown;
|
1736
1731
|
response: {
|
@@ -1806,12 +1801,14 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1806
1801
|
};
|
1807
1802
|
};
|
1808
1803
|
} & {
|
1809
|
-
|
1810
|
-
|
1804
|
+
icons: {
|
1805
|
+
post: {
|
1811
1806
|
body: unknown;
|
1812
1807
|
params: {};
|
1813
1808
|
query: unknown;
|
1814
|
-
headers:
|
1809
|
+
headers: {
|
1810
|
+
authorization: string;
|
1811
|
+
};
|
1815
1812
|
response: {
|
1816
1813
|
200: void;
|
1817
1814
|
};
|
@@ -151,6 +151,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
151
151
|
verified?: boolean | undefined;
|
152
152
|
isNative?: boolean | undefined;
|
153
153
|
test?: boolean | undefined;
|
154
|
+
missingIcons?: boolean | undefined;
|
154
155
|
};
|
155
156
|
headers: unknown;
|
156
157
|
response: {
|
@@ -186,6 +187,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
186
187
|
verified?: boolean | undefined;
|
187
188
|
isNative?: boolean | undefined;
|
188
189
|
test?: boolean | undefined;
|
190
|
+
missingIcons?: boolean | undefined;
|
189
191
|
};
|
190
192
|
headers: unknown;
|
191
193
|
response: {
|
@@ -261,12 +263,14 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
261
263
|
};
|
262
264
|
};
|
263
265
|
} & {
|
264
|
-
|
265
|
-
|
266
|
+
icons: {
|
267
|
+
post: {
|
266
268
|
body: unknown;
|
267
269
|
params: {};
|
268
270
|
query: unknown;
|
269
|
-
headers:
|
271
|
+
headers: {
|
272
|
+
authorization: string;
|
273
|
+
};
|
270
274
|
response: {
|
271
275
|
200: void;
|
272
276
|
};
|