@merkl/api 0.10.241 → 0.10.243
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/libs/campaigns/utils/getEulerV2Vaults.js +6 -4
- package/dist/src/libs/tokens/balances.js +3 -3
- package/dist/src/modules/v4/interaction/interaction.service.js +7 -0
- package/dist/src/routes/v1/allowances.js +2 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -9,12 +9,14 @@ import { safeFetchLogs } from "./fetchLogs";
|
|
9
9
|
const VAULT_LENS_ADDRESS = {
|
10
10
|
[ChainId.MAINNET]: "0x57904B4DF131F00DEE9BB75a8FA1D27744035c90",
|
11
11
|
[ChainId.SWELL]: "0x7caA3c60D730D94D4b5E0E80E3b7D461fD153526",
|
12
|
+
[ChainId.BASE]: "0xc20B6e1d52ce377a450512958EEE8142063436CD",
|
12
13
|
};
|
13
14
|
const EVC_CREATION_BLOCK = {
|
14
15
|
[ChainId.MAINNET]: 20529207,
|
15
16
|
[ChainId.SWELL]: 485320,
|
17
|
+
[ChainId.BASE]: 24127584,
|
16
18
|
};
|
17
|
-
const eulerChainds = [ChainId.MAINNET, ChainId.SWELL];
|
19
|
+
const eulerChainds = [ChainId.MAINNET, ChainId.SWELL, ChainId.BASE];
|
18
20
|
async function getEulerV2Vaults() {
|
19
21
|
let vaults = [];
|
20
22
|
for (const chainId of eulerChainds) {
|
@@ -42,7 +44,7 @@ async function getEulerV2Vaults() {
|
|
42
44
|
return {
|
43
45
|
allowFailure: true,
|
44
46
|
callData: EulerVaultLensInterface.encodeFunctionData("getRecognizedCollateralsLTVInfo", [vault.address]),
|
45
|
-
target: VAULT_LENS_ADDRESS[
|
47
|
+
target: VAULT_LENS_ADDRESS[chainId],
|
46
48
|
};
|
47
49
|
}),
|
48
50
|
});
|
@@ -62,7 +64,7 @@ async function getEulerV2Vaults() {
|
|
62
64
|
});
|
63
65
|
}
|
64
66
|
}
|
65
|
-
const resCollatUnderlying = await batchMulticallCallWithRetry(
|
67
|
+
const resCollatUnderlying = await batchMulticallCallWithRetry(chainId, {
|
66
68
|
calls: callsCollatUnderlying,
|
67
69
|
});
|
68
70
|
for (let i = 0; i < resCollatUnderlying.length; i = i + 2) {
|
@@ -73,7 +75,7 @@ async function getEulerV2Vaults() {
|
|
73
75
|
target: underlyingToken,
|
74
76
|
});
|
75
77
|
}
|
76
|
-
const resCollatUnderlyingSymbol = await batchMulticallCallWithRetry(
|
78
|
+
const resCollatUnderlyingSymbol = await batchMulticallCallWithRetry(chainId, {
|
77
79
|
calls: callsCollatUnderlyingSymbol,
|
78
80
|
});
|
79
81
|
vaults = vaults.concat((await Promise.all(decodedVaults.map(async (decodedVault, index) => {
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { ChainId, ChainInteractionService, Erc20__factory, EthOnZKSync_INTERFACE, NETWORK_LABELS, } from "@sdk";
|
1
|
+
import { ChainId, ChainInteractionService, ETH_ADDRESS, ETH_ZKSYNC_ADDRESS, Erc20__factory, EthOnZKSync_INTERFACE, NETWORK_LABELS, } from "@sdk";
|
2
2
|
import { log } from "../../utils/logger";
|
3
3
|
import { getTokensListWithCache } from "../getTokensList";
|
4
4
|
export async function getOnlyUserBalance(chainId, userAddress, tokenAddresses) {
|
5
5
|
const calls = [];
|
6
6
|
const ERC20_Interface = Erc20__factory.createInterface();
|
7
7
|
for (const tokenAddress of tokenAddresses) {
|
8
|
-
if (chainId === ChainId.ZKSYNC && tokenAddress ===
|
8
|
+
if (chainId === ChainId.ZKSYNC && tokenAddress === ETH_ZKSYNC_ADDRESS) {
|
9
9
|
calls.push({
|
10
10
|
allowFailure: true,
|
11
11
|
callData: EthOnZKSync_INTERFACE.encodeFunctionData("balanceOf", [userAddress]),
|
@@ -54,7 +54,7 @@ export async function getUserBalances(user, chainId, tokenAddresses) {
|
|
54
54
|
},
|
55
55
|
};
|
56
56
|
}
|
57
|
-
const tokenListAddresses = Object.keys(tokens).filter(t => t !==
|
57
|
+
const tokenListAddresses = Object.keys(tokens).filter(t => t !== ETH_ADDRESS);
|
58
58
|
const ERC20_Interface = Erc20__factory.createInterface();
|
59
59
|
const calls = [];
|
60
60
|
for (const tokenAddress of tokenListAddresses) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ETH_ZKSYNC_ADDRESS } from "@sdk";
|
1
2
|
import { decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
2
3
|
import { ChainInteractionService } from "../chainInteraction";
|
3
4
|
import { EnsoService } from "../enso/enso.service";
|
@@ -61,6 +62,9 @@ export class InteractionService {
|
|
61
62
|
* @returns approved?, approval tx & allowance amount
|
62
63
|
*/
|
63
64
|
static async getApproval(chainId, owner, spender, tokenAddress, amount) {
|
65
|
+
// Normalizing ETH on ZKSync
|
66
|
+
if (tokenAddress === ETH_ZKSYNC_ADDRESS)
|
67
|
+
tokenAddress = ETH_ZKSYNC_ADDRESS;
|
64
68
|
//TODO: add utils to make using viem type-safety more concise
|
65
69
|
const abi = parseAbi([
|
66
70
|
"function approve(address, uint256) returns (bool)",
|
@@ -95,6 +99,9 @@ export class InteractionService {
|
|
95
99
|
};
|
96
100
|
}
|
97
101
|
static async getTransaction(provider, chainId, protocolId, identifier, userAddress, fromTokenAddress, fromTokenAmount, slippage) {
|
102
|
+
// Normalizing ETH on ZKSync
|
103
|
+
if (fromTokenAddress === ETH_ZKSYNC_ADDRESS)
|
104
|
+
fromTokenAddress = ETH_ZKSYNC_ADDRESS;
|
98
105
|
if (provider === "zap")
|
99
106
|
return await KyberZapService.getTransaction(chainId, protocolId, identifier, userAddress, fromTokenAddress, fromTokenAmount, slippage);
|
100
107
|
const { tx, ...quote } = await EnsoService.getTransaction({
|
@@ -3,13 +3,13 @@ import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
|
|
3
3
|
import { getUserBalances } from "../../libs/tokens/balances";
|
4
4
|
import { executeSimple } from "../../utils/execute";
|
5
5
|
import { throwOnInvalidAddress } from "../../utils/throw";
|
6
|
-
import { ChainId, ERC20Interface, registry } from "@sdk";
|
6
|
+
import { ChainId, ERC20Interface, ETH_ADDRESS, registry } from "@sdk";
|
7
7
|
import { t } from "elysia";
|
8
8
|
export async function getUserAllowances(user, spenders, tokens, chainId, additionalTokenAddresses) {
|
9
9
|
/** Filtered tokens list */
|
10
10
|
const filteredTokens = Object.keys(tokens).reduce((filteredTokensList, tokenAddress) => {
|
11
11
|
if (tokenAddress === "0x0000000000000000000000000000000000001010" ||
|
12
|
-
tokenAddress ===
|
12
|
+
tokenAddress === ETH_ADDRESS ||
|
13
13
|
tokenAddress === registry(ChainId.MAINNET)?.veANGLE)
|
14
14
|
return filteredTokensList;
|
15
15
|
if (!tokens[tokenAddress]?.wrappingMethod || tokens[tokenAddress]?.wrappingMethod !== "Convex") {
|