@merkl/api 0.10.230 → 0.10.232
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/database/api/.generated/edge.js +6 -12
- package/dist/database/api/.generated/index-browser.js +3 -8
- package/dist/database/api/.generated/index.d.ts +156 -124
- package/dist/database/api/.generated/index.js +6 -12
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +3 -10
- package/dist/database/api/.generated/wasm.js +3 -8
- package/dist/database/engine/.generated/edge.js +2 -3
- package/dist/database/engine/.generated/index.js +2 -3
- package/dist/database/engine/.generated/package.json +1 -1
- package/dist/database/engine/.generated/schema.prisma +1 -1
- package/dist/src/eden/index.d.ts +142 -155
- package/dist/src/index.d.ts +52 -55
- package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +2 -42
- package/dist/src/modules/v4/interaction/interaction.controller.js +2 -20
- package/dist/src/modules/v4/interaction/interaction.model.d.ts +1 -0
- package/dist/src/modules/v4/interaction/interaction.model.js +1 -0
- package/dist/src/modules/v4/interaction/interaction.service.d.ts +1 -1
- package/dist/src/modules/v4/interaction/interaction.service.js +2 -2
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +1 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +1 -0
- package/dist/src/modules/v4/kyberzap/kyberzap.service.d.ts +1 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +6 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +5 -3
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +1 -2
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -14
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +18 -8
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +9 -4
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +4 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +113 -46
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +6 -6
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +3 -15
- package/dist/src/modules/v4/protocol/protocol.model.js +3 -4
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +5 -5
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.repository.d.ts +3 -2
- package/dist/src/modules/v4/reward/reward.service.d.ts +18 -12
- package/dist/src/modules/v4/router.d.ts +52 -55
- package/dist/src/modules/v4/token/token.controller.d.ts +33 -0
- package/dist/src/modules/v4/token/token.controller.js +14 -1
- package/dist/src/modules/v4/token/token.model.d.ts +8 -0
- package/dist/src/modules/v4/token/token.model.js +7 -0
- package/dist/src/modules/v4/token/token.service.d.ts +19 -1
- package/dist/src/modules/v4/token/token.service.js +10 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +6 -4
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/modules/v4/zyfi/zyfi.model.d.ts +0 -45
- package/dist/src/modules/v4/zyfi/zyfi.model.js +0 -1
- package/dist/src/modules/v4/zyfi/zyfi.service.d.ts +0 -30
- package/dist/src/modules/v4/zyfi/zyfi.service.js +0 -35
package/dist/src/index.d.ts
CHANGED
@@ -267,7 +267,7 @@ declare const app: Elysia<"", false, {
|
|
267
267
|
url: string;
|
268
268
|
description: string;
|
269
269
|
id: string;
|
270
|
-
tags:
|
270
|
+
tags: string[];
|
271
271
|
icon: string;
|
272
272
|
} | undefined;
|
273
273
|
name: string;
|
@@ -277,6 +277,7 @@ declare const app: Elysia<"", false, {
|
|
277
277
|
identifier: string;
|
278
278
|
chainId: number;
|
279
279
|
action: import("../database/api/.generated").$Enums.OpportunityAction;
|
280
|
+
depositUrl: string | null;
|
280
281
|
tvl: number;
|
281
282
|
apr: number;
|
282
283
|
dailyRewards: number;
|
@@ -330,7 +331,7 @@ declare const app: Elysia<"", false, {
|
|
330
331
|
url: string;
|
331
332
|
description: string;
|
332
333
|
id: string;
|
333
|
-
tags:
|
334
|
+
tags: string[];
|
334
335
|
icon: string;
|
335
336
|
} | null | undefined;
|
336
337
|
aprRecord?: {
|
@@ -439,7 +440,7 @@ declare const app: Elysia<"", false, {
|
|
439
440
|
url: string;
|
440
441
|
description: string;
|
441
442
|
id: string;
|
442
|
-
tags:
|
443
|
+
tags: string[];
|
443
444
|
icon: string;
|
444
445
|
} | null | undefined;
|
445
446
|
aprRecord?: {
|
@@ -635,6 +636,7 @@ declare const app: Elysia<"", false, {
|
|
635
636
|
identifier: string;
|
636
637
|
chainId: number;
|
637
638
|
action: import("../database/api/.generated").$Enums.OpportunityAction;
|
639
|
+
depositUrl: string | null;
|
638
640
|
mainProtocolId: string | null;
|
639
641
|
tvl: number;
|
640
642
|
apr: number;
|
@@ -856,7 +858,7 @@ declare const app: Elysia<"", false, {
|
|
856
858
|
query: {
|
857
859
|
id?: string | undefined;
|
858
860
|
items?: number | undefined;
|
859
|
-
tags?:
|
861
|
+
tags?: string[] | undefined;
|
860
862
|
page?: number | undefined;
|
861
863
|
opportunityTag?: string | undefined;
|
862
864
|
};
|
@@ -867,7 +869,7 @@ declare const app: Elysia<"", false, {
|
|
867
869
|
url: string;
|
868
870
|
description: string;
|
869
871
|
id: string;
|
870
|
-
tags:
|
872
|
+
tags: string[];
|
871
873
|
icon: string;
|
872
874
|
} & {})[];
|
873
875
|
};
|
@@ -904,7 +906,7 @@ declare const app: Elysia<"", false, {
|
|
904
906
|
url: string;
|
905
907
|
description: string;
|
906
908
|
id: string;
|
907
|
-
tags:
|
909
|
+
tags: string[];
|
908
910
|
icon: string;
|
909
911
|
} | null;
|
910
912
|
};
|
@@ -933,7 +935,7 @@ declare const app: Elysia<"", false, {
|
|
933
935
|
url: string;
|
934
936
|
description: string;
|
935
937
|
id: string;
|
936
|
-
tags:
|
938
|
+
tags: string[];
|
937
939
|
icon: string;
|
938
940
|
};
|
939
941
|
};
|
@@ -949,7 +951,7 @@ declare const app: Elysia<"", false, {
|
|
949
951
|
url: string;
|
950
952
|
description: string;
|
951
953
|
id: string;
|
952
|
-
tags:
|
954
|
+
tags: string[];
|
953
955
|
icon: string;
|
954
956
|
};
|
955
957
|
params: {};
|
@@ -963,7 +965,7 @@ declare const app: Elysia<"", false, {
|
|
963
965
|
url: string;
|
964
966
|
description: string;
|
965
967
|
id: string;
|
966
|
-
tags:
|
968
|
+
tags: string[];
|
967
969
|
icon: string;
|
968
970
|
};
|
969
971
|
};
|
@@ -1086,6 +1088,39 @@ declare const app: Elysia<"", false, {
|
|
1086
1088
|
};
|
1087
1089
|
};
|
1088
1090
|
};
|
1091
|
+
} & {
|
1092
|
+
tokens: {
|
1093
|
+
index: {
|
1094
|
+
post: {
|
1095
|
+
body: {
|
1096
|
+
isTest?: boolean | undefined;
|
1097
|
+
icon: string;
|
1098
|
+
chainId: number;
|
1099
|
+
address: string;
|
1100
|
+
verified: boolean;
|
1101
|
+
};
|
1102
|
+
params: {};
|
1103
|
+
query: unknown;
|
1104
|
+
headers: {
|
1105
|
+
authorization: string;
|
1106
|
+
};
|
1107
|
+
response: {
|
1108
|
+
200: {
|
1109
|
+
symbol: string;
|
1110
|
+
name: string | null;
|
1111
|
+
id: string;
|
1112
|
+
icon: string;
|
1113
|
+
chainId: number;
|
1114
|
+
address: string;
|
1115
|
+
decimals: number;
|
1116
|
+
verified: boolean;
|
1117
|
+
isTest: boolean;
|
1118
|
+
price?: number | null | undefined;
|
1119
|
+
} | undefined;
|
1120
|
+
};
|
1121
|
+
};
|
1122
|
+
};
|
1123
|
+
};
|
1089
1124
|
} & {
|
1090
1125
|
tokens: {
|
1091
1126
|
":id": {
|
@@ -1834,7 +1869,7 @@ declare const app: Elysia<"", false, {
|
|
1834
1869
|
url: string;
|
1835
1870
|
description: string;
|
1836
1871
|
id: string;
|
1837
|
-
tags:
|
1872
|
+
tags: string[];
|
1838
1873
|
icon: string;
|
1839
1874
|
}[];
|
1840
1875
|
MainProtocol: {
|
@@ -1842,7 +1877,7 @@ declare const app: Elysia<"", false, {
|
|
1842
1877
|
url: string;
|
1843
1878
|
description: string;
|
1844
1879
|
id: string;
|
1845
|
-
tags:
|
1880
|
+
tags: string[];
|
1846
1881
|
icon: string;
|
1847
1882
|
} | null;
|
1848
1883
|
} & {
|
@@ -1854,6 +1889,7 @@ declare const app: Elysia<"", false, {
|
|
1854
1889
|
identifier: string;
|
1855
1890
|
chainId: number;
|
1856
1891
|
action: import("../database/api/.generated").$Enums.OpportunityAction;
|
1892
|
+
depositUrl: string | null;
|
1857
1893
|
mainProtocolId: string | null;
|
1858
1894
|
tvl: number;
|
1859
1895
|
apr: number;
|
@@ -1949,7 +1985,7 @@ declare const app: Elysia<"", false, {
|
|
1949
1985
|
url: string;
|
1950
1986
|
description: string;
|
1951
1987
|
id: string;
|
1952
|
-
tags:
|
1988
|
+
tags: string[];
|
1953
1989
|
icon: string;
|
1954
1990
|
}[];
|
1955
1991
|
MainProtocol: {
|
@@ -1957,7 +1993,7 @@ declare const app: Elysia<"", false, {
|
|
1957
1993
|
url: string;
|
1958
1994
|
description: string;
|
1959
1995
|
id: string;
|
1960
|
-
tags:
|
1996
|
+
tags: string[];
|
1961
1997
|
icon: string;
|
1962
1998
|
} | null;
|
1963
1999
|
} & {
|
@@ -1969,6 +2005,7 @@ declare const app: Elysia<"", false, {
|
|
1969
2005
|
identifier: string;
|
1970
2006
|
chainId: number;
|
1971
2007
|
action: import("../database/api/.generated").$Enums.OpportunityAction;
|
2008
|
+
depositUrl: string | null;
|
1972
2009
|
mainProtocolId: string | null;
|
1973
2010
|
tvl: number;
|
1974
2011
|
apr: number;
|
@@ -2172,7 +2209,7 @@ declare const app: Elysia<"", false, {
|
|
2172
2209
|
url: string;
|
2173
2210
|
description: string;
|
2174
2211
|
id: string;
|
2175
|
-
tags:
|
2212
|
+
tags: string[];
|
2176
2213
|
icon: string;
|
2177
2214
|
} & {})[];
|
2178
2215
|
};
|
@@ -2186,6 +2223,7 @@ declare const app: Elysia<"", false, {
|
|
2186
2223
|
body: unknown;
|
2187
2224
|
params: {};
|
2188
2225
|
query: {
|
2226
|
+
slippage?: number | undefined;
|
2189
2227
|
identifier: string;
|
2190
2228
|
chainId: number;
|
2191
2229
|
protocolId: string;
|
@@ -2206,47 +2244,6 @@ declare const app: Elysia<"", false, {
|
|
2206
2244
|
};
|
2207
2245
|
};
|
2208
2246
|
};
|
2209
|
-
} & {
|
2210
|
-
interaction: {
|
2211
|
-
sponsored: {
|
2212
|
-
get: {
|
2213
|
-
body: unknown;
|
2214
|
-
params: {};
|
2215
|
-
query: {
|
2216
|
-
identifier: string;
|
2217
|
-
chainId: number;
|
2218
|
-
protocolId: string;
|
2219
|
-
userAddress: string;
|
2220
|
-
fromAmount: string;
|
2221
|
-
fromTokenAddress: string;
|
2222
|
-
};
|
2223
|
-
headers: unknown;
|
2224
|
-
response: {
|
2225
|
-
200: {
|
2226
|
-
expirationTime: string;
|
2227
|
-
expiresIn: string;
|
2228
|
-
feeTokenAmount: string;
|
2229
|
-
feeTokendecimals: string;
|
2230
|
-
feeUSD: string;
|
2231
|
-
gasLimit: string;
|
2232
|
-
gasPrice: string;
|
2233
|
-
markup: string;
|
2234
|
-
maxNonce: string;
|
2235
|
-
protocolAddress: string;
|
2236
|
-
sponsorshipRatio: string;
|
2237
|
-
tokenAddress: string;
|
2238
|
-
tokenPrice: string;
|
2239
|
-
txData: {
|
2240
|
-
from: string;
|
2241
|
-
to: string;
|
2242
|
-
data: string;
|
2243
|
-
};
|
2244
|
-
warnings: string[];
|
2245
|
-
} | undefined;
|
2246
|
-
};
|
2247
|
-
};
|
2248
|
-
};
|
2249
|
-
};
|
2250
2247
|
};
|
2251
2248
|
} & {
|
2252
2249
|
v4: {
|
@@ -10,7 +10,7 @@ export declare abstract class EnsoService {
|
|
10
10
|
url: string;
|
11
11
|
description: string;
|
12
12
|
id: string;
|
13
|
-
tags:
|
13
|
+
tags: string[];
|
14
14
|
icon: string;
|
15
15
|
} & {})[]>;
|
16
16
|
static getTokens(chainId: number, slug: EnsoSlug, identifier?: string): Promise<{
|
@@ -45,7 +45,7 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
45
45
|
url: string;
|
46
46
|
description: string;
|
47
47
|
id: string;
|
48
|
-
tags:
|
48
|
+
tags: string[];
|
49
49
|
icon: string;
|
50
50
|
} & {})[];
|
51
51
|
};
|
@@ -59,6 +59,7 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
59
59
|
body: unknown;
|
60
60
|
params: {};
|
61
61
|
query: {
|
62
|
+
slippage?: number | undefined;
|
62
63
|
identifier: string;
|
63
64
|
chainId: number;
|
64
65
|
protocolId: string;
|
@@ -79,47 +80,6 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
79
80
|
};
|
80
81
|
};
|
81
82
|
};
|
82
|
-
} & {
|
83
|
-
interaction: {
|
84
|
-
sponsored: {
|
85
|
-
get: {
|
86
|
-
body: unknown;
|
87
|
-
params: {};
|
88
|
-
query: {
|
89
|
-
identifier: string;
|
90
|
-
chainId: number;
|
91
|
-
protocolId: string;
|
92
|
-
userAddress: string;
|
93
|
-
fromAmount: string;
|
94
|
-
fromTokenAddress: string;
|
95
|
-
};
|
96
|
-
headers: unknown;
|
97
|
-
response: {
|
98
|
-
200: {
|
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: {
|
113
|
-
from: string;
|
114
|
-
to: string;
|
115
|
-
data: string;
|
116
|
-
};
|
117
|
-
warnings: string[];
|
118
|
-
} | undefined;
|
119
|
-
};
|
120
|
-
};
|
121
|
-
};
|
122
|
-
};
|
123
83
|
}, {
|
124
84
|
derive: {};
|
125
85
|
resolve: {};
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import { ChainId } from "@sdk";
|
2
1
|
import Elysia from "elysia";
|
3
2
|
import { EnsoService } from "../enso/enso.service";
|
4
|
-
import { ZyfiService } from "../zyfi/zyfi.service";
|
5
3
|
import { GetInteractionProtocolsQueryDto, GetInteractionQuoteQueryDto, GetInteractionTargetsQueryDto, } from "./interaction.model";
|
6
4
|
import { InteractionService } from "./interaction.service";
|
7
5
|
// ─── Interaction Controller ──────────────────────────────────────────────────
|
@@ -27,32 +25,16 @@ export const InteractionController = new Elysia({
|
|
27
25
|
},
|
28
26
|
})
|
29
27
|
// ─── Get Transaction ─────────────────────────────────────────────────
|
30
|
-
.get("/transaction", async ({ query: { protocolId, chainId, identifier, userAddress, fromAmount, fromTokenAddress } }) => {
|
28
|
+
.get("/transaction", async ({ query: { protocolId, chainId, identifier, userAddress, fromAmount, fromTokenAddress, slippage } }) => {
|
31
29
|
const [target] = await InteractionService.getTargets(chainId, protocolId, identifier);
|
32
30
|
//TODO: throw error
|
33
31
|
if (!target)
|
34
32
|
return;
|
35
|
-
return await InteractionService.getTransaction(target.provider, chainId, protocolId, identifier, userAddress, fromTokenAddress, BigInt(fromAmount));
|
33
|
+
return await InteractionService.getTransaction(target.provider, chainId, protocolId, identifier, userAddress, fromTokenAddress, BigInt(fromAmount), slippage);
|
36
34
|
}, {
|
37
35
|
query: GetInteractionQuoteQueryDto,
|
38
36
|
detail: {
|
39
37
|
summary: "Get participate transaction",
|
40
38
|
description: "",
|
41
39
|
},
|
42
|
-
})
|
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);
|
47
|
-
//TODO: throw error
|
48
|
-
if (!target)
|
49
|
-
return;
|
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 });
|
52
|
-
}, {
|
53
|
-
query: GetInteractionQuoteQueryDto,
|
54
|
-
detail: {
|
55
|
-
summary: "Get participate transaction wrapped by paymaster",
|
56
|
-
description: "",
|
57
|
-
},
|
58
40
|
});
|
@@ -56,6 +56,7 @@ export declare const GetInteractionQuoteQueryDto: import("@sinclair/typebox").TO
|
|
56
56
|
userAddress: import("@sinclair/typebox").TString;
|
57
57
|
fromTokenAddress: import("@sinclair/typebox").TString;
|
58
58
|
fromAmount: import("@sinclair/typebox").TString;
|
59
|
+
slippage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
59
60
|
}>;
|
60
61
|
export declare const GetInteractionProtocolsQueryDto: import("@sinclair/typebox").TObject<{
|
61
62
|
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
@@ -18,6 +18,7 @@ export const GetInteractionQuoteQueryDto = t.Object({
|
|
18
18
|
userAddress: t.String(),
|
19
19
|
fromTokenAddress: t.String(),
|
20
20
|
fromAmount: t.String(),
|
21
|
+
slippage: t.Optional(t.Number({ description: "Slippage in basis points (O.1%)" })),
|
21
22
|
});
|
22
23
|
export const GetInteractionProtocolsQueryDto = t.Object({
|
23
24
|
chainId: t.Optional(t.Numeric()),
|
@@ -19,5 +19,5 @@ export declare abstract class InteractionService {
|
|
19
19
|
data: `0x${string}`;
|
20
20
|
};
|
21
21
|
}>;
|
22
|
-
static getTransaction(provider: InteractionTarget["provider"], chainId: number, protocolId: ProtocolId, identifier: string, userAddress: string, fromTokenAddress: string, fromTokenAmount: bigint): Promise<InteractionQuote>;
|
22
|
+
static getTransaction(provider: InteractionTarget["provider"], chainId: number, protocolId: ProtocolId, identifier: string, userAddress: string, fromTokenAddress: string, fromTokenAmount: bigint, slippage?: number): Promise<InteractionQuote>;
|
23
23
|
}
|
@@ -94,9 +94,9 @@ export class InteractionService {
|
|
94
94
|
},
|
95
95
|
};
|
96
96
|
}
|
97
|
-
static async getTransaction(provider, chainId, protocolId, identifier, userAddress, fromTokenAddress, fromTokenAmount) {
|
97
|
+
static async getTransaction(provider, chainId, protocolId, identifier, userAddress, fromTokenAddress, fromTokenAmount, slippage) {
|
98
98
|
if (provider === "zap")
|
99
|
-
return await KyberZapService.getTransaction(chainId, protocolId, identifier, userAddress, fromTokenAddress, fromTokenAmount);
|
99
|
+
return await KyberZapService.getTransaction(chainId, protocolId, identifier, userAddress, fromTokenAddress, fromTokenAmount, slippage);
|
100
100
|
const { tx, ...quote } = await EnsoService.getTransaction({
|
101
101
|
fromAddress: userAddress,
|
102
102
|
tokenIn: [fromTokenAddress],
|
@@ -28,6 +28,7 @@ export declare const apiTypes: {
|
|
28
28
|
amountIn: import("@sinclair/typebox").TString;
|
29
29
|
feeAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
30
30
|
feePcm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
31
|
+
sipplage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
31
32
|
}>;
|
32
33
|
readonly response: import("@sinclair/typebox").TObject<{
|
33
34
|
message: import("@sinclair/typebox").TString;
|
@@ -11,5 +11,5 @@ export declare abstract class KyberZapService {
|
|
11
11
|
* @param param0
|
12
12
|
*/
|
13
13
|
static getFullRangeTicks(): number[];
|
14
|
-
static getTransaction(chainId: number, protocol: ProtocolId, identifier: string, userAddress: string, fromTokenAddress: string, fromTokenAmount: bigint): Promise<InteractionQuote>;
|
14
|
+
static getTransaction(chainId: number, protocol: ProtocolId, identifier: string, userAddress: string, fromTokenAddress: string, fromTokenAmount: bigint, slippage?: number): Promise<InteractionQuote>;
|
15
15
|
}
|
@@ -7,6 +7,7 @@ export class KyberZapService {
|
|
7
7
|
headers: new Headers({
|
8
8
|
Authorization: `Bearer ${process.env.KYBERSWAP_ZAP_API_KEY}`,
|
9
9
|
"Content-Type": "application/json",
|
10
|
+
"X-Client-Id": "merkl",
|
10
11
|
}),
|
11
12
|
});
|
12
13
|
if (res.status !== 200)
|
@@ -18,8 +19,9 @@ export class KyberZapService {
|
|
18
19
|
method: "POST",
|
19
20
|
body: JSON.stringify(params?.body),
|
20
21
|
headers: new Headers({
|
21
|
-
Authorization: `Bearer ${
|
22
|
+
Authorization: `Bearer ${process.env.KYBERSWAP_ZAP_API_KEY}`,
|
22
23
|
"Content-Type": "application/json",
|
24
|
+
"X-Client-Id": "merkl",
|
23
25
|
}),
|
24
26
|
});
|
25
27
|
if (res.status !== 200)
|
@@ -43,7 +45,7 @@ export class KyberZapService {
|
|
43
45
|
static getFullRangeTicks() {
|
44
46
|
return [-886800, 886800];
|
45
47
|
}
|
46
|
-
static async getTransaction(chainId, protocol, identifier, userAddress, fromTokenAddress, fromTokenAmount) {
|
48
|
+
static async getTransaction(chainId, protocol, identifier, userAddress, fromTokenAddress, fromTokenAmount, slippage) {
|
47
49
|
const [lower, upper] = KyberZapService.getFullRangeTicks();
|
48
50
|
const { data: route } = await KyberZapService.#fetch("/api/v1/in/route", {
|
49
51
|
query: {
|
@@ -53,6 +55,8 @@ export class KyberZapService {
|
|
53
55
|
"position.tickLower": lower?.toString(),
|
54
56
|
"position.tickUpper": upper?.toString(),
|
55
57
|
dex: KyberZapService.getDexId(protocol),
|
58
|
+
//TODO: add a lesser value here (2% by default)
|
59
|
+
sipplage: slippage ?? 200,
|
56
60
|
},
|
57
61
|
chainId,
|
58
62
|
});
|
@@ -136,7 +136,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
136
136
|
url: string;
|
137
137
|
description: string;
|
138
138
|
id: string;
|
139
|
-
tags:
|
139
|
+
tags: string[];
|
140
140
|
icon: string;
|
141
141
|
} | undefined;
|
142
142
|
name: string;
|
@@ -146,6 +146,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
146
146
|
identifier: string;
|
147
147
|
chainId: number;
|
148
148
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
149
|
+
depositUrl: string | null;
|
149
150
|
tvl: number;
|
150
151
|
apr: number;
|
151
152
|
dailyRewards: number;
|
@@ -199,7 +200,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
199
200
|
url: string;
|
200
201
|
description: string;
|
201
202
|
id: string;
|
202
|
-
tags:
|
203
|
+
tags: string[];
|
203
204
|
icon: string;
|
204
205
|
} | null | undefined;
|
205
206
|
aprRecord?: {
|
@@ -308,7 +309,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
308
309
|
url: string;
|
309
310
|
description: string;
|
310
311
|
id: string;
|
311
|
-
tags:
|
312
|
+
tags: string[];
|
312
313
|
icon: string;
|
313
314
|
} | null | undefined;
|
314
315
|
aprRecord?: {
|
@@ -504,6 +505,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
504
505
|
identifier: string;
|
505
506
|
chainId: number;
|
506
507
|
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
508
|
+
depositUrl: string | null;
|
507
509
|
mainProtocolId: string | null;
|
508
510
|
tvl: number;
|
509
511
|
apr: number;
|
@@ -2,7 +2,7 @@ import { HttpErrorDto, NotFoundError, NotFoundErrorDto } from "../../../errors";
|
|
2
2
|
import { BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
3
3
|
import { AuthorizationHeadersDto, TokenAuthGuard } from "../../../guards/TokenAuth.guard";
|
4
4
|
import Elysia, { t } from "elysia";
|
5
|
-
import {
|
5
|
+
import { CreateOpportunityDto, GetOpportunitiesQueryDto, OpportunityAggregateFieldDto, OpportunityIdDto, OpportunityResourceDto, OpportunityUniqueDto, OpportunityWithCampaignsResourceDto, UpdateOpportunityDto, } from "./opportunity.model";
|
6
6
|
import { OpportunityService } from "./opportunity.service";
|
7
7
|
import { transformId } from "./transform-id.pipe";
|
8
8
|
import { validateId } from "./validate-id.pipe";
|
@@ -106,7 +106,6 @@ export const OpportunityController = new Elysia({
|
|
106
106
|
.get("/aggregate/:field", async ({ query, params }) => await OpportunityService.aggregate(query, params.field), {
|
107
107
|
params: OpportunityAggregateFieldDto,
|
108
108
|
query: GetOpportunitiesQueryDto,
|
109
|
-
response: AggregationResourceDto,
|
110
109
|
})
|
111
110
|
// ─── Update An Opportunity ───────────────────────────────────────────
|
112
111
|
.patch("/:id", async ({ params, body }) => await OpportunityService.update(params.id, body), {
|
@@ -124,13 +124,7 @@ export declare const OpportunityResourceDto: import("@sinclair/typebox").TObject
|
|
124
124
|
id: import("@sinclair/typebox").TString;
|
125
125
|
name: import("@sinclair/typebox").TString;
|
126
126
|
icon: import("@sinclair/typebox").TString;
|
127
|
-
tags: import("@sinclair/typebox").TArray<import("@sinclair/typebox").
|
128
|
-
AMM: "AMM";
|
129
|
-
ALM: "ALM";
|
130
|
-
DEX: "DEX";
|
131
|
-
LENDING: "LENDING";
|
132
|
-
PERPETUAL: "PERPETUAL";
|
133
|
-
}>>;
|
127
|
+
tags: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
134
128
|
description: import("@sinclair/typebox").TString;
|
135
129
|
url: import("@sinclair/typebox").TString;
|
136
130
|
}>, import("@sinclair/typebox").TNull]>>;
|
@@ -140,13 +134,7 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
140
134
|
id: import("@sinclair/typebox").TString;
|
141
135
|
name: import("@sinclair/typebox").TString;
|
142
136
|
icon: import("@sinclair/typebox").TString;
|
143
|
-
tags: import("@sinclair/typebox").TArray<import("@sinclair/typebox").
|
144
|
-
AMM: "AMM";
|
145
|
-
ALM: "ALM";
|
146
|
-
DEX: "DEX";
|
147
|
-
LENDING: "LENDING";
|
148
|
-
PERPETUAL: "PERPETUAL";
|
149
|
-
}>>;
|
137
|
+
tags: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
150
138
|
description: import("@sinclair/typebox").TString;
|
151
139
|
url: import("@sinclair/typebox").TString;
|
152
140
|
}>, import("@sinclair/typebox").TNull]>>;
|