@oydual31/more-vaults-sdk 0.4.2 → 0.6.0

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 (38) hide show
  1. package/README.md +94 -0
  2. package/dist/{spokeRoutes-B8Lnk-t4.d.cts → curatorBridge-CNs59kT9.d.cts} +222 -1
  3. package/dist/{spokeRoutes-B8Lnk-t4.d.ts → curatorBridge-CNs59kT9.d.ts} +222 -1
  4. package/dist/ethers/index.cjs +328 -3
  5. package/dist/ethers/index.cjs.map +1 -1
  6. package/dist/ethers/index.d.cts +279 -1
  7. package/dist/ethers/index.d.ts +279 -1
  8. package/dist/ethers/index.js +318 -5
  9. package/dist/ethers/index.js.map +1 -1
  10. package/dist/react/index.cjs +375 -0
  11. package/dist/react/index.cjs.map +1 -1
  12. package/dist/react/index.d.cts +266 -2
  13. package/dist/react/index.d.ts +266 -2
  14. package/dist/react/index.js +372 -2
  15. package/dist/react/index.js.map +1 -1
  16. package/dist/viem/index.cjs +377 -0
  17. package/dist/viem/index.cjs.map +1 -1
  18. package/dist/viem/index.d.cts +261 -3
  19. package/dist/viem/index.d.ts +261 -3
  20. package/dist/viem/index.js +367 -2
  21. package/dist/viem/index.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/ethers/abis.ts +24 -0
  24. package/src/ethers/curatorBridge.ts +235 -0
  25. package/src/ethers/curatorSubVaults.ts +443 -0
  26. package/src/ethers/index.ts +26 -0
  27. package/src/ethers/types.ts +99 -0
  28. package/src/react/index.ts +14 -0
  29. package/src/react/useCuratorBridgeQuote.ts +43 -0
  30. package/src/react/useERC7540RequestStatus.ts +43 -0
  31. package/src/react/useExecuteBridge.ts +50 -0
  32. package/src/react/useSubVaultPositions.ts +35 -0
  33. package/src/react/useVaultPortfolio.ts +35 -0
  34. package/src/viem/abis.ts +24 -0
  35. package/src/viem/curatorBridge.ts +288 -0
  36. package/src/viem/curatorSubVaults.ts +514 -0
  37. package/src/viem/index.ts +23 -0
  38. package/src/viem/types.ts +100 -0
@@ -520,6 +520,97 @@ interface VaultAssetBreakdown {
520
520
  /** Vault underlying token decimals */
521
521
  underlyingDecimals: number;
522
522
  }
523
+ /**
524
+ * A single active sub-vault position held by the curator vault.
525
+ * Covers both ERC4626 (synchronous) and ERC7540 (asynchronous) sub-vaults.
526
+ */
527
+ interface SubVaultPosition {
528
+ /** Sub-vault contract address */
529
+ address: string;
530
+ /** Protocol type of the sub-vault */
531
+ type: "erc4626" | "erc7540";
532
+ /** Name of the sub-vault share token */
533
+ name: string;
534
+ /** Symbol of the sub-vault share token */
535
+ symbol: string;
536
+ /** Decimals of the sub-vault share token */
537
+ decimals: number;
538
+ /** Shares of the sub-vault held by the curator vault */
539
+ sharesBalance: bigint;
540
+ /** Current value of the shares in terms of the sub-vault's underlying asset */
541
+ underlyingValue: bigint;
542
+ /** Underlying asset address of the sub-vault */
543
+ underlyingAsset: string;
544
+ /** Symbol of the sub-vault's underlying asset */
545
+ underlyingSymbol: string;
546
+ /** Decimals of the sub-vault's underlying asset */
547
+ underlyingDecimals: number;
548
+ }
549
+ /**
550
+ * Metadata and capability snapshot for a potential sub-vault investment target.
551
+ */
552
+ interface SubVaultInfo {
553
+ /** Sub-vault contract address */
554
+ address: string;
555
+ /** Protocol type: ERC4626 (sync) or ERC7540 (async) */
556
+ type: "erc4626" | "erc7540";
557
+ /** Sub-vault share token name */
558
+ name: string;
559
+ /** Sub-vault share token symbol */
560
+ symbol: string;
561
+ /** Sub-vault share token decimals */
562
+ decimals: number;
563
+ /** Underlying asset address */
564
+ underlyingAsset: string;
565
+ /** Underlying asset symbol */
566
+ underlyingSymbol: string;
567
+ /** Underlying asset decimals */
568
+ underlyingDecimals: number;
569
+ /** Maximum amount the curator vault can deposit (from maxDeposit(vault)) */
570
+ maxDeposit: bigint;
571
+ /** Whether the sub-vault is whitelisted in the global MoreVaults registry */
572
+ isWhitelisted: boolean;
573
+ }
574
+ /**
575
+ * Status of pending and claimable ERC7540 async requests for a sub-vault.
576
+ * Uses requestId = 0 (the standard default for non-batch ERC7540 vaults).
577
+ */
578
+ interface ERC7540RequestStatus {
579
+ /** Sub-vault address these statuses belong to */
580
+ subVault: string;
581
+ /** Assets in a pending deposit request (not yet claimable) */
582
+ pendingDeposit: bigint;
583
+ /** Assets ready to be claimed/finalized as shares */
584
+ claimableDeposit: bigint;
585
+ /** Shares in a pending redeem request (not yet claimable) */
586
+ pendingRedeem: bigint;
587
+ /** Assets ready to be claimed after redeem fulfillment */
588
+ claimableRedeem: bigint;
589
+ /** True if claimableDeposit > 0 — vault can call erc7540Deposit to finalize */
590
+ canFinalizeDeposit: boolean;
591
+ /** True if claimableRedeem > 0 — vault can call erc7540Redeem to finalize */
592
+ canFinalizeRedeem: boolean;
593
+ }
594
+ /**
595
+ * Full portfolio view for a curator vault combining liquid and invested assets.
596
+ */
597
+ interface VaultPortfolio {
598
+ /** Liquid ERC20 asset balances held directly by the vault (excludes sub-vault share tokens) */
599
+ liquidAssets: AssetBalance[];
600
+ /** Active positions in ERC4626/ERC7540 sub-vaults */
601
+ subVaultPositions: SubVaultPosition[];
602
+ /**
603
+ * Approximate total value in underlying terms:
604
+ * liquid underlying balance + sum of sub-vault convertToAssets values.
605
+ */
606
+ totalValue: bigint;
607
+ /** totalAssets() from the vault — authoritative AUM figure */
608
+ totalAssets: bigint;
609
+ /** totalSupply() of vault shares */
610
+ totalSupply: bigint;
611
+ /** Assets locked in pending ERC7540 requests (lockedTokensAmountOfAsset) */
612
+ lockedAssets: bigint;
613
+ }
523
614
 
524
615
  /**
525
616
  * Human-readable ABI fragments for MoreVaults diamond facets.
@@ -568,6 +659,11 @@ declare const VAULT_ANALYSIS_ABI: readonly ["function getAvailableAssets() view
568
659
  * MoreVaultsRegistry ABI — global protocol and bridge whitelist checks.
569
660
  */
570
661
  declare const REGISTRY_ABI: readonly ["function isWhitelisted(address protocol) view returns (bool)", "function isBridgeAllowed(address bridge) view returns (bool)", "function getAllowedFacets() view returns (address[])"];
662
+ /**
663
+ * Sub-vault ABI — reads for ERC4626/ERC7540 sub-vaults and ConfigurationFacet extensions.
664
+ * Used by curator sub-vault portfolio helpers (Phase 5).
665
+ */
666
+ declare const SUB_VAULT_ABI: readonly ["function tokensHeld(bytes32 id) view returns (address[])", "function lockedTokensAmountOfAsset(address asset) view returns (uint256)", "function convertToAssets(uint256 shares) view returns (uint256)", "function convertToShares(uint256 assets) view returns (uint256)", "function previewDeposit(uint256 assets) view returns (uint256)", "function previewRedeem(uint256 shares) view returns (uint256)", "function maxDeposit(address receiver) view returns (uint256)", "function maxRedeem(address owner) view returns (uint256)", "function pendingDepositRequest(uint256 requestId, address controller) view returns (uint256)", "function claimableDepositRequest(uint256 requestId, address controller) view returns (uint256)", "function pendingRedeemRequest(uint256 requestId, address controller) view returns (uint256)", "function claimableRedeemRequest(uint256 requestId, address controller) view returns (uint256)"];
571
667
 
572
668
  /**
573
669
  * Typed error classes for the MoreVaults SDK.
@@ -1657,6 +1753,188 @@ declare function buildUniswapV3Swap(params: {
1657
1753
  recipient: string;
1658
1754
  }): CuratorAction;
1659
1755
 
1756
+ /**
1757
+ * Curator BridgeFacet helpers for the MoreVaults ethers.js v6 SDK.
1758
+ *
1759
+ * Provides typed helpers to quote and execute cross-chain asset bridging
1760
+ * via BridgeFacet.executeBridging on any MoreVaults diamond.
1761
+ *
1762
+ * Key flows:
1763
+ * 1. `quoteCuratorBridgeFee` — read-only fee estimation via LzAdapter
1764
+ * 2. `executeCuratorBridge` — send bridging transaction (curator only)
1765
+ * 3. `encodeBridgeParams` — encode the 5-field bridgeSpecificParams bytes
1766
+ * 4. `findBridgeRoute` — resolve OFT route for a token on given chains
1767
+ *
1768
+ * @module curatorBridge
1769
+ */
1770
+
1771
+ /**
1772
+ * Parameters for a curator bridge operation.
1773
+ */
1774
+ interface CuratorBridgeParams {
1775
+ /** OFT contract address on the source chain (from OFT_ROUTES[symbol][chainId].oft) */
1776
+ oftToken: string;
1777
+ /** LayerZero endpoint ID of the destination chain */
1778
+ dstEid: number;
1779
+ /** Amount to bridge (in token's native units) */
1780
+ amount: bigint;
1781
+ /** Vault address on the destination chain (hub or spoke) */
1782
+ dstVault: string;
1783
+ /** Address where excess LayerZero gas refunds are sent (usually the curator wallet) */
1784
+ refundAddress: string;
1785
+ }
1786
+ /**
1787
+ * Encode the 5-field bridgeSpecificParams for use in `executeBridging`.
1788
+ *
1789
+ * Encodes: (oftToken, dstEid, amount, dstVault, refundAddress)
1790
+ * Types: (address, uint32, uint256, address, address)
1791
+ *
1792
+ * @param params Full bridge parameters including refundAddress
1793
+ * @returns ABI-encoded hex string
1794
+ */
1795
+ declare function encodeBridgeParams(params: CuratorBridgeParams): string;
1796
+ /**
1797
+ * Find the OFT bridge route for a given token address on the source chain.
1798
+ *
1799
+ * Searches OFT_ROUTES for an asset whose `token` or `oft` field matches
1800
+ * the provided address on the given source chainId.
1801
+ *
1802
+ * @param srcChainId EVM chain ID of the source chain
1803
+ * @param dstChainId EVM chain ID of the destination chain
1804
+ * @param tokenAddress ERC-20 token address on the source chain
1805
+ * @returns Route info or null if no matching route exists
1806
+ */
1807
+ declare function findBridgeRoute(srcChainId: number, dstChainId: number, tokenAddress: string): {
1808
+ oftSrc: string;
1809
+ oftDst: string;
1810
+ symbol: string;
1811
+ } | null;
1812
+ /**
1813
+ * Quote the native fee required to bridge assets via the vault's LzAdapter.
1814
+ *
1815
+ * Calls `lzAdapter.quoteBridgeFee(bridgeSpecificParams)` using a 4-field
1816
+ * encoding (no refundAddress). The returned fee must be sent as `value`
1817
+ * when calling `executeBridging`.
1818
+ *
1819
+ * @param provider Read-only provider (must be on the vault's chain)
1820
+ * @param vault Hub vault address (diamond proxy)
1821
+ * @param params Bridge parameters (refundAddress is included but not encoded for quote)
1822
+ * @returns Native fee in wei
1823
+ *
1824
+ * @example
1825
+ * ```typescript
1826
+ * const fee = await quoteCuratorBridgeFee(provider, VAULT, {
1827
+ * oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
1828
+ * dstEid: 30101,
1829
+ * amount: 1_000_000n,
1830
+ * dstVault: '0xSpokeVault...',
1831
+ * refundAddress: '0xCurator...',
1832
+ * })
1833
+ * ```
1834
+ */
1835
+ declare function quoteCuratorBridgeFee(provider: Provider, vault: string, params: CuratorBridgeParams): Promise<bigint>;
1836
+ /**
1837
+ * Execute a curator bridge operation via `BridgeFacet.executeBridging`.
1838
+ *
1839
+ * This is a direct curator call (NOT via multicall). The vault pauses during
1840
+ * bridging for security. The `token` parameter is the underlying ERC-20,
1841
+ * NOT the OFT address.
1842
+ *
1843
+ * Steps:
1844
+ * 1. Get lzAdapter from `getCuratorVaultStatus`
1845
+ * 2. Quote the native bridge fee
1846
+ * 3. Encode 5-field bridgeSpecificParams
1847
+ * 4. Call `vault.executeBridging(adapter, token, amount, bridgeSpecificParams)` with fee as value
1848
+ *
1849
+ * @param signer Signer with curator account attached
1850
+ * @param vault Hub vault address (diamond proxy)
1851
+ * @param token Underlying ERC-20 token address (NOT the OFT address)
1852
+ * @param params Full bridge parameters including refundAddress
1853
+ * @returns Transaction receipt
1854
+ * @throws If caller is not curator, vault is paused, or bridge fails
1855
+ */
1856
+ declare function executeCuratorBridge(signer: Signer, vault: string, token: string, params: CuratorBridgeParams): Promise<ContractTransactionReceipt>;
1857
+
1858
+ /**
1859
+ * Curator sub-vault read helpers for the MoreVaults ethers.js v6 SDK (Phase 5).
1860
+ *
1861
+ * Provides portfolio views and sub-vault analysis for curator dashboards.
1862
+ * Supports both ERC4626 (synchronous) and ERC7540 (asynchronous) sub-vaults.
1863
+ *
1864
+ * All functions are read-only (no wallet needed) and use Multicall3 for
1865
+ * batched RPC efficiency.
1866
+ */
1867
+
1868
+ /**
1869
+ * Get active sub-vault positions held by the vault.
1870
+ *
1871
+ * Queries the vault's `tokensHeld` for ERC4626 and ERC7540 type IDs, then
1872
+ * fetches balances, underlying values, and token metadata for each sub-vault.
1873
+ * Sub-vaults with zero share balance are excluded.
1874
+ *
1875
+ * @param provider Read-only provider (must be on the vault's chain)
1876
+ * @param vault Vault address (diamond proxy)
1877
+ * @returns Array of active SubVaultPosition objects
1878
+ */
1879
+ declare function getSubVaultPositions(provider: Provider, vault: string): Promise<SubVaultPosition[]>;
1880
+ /**
1881
+ * Detect whether a contract is an ERC7540, ERC4626, or unknown vault type.
1882
+ *
1883
+ * Tries to call ERC7540-specific functions first (pendingDepositRequest).
1884
+ * Falls back to ERC4626 convertToAssets(0). Returns null if neither succeeds.
1885
+ *
1886
+ * @param provider Read-only provider (must be on the same chain as subVault)
1887
+ * @param subVault Sub-vault contract address to probe
1888
+ * @returns 'erc7540' | 'erc4626' | null
1889
+ */
1890
+ declare function detectSubVaultType(provider: Provider, subVault: string): Promise<"erc4626" | "erc7540" | null>;
1891
+ /**
1892
+ * Analyse a specific sub-vault to understand deposit limits, metadata, type,
1893
+ * and global-registry whitelist status.
1894
+ *
1895
+ * @param provider Read-only provider (must be on the vault's chain)
1896
+ * @param vault Vault address (diamond proxy) — used to check maxDeposit
1897
+ * @param subVault Sub-vault address to analyse
1898
+ * @returns SubVaultInfo snapshot
1899
+ */
1900
+ declare function getSubVaultInfo(provider: Provider, vault: string, subVault: string): Promise<SubVaultInfo>;
1901
+ /**
1902
+ * Get the ERC7540 async request status for a specific sub-vault and vault controller.
1903
+ *
1904
+ * @param provider Read-only provider (must be on the vault's chain)
1905
+ * @param vault Vault address acting as controller in the sub-vault
1906
+ * @param subVault ERC7540 sub-vault address
1907
+ * @returns ERC7540RequestStatus with canFinalize flags
1908
+ */
1909
+ declare function getERC7540RequestStatus(provider: Provider, vault: string, subVault: string): Promise<ERC7540RequestStatus>;
1910
+ /**
1911
+ * Preview how many shares the vault would receive for a given asset deposit.
1912
+ *
1913
+ * @param provider Read-only provider
1914
+ * @param subVault Sub-vault address (ERC4626 or ERC7540)
1915
+ * @param assets Amount of underlying assets to preview
1916
+ * @returns Expected shares to be minted
1917
+ */
1918
+ declare function previewSubVaultDeposit(provider: Provider, subVault: string, assets: bigint): Promise<bigint>;
1919
+ /**
1920
+ * Preview how many underlying assets would be returned for redeeming shares.
1921
+ *
1922
+ * @param provider Read-only provider
1923
+ * @param subVault Sub-vault address (ERC4626 or ERC7540)
1924
+ * @param shares Number of shares to preview redemption for
1925
+ * @returns Expected underlying assets to be returned
1926
+ */
1927
+ declare function previewSubVaultRedeem(provider: Provider, subVault: string, shares: bigint): Promise<bigint>;
1928
+ /**
1929
+ * Get the complete portfolio view for a vault, combining liquid asset balances
1930
+ * with active sub-vault positions and locked ERC7540 assets.
1931
+ *
1932
+ * @param provider Read-only provider (must be on the vault's hub chain)
1933
+ * @param vault Vault address (diamond proxy)
1934
+ * @returns VaultPortfolio with full breakdown
1935
+ */
1936
+ declare function getVaultPortfolio(provider: Provider, vault: string): Promise<VaultPortfolio>;
1937
+
1660
1938
  /**
1661
1939
  * Vault topology helpers for the MoreVaults ethers.js v6 SDK.
1662
1940
  *
@@ -1941,4 +2219,4 @@ declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, a
1941
2219
  */
1942
2220
  declare function asSdkSigner(signer: unknown): Signer;
1943
2221
 
1944
- export { ActionType, type ActionTypeValue, type AssetBalance, type AssetInfo, type AsyncRequestResult, type AsyncRequestStatus, type AsyncRequestStatusInfo, BRIDGE_ABI, BRIDGE_FACET_ABI, type BatchSwapParams, type BridgeParams, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, type CrossChainRequestInfo, type CuratorAction, type CuratorVaultStatus, DEX_ABI, type DepositBlockReason, type DepositEligibility, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, type InboundRoute, type InboundRouteWithBalance, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, type MaxWithdrawable, MissingEscrowAddressError, MoreVaultsError, type MultiChainUserPosition, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, type OutboundRoute, type PendingAction, REGISTRY_ABI, type RedeemResult, type SpokeBalance, type SpokeRedeemRoute, type SubmitActionsResult, type SwapParams, UNISWAP_V3_ROUTERS, type UserBalances, type UserPosition, VAULT_ABI, VAULT_ANALYSIS_ABI, type VaultAddresses, type VaultAnalysis, type VaultAssetBreakdown, type VaultDistribution, type VaultMetadata, type VaultMode, VaultPausedError, type VaultStatus, type VaultSummary, type VaultTopology, WrongChainError, asSdkSigner, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositCrossChainOracleOn, depositFromSpoke, depositFromSpokeAsync, depositMultiAsset, depositSimple, detectStargateOft, discoverVaultTopology, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultAnalysis, getVaultAssetBreakdown, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
2222
+ export { ActionType, type ActionTypeValue, type AssetBalance, type AssetInfo, type AsyncRequestResult, type AsyncRequestStatus, type AsyncRequestStatusInfo, BRIDGE_ABI, BRIDGE_FACET_ABI, type BatchSwapParams, type BridgeParams, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, type CrossChainRequestInfo, type CuratorAction, type CuratorBridgeParams, type CuratorVaultStatus, DEX_ABI, type DepositBlockReason, type DepositEligibility, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, type ERC7540RequestStatus, ERC7540_FACET_ABI, EscrowNotConfiguredError, type InboundRoute, type InboundRouteWithBalance, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, type MaxWithdrawable, MissingEscrowAddressError, MoreVaultsError, type MultiChainUserPosition, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, type OutboundRoute, type PendingAction, REGISTRY_ABI, type RedeemResult, SUB_VAULT_ABI, type SpokeBalance, type SpokeRedeemRoute, type SubVaultInfo, type SubVaultPosition, type SubmitActionsResult, type SwapParams, UNISWAP_V3_ROUTERS, type UserBalances, type UserPosition, VAULT_ABI, VAULT_ANALYSIS_ABI, type VaultAddresses, type VaultAnalysis, type VaultAssetBreakdown, type VaultDistribution, type VaultMetadata, type VaultMode, VaultPausedError, type VaultPortfolio, type VaultStatus, type VaultSummary, type VaultTopology, WrongChainError, asSdkSigner, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositCrossChainOracleOn, depositFromSpoke, depositFromSpokeAsync, depositMultiAsset, depositSimple, detectStargateOft, detectSubVaultType, discoverVaultTopology, encodeBridgeParams, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, executeCuratorBridge, findBridgeRoute, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getERC7540RequestStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getSubVaultInfo, getSubVaultPositions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultAnalysis, getVaultAssetBreakdown, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultPortfolio, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, previewSubVaultDeposit, previewSubVaultRedeem, quoteComposeFee, quoteCuratorBridgeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
@@ -520,6 +520,97 @@ interface VaultAssetBreakdown {
520
520
  /** Vault underlying token decimals */
521
521
  underlyingDecimals: number;
522
522
  }
523
+ /**
524
+ * A single active sub-vault position held by the curator vault.
525
+ * Covers both ERC4626 (synchronous) and ERC7540 (asynchronous) sub-vaults.
526
+ */
527
+ interface SubVaultPosition {
528
+ /** Sub-vault contract address */
529
+ address: string;
530
+ /** Protocol type of the sub-vault */
531
+ type: "erc4626" | "erc7540";
532
+ /** Name of the sub-vault share token */
533
+ name: string;
534
+ /** Symbol of the sub-vault share token */
535
+ symbol: string;
536
+ /** Decimals of the sub-vault share token */
537
+ decimals: number;
538
+ /** Shares of the sub-vault held by the curator vault */
539
+ sharesBalance: bigint;
540
+ /** Current value of the shares in terms of the sub-vault's underlying asset */
541
+ underlyingValue: bigint;
542
+ /** Underlying asset address of the sub-vault */
543
+ underlyingAsset: string;
544
+ /** Symbol of the sub-vault's underlying asset */
545
+ underlyingSymbol: string;
546
+ /** Decimals of the sub-vault's underlying asset */
547
+ underlyingDecimals: number;
548
+ }
549
+ /**
550
+ * Metadata and capability snapshot for a potential sub-vault investment target.
551
+ */
552
+ interface SubVaultInfo {
553
+ /** Sub-vault contract address */
554
+ address: string;
555
+ /** Protocol type: ERC4626 (sync) or ERC7540 (async) */
556
+ type: "erc4626" | "erc7540";
557
+ /** Sub-vault share token name */
558
+ name: string;
559
+ /** Sub-vault share token symbol */
560
+ symbol: string;
561
+ /** Sub-vault share token decimals */
562
+ decimals: number;
563
+ /** Underlying asset address */
564
+ underlyingAsset: string;
565
+ /** Underlying asset symbol */
566
+ underlyingSymbol: string;
567
+ /** Underlying asset decimals */
568
+ underlyingDecimals: number;
569
+ /** Maximum amount the curator vault can deposit (from maxDeposit(vault)) */
570
+ maxDeposit: bigint;
571
+ /** Whether the sub-vault is whitelisted in the global MoreVaults registry */
572
+ isWhitelisted: boolean;
573
+ }
574
+ /**
575
+ * Status of pending and claimable ERC7540 async requests for a sub-vault.
576
+ * Uses requestId = 0 (the standard default for non-batch ERC7540 vaults).
577
+ */
578
+ interface ERC7540RequestStatus {
579
+ /** Sub-vault address these statuses belong to */
580
+ subVault: string;
581
+ /** Assets in a pending deposit request (not yet claimable) */
582
+ pendingDeposit: bigint;
583
+ /** Assets ready to be claimed/finalized as shares */
584
+ claimableDeposit: bigint;
585
+ /** Shares in a pending redeem request (not yet claimable) */
586
+ pendingRedeem: bigint;
587
+ /** Assets ready to be claimed after redeem fulfillment */
588
+ claimableRedeem: bigint;
589
+ /** True if claimableDeposit > 0 — vault can call erc7540Deposit to finalize */
590
+ canFinalizeDeposit: boolean;
591
+ /** True if claimableRedeem > 0 — vault can call erc7540Redeem to finalize */
592
+ canFinalizeRedeem: boolean;
593
+ }
594
+ /**
595
+ * Full portfolio view for a curator vault combining liquid and invested assets.
596
+ */
597
+ interface VaultPortfolio {
598
+ /** Liquid ERC20 asset balances held directly by the vault (excludes sub-vault share tokens) */
599
+ liquidAssets: AssetBalance[];
600
+ /** Active positions in ERC4626/ERC7540 sub-vaults */
601
+ subVaultPositions: SubVaultPosition[];
602
+ /**
603
+ * Approximate total value in underlying terms:
604
+ * liquid underlying balance + sum of sub-vault convertToAssets values.
605
+ */
606
+ totalValue: bigint;
607
+ /** totalAssets() from the vault — authoritative AUM figure */
608
+ totalAssets: bigint;
609
+ /** totalSupply() of vault shares */
610
+ totalSupply: bigint;
611
+ /** Assets locked in pending ERC7540 requests (lockedTokensAmountOfAsset) */
612
+ lockedAssets: bigint;
613
+ }
523
614
 
524
615
  /**
525
616
  * Human-readable ABI fragments for MoreVaults diamond facets.
@@ -568,6 +659,11 @@ declare const VAULT_ANALYSIS_ABI: readonly ["function getAvailableAssets() view
568
659
  * MoreVaultsRegistry ABI — global protocol and bridge whitelist checks.
569
660
  */
570
661
  declare const REGISTRY_ABI: readonly ["function isWhitelisted(address protocol) view returns (bool)", "function isBridgeAllowed(address bridge) view returns (bool)", "function getAllowedFacets() view returns (address[])"];
662
+ /**
663
+ * Sub-vault ABI — reads for ERC4626/ERC7540 sub-vaults and ConfigurationFacet extensions.
664
+ * Used by curator sub-vault portfolio helpers (Phase 5).
665
+ */
666
+ declare const SUB_VAULT_ABI: readonly ["function tokensHeld(bytes32 id) view returns (address[])", "function lockedTokensAmountOfAsset(address asset) view returns (uint256)", "function convertToAssets(uint256 shares) view returns (uint256)", "function convertToShares(uint256 assets) view returns (uint256)", "function previewDeposit(uint256 assets) view returns (uint256)", "function previewRedeem(uint256 shares) view returns (uint256)", "function maxDeposit(address receiver) view returns (uint256)", "function maxRedeem(address owner) view returns (uint256)", "function pendingDepositRequest(uint256 requestId, address controller) view returns (uint256)", "function claimableDepositRequest(uint256 requestId, address controller) view returns (uint256)", "function pendingRedeemRequest(uint256 requestId, address controller) view returns (uint256)", "function claimableRedeemRequest(uint256 requestId, address controller) view returns (uint256)"];
571
667
 
572
668
  /**
573
669
  * Typed error classes for the MoreVaults SDK.
@@ -1657,6 +1753,188 @@ declare function buildUniswapV3Swap(params: {
1657
1753
  recipient: string;
1658
1754
  }): CuratorAction;
1659
1755
 
1756
+ /**
1757
+ * Curator BridgeFacet helpers for the MoreVaults ethers.js v6 SDK.
1758
+ *
1759
+ * Provides typed helpers to quote and execute cross-chain asset bridging
1760
+ * via BridgeFacet.executeBridging on any MoreVaults diamond.
1761
+ *
1762
+ * Key flows:
1763
+ * 1. `quoteCuratorBridgeFee` — read-only fee estimation via LzAdapter
1764
+ * 2. `executeCuratorBridge` — send bridging transaction (curator only)
1765
+ * 3. `encodeBridgeParams` — encode the 5-field bridgeSpecificParams bytes
1766
+ * 4. `findBridgeRoute` — resolve OFT route for a token on given chains
1767
+ *
1768
+ * @module curatorBridge
1769
+ */
1770
+
1771
+ /**
1772
+ * Parameters for a curator bridge operation.
1773
+ */
1774
+ interface CuratorBridgeParams {
1775
+ /** OFT contract address on the source chain (from OFT_ROUTES[symbol][chainId].oft) */
1776
+ oftToken: string;
1777
+ /** LayerZero endpoint ID of the destination chain */
1778
+ dstEid: number;
1779
+ /** Amount to bridge (in token's native units) */
1780
+ amount: bigint;
1781
+ /** Vault address on the destination chain (hub or spoke) */
1782
+ dstVault: string;
1783
+ /** Address where excess LayerZero gas refunds are sent (usually the curator wallet) */
1784
+ refundAddress: string;
1785
+ }
1786
+ /**
1787
+ * Encode the 5-field bridgeSpecificParams for use in `executeBridging`.
1788
+ *
1789
+ * Encodes: (oftToken, dstEid, amount, dstVault, refundAddress)
1790
+ * Types: (address, uint32, uint256, address, address)
1791
+ *
1792
+ * @param params Full bridge parameters including refundAddress
1793
+ * @returns ABI-encoded hex string
1794
+ */
1795
+ declare function encodeBridgeParams(params: CuratorBridgeParams): string;
1796
+ /**
1797
+ * Find the OFT bridge route for a given token address on the source chain.
1798
+ *
1799
+ * Searches OFT_ROUTES for an asset whose `token` or `oft` field matches
1800
+ * the provided address on the given source chainId.
1801
+ *
1802
+ * @param srcChainId EVM chain ID of the source chain
1803
+ * @param dstChainId EVM chain ID of the destination chain
1804
+ * @param tokenAddress ERC-20 token address on the source chain
1805
+ * @returns Route info or null if no matching route exists
1806
+ */
1807
+ declare function findBridgeRoute(srcChainId: number, dstChainId: number, tokenAddress: string): {
1808
+ oftSrc: string;
1809
+ oftDst: string;
1810
+ symbol: string;
1811
+ } | null;
1812
+ /**
1813
+ * Quote the native fee required to bridge assets via the vault's LzAdapter.
1814
+ *
1815
+ * Calls `lzAdapter.quoteBridgeFee(bridgeSpecificParams)` using a 4-field
1816
+ * encoding (no refundAddress). The returned fee must be sent as `value`
1817
+ * when calling `executeBridging`.
1818
+ *
1819
+ * @param provider Read-only provider (must be on the vault's chain)
1820
+ * @param vault Hub vault address (diamond proxy)
1821
+ * @param params Bridge parameters (refundAddress is included but not encoded for quote)
1822
+ * @returns Native fee in wei
1823
+ *
1824
+ * @example
1825
+ * ```typescript
1826
+ * const fee = await quoteCuratorBridgeFee(provider, VAULT, {
1827
+ * oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
1828
+ * dstEid: 30101,
1829
+ * amount: 1_000_000n,
1830
+ * dstVault: '0xSpokeVault...',
1831
+ * refundAddress: '0xCurator...',
1832
+ * })
1833
+ * ```
1834
+ */
1835
+ declare function quoteCuratorBridgeFee(provider: Provider, vault: string, params: CuratorBridgeParams): Promise<bigint>;
1836
+ /**
1837
+ * Execute a curator bridge operation via `BridgeFacet.executeBridging`.
1838
+ *
1839
+ * This is a direct curator call (NOT via multicall). The vault pauses during
1840
+ * bridging for security. The `token` parameter is the underlying ERC-20,
1841
+ * NOT the OFT address.
1842
+ *
1843
+ * Steps:
1844
+ * 1. Get lzAdapter from `getCuratorVaultStatus`
1845
+ * 2. Quote the native bridge fee
1846
+ * 3. Encode 5-field bridgeSpecificParams
1847
+ * 4. Call `vault.executeBridging(adapter, token, amount, bridgeSpecificParams)` with fee as value
1848
+ *
1849
+ * @param signer Signer with curator account attached
1850
+ * @param vault Hub vault address (diamond proxy)
1851
+ * @param token Underlying ERC-20 token address (NOT the OFT address)
1852
+ * @param params Full bridge parameters including refundAddress
1853
+ * @returns Transaction receipt
1854
+ * @throws If caller is not curator, vault is paused, or bridge fails
1855
+ */
1856
+ declare function executeCuratorBridge(signer: Signer, vault: string, token: string, params: CuratorBridgeParams): Promise<ContractTransactionReceipt>;
1857
+
1858
+ /**
1859
+ * Curator sub-vault read helpers for the MoreVaults ethers.js v6 SDK (Phase 5).
1860
+ *
1861
+ * Provides portfolio views and sub-vault analysis for curator dashboards.
1862
+ * Supports both ERC4626 (synchronous) and ERC7540 (asynchronous) sub-vaults.
1863
+ *
1864
+ * All functions are read-only (no wallet needed) and use Multicall3 for
1865
+ * batched RPC efficiency.
1866
+ */
1867
+
1868
+ /**
1869
+ * Get active sub-vault positions held by the vault.
1870
+ *
1871
+ * Queries the vault's `tokensHeld` for ERC4626 and ERC7540 type IDs, then
1872
+ * fetches balances, underlying values, and token metadata for each sub-vault.
1873
+ * Sub-vaults with zero share balance are excluded.
1874
+ *
1875
+ * @param provider Read-only provider (must be on the vault's chain)
1876
+ * @param vault Vault address (diamond proxy)
1877
+ * @returns Array of active SubVaultPosition objects
1878
+ */
1879
+ declare function getSubVaultPositions(provider: Provider, vault: string): Promise<SubVaultPosition[]>;
1880
+ /**
1881
+ * Detect whether a contract is an ERC7540, ERC4626, or unknown vault type.
1882
+ *
1883
+ * Tries to call ERC7540-specific functions first (pendingDepositRequest).
1884
+ * Falls back to ERC4626 convertToAssets(0). Returns null if neither succeeds.
1885
+ *
1886
+ * @param provider Read-only provider (must be on the same chain as subVault)
1887
+ * @param subVault Sub-vault contract address to probe
1888
+ * @returns 'erc7540' | 'erc4626' | null
1889
+ */
1890
+ declare function detectSubVaultType(provider: Provider, subVault: string): Promise<"erc4626" | "erc7540" | null>;
1891
+ /**
1892
+ * Analyse a specific sub-vault to understand deposit limits, metadata, type,
1893
+ * and global-registry whitelist status.
1894
+ *
1895
+ * @param provider Read-only provider (must be on the vault's chain)
1896
+ * @param vault Vault address (diamond proxy) — used to check maxDeposit
1897
+ * @param subVault Sub-vault address to analyse
1898
+ * @returns SubVaultInfo snapshot
1899
+ */
1900
+ declare function getSubVaultInfo(provider: Provider, vault: string, subVault: string): Promise<SubVaultInfo>;
1901
+ /**
1902
+ * Get the ERC7540 async request status for a specific sub-vault and vault controller.
1903
+ *
1904
+ * @param provider Read-only provider (must be on the vault's chain)
1905
+ * @param vault Vault address acting as controller in the sub-vault
1906
+ * @param subVault ERC7540 sub-vault address
1907
+ * @returns ERC7540RequestStatus with canFinalize flags
1908
+ */
1909
+ declare function getERC7540RequestStatus(provider: Provider, vault: string, subVault: string): Promise<ERC7540RequestStatus>;
1910
+ /**
1911
+ * Preview how many shares the vault would receive for a given asset deposit.
1912
+ *
1913
+ * @param provider Read-only provider
1914
+ * @param subVault Sub-vault address (ERC4626 or ERC7540)
1915
+ * @param assets Amount of underlying assets to preview
1916
+ * @returns Expected shares to be minted
1917
+ */
1918
+ declare function previewSubVaultDeposit(provider: Provider, subVault: string, assets: bigint): Promise<bigint>;
1919
+ /**
1920
+ * Preview how many underlying assets would be returned for redeeming shares.
1921
+ *
1922
+ * @param provider Read-only provider
1923
+ * @param subVault Sub-vault address (ERC4626 or ERC7540)
1924
+ * @param shares Number of shares to preview redemption for
1925
+ * @returns Expected underlying assets to be returned
1926
+ */
1927
+ declare function previewSubVaultRedeem(provider: Provider, subVault: string, shares: bigint): Promise<bigint>;
1928
+ /**
1929
+ * Get the complete portfolio view for a vault, combining liquid asset balances
1930
+ * with active sub-vault positions and locked ERC7540 assets.
1931
+ *
1932
+ * @param provider Read-only provider (must be on the vault's hub chain)
1933
+ * @param vault Vault address (diamond proxy)
1934
+ * @returns VaultPortfolio with full breakdown
1935
+ */
1936
+ declare function getVaultPortfolio(provider: Provider, vault: string): Promise<VaultPortfolio>;
1937
+
1660
1938
  /**
1661
1939
  * Vault topology helpers for the MoreVaults ethers.js v6 SDK.
1662
1940
  *
@@ -1941,4 +2219,4 @@ declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, a
1941
2219
  */
1942
2220
  declare function asSdkSigner(signer: unknown): Signer;
1943
2221
 
1944
- export { ActionType, type ActionTypeValue, type AssetBalance, type AssetInfo, type AsyncRequestResult, type AsyncRequestStatus, type AsyncRequestStatusInfo, BRIDGE_ABI, BRIDGE_FACET_ABI, type BatchSwapParams, type BridgeParams, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, type CrossChainRequestInfo, type CuratorAction, type CuratorVaultStatus, DEX_ABI, type DepositBlockReason, type DepositEligibility, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, type InboundRoute, type InboundRouteWithBalance, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, type MaxWithdrawable, MissingEscrowAddressError, MoreVaultsError, type MultiChainUserPosition, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, type OutboundRoute, type PendingAction, REGISTRY_ABI, type RedeemResult, type SpokeBalance, type SpokeRedeemRoute, type SubmitActionsResult, type SwapParams, UNISWAP_V3_ROUTERS, type UserBalances, type UserPosition, VAULT_ABI, VAULT_ANALYSIS_ABI, type VaultAddresses, type VaultAnalysis, type VaultAssetBreakdown, type VaultDistribution, type VaultMetadata, type VaultMode, VaultPausedError, type VaultStatus, type VaultSummary, type VaultTopology, WrongChainError, asSdkSigner, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositCrossChainOracleOn, depositFromSpoke, depositFromSpokeAsync, depositMultiAsset, depositSimple, detectStargateOft, discoverVaultTopology, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultAnalysis, getVaultAssetBreakdown, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
2222
+ export { ActionType, type ActionTypeValue, type AssetBalance, type AssetInfo, type AsyncRequestResult, type AsyncRequestStatus, type AsyncRequestStatusInfo, BRIDGE_ABI, BRIDGE_FACET_ABI, type BatchSwapParams, type BridgeParams, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, type CrossChainRequestInfo, type CuratorAction, type CuratorBridgeParams, type CuratorVaultStatus, DEX_ABI, type DepositBlockReason, type DepositEligibility, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, type ERC7540RequestStatus, ERC7540_FACET_ABI, EscrowNotConfiguredError, type InboundRoute, type InboundRouteWithBalance, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, type MaxWithdrawable, MissingEscrowAddressError, MoreVaultsError, type MultiChainUserPosition, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, type OutboundRoute, type PendingAction, REGISTRY_ABI, type RedeemResult, SUB_VAULT_ABI, type SpokeBalance, type SpokeRedeemRoute, type SubVaultInfo, type SubVaultPosition, type SubmitActionsResult, type SwapParams, UNISWAP_V3_ROUTERS, type UserBalances, type UserPosition, VAULT_ABI, VAULT_ANALYSIS_ABI, type VaultAddresses, type VaultAnalysis, type VaultAssetBreakdown, type VaultDistribution, type VaultMetadata, type VaultMode, VaultPausedError, type VaultPortfolio, type VaultStatus, type VaultSummary, type VaultTopology, WrongChainError, asSdkSigner, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositCrossChainOracleOn, depositFromSpoke, depositFromSpokeAsync, depositMultiAsset, depositSimple, detectStargateOft, detectSubVaultType, discoverVaultTopology, encodeBridgeParams, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, executeCuratorBridge, findBridgeRoute, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getERC7540RequestStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getSubVaultInfo, getSubVaultPositions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultAnalysis, getVaultAssetBreakdown, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultPortfolio, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, previewSubVaultDeposit, previewSubVaultRedeem, quoteComposeFee, quoteCuratorBridgeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };