@oydual31/more-vaults-sdk 0.2.2 → 0.2.3
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 +13 -10
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +13 -10
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/src/react/useVaultDistribution.ts +21 -20
package/dist/react/index.cjs
CHANGED
|
@@ -2039,9 +2039,12 @@ function useRedeemShares(vault, chainId) {
|
|
|
2039
2039
|
};
|
|
2040
2040
|
}
|
|
2041
2041
|
function useVaultDistribution(vault) {
|
|
2042
|
-
const
|
|
2043
|
-
|
|
2044
|
-
|
|
2042
|
+
const { data: topology } = reactQuery.useQuery({
|
|
2043
|
+
queryKey: ["vaultTopology", vault],
|
|
2044
|
+
queryFn: () => discoverVaultTopology(vault),
|
|
2045
|
+
enabled: !!vault,
|
|
2046
|
+
staleTime: 5 * 60 * 1e3
|
|
2047
|
+
});
|
|
2045
2048
|
const spokeClients = react.useMemo(() => {
|
|
2046
2049
|
if (!topology) return {};
|
|
2047
2050
|
const clients = {};
|
|
@@ -2052,13 +2055,13 @@ function useVaultDistribution(vault) {
|
|
|
2052
2055
|
return clients;
|
|
2053
2056
|
}, [topology]);
|
|
2054
2057
|
const { data: distribution, isLoading } = reactQuery.useQuery({
|
|
2055
|
-
queryKey: ["vaultDistribution", vault,
|
|
2056
|
-
queryFn: () =>
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
spokeClients
|
|
2060
|
-
|
|
2061
|
-
enabled: !!vault && !!
|
|
2058
|
+
queryKey: ["vaultDistribution", vault, topology?.hubChainId],
|
|
2059
|
+
queryFn: () => {
|
|
2060
|
+
const hubClient = createChainClient(topology.hubChainId);
|
|
2061
|
+
if (!hubClient) throw new Error(`No public RPC for hub chainId ${topology.hubChainId}`);
|
|
2062
|
+
return getVaultDistribution(hubClient, vault, spokeClients);
|
|
2063
|
+
},
|
|
2064
|
+
enabled: !!vault && !!topology && topology.role !== "local",
|
|
2062
2065
|
staleTime: 3e4
|
|
2063
2066
|
});
|
|
2064
2067
|
return { distribution, isLoading };
|