@oydual31/more-vaults-sdk 0.2.6 → 0.2.8
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/README.md +23 -8
- package/dist/react/index.cjs +23 -11
- 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 +23 -11
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-z7s_5ooO.d.cts → spokeRoutes-FgKCJQYa.d.cts} +5 -2
- package/dist/{spokeRoutes-z7s_5ooO.d.ts → spokeRoutes-FgKCJQYa.d.ts} +5 -2
- package/dist/viem/index.cjs +44 -11
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +22 -11
- package/dist/viem/index.d.ts +22 -11
- package/dist/viem/index.js +44 -12
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/index.ts +1 -0
- package/src/viem/redeemFlows.ts +50 -10
- package/src/viem/userHelpers.ts +33 -15
package/dist/react/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { j as VaultStatus, h as VaultMetadata, g as UserPosition, e as MultiChainUserPosition, b as AsyncRequestStatusInfo, l as VaultTopology, V as VaultDistribution, d as InboundRouteWithBalance } from '../spokeRoutes-
|
|
2
|
+
import { j as VaultStatus, h as VaultMetadata, g as UserPosition, e as MultiChainUserPosition, b as AsyncRequestStatusInfo, l as VaultTopology, V as VaultDistribution, d as InboundRouteWithBalance } from '../spokeRoutes-FgKCJQYa.cjs';
|
|
3
3
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { j as VaultStatus, h as VaultMetadata, g as UserPosition, e as MultiChainUserPosition, b as AsyncRequestStatusInfo, l as VaultTopology, V as VaultDistribution, d as InboundRouteWithBalance } from '../spokeRoutes-
|
|
2
|
+
import { j as VaultStatus, h as VaultMetadata, g as UserPosition, e as MultiChainUserPosition, b as AsyncRequestStatusInfo, l as VaultTopology, V as VaultDistribution, d as InboundRouteWithBalance } from '../spokeRoutes-FgKCJQYa.js';
|
|
3
3
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
|
package/dist/react/index.js
CHANGED
|
@@ -1773,6 +1773,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
1773
1773
|
});
|
|
1774
1774
|
const [withdrawShares, timelockEndsAt] = withdrawalRequest;
|
|
1775
1775
|
const spokeShares = {};
|
|
1776
|
+
const rawSpokeShares = {};
|
|
1776
1777
|
if (topo.spokeChainIds.length > 0) {
|
|
1777
1778
|
let hubShareOft = null;
|
|
1778
1779
|
try {
|
|
@@ -1795,7 +1796,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
1795
1796
|
const spokePromises = topo.spokeChainIds.map(async (spokeChainId) => {
|
|
1796
1797
|
try {
|
|
1797
1798
|
const spokeEid = CHAIN_ID_TO_EID[spokeChainId];
|
|
1798
|
-
if (!spokeEid) return { chainId: spokeChainId, balance: 0n };
|
|
1799
|
+
if (!spokeEid) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
1799
1800
|
const spokeOftBytes32 = await hubClient.readContract({
|
|
1800
1801
|
address: hubShareOft,
|
|
1801
1802
|
abi: OFT_ABI,
|
|
@@ -1804,24 +1805,34 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
1804
1805
|
});
|
|
1805
1806
|
const spokeOft = getAddress(`0x${spokeOftBytes32.slice(-40)}`);
|
|
1806
1807
|
if (spokeOft === "0x0000000000000000000000000000000000000000") {
|
|
1807
|
-
return { chainId: spokeChainId, balance: 0n };
|
|
1808
|
+
return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
1808
1809
|
}
|
|
1809
1810
|
const spokeClient = createChainClient(spokeChainId);
|
|
1810
|
-
if (!spokeClient) return { chainId: spokeChainId, balance: 0n };
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1811
|
+
if (!spokeClient) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
1812
|
+
const [rawBalance, spokeOftDecimals] = await spokeClient.multicall({
|
|
1813
|
+
contracts: [
|
|
1814
|
+
{ address: spokeOft, abi: ERC20_ABI, functionName: "balanceOf", args: [u] },
|
|
1815
|
+
{ address: spokeOft, abi: METADATA_ABI, functionName: "decimals" }
|
|
1816
|
+
],
|
|
1817
|
+
allowFailure: false
|
|
1816
1818
|
});
|
|
1817
|
-
|
|
1819
|
+
let balance;
|
|
1820
|
+
if (spokeOftDecimals > decimals) {
|
|
1821
|
+
balance = rawBalance / 10n ** BigInt(spokeOftDecimals - decimals);
|
|
1822
|
+
} else if (spokeOftDecimals < decimals) {
|
|
1823
|
+
balance = rawBalance * 10n ** BigInt(decimals - spokeOftDecimals);
|
|
1824
|
+
} else {
|
|
1825
|
+
balance = rawBalance;
|
|
1826
|
+
}
|
|
1827
|
+
return { chainId: spokeChainId, balance, rawBalance };
|
|
1818
1828
|
} catch {
|
|
1819
|
-
return { chainId: spokeChainId, balance: 0n };
|
|
1829
|
+
return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
1820
1830
|
}
|
|
1821
1831
|
});
|
|
1822
1832
|
const results = await Promise.all(spokePromises);
|
|
1823
|
-
for (const { chainId, balance } of results) {
|
|
1833
|
+
for (const { chainId, balance, rawBalance } of results) {
|
|
1824
1834
|
spokeShares[chainId] = balance;
|
|
1835
|
+
rawSpokeShares[chainId] = rawBalance;
|
|
1825
1836
|
}
|
|
1826
1837
|
}
|
|
1827
1838
|
}
|
|
@@ -1841,6 +1852,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
1841
1852
|
return {
|
|
1842
1853
|
hubShares,
|
|
1843
1854
|
spokeShares,
|
|
1855
|
+
rawSpokeShares,
|
|
1844
1856
|
totalShares,
|
|
1845
1857
|
estimatedAssets,
|
|
1846
1858
|
sharePrice,
|