@oydual31/more-vaults-sdk 0.4.2 → 0.5.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.
package/README.md CHANGED
@@ -173,6 +173,8 @@ All three modules expose the same logical features. Choose based on your stack.
173
173
  | `executeActions` | Yes | Yes | `useExecuteActions` |
174
174
  | `vetoActions` | Yes | Yes | `useVetoActions` |
175
175
  | `buildUniswapV3Swap`, `encodeUniswapV3SwapCalldata` | Yes | Yes | — |
176
+ | `quoteCuratorBridgeFee`, `executeCuratorBridge` | Yes | Yes | `useCuratorBridgeQuote`, `useExecuteBridge` |
177
+ | `findBridgeRoute`, `encodeBridgeParams` | Yes | Yes | — |
176
178
  | `detectStargateOft` | Yes | Yes | — |
177
179
  | `preflightSync`, `preflightAsync` | Yes | Yes | — |
178
180
  | `preflightSpokeDeposit`, `preflightSpokeRedeem` | Yes | Yes | — |
@@ -675,6 +677,46 @@ const { targetContract, swapCallData } = encodeUniswapV3SwapCalldata({
675
677
  })
676
678
  ```
677
679
 
680
+ ### Bridge operations
681
+
682
+ Curators can bridge assets between hub and spoke vaults via LayerZero. This is a direct curator call (not via multicall) — the vault pauses during bridging for security.
683
+
684
+ ```ts
685
+ import {
686
+ quoteCuratorBridgeFee,
687
+ executeCuratorBridge,
688
+ findBridgeRoute,
689
+ } from '@oydual31/more-vaults-sdk/viem'
690
+
691
+ // Find the OFT route for USDC between Base and Arbitrum
692
+ const route = findBridgeRoute(8453, 42161, USDC_ADDRESS)
693
+ // route.oftSrc — OFT on source chain (Stargate USDC on Base)
694
+ // route.oftDst — OFT on destination chain
695
+ // route.symbol — 'stgUSDC'
696
+
697
+ // Quote the LayerZero fee
698
+ const fee = await quoteCuratorBridgeFee(publicClient, VAULT, {
699
+ oftToken: route.oftSrc,
700
+ dstEid: 30110, // Arbitrum LZ EID
701
+ amount: parseUnits('1000', 6), // 1000 USDC
702
+ dstVault: SPOKE_VAULT_ADDRESS,
703
+ refundAddress: curatorAddress,
704
+ })
705
+
706
+ // Execute the bridge (curator only)
707
+ const txHash = await executeCuratorBridge(
708
+ walletClient, publicClient, VAULT,
709
+ USDC_ADDRESS, // underlying ERC-20 token
710
+ {
711
+ oftToken: route.oftSrc,
712
+ dstEid: 30110,
713
+ amount: parseUnits('1000', 6),
714
+ dstVault: SPOKE_VAULT_ADDRESS,
715
+ refundAddress: curatorAddress,
716
+ },
717
+ )
718
+ ```
719
+
678
720
  ---
679
721
 
680
722
  ## Vault topology & distribution
@@ -849,6 +891,8 @@ Import from `@oydual31/more-vaults-sdk/react`. Requires wagmi v2 + @tanstack/rea
849
891
  | `useSubmitActions()` | Submit a batch of curator actions |
850
892
  | `useExecuteActions()` | Execute queued actions after timelock |
851
893
  | `useVetoActions()` | Guardian: cancel pending actions |
894
+ | `useCuratorBridgeQuote()` | Quote LayerZero fee for curator bridge |
895
+ | `useExecuteBridge()` | Execute curator bridge operation |
852
896
 
853
897
  ### React example
854
898
 
@@ -818,4 +818,133 @@ declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<
818
818
  */
819
819
  declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, amount: bigint, userAddress: Address): Promise<bigint>;
820
820
 
821
- export { getUserBalancesForRoutes as $, type AsyncRequestResult as A, type BatchSwapParams as B, type ComposeData as C, type DepositResult as D, type VaultSummary as E, type VaultTopology as F, canDeposit as G, detectStargateOft as H, type InboundRoute as I, discoverVaultTopology as J, ensureAllowance as K, getAllVaultChainIds as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, type PendingAction as P, getAsyncRequestStatus as Q, type RedeemResult as R, type SpokeDepositResult as S, getAsyncRequestStatusLabel as T, type UserBalances as U, type VaultAddresses as V, getFullVaultTopology as W, getInboundRoutes as X, getMaxWithdrawable as Y, getOutboundRoutes as Z, getUserBalances as _, type CuratorVaultStatus as a, getUserPosition as a0, getUserPositionMultiChain as a1, getVaultDistribution as a2, getVaultDistributionWithTopology as a3, getVaultMetadata as a4, getVaultStatus as a5, getVaultSummary as a6, getVaultTopology as a7, isAsyncMode as a8, isOnHubChain as a9, previewDeposit as aa, previewRedeem as ab, quoteLzFee as ac, quoteRouteDepositFee as ad, waitForAsyncRequest as ae, waitForTx as af, type VaultAnalysis as b, type VaultAssetBreakdown as c, type CuratorAction as d, type SubmitActionsResult as e, ActionType as f, type ActionTypeValue as g, type AssetBalance as h, type AssetInfo as i, type AsyncRequestFinalResult as j, type AsyncRequestStatus as k, type AsyncRequestStatusInfo as l, type BridgeParams as m, type CrossChainRequestInfo as n, type DepositBlockReason as o, type DepositEligibility as p, type InboundRouteWithBalance as q, type MultiChainUserPosition as r, type OutboundRoute as s, type SpokeBalance as t, type SwapParams as u, type UserPosition as v, type VaultDistribution as w, type VaultMetadata as x, type VaultMode as y, type VaultStatus as z };
821
+ /**
822
+ * Curator BridgeFacet helpers for the MoreVaults SDK.
823
+ *
824
+ * Provides typed helpers to quote and execute cross-chain asset bridging
825
+ * via BridgeFacet.executeBridging on any MoreVaults diamond.
826
+ *
827
+ * Key flows:
828
+ * 1. `quoteCuratorBridgeFee` — read-only fee estimation via LzAdapter
829
+ * 2. `executeCuratorBridge` — send bridging transaction (curator only)
830
+ * 3. `encodeBridgeParams` — encode the 5-field bridgeSpecificParams bytes
831
+ * 4. `findBridgeRoute` — resolve OFT route for a token on given chains
832
+ *
833
+ * Bridge call flow:
834
+ * curator → vault.executeBridging(adapter, token, amount, bridgeSpecificParams)
835
+ * bridgeSpecificParams = abi.encode(oftToken, dstEid, amount, dstVault, refundAddress)
836
+ *
837
+ * Quote call flow:
838
+ * publicClient → lzAdapter.quoteBridgeFee(encode(oftToken, dstEid, amount, dstVault))
839
+ *
840
+ * @module curatorBridge
841
+ */
842
+
843
+ /**
844
+ * Parameters for a curator bridge operation.
845
+ * Used in both quoting (4-field) and execution (5-field with refundAddress).
846
+ */
847
+ interface CuratorBridgeParams {
848
+ /** OFT contract address on the source chain (from OFT_ROUTES[symbol][chainId].oft) */
849
+ oftToken: Address;
850
+ /** LayerZero endpoint ID of the destination chain */
851
+ dstEid: number;
852
+ /** Amount to bridge (in token's native units) */
853
+ amount: bigint;
854
+ /** Vault address on the destination chain (hub or spoke) */
855
+ dstVault: Address;
856
+ /** Address where excess LayerZero gas refunds are sent (usually the curator wallet) */
857
+ refundAddress: Address;
858
+ }
859
+ /**
860
+ * Encode the 5-field bridgeSpecificParams for use in `executeBridging`.
861
+ *
862
+ * Encodes: (oftToken, dstEid, amount, dstVault, refundAddress)
863
+ * Types: (address, uint32, uint256, address, address)
864
+ *
865
+ * @param params Full bridge parameters including refundAddress
866
+ * @returns ABI-encoded bytes (`0x`-prefixed hex string)
867
+ */
868
+ declare function encodeBridgeParams(params: CuratorBridgeParams): `0x${string}`;
869
+ /**
870
+ * Find the OFT bridge route for a given token address on the source chain.
871
+ *
872
+ * Searches OFT_ROUTES for an asset whose `token` or `oft` field matches
873
+ * the provided address on the given source chainId.
874
+ *
875
+ * @param srcChainId EVM chain ID of the source chain (where the vault holds the token)
876
+ * @param dstChainId EVM chain ID of the destination chain
877
+ * @param tokenAddress ERC-20 token address on the source chain
878
+ * @returns Route info or null if no matching route exists
879
+ *
880
+ * @example
881
+ * ```typescript
882
+ * const route = findBridgeRoute(8453, 1, '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913')
883
+ * // → { symbol: 'stgUSDC', oftHub: '0x27a1...', oftSpoke: '0xc026...' }
884
+ * ```
885
+ */
886
+ declare function findBridgeRoute(srcChainId: number, dstChainId: number, tokenAddress: Address): {
887
+ oftSrc: Address;
888
+ oftDst: Address;
889
+ symbol: string;
890
+ } | null;
891
+ /**
892
+ * Quote the native fee required to bridge assets via the vault's LzAdapter.
893
+ *
894
+ * Calls `lzAdapter.quoteBridgeFee(bridgeSpecificParams)` using a 4-field
895
+ * encoding (no refundAddress). The returned fee must be sent as `msg.value`
896
+ * when calling `executeBridging`.
897
+ *
898
+ * @param publicClient Viem public client (must be on the vault's chain)
899
+ * @param vault Hub vault address (diamond proxy)
900
+ * @param params Bridge parameters (refundAddress is optional here)
901
+ * @returns Native fee in wei
902
+ *
903
+ * @example
904
+ * ```typescript
905
+ * const fee = await quoteCuratorBridgeFee(publicClient, VAULT, {
906
+ * oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26', // stgUSDC on Base
907
+ * dstEid: 30101, // Ethereum EID
908
+ * amount: 1_000_000n, // 1 USDC
909
+ * dstVault: '0xSpokeVault...',
910
+ * refundAddress: '0xCurator...',
911
+ * })
912
+ * console.log('Fee:', formatEther(fee), 'ETH')
913
+ * ```
914
+ */
915
+ declare function quoteCuratorBridgeFee(publicClient: PublicClient, vault: Address, params: CuratorBridgeParams): Promise<bigint>;
916
+ /**
917
+ * Execute a curator bridge operation via `BridgeFacet.executeBridging`.
918
+ *
919
+ * This is a direct curator call (NOT via multicall). The vault pauses during
920
+ * bridging for security. The `token` passed to executeBridging is the underlying
921
+ * ERC-20, NOT the OFT address.
922
+ *
923
+ * Steps:
924
+ * 1. Get lzAdapter from `getCuratorVaultStatus`
925
+ * 2. Quote the native bridge fee
926
+ * 3. Encode 5-field bridgeSpecificParams
927
+ * 4. Call `vault.executeBridging(adapter, token, amount, bridgeSpecificParams)` with fee as value
928
+ *
929
+ * @param walletClient Wallet client with curator account attached
930
+ * @param publicClient Public client for reads and fee quoting
931
+ * @param vault Hub vault address (diamond proxy)
932
+ * @param token Underlying ERC-20 token address (NOT the OFT address)
933
+ * @param params Full bridge parameters including refundAddress
934
+ * @returns Transaction hash
935
+ * @throws If caller is not curator, vault is paused, or bridge fails
936
+ *
937
+ * @example
938
+ * ```typescript
939
+ * const txHash = await executeCuratorBridge(walletClient, publicClient, VAULT, USDC_ADDRESS, {
940
+ * oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
941
+ * dstEid: 30101,
942
+ * amount: 1_000_000n,
943
+ * dstVault: '0xSpokeVault...',
944
+ * refundAddress: curatorAddress,
945
+ * })
946
+ * ```
947
+ */
948
+ declare function executeCuratorBridge(walletClient: WalletClient, publicClient: PublicClient, vault: Address, token: Address, params: CuratorBridgeParams): Promise<Hash>;
949
+
950
+ export { getInboundRoutes as $, type AsyncRequestResult as A, type BatchSwapParams as B, type ComposeData as C, type DepositResult as D, type VaultStatus as E, type VaultSummary as F, type VaultTopology as G, canDeposit as H, type InboundRoute as I, detectStargateOft as J, discoverVaultTopology as K, encodeBridgeParams as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, type PendingAction as P, ensureAllowance as Q, type RedeemResult as R, type SpokeDepositResult as S, executeCuratorBridge as T, type UserBalances as U, type VaultAddresses as V, findBridgeRoute as W, getAllVaultChainIds as X, getAsyncRequestStatus as Y, getAsyncRequestStatusLabel as Z, getFullVaultTopology as _, type CuratorVaultStatus as a, getMaxWithdrawable as a0, getOutboundRoutes as a1, getUserBalances as a2, getUserBalancesForRoutes as a3, getUserPosition as a4, getUserPositionMultiChain as a5, getVaultDistribution as a6, getVaultDistributionWithTopology as a7, getVaultMetadata as a8, getVaultStatus as a9, getVaultSummary as aa, getVaultTopology as ab, isAsyncMode as ac, isOnHubChain as ad, previewDeposit as ae, previewRedeem as af, quoteCuratorBridgeFee as ag, quoteLzFee as ah, quoteRouteDepositFee as ai, waitForAsyncRequest as aj, waitForTx as ak, type VaultAnalysis as b, type VaultAssetBreakdown as c, type CuratorAction as d, type SubmitActionsResult as e, ActionType as f, type ActionTypeValue as g, type AssetBalance as h, type AssetInfo as i, type AsyncRequestFinalResult as j, type AsyncRequestStatus as k, type AsyncRequestStatusInfo as l, type BridgeParams as m, type CrossChainRequestInfo as n, type CuratorBridgeParams as o, type DepositBlockReason as p, type DepositEligibility as q, type InboundRouteWithBalance as r, type MultiChainUserPosition as s, type OutboundRoute as t, type SpokeBalance as u, type SwapParams as v, type UserPosition as w, type VaultDistribution as x, type VaultMetadata as y, type VaultMode as z };
@@ -818,4 +818,133 @@ declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<
818
818
  */
819
819
  declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, amount: bigint, userAddress: Address): Promise<bigint>;
820
820
 
821
- export { getUserBalancesForRoutes as $, type AsyncRequestResult as A, type BatchSwapParams as B, type ComposeData as C, type DepositResult as D, type VaultSummary as E, type VaultTopology as F, canDeposit as G, detectStargateOft as H, type InboundRoute as I, discoverVaultTopology as J, ensureAllowance as K, getAllVaultChainIds as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, type PendingAction as P, getAsyncRequestStatus as Q, type RedeemResult as R, type SpokeDepositResult as S, getAsyncRequestStatusLabel as T, type UserBalances as U, type VaultAddresses as V, getFullVaultTopology as W, getInboundRoutes as X, getMaxWithdrawable as Y, getOutboundRoutes as Z, getUserBalances as _, type CuratorVaultStatus as a, getUserPosition as a0, getUserPositionMultiChain as a1, getVaultDistribution as a2, getVaultDistributionWithTopology as a3, getVaultMetadata as a4, getVaultStatus as a5, getVaultSummary as a6, getVaultTopology as a7, isAsyncMode as a8, isOnHubChain as a9, previewDeposit as aa, previewRedeem as ab, quoteLzFee as ac, quoteRouteDepositFee as ad, waitForAsyncRequest as ae, waitForTx as af, type VaultAnalysis as b, type VaultAssetBreakdown as c, type CuratorAction as d, type SubmitActionsResult as e, ActionType as f, type ActionTypeValue as g, type AssetBalance as h, type AssetInfo as i, type AsyncRequestFinalResult as j, type AsyncRequestStatus as k, type AsyncRequestStatusInfo as l, type BridgeParams as m, type CrossChainRequestInfo as n, type DepositBlockReason as o, type DepositEligibility as p, type InboundRouteWithBalance as q, type MultiChainUserPosition as r, type OutboundRoute as s, type SpokeBalance as t, type SwapParams as u, type UserPosition as v, type VaultDistribution as w, type VaultMetadata as x, type VaultMode as y, type VaultStatus as z };
821
+ /**
822
+ * Curator BridgeFacet helpers for the MoreVaults SDK.
823
+ *
824
+ * Provides typed helpers to quote and execute cross-chain asset bridging
825
+ * via BridgeFacet.executeBridging on any MoreVaults diamond.
826
+ *
827
+ * Key flows:
828
+ * 1. `quoteCuratorBridgeFee` — read-only fee estimation via LzAdapter
829
+ * 2. `executeCuratorBridge` — send bridging transaction (curator only)
830
+ * 3. `encodeBridgeParams` — encode the 5-field bridgeSpecificParams bytes
831
+ * 4. `findBridgeRoute` — resolve OFT route for a token on given chains
832
+ *
833
+ * Bridge call flow:
834
+ * curator → vault.executeBridging(adapter, token, amount, bridgeSpecificParams)
835
+ * bridgeSpecificParams = abi.encode(oftToken, dstEid, amount, dstVault, refundAddress)
836
+ *
837
+ * Quote call flow:
838
+ * publicClient → lzAdapter.quoteBridgeFee(encode(oftToken, dstEid, amount, dstVault))
839
+ *
840
+ * @module curatorBridge
841
+ */
842
+
843
+ /**
844
+ * Parameters for a curator bridge operation.
845
+ * Used in both quoting (4-field) and execution (5-field with refundAddress).
846
+ */
847
+ interface CuratorBridgeParams {
848
+ /** OFT contract address on the source chain (from OFT_ROUTES[symbol][chainId].oft) */
849
+ oftToken: Address;
850
+ /** LayerZero endpoint ID of the destination chain */
851
+ dstEid: number;
852
+ /** Amount to bridge (in token's native units) */
853
+ amount: bigint;
854
+ /** Vault address on the destination chain (hub or spoke) */
855
+ dstVault: Address;
856
+ /** Address where excess LayerZero gas refunds are sent (usually the curator wallet) */
857
+ refundAddress: Address;
858
+ }
859
+ /**
860
+ * Encode the 5-field bridgeSpecificParams for use in `executeBridging`.
861
+ *
862
+ * Encodes: (oftToken, dstEid, amount, dstVault, refundAddress)
863
+ * Types: (address, uint32, uint256, address, address)
864
+ *
865
+ * @param params Full bridge parameters including refundAddress
866
+ * @returns ABI-encoded bytes (`0x`-prefixed hex string)
867
+ */
868
+ declare function encodeBridgeParams(params: CuratorBridgeParams): `0x${string}`;
869
+ /**
870
+ * Find the OFT bridge route for a given token address on the source chain.
871
+ *
872
+ * Searches OFT_ROUTES for an asset whose `token` or `oft` field matches
873
+ * the provided address on the given source chainId.
874
+ *
875
+ * @param srcChainId EVM chain ID of the source chain (where the vault holds the token)
876
+ * @param dstChainId EVM chain ID of the destination chain
877
+ * @param tokenAddress ERC-20 token address on the source chain
878
+ * @returns Route info or null if no matching route exists
879
+ *
880
+ * @example
881
+ * ```typescript
882
+ * const route = findBridgeRoute(8453, 1, '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913')
883
+ * // → { symbol: 'stgUSDC', oftHub: '0x27a1...', oftSpoke: '0xc026...' }
884
+ * ```
885
+ */
886
+ declare function findBridgeRoute(srcChainId: number, dstChainId: number, tokenAddress: Address): {
887
+ oftSrc: Address;
888
+ oftDst: Address;
889
+ symbol: string;
890
+ } | null;
891
+ /**
892
+ * Quote the native fee required to bridge assets via the vault's LzAdapter.
893
+ *
894
+ * Calls `lzAdapter.quoteBridgeFee(bridgeSpecificParams)` using a 4-field
895
+ * encoding (no refundAddress). The returned fee must be sent as `msg.value`
896
+ * when calling `executeBridging`.
897
+ *
898
+ * @param publicClient Viem public client (must be on the vault's chain)
899
+ * @param vault Hub vault address (diamond proxy)
900
+ * @param params Bridge parameters (refundAddress is optional here)
901
+ * @returns Native fee in wei
902
+ *
903
+ * @example
904
+ * ```typescript
905
+ * const fee = await quoteCuratorBridgeFee(publicClient, VAULT, {
906
+ * oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26', // stgUSDC on Base
907
+ * dstEid: 30101, // Ethereum EID
908
+ * amount: 1_000_000n, // 1 USDC
909
+ * dstVault: '0xSpokeVault...',
910
+ * refundAddress: '0xCurator...',
911
+ * })
912
+ * console.log('Fee:', formatEther(fee), 'ETH')
913
+ * ```
914
+ */
915
+ declare function quoteCuratorBridgeFee(publicClient: PublicClient, vault: Address, params: CuratorBridgeParams): Promise<bigint>;
916
+ /**
917
+ * Execute a curator bridge operation via `BridgeFacet.executeBridging`.
918
+ *
919
+ * This is a direct curator call (NOT via multicall). The vault pauses during
920
+ * bridging for security. The `token` passed to executeBridging is the underlying
921
+ * ERC-20, NOT the OFT address.
922
+ *
923
+ * Steps:
924
+ * 1. Get lzAdapter from `getCuratorVaultStatus`
925
+ * 2. Quote the native bridge fee
926
+ * 3. Encode 5-field bridgeSpecificParams
927
+ * 4. Call `vault.executeBridging(adapter, token, amount, bridgeSpecificParams)` with fee as value
928
+ *
929
+ * @param walletClient Wallet client with curator account attached
930
+ * @param publicClient Public client for reads and fee quoting
931
+ * @param vault Hub vault address (diamond proxy)
932
+ * @param token Underlying ERC-20 token address (NOT the OFT address)
933
+ * @param params Full bridge parameters including refundAddress
934
+ * @returns Transaction hash
935
+ * @throws If caller is not curator, vault is paused, or bridge fails
936
+ *
937
+ * @example
938
+ * ```typescript
939
+ * const txHash = await executeCuratorBridge(walletClient, publicClient, VAULT, USDC_ADDRESS, {
940
+ * oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
941
+ * dstEid: 30101,
942
+ * amount: 1_000_000n,
943
+ * dstVault: '0xSpokeVault...',
944
+ * refundAddress: curatorAddress,
945
+ * })
946
+ * ```
947
+ */
948
+ declare function executeCuratorBridge(walletClient: WalletClient, publicClient: PublicClient, vault: Address, token: Address, params: CuratorBridgeParams): Promise<Hash>;
949
+
950
+ export { getInboundRoutes as $, type AsyncRequestResult as A, type BatchSwapParams as B, type ComposeData as C, type DepositResult as D, type VaultStatus as E, type VaultSummary as F, type VaultTopology as G, canDeposit as H, type InboundRoute as I, detectStargateOft as J, discoverVaultTopology as K, encodeBridgeParams as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, type PendingAction as P, ensureAllowance as Q, type RedeemResult as R, type SpokeDepositResult as S, executeCuratorBridge as T, type UserBalances as U, type VaultAddresses as V, findBridgeRoute as W, getAllVaultChainIds as X, getAsyncRequestStatus as Y, getAsyncRequestStatusLabel as Z, getFullVaultTopology as _, type CuratorVaultStatus as a, getMaxWithdrawable as a0, getOutboundRoutes as a1, getUserBalances as a2, getUserBalancesForRoutes as a3, getUserPosition as a4, getUserPositionMultiChain as a5, getVaultDistribution as a6, getVaultDistributionWithTopology as a7, getVaultMetadata as a8, getVaultStatus as a9, getVaultSummary as aa, getVaultTopology as ab, isAsyncMode as ac, isOnHubChain as ad, previewDeposit as ae, previewRedeem as af, quoteCuratorBridgeFee as ag, quoteLzFee as ah, quoteRouteDepositFee as ai, waitForAsyncRequest as aj, waitForTx as ak, type VaultAnalysis as b, type VaultAssetBreakdown as c, type CuratorAction as d, type SubmitActionsResult as e, ActionType as f, type ActionTypeValue as g, type AssetBalance as h, type AssetInfo as i, type AsyncRequestFinalResult as j, type AsyncRequestStatus as k, type AsyncRequestStatusInfo as l, type BridgeParams as m, type CrossChainRequestInfo as n, type CuratorBridgeParams as o, type DepositBlockReason as p, type DepositEligibility as q, type InboundRouteWithBalance as r, type MultiChainUserPosition as s, type OutboundRoute as t, type SpokeBalance as u, type SwapParams as v, type UserPosition as w, type VaultDistribution as x, type VaultMetadata as y, type VaultMode as z };
@@ -2298,6 +2298,75 @@ function buildUniswapV3Swap(params) {
2298
2298
  }
2299
2299
  };
2300
2300
  }
2301
+ function encodeBridgeParams(params) {
2302
+ const coder = ethers.AbiCoder.defaultAbiCoder();
2303
+ return coder.encode(
2304
+ ["address", "uint32", "uint256", "address", "address"],
2305
+ [
2306
+ ethers.getAddress(params.oftToken),
2307
+ params.dstEid,
2308
+ params.amount,
2309
+ ethers.getAddress(params.dstVault),
2310
+ ethers.getAddress(params.refundAddress)
2311
+ ]
2312
+ );
2313
+ }
2314
+ function encodeBridgeParamsForQuote(params) {
2315
+ const coder = ethers.AbiCoder.defaultAbiCoder();
2316
+ return coder.encode(
2317
+ ["address", "uint32", "uint256", "address"],
2318
+ [
2319
+ ethers.getAddress(params.oftToken),
2320
+ params.dstEid,
2321
+ params.amount,
2322
+ ethers.getAddress(params.dstVault)
2323
+ ]
2324
+ );
2325
+ }
2326
+ function findBridgeRoute(srcChainId, dstChainId, tokenAddress) {
2327
+ const normalizedToken = ethers.getAddress(tokenAddress);
2328
+ for (const [symbol, chains] of Object.entries(OFT_ROUTES)) {
2329
+ const srcEntry = chains[srcChainId];
2330
+ const dstEntry = chains[dstChainId];
2331
+ if (!srcEntry || !dstEntry) continue;
2332
+ const srcToken = ethers.getAddress(srcEntry.token);
2333
+ const srcOft = ethers.getAddress(srcEntry.oft);
2334
+ if (srcToken === normalizedToken || srcOft === normalizedToken) {
2335
+ return {
2336
+ oftSrc: srcOft,
2337
+ oftDst: ethers.getAddress(dstEntry.oft),
2338
+ symbol
2339
+ };
2340
+ }
2341
+ }
2342
+ return null;
2343
+ }
2344
+ async function quoteCuratorBridgeFee(provider, vault, params) {
2345
+ const status = await getCuratorVaultStatus(provider, vault);
2346
+ const lzAdapter = status.lzAdapter;
2347
+ const bridgeSpecificParams = encodeBridgeParamsForQuote(params);
2348
+ const adapterContract = new ethers.Contract(lzAdapter, LZ_ADAPTER_ABI, provider);
2349
+ const nativeFee = await adapterContract.quoteBridgeFee.staticCall(
2350
+ bridgeSpecificParams
2351
+ );
2352
+ return nativeFee;
2353
+ }
2354
+ async function executeCuratorBridge(signer, vault, token, params) {
2355
+ const provider = signer.provider;
2356
+ const status = await getCuratorVaultStatus(provider, vault);
2357
+ const lzAdapter = status.lzAdapter;
2358
+ const fee = await quoteCuratorBridgeFee(provider, vault, params);
2359
+ const bridgeSpecificParams = encodeBridgeParams(params);
2360
+ const vaultContract = new ethers.Contract(vault, BRIDGE_FACET_ABI, signer);
2361
+ const tx = await vaultContract.executeBridging(
2362
+ ethers.getAddress(lzAdapter),
2363
+ ethers.getAddress(token),
2364
+ params.amount,
2365
+ bridgeSpecificParams,
2366
+ { value: fee }
2367
+ );
2368
+ return tx.wait();
2369
+ }
2301
2370
 
2302
2371
  // src/ethers/distribution.ts
2303
2372
  async function getVaultDistribution(hubProvider, vault, spokeProviders) {
@@ -2589,11 +2658,14 @@ exports.depositMultiAsset = depositMultiAsset;
2589
2658
  exports.depositSimple = depositSimple;
2590
2659
  exports.detectStargateOft = detectStargateOft;
2591
2660
  exports.discoverVaultTopology = discoverVaultTopology;
2661
+ exports.encodeBridgeParams = encodeBridgeParams;
2592
2662
  exports.encodeCuratorAction = encodeCuratorAction;
2593
2663
  exports.encodeUniswapV3SwapCalldata = encodeUniswapV3SwapCalldata;
2594
2664
  exports.ensureAllowance = ensureAllowance;
2595
2665
  exports.executeActions = executeActions;
2596
2666
  exports.executeCompose = executeCompose;
2667
+ exports.executeCuratorBridge = executeCuratorBridge;
2668
+ exports.findBridgeRoute = findBridgeRoute;
2597
2669
  exports.getAllVaultChainIds = getAllVaultChainIds;
2598
2670
  exports.getAsyncRequestStatus = getAsyncRequestStatus;
2599
2671
  exports.getAsyncRequestStatusLabel = getAsyncRequestStatusLabel;
@@ -2628,6 +2700,7 @@ exports.preflightSync = preflightSync;
2628
2700
  exports.previewDeposit = previewDeposit;
2629
2701
  exports.previewRedeem = previewRedeem;
2630
2702
  exports.quoteComposeFee = quoteComposeFee;
2703
+ exports.quoteCuratorBridgeFee = quoteCuratorBridgeFee;
2631
2704
  exports.quoteDepositFromSpokeFee = quoteDepositFromSpokeFee;
2632
2705
  exports.quoteLzFee = quoteLzFee;
2633
2706
  exports.quoteRouteDepositFee = quoteRouteDepositFee;