@oydual31/more-vaults-sdk 1.0.0 → 1.1.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.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/{curatorBridge-CR9eYhuM.d.cts → curatorBridge-DDNgHubw.d.cts} +27 -12
  3. package/dist/{curatorBridge-CR9eYhuM.d.ts → curatorBridge-DDNgHubw.d.ts} +27 -12
  4. package/dist/ethers/index.cjs +482 -160
  5. package/dist/ethers/index.cjs.map +1 -1
  6. package/dist/ethers/index.d.cts +158 -10
  7. package/dist/ethers/index.d.ts +158 -10
  8. package/dist/ethers/index.js +469 -161
  9. package/dist/ethers/index.js.map +1 -1
  10. package/dist/react/index.cjs +522 -227
  11. package/dist/react/index.cjs.map +1 -1
  12. package/dist/react/index.d.cts +2 -2
  13. package/dist/react/index.d.ts +2 -2
  14. package/dist/react/index.js +522 -227
  15. package/dist/react/index.js.map +1 -1
  16. package/dist/viem/index.cjs +877 -446
  17. package/dist/viem/index.cjs.map +1 -1
  18. package/dist/viem/index.d.cts +154 -12
  19. package/dist/viem/index.d.ts +154 -12
  20. package/dist/viem/index.js +865 -447
  21. package/dist/viem/index.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/ethers/adminActions.ts +161 -31
  24. package/src/ethers/crossChainFlows.ts +6 -0
  25. package/src/ethers/curatorBridge.ts +23 -12
  26. package/src/ethers/curatorMulticall.ts +27 -6
  27. package/src/ethers/curatorStatus.ts +7 -2
  28. package/src/ethers/curatorSubVaults.ts +11 -2
  29. package/src/ethers/depositFlows.ts +69 -36
  30. package/src/ethers/errorParser.ts +96 -0
  31. package/src/ethers/errors.ts +107 -0
  32. package/src/ethers/index.ts +15 -1
  33. package/src/ethers/preflight.ts +27 -60
  34. package/src/ethers/redeemFlows.ts +69 -26
  35. package/src/ethers/spokeRoutes.ts +7 -6
  36. package/src/ethers/topology.ts +17 -6
  37. package/src/ethers/userHelpers.ts +2 -1
  38. package/src/ethers/utils.ts +88 -14
  39. package/src/react/useInboundRoutes.ts +4 -3
  40. package/src/viem/adminActions.ts +214 -82
  41. package/src/viem/crossChainFlows.ts +42 -28
  42. package/src/viem/curatorBridge.ts +31 -9
  43. package/src/viem/curatorMulticall.ts +39 -21
  44. package/src/viem/curatorStatus.ts +64 -41
  45. package/src/viem/curatorSubVaults.ts +23 -14
  46. package/src/viem/depositFlows.ts +97 -57
  47. package/src/viem/distribution.ts +7 -1
  48. package/src/viem/errorParser.ts +96 -0
  49. package/src/viem/errors.ts +107 -0
  50. package/src/viem/index.ts +13 -0
  51. package/src/viem/preflight.ts +26 -59
  52. package/src/viem/redeemFlows.ts +106 -44
  53. package/src/viem/spokeRoutes.ts +128 -59
  54. package/src/viem/topology.ts +69 -53
  55. package/src/viem/userHelpers.ts +108 -42
  56. package/src/viem/utils.ts +62 -34
package/README.md CHANGED
@@ -776,7 +776,7 @@ if (status.canFinalizeDeposit) {
776
776
 
777
777
  ## Vault configuration
778
778
 
779
- Phase 7 — full admin/curator/guardian config reads and writes.
779
+ Full admin/curator/guardian config reads and writes.
780
780
 
781
781
  ### Reading configuration
782
782
 
@@ -876,11 +876,15 @@ declare function discoverVaultTopology(vault: Address, publicClient?: PublicClie
876
876
  * Useful for showing a "Switch to Base" prompt before deposit.
877
877
  *
878
878
  * @param currentChainId Chain ID the wallet is currently connected to
879
- * @param topology Result of getVaultTopology
879
+ * @param topology Result of getVaultTopology or discoverVaultTopology
880
+ * @returns true if the wallet is already on the hub chain
880
881
  */
881
882
  declare function isOnHubChain(currentChainId: number, topology: VaultTopology): boolean;
882
883
  /**
883
884
  * Get all chain IDs where this vault is deployed (hub + all spokes).
885
+ *
886
+ * @param topology Result of getVaultTopology or discoverVaultTopology
887
+ * @returns Array starting with the hub chainId followed by all spoke chainIds
884
888
  */
885
889
  declare function getAllVaultChainIds(topology: VaultTopology): number[];
886
890
 
@@ -999,23 +1003,33 @@ interface InboundRouteWithBalance extends InboundRoute {
999
1003
  userBalance: bigint;
1000
1004
  }
1001
1005
  /**
1002
- * Find all valid OFT inbound routes for a vault.
1006
+ * Find all valid inbound deposit routes for a vault.
1007
+ *
1008
+ * Accepts a single asset address **or an array** of depositable asset addresses.
1009
+ * When an array is passed (multi-asset vaults), routes for each asset are fetched
1010
+ * in parallel and merged — topology and async-mode are fetched only once.
1003
1011
  *
1004
- * Only returns routes for chains where the vault has a registered spoke
1005
- * this is required so the composer can send shares back to the user's chain.
1006
- * The hub chain is always included as a 'direct' deposit option.
1012
+ * The hub chain is always included as a 'direct' (or 'direct-async') option for
1013
+ * every depositable asset, even if the token is not in OFT_ROUTES.
1007
1014
  *
1008
- * Routes that revert on quoteSend() (no liquidity, no peer) are excluded.
1015
+ * Routes that revert on quoteSend() (no liquidity, no peer) are excluded silently.
1009
1016
  *
1010
- * @param hubChainId Chain ID of the vault hub (e.g. 8453 for Base)
1011
- * @param vault Vault address (to resolve registered spoke chains)
1012
- * @param vaultAsset vault.asset() address on the hub chain
1013
- * @param userAddress User address (used as receiver for fee quote)
1017
+ * @param hubChainId Chain ID of the vault hub (e.g. 747 for Flow EVM)
1018
+ * @param vault Vault address
1019
+ * @param vaultAsset Single asset address OR array of depositable asset addresses
1020
+ * @param userAddress User address (used as receiver for fee quotes)
1021
+ * @returns Array of InboundRoute objects; hub direct route(s) are first
1014
1022
  */
1015
- declare function getInboundRoutes(hubChainId: number, vault: Address, vaultAsset: Address, userAddress: Address): Promise<InboundRoute[]>;
1023
+ declare function getInboundRoutes(hubChainId: number, vault: Address, vaultAsset: Address | Address[], userAddress: Address): Promise<InboundRoute[]>;
1016
1024
  /**
1017
1025
  * Fetch user token balances for each inbound route in parallel.
1018
- * Routes with native ETH as token (zeroAddress) return the chain's ETH balance.
1026
+ *
1027
+ * Routes with native token as the source (zeroAddress) return the chain's
1028
+ * native gas balance instead of an ERC-20 balance.
1029
+ *
1030
+ * @param routes Array of InboundRoute objects from getInboundRoutes
1031
+ * @param userAddress User wallet address to query balances for
1032
+ * @returns Each route extended with the user's current token balance
1019
1033
  */
1020
1034
  declare function getUserBalancesForRoutes(routes: InboundRoute[], userAddress: Address): Promise<InboundRouteWithBalance[]>;
1021
1035
  /**
@@ -1027,6 +1041,7 @@ declare function getUserBalancesForRoutes(routes: InboundRoute[], userAddress: A
1027
1041
  *
1028
1042
  * @param hubChainId Chain ID of the vault hub (e.g. 8453 for Base)
1029
1043
  * @param vault Vault address (to resolve registered spoke chains)
1044
+ * @returns Array of OutboundRoute objects; hub is always at index 0
1030
1045
  */
1031
1046
  declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<OutboundRoute[]>;
1032
1047
  /**
@@ -876,11 +876,15 @@ declare function discoverVaultTopology(vault: Address, publicClient?: PublicClie
876
876
  * Useful for showing a "Switch to Base" prompt before deposit.
877
877
  *
878
878
  * @param currentChainId Chain ID the wallet is currently connected to
879
- * @param topology Result of getVaultTopology
879
+ * @param topology Result of getVaultTopology or discoverVaultTopology
880
+ * @returns true if the wallet is already on the hub chain
880
881
  */
881
882
  declare function isOnHubChain(currentChainId: number, topology: VaultTopology): boolean;
882
883
  /**
883
884
  * Get all chain IDs where this vault is deployed (hub + all spokes).
885
+ *
886
+ * @param topology Result of getVaultTopology or discoverVaultTopology
887
+ * @returns Array starting with the hub chainId followed by all spoke chainIds
884
888
  */
885
889
  declare function getAllVaultChainIds(topology: VaultTopology): number[];
886
890
 
@@ -999,23 +1003,33 @@ interface InboundRouteWithBalance extends InboundRoute {
999
1003
  userBalance: bigint;
1000
1004
  }
1001
1005
  /**
1002
- * Find all valid OFT inbound routes for a vault.
1006
+ * Find all valid inbound deposit routes for a vault.
1007
+ *
1008
+ * Accepts a single asset address **or an array** of depositable asset addresses.
1009
+ * When an array is passed (multi-asset vaults), routes for each asset are fetched
1010
+ * in parallel and merged — topology and async-mode are fetched only once.
1003
1011
  *
1004
- * Only returns routes for chains where the vault has a registered spoke
1005
- * this is required so the composer can send shares back to the user's chain.
1006
- * The hub chain is always included as a 'direct' deposit option.
1012
+ * The hub chain is always included as a 'direct' (or 'direct-async') option for
1013
+ * every depositable asset, even if the token is not in OFT_ROUTES.
1007
1014
  *
1008
- * Routes that revert on quoteSend() (no liquidity, no peer) are excluded.
1015
+ * Routes that revert on quoteSend() (no liquidity, no peer) are excluded silently.
1009
1016
  *
1010
- * @param hubChainId Chain ID of the vault hub (e.g. 8453 for Base)
1011
- * @param vault Vault address (to resolve registered spoke chains)
1012
- * @param vaultAsset vault.asset() address on the hub chain
1013
- * @param userAddress User address (used as receiver for fee quote)
1017
+ * @param hubChainId Chain ID of the vault hub (e.g. 747 for Flow EVM)
1018
+ * @param vault Vault address
1019
+ * @param vaultAsset Single asset address OR array of depositable asset addresses
1020
+ * @param userAddress User address (used as receiver for fee quotes)
1021
+ * @returns Array of InboundRoute objects; hub direct route(s) are first
1014
1022
  */
1015
- declare function getInboundRoutes(hubChainId: number, vault: Address, vaultAsset: Address, userAddress: Address): Promise<InboundRoute[]>;
1023
+ declare function getInboundRoutes(hubChainId: number, vault: Address, vaultAsset: Address | Address[], userAddress: Address): Promise<InboundRoute[]>;
1016
1024
  /**
1017
1025
  * Fetch user token balances for each inbound route in parallel.
1018
- * Routes with native ETH as token (zeroAddress) return the chain's ETH balance.
1026
+ *
1027
+ * Routes with native token as the source (zeroAddress) return the chain's
1028
+ * native gas balance instead of an ERC-20 balance.
1029
+ *
1030
+ * @param routes Array of InboundRoute objects from getInboundRoutes
1031
+ * @param userAddress User wallet address to query balances for
1032
+ * @returns Each route extended with the user's current token balance
1019
1033
  */
1020
1034
  declare function getUserBalancesForRoutes(routes: InboundRoute[], userAddress: Address): Promise<InboundRouteWithBalance[]>;
1021
1035
  /**
@@ -1027,6 +1041,7 @@ declare function getUserBalancesForRoutes(routes: InboundRoute[], userAddress: A
1027
1041
  *
1028
1042
  * @param hubChainId Chain ID of the vault hub (e.g. 8453 for Base)
1029
1043
  * @param vault Vault address (to resolve registered spoke chains)
1044
+ * @returns Array of OutboundRoute objects; hub is always at index 0
1030
1045
  */
1031
1046
  declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<OutboundRoute[]>;
1032
1047
  /**