@oydual31/more-vaults-sdk 0.1.13 → 0.1.14
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/react/index.cjs +33 -16
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +33 -16
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-CQeExpAR.d.cts → spokeRoutes-BFIxGa1h.d.cts} +8 -1
- package/dist/{spokeRoutes-CQeExpAR.d.ts → spokeRoutes-BFIxGa1h.d.ts} +8 -1
- package/dist/viem/index.cjs +33 -16
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +1 -1
- package/dist/viem/index.d.ts +1 -1
- package/dist/viem/index.js +33 -16
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/spokeRoutes.ts +56 -29
package/dist/viem/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hash, Address, WalletClient, PublicClient } from 'viem';
|
|
2
2
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestStatus, a as AsyncRequestStatusInfo, D as DepositBlockReason, b as DepositEligibility, I as InboundRoute, c as InboundRouteWithBalance, M as MaxWithdrawable, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, d as OutboundRoute, S as SpokeBalance, U as UserBalances, e as UserPosition, V as VaultDistribution, f as VaultMetadata, g as VaultMode, h as VaultStatus, i as VaultSummary, j as VaultTopology, k as canDeposit, l as ensureAllowance, m as getAllVaultChainIds, n as getAsyncRequestStatus, o as getAsyncRequestStatusLabel, p as getFullVaultTopology, q as getInboundRoutes, r as getMaxWithdrawable, s as getOutboundRoutes, t as getUserBalances, u as getUserBalancesForRoutes, v as getUserPosition, w as getVaultDistribution, x as getVaultDistributionWithTopology, y as getVaultMetadata, z as getVaultStatus, B as getVaultSummary, C as getVaultTopology, E as isAsyncMode, F as isOnHubChain, G as previewDeposit, H as previewRedeem, J as quoteLzFee, K as quoteRouteDepositFee } from '../spokeRoutes-
|
|
3
|
+
export { A as AsyncRequestStatus, a as AsyncRequestStatusInfo, D as DepositBlockReason, b as DepositEligibility, I as InboundRoute, c as InboundRouteWithBalance, M as MaxWithdrawable, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, d as OutboundRoute, S as SpokeBalance, U as UserBalances, e as UserPosition, V as VaultDistribution, f as VaultMetadata, g as VaultMode, h as VaultStatus, i as VaultSummary, j as VaultTopology, k as canDeposit, l as ensureAllowance, m as getAllVaultChainIds, n as getAsyncRequestStatus, o as getAsyncRequestStatusLabel, p as getFullVaultTopology, q as getInboundRoutes, r as getMaxWithdrawable, s as getOutboundRoutes, t as getUserBalances, u as getUserBalancesForRoutes, v as getUserPosition, w as getVaultDistribution, x as getVaultDistributionWithTopology, y as getVaultMetadata, z as getVaultStatus, B as getVaultSummary, C as getVaultTopology, E as isAsyncMode, F as isOnHubChain, G as previewDeposit, H as previewRedeem, J as quoteLzFee, K as quoteRouteDepositFee } from '../spokeRoutes-BFIxGa1h.cjs';
|
|
4
4
|
|
|
5
5
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
6
|
declare const CHAIN_IDS: {
|
package/dist/viem/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hash, Address, WalletClient, PublicClient } from 'viem';
|
|
2
2
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestStatus, a as AsyncRequestStatusInfo, D as DepositBlockReason, b as DepositEligibility, I as InboundRoute, c as InboundRouteWithBalance, M as MaxWithdrawable, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, d as OutboundRoute, S as SpokeBalance, U as UserBalances, e as UserPosition, V as VaultDistribution, f as VaultMetadata, g as VaultMode, h as VaultStatus, i as VaultSummary, j as VaultTopology, k as canDeposit, l as ensureAllowance, m as getAllVaultChainIds, n as getAsyncRequestStatus, o as getAsyncRequestStatusLabel, p as getFullVaultTopology, q as getInboundRoutes, r as getMaxWithdrawable, s as getOutboundRoutes, t as getUserBalances, u as getUserBalancesForRoutes, v as getUserPosition, w as getVaultDistribution, x as getVaultDistributionWithTopology, y as getVaultMetadata, z as getVaultStatus, B as getVaultSummary, C as getVaultTopology, E as isAsyncMode, F as isOnHubChain, G as previewDeposit, H as previewRedeem, J as quoteLzFee, K as quoteRouteDepositFee } from '../spokeRoutes-
|
|
3
|
+
export { A as AsyncRequestStatus, a as AsyncRequestStatusInfo, D as DepositBlockReason, b as DepositEligibility, I as InboundRoute, c as InboundRouteWithBalance, M as MaxWithdrawable, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, d as OutboundRoute, S as SpokeBalance, U as UserBalances, e as UserPosition, V as VaultDistribution, f as VaultMetadata, g as VaultMode, h as VaultStatus, i as VaultSummary, j as VaultTopology, k as canDeposit, l as ensureAllowance, m as getAllVaultChainIds, n as getAsyncRequestStatus, o as getAsyncRequestStatusLabel, p as getFullVaultTopology, q as getInboundRoutes, r as getMaxWithdrawable, s as getOutboundRoutes, t as getUserBalances, u as getUserBalancesForRoutes, v as getUserPosition, w as getVaultDistribution, x as getVaultDistributionWithTopology, y as getVaultMetadata, z as getVaultStatus, B as getVaultSummary, C as getVaultTopology, E as isAsyncMode, F as isOnHubChain, G as previewDeposit, H as previewRedeem, J as quoteLzFee, K as quoteRouteDepositFee } from '../spokeRoutes-BFIxGa1h.js';
|
|
4
4
|
|
|
5
5
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
6
|
declare const CHAIN_IDS: {
|
package/dist/viem/index.js
CHANGED
|
@@ -1943,6 +1943,15 @@ function createChainClient(chainId) {
|
|
|
1943
1943
|
transport: rpcs.length === 1 ? http(rpcs[0]) : fallback(rpcs.map((url) => http(url)))
|
|
1944
1944
|
});
|
|
1945
1945
|
}
|
|
1946
|
+
var SYMBOL_ABI = [{ name: "symbol", type: "function", stateMutability: "view", inputs: [], outputs: [{ type: "string" }] }];
|
|
1947
|
+
async function readTokenSymbol(client, token, fallbackSymbol) {
|
|
1948
|
+
if (!client) return fallbackSymbol;
|
|
1949
|
+
try {
|
|
1950
|
+
return await client.readContract({ address: token, abi: SYMBOL_ABI, functionName: "symbol" });
|
|
1951
|
+
} catch {
|
|
1952
|
+
return fallbackSymbol;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1946
1955
|
Object.fromEntries(
|
|
1947
1956
|
Object.entries(PUBLIC_RPCS).map(([k, v]) => [k, v[0]])
|
|
1948
1957
|
);
|
|
@@ -1978,26 +1987,31 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
|
|
|
1978
1987
|
if (!client) return;
|
|
1979
1988
|
try {
|
|
1980
1989
|
const receiverBytes32 = `0x${getAddress(userAddress).slice(2).padStart(64, "0")}`;
|
|
1981
|
-
const
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1990
|
+
const spokeTokenAddr = getAddress(spokeEntry.token);
|
|
1991
|
+
const [fee, sourceTokenSymbol] = await Promise.all([
|
|
1992
|
+
client.readContract({
|
|
1993
|
+
address: getAddress(spokeEntry.oft),
|
|
1994
|
+
abi: OFT_ABI,
|
|
1995
|
+
functionName: "quoteSend",
|
|
1996
|
+
args: [{
|
|
1997
|
+
dstEid: hubEid,
|
|
1998
|
+
to: receiverBytes32,
|
|
1999
|
+
amountLD: 1000000n,
|
|
2000
|
+
minAmountLD: 0n,
|
|
2001
|
+
extraOptions: "0x",
|
|
2002
|
+
composeMsg: "0x",
|
|
2003
|
+
oftCmd
|
|
2004
|
+
}, false]
|
|
2005
|
+
}),
|
|
2006
|
+
readTokenSymbol(client, spokeTokenAddr, symbol)
|
|
2007
|
+
]);
|
|
1995
2008
|
results.push({
|
|
1996
2009
|
symbol,
|
|
1997
2010
|
spokeChainId,
|
|
1998
2011
|
depositType: "oft-compose",
|
|
1999
2012
|
spokeOft: getAddress(spokeEntry.oft),
|
|
2000
|
-
spokeToken:
|
|
2013
|
+
spokeToken: spokeTokenAddr,
|
|
2014
|
+
sourceTokenSymbol,
|
|
2001
2015
|
hubOft: getAddress(hubEntry.oft),
|
|
2002
2016
|
oftCmd,
|
|
2003
2017
|
lzFeeEstimate: fee.nativeFee,
|
|
@@ -2011,12 +2025,15 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
|
|
|
2011
2025
|
for (const [symbol, chainMap] of Object.entries(OFT_ROUTES)) {
|
|
2012
2026
|
const hubEntry = chainMap[hubChainId];
|
|
2013
2027
|
if (hubEntry && getAddress(hubEntry.token) === getAddress(vaultAsset)) {
|
|
2028
|
+
const hubTokenAddr = getAddress(hubEntry.token);
|
|
2029
|
+
const sourceTokenSymbol = await readTokenSymbol(hubClient, hubTokenAddr, symbol);
|
|
2014
2030
|
results.unshift({
|
|
2015
2031
|
symbol,
|
|
2016
2032
|
spokeChainId: hubChainId,
|
|
2017
2033
|
depositType: "direct",
|
|
2018
2034
|
spokeOft: null,
|
|
2019
|
-
spokeToken:
|
|
2035
|
+
spokeToken: hubTokenAddr,
|
|
2036
|
+
sourceTokenSymbol,
|
|
2020
2037
|
hubOft: null,
|
|
2021
2038
|
oftCmd: "0x",
|
|
2022
2039
|
lzFeeEstimate: 0n,
|