@merkl/api 0.21.0 → 0.21.1
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.
@@ -96,7 +96,7 @@ export class EnsoService {
|
|
96
96
|
const targets = await EnsoService.getTargetsFromTokens(tokens);
|
97
97
|
return targets?.[0];
|
98
98
|
},
|
99
|
-
async getTransaction(chainId,
|
99
|
+
async getTransaction(chainId, _protocolId, identifier, userAddress, fromTokenAddress, fromTokenAmount, options) {
|
100
100
|
const { tx, ...quote } = await EnsoService.getTransaction({
|
101
101
|
fromAddress: userAddress,
|
102
102
|
tokenIn: [fromTokenAddress],
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Elysia from "elysia";
|
2
|
+
import { isAddress } from "viem";
|
2
3
|
import { EnsoService } from "../enso/enso.service";
|
3
4
|
import { GetInteractionProtocolsQueryDto, GetInteractionQuoteQueryDto, GetInteractionTargetsQueryDto, } from "./interaction.model";
|
4
5
|
import { InteractionService } from "./interaction.service";
|
@@ -8,6 +9,8 @@ export const InteractionController = new Elysia({
|
|
8
9
|
detail: { tags: ["Interaction"], hide: true },
|
9
10
|
})
|
10
11
|
.get("/targets", async ({ query: { protocolId, chainId, identifier } }) => {
|
12
|
+
if (!isAddress(identifier))
|
13
|
+
return [];
|
11
14
|
return await InteractionService.getTargets(chainId, protocolId, identifier);
|
12
15
|
}, {
|
13
16
|
query: GetInteractionTargetsQueryDto,
|
@@ -26,6 +29,8 @@ export const InteractionController = new Elysia({
|
|
26
29
|
})
|
27
30
|
// ─── Get Transaction ─────────────────────────────────────────────────
|
28
31
|
.get("/transaction", async ({ query: { protocolId, chainId, identifier, userAddress, fromAmount, fromTokenAddress, slippage } }) => {
|
32
|
+
if (!isAddress(identifier))
|
33
|
+
return;
|
29
34
|
const [target] = await InteractionService.getTargets(chainId, protocolId, identifier);
|
30
35
|
//TODO: throw error
|
31
36
|
if (!target)
|