@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 +44 -0
- package/dist/{spokeRoutes-B8Lnk-t4.d.cts → curatorBridge-DTW1lPF7.d.cts} +130 -1
- package/dist/{spokeRoutes-B8Lnk-t4.d.ts → curatorBridge-DTW1lPF7.d.ts} +130 -1
- package/dist/ethers/index.cjs +73 -0
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.d.cts +103 -1
- package/dist/ethers/index.d.ts +103 -1
- package/dist/ethers/index.js +71 -2
- package/dist/ethers/index.js.map +1 -1
- package/dist/react/index.cjs +163 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +214 -2
- package/dist/react/index.d.ts +214 -2
- package/dist/react/index.js +162 -1
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +91 -0
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +2 -2
- package/dist/viem/index.d.ts +2 -2
- package/dist/viem/index.js +88 -1
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ethers/curatorBridge.ts +235 -0
- package/src/ethers/index.ts +9 -0
- package/src/react/index.ts +4 -0
- package/src/react/useCuratorBridgeQuote.ts +43 -0
- package/src/react/useExecuteBridge.ts +50 -0
- package/src/viem/curatorBridge.ts +288 -0
- package/src/viem/index.ts +7 -0
package/dist/ethers/index.d.cts
CHANGED
|
@@ -1657,6 +1657,108 @@ declare function buildUniswapV3Swap(params: {
|
|
|
1657
1657
|
recipient: string;
|
|
1658
1658
|
}): CuratorAction;
|
|
1659
1659
|
|
|
1660
|
+
/**
|
|
1661
|
+
* Curator BridgeFacet helpers for the MoreVaults ethers.js v6 SDK.
|
|
1662
|
+
*
|
|
1663
|
+
* Provides typed helpers to quote and execute cross-chain asset bridging
|
|
1664
|
+
* via BridgeFacet.executeBridging on any MoreVaults diamond.
|
|
1665
|
+
*
|
|
1666
|
+
* Key flows:
|
|
1667
|
+
* 1. `quoteCuratorBridgeFee` — read-only fee estimation via LzAdapter
|
|
1668
|
+
* 2. `executeCuratorBridge` — send bridging transaction (curator only)
|
|
1669
|
+
* 3. `encodeBridgeParams` — encode the 5-field bridgeSpecificParams bytes
|
|
1670
|
+
* 4. `findBridgeRoute` — resolve OFT route for a token on given chains
|
|
1671
|
+
*
|
|
1672
|
+
* @module curatorBridge
|
|
1673
|
+
*/
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* Parameters for a curator bridge operation.
|
|
1677
|
+
*/
|
|
1678
|
+
interface CuratorBridgeParams {
|
|
1679
|
+
/** OFT contract address on the source chain (from OFT_ROUTES[symbol][chainId].oft) */
|
|
1680
|
+
oftToken: string;
|
|
1681
|
+
/** LayerZero endpoint ID of the destination chain */
|
|
1682
|
+
dstEid: number;
|
|
1683
|
+
/** Amount to bridge (in token's native units) */
|
|
1684
|
+
amount: bigint;
|
|
1685
|
+
/** Vault address on the destination chain (hub or spoke) */
|
|
1686
|
+
dstVault: string;
|
|
1687
|
+
/** Address where excess LayerZero gas refunds are sent (usually the curator wallet) */
|
|
1688
|
+
refundAddress: string;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Encode the 5-field bridgeSpecificParams for use in `executeBridging`.
|
|
1692
|
+
*
|
|
1693
|
+
* Encodes: (oftToken, dstEid, amount, dstVault, refundAddress)
|
|
1694
|
+
* Types: (address, uint32, uint256, address, address)
|
|
1695
|
+
*
|
|
1696
|
+
* @param params Full bridge parameters including refundAddress
|
|
1697
|
+
* @returns ABI-encoded hex string
|
|
1698
|
+
*/
|
|
1699
|
+
declare function encodeBridgeParams(params: CuratorBridgeParams): string;
|
|
1700
|
+
/**
|
|
1701
|
+
* Find the OFT bridge route for a given token address on the source chain.
|
|
1702
|
+
*
|
|
1703
|
+
* Searches OFT_ROUTES for an asset whose `token` or `oft` field matches
|
|
1704
|
+
* the provided address on the given source chainId.
|
|
1705
|
+
*
|
|
1706
|
+
* @param srcChainId EVM chain ID of the source chain
|
|
1707
|
+
* @param dstChainId EVM chain ID of the destination chain
|
|
1708
|
+
* @param tokenAddress ERC-20 token address on the source chain
|
|
1709
|
+
* @returns Route info or null if no matching route exists
|
|
1710
|
+
*/
|
|
1711
|
+
declare function findBridgeRoute(srcChainId: number, dstChainId: number, tokenAddress: string): {
|
|
1712
|
+
oftSrc: string;
|
|
1713
|
+
oftDst: string;
|
|
1714
|
+
symbol: string;
|
|
1715
|
+
} | null;
|
|
1716
|
+
/**
|
|
1717
|
+
* Quote the native fee required to bridge assets via the vault's LzAdapter.
|
|
1718
|
+
*
|
|
1719
|
+
* Calls `lzAdapter.quoteBridgeFee(bridgeSpecificParams)` using a 4-field
|
|
1720
|
+
* encoding (no refundAddress). The returned fee must be sent as `value`
|
|
1721
|
+
* when calling `executeBridging`.
|
|
1722
|
+
*
|
|
1723
|
+
* @param provider Read-only provider (must be on the vault's chain)
|
|
1724
|
+
* @param vault Hub vault address (diamond proxy)
|
|
1725
|
+
* @param params Bridge parameters (refundAddress is included but not encoded for quote)
|
|
1726
|
+
* @returns Native fee in wei
|
|
1727
|
+
*
|
|
1728
|
+
* @example
|
|
1729
|
+
* ```typescript
|
|
1730
|
+
* const fee = await quoteCuratorBridgeFee(provider, VAULT, {
|
|
1731
|
+
* oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
1732
|
+
* dstEid: 30101,
|
|
1733
|
+
* amount: 1_000_000n,
|
|
1734
|
+
* dstVault: '0xSpokeVault...',
|
|
1735
|
+
* refundAddress: '0xCurator...',
|
|
1736
|
+
* })
|
|
1737
|
+
* ```
|
|
1738
|
+
*/
|
|
1739
|
+
declare function quoteCuratorBridgeFee(provider: Provider, vault: string, params: CuratorBridgeParams): Promise<bigint>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Execute a curator bridge operation via `BridgeFacet.executeBridging`.
|
|
1742
|
+
*
|
|
1743
|
+
* This is a direct curator call (NOT via multicall). The vault pauses during
|
|
1744
|
+
* bridging for security. The `token` parameter is the underlying ERC-20,
|
|
1745
|
+
* NOT the OFT address.
|
|
1746
|
+
*
|
|
1747
|
+
* Steps:
|
|
1748
|
+
* 1. Get lzAdapter from `getCuratorVaultStatus`
|
|
1749
|
+
* 2. Quote the native bridge fee
|
|
1750
|
+
* 3. Encode 5-field bridgeSpecificParams
|
|
1751
|
+
* 4. Call `vault.executeBridging(adapter, token, amount, bridgeSpecificParams)` with fee as value
|
|
1752
|
+
*
|
|
1753
|
+
* @param signer Signer with curator account attached
|
|
1754
|
+
* @param vault Hub vault address (diamond proxy)
|
|
1755
|
+
* @param token Underlying ERC-20 token address (NOT the OFT address)
|
|
1756
|
+
* @param params Full bridge parameters including refundAddress
|
|
1757
|
+
* @returns Transaction receipt
|
|
1758
|
+
* @throws If caller is not curator, vault is paused, or bridge fails
|
|
1759
|
+
*/
|
|
1760
|
+
declare function executeCuratorBridge(signer: Signer, vault: string, token: string, params: CuratorBridgeParams): Promise<ContractTransactionReceipt>;
|
|
1761
|
+
|
|
1660
1762
|
/**
|
|
1661
1763
|
* Vault topology helpers for the MoreVaults ethers.js v6 SDK.
|
|
1662
1764
|
*
|
|
@@ -1941,4 +2043,4 @@ declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, a
|
|
|
1941
2043
|
*/
|
|
1942
2044
|
declare function asSdkSigner(signer: unknown): Signer;
|
|
1943
2045
|
|
|
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 };
|
|
2046
|
+
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, 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, encodeBridgeParams, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, executeCuratorBridge, findBridgeRoute, 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, quoteCuratorBridgeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
|
package/dist/ethers/index.d.ts
CHANGED
|
@@ -1657,6 +1657,108 @@ declare function buildUniswapV3Swap(params: {
|
|
|
1657
1657
|
recipient: string;
|
|
1658
1658
|
}): CuratorAction;
|
|
1659
1659
|
|
|
1660
|
+
/**
|
|
1661
|
+
* Curator BridgeFacet helpers for the MoreVaults ethers.js v6 SDK.
|
|
1662
|
+
*
|
|
1663
|
+
* Provides typed helpers to quote and execute cross-chain asset bridging
|
|
1664
|
+
* via BridgeFacet.executeBridging on any MoreVaults diamond.
|
|
1665
|
+
*
|
|
1666
|
+
* Key flows:
|
|
1667
|
+
* 1. `quoteCuratorBridgeFee` — read-only fee estimation via LzAdapter
|
|
1668
|
+
* 2. `executeCuratorBridge` — send bridging transaction (curator only)
|
|
1669
|
+
* 3. `encodeBridgeParams` — encode the 5-field bridgeSpecificParams bytes
|
|
1670
|
+
* 4. `findBridgeRoute` — resolve OFT route for a token on given chains
|
|
1671
|
+
*
|
|
1672
|
+
* @module curatorBridge
|
|
1673
|
+
*/
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* Parameters for a curator bridge operation.
|
|
1677
|
+
*/
|
|
1678
|
+
interface CuratorBridgeParams {
|
|
1679
|
+
/** OFT contract address on the source chain (from OFT_ROUTES[symbol][chainId].oft) */
|
|
1680
|
+
oftToken: string;
|
|
1681
|
+
/** LayerZero endpoint ID of the destination chain */
|
|
1682
|
+
dstEid: number;
|
|
1683
|
+
/** Amount to bridge (in token's native units) */
|
|
1684
|
+
amount: bigint;
|
|
1685
|
+
/** Vault address on the destination chain (hub or spoke) */
|
|
1686
|
+
dstVault: string;
|
|
1687
|
+
/** Address where excess LayerZero gas refunds are sent (usually the curator wallet) */
|
|
1688
|
+
refundAddress: string;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Encode the 5-field bridgeSpecificParams for use in `executeBridging`.
|
|
1692
|
+
*
|
|
1693
|
+
* Encodes: (oftToken, dstEid, amount, dstVault, refundAddress)
|
|
1694
|
+
* Types: (address, uint32, uint256, address, address)
|
|
1695
|
+
*
|
|
1696
|
+
* @param params Full bridge parameters including refundAddress
|
|
1697
|
+
* @returns ABI-encoded hex string
|
|
1698
|
+
*/
|
|
1699
|
+
declare function encodeBridgeParams(params: CuratorBridgeParams): string;
|
|
1700
|
+
/**
|
|
1701
|
+
* Find the OFT bridge route for a given token address on the source chain.
|
|
1702
|
+
*
|
|
1703
|
+
* Searches OFT_ROUTES for an asset whose `token` or `oft` field matches
|
|
1704
|
+
* the provided address on the given source chainId.
|
|
1705
|
+
*
|
|
1706
|
+
* @param srcChainId EVM chain ID of the source chain
|
|
1707
|
+
* @param dstChainId EVM chain ID of the destination chain
|
|
1708
|
+
* @param tokenAddress ERC-20 token address on the source chain
|
|
1709
|
+
* @returns Route info or null if no matching route exists
|
|
1710
|
+
*/
|
|
1711
|
+
declare function findBridgeRoute(srcChainId: number, dstChainId: number, tokenAddress: string): {
|
|
1712
|
+
oftSrc: string;
|
|
1713
|
+
oftDst: string;
|
|
1714
|
+
symbol: string;
|
|
1715
|
+
} | null;
|
|
1716
|
+
/**
|
|
1717
|
+
* Quote the native fee required to bridge assets via the vault's LzAdapter.
|
|
1718
|
+
*
|
|
1719
|
+
* Calls `lzAdapter.quoteBridgeFee(bridgeSpecificParams)` using a 4-field
|
|
1720
|
+
* encoding (no refundAddress). The returned fee must be sent as `value`
|
|
1721
|
+
* when calling `executeBridging`.
|
|
1722
|
+
*
|
|
1723
|
+
* @param provider Read-only provider (must be on the vault's chain)
|
|
1724
|
+
* @param vault Hub vault address (diamond proxy)
|
|
1725
|
+
* @param params Bridge parameters (refundAddress is included but not encoded for quote)
|
|
1726
|
+
* @returns Native fee in wei
|
|
1727
|
+
*
|
|
1728
|
+
* @example
|
|
1729
|
+
* ```typescript
|
|
1730
|
+
* const fee = await quoteCuratorBridgeFee(provider, VAULT, {
|
|
1731
|
+
* oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
1732
|
+
* dstEid: 30101,
|
|
1733
|
+
* amount: 1_000_000n,
|
|
1734
|
+
* dstVault: '0xSpokeVault...',
|
|
1735
|
+
* refundAddress: '0xCurator...',
|
|
1736
|
+
* })
|
|
1737
|
+
* ```
|
|
1738
|
+
*/
|
|
1739
|
+
declare function quoteCuratorBridgeFee(provider: Provider, vault: string, params: CuratorBridgeParams): Promise<bigint>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Execute a curator bridge operation via `BridgeFacet.executeBridging`.
|
|
1742
|
+
*
|
|
1743
|
+
* This is a direct curator call (NOT via multicall). The vault pauses during
|
|
1744
|
+
* bridging for security. The `token` parameter is the underlying ERC-20,
|
|
1745
|
+
* NOT the OFT address.
|
|
1746
|
+
*
|
|
1747
|
+
* Steps:
|
|
1748
|
+
* 1. Get lzAdapter from `getCuratorVaultStatus`
|
|
1749
|
+
* 2. Quote the native bridge fee
|
|
1750
|
+
* 3. Encode 5-field bridgeSpecificParams
|
|
1751
|
+
* 4. Call `vault.executeBridging(adapter, token, amount, bridgeSpecificParams)` with fee as value
|
|
1752
|
+
*
|
|
1753
|
+
* @param signer Signer with curator account attached
|
|
1754
|
+
* @param vault Hub vault address (diamond proxy)
|
|
1755
|
+
* @param token Underlying ERC-20 token address (NOT the OFT address)
|
|
1756
|
+
* @param params Full bridge parameters including refundAddress
|
|
1757
|
+
* @returns Transaction receipt
|
|
1758
|
+
* @throws If caller is not curator, vault is paused, or bridge fails
|
|
1759
|
+
*/
|
|
1760
|
+
declare function executeCuratorBridge(signer: Signer, vault: string, token: string, params: CuratorBridgeParams): Promise<ContractTransactionReceipt>;
|
|
1761
|
+
|
|
1660
1762
|
/**
|
|
1661
1763
|
* Vault topology helpers for the MoreVaults ethers.js v6 SDK.
|
|
1662
1764
|
*
|
|
@@ -1941,4 +2043,4 @@ declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, a
|
|
|
1941
2043
|
*/
|
|
1942
2044
|
declare function asSdkSigner(signer: unknown): Signer;
|
|
1943
2045
|
|
|
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 };
|
|
2046
|
+
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, 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, encodeBridgeParams, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, executeCuratorBridge, findBridgeRoute, 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, quoteCuratorBridgeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
|
package/dist/ethers/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Contract, Interface, ZeroAddress, zeroPadValue, AbiCoder, JsonRpcProvider } from 'ethers';
|
|
1
|
+
import { Contract, Interface, ZeroAddress, zeroPadValue, AbiCoder, getAddress, JsonRpcProvider } from 'ethers';
|
|
2
2
|
|
|
3
3
|
// src/ethers/chains.ts
|
|
4
4
|
var CHAIN_IDS = {
|
|
@@ -2296,6 +2296,75 @@ function buildUniswapV3Swap(params) {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
};
|
|
2298
2298
|
}
|
|
2299
|
+
function encodeBridgeParams(params) {
|
|
2300
|
+
const coder = AbiCoder.defaultAbiCoder();
|
|
2301
|
+
return coder.encode(
|
|
2302
|
+
["address", "uint32", "uint256", "address", "address"],
|
|
2303
|
+
[
|
|
2304
|
+
getAddress(params.oftToken),
|
|
2305
|
+
params.dstEid,
|
|
2306
|
+
params.amount,
|
|
2307
|
+
getAddress(params.dstVault),
|
|
2308
|
+
getAddress(params.refundAddress)
|
|
2309
|
+
]
|
|
2310
|
+
);
|
|
2311
|
+
}
|
|
2312
|
+
function encodeBridgeParamsForQuote(params) {
|
|
2313
|
+
const coder = AbiCoder.defaultAbiCoder();
|
|
2314
|
+
return coder.encode(
|
|
2315
|
+
["address", "uint32", "uint256", "address"],
|
|
2316
|
+
[
|
|
2317
|
+
getAddress(params.oftToken),
|
|
2318
|
+
params.dstEid,
|
|
2319
|
+
params.amount,
|
|
2320
|
+
getAddress(params.dstVault)
|
|
2321
|
+
]
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
function findBridgeRoute(srcChainId, dstChainId, tokenAddress) {
|
|
2325
|
+
const normalizedToken = getAddress(tokenAddress);
|
|
2326
|
+
for (const [symbol, chains] of Object.entries(OFT_ROUTES)) {
|
|
2327
|
+
const srcEntry = chains[srcChainId];
|
|
2328
|
+
const dstEntry = chains[dstChainId];
|
|
2329
|
+
if (!srcEntry || !dstEntry) continue;
|
|
2330
|
+
const srcToken = getAddress(srcEntry.token);
|
|
2331
|
+
const srcOft = getAddress(srcEntry.oft);
|
|
2332
|
+
if (srcToken === normalizedToken || srcOft === normalizedToken) {
|
|
2333
|
+
return {
|
|
2334
|
+
oftSrc: srcOft,
|
|
2335
|
+
oftDst: getAddress(dstEntry.oft),
|
|
2336
|
+
symbol
|
|
2337
|
+
};
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
return null;
|
|
2341
|
+
}
|
|
2342
|
+
async function quoteCuratorBridgeFee(provider, vault, params) {
|
|
2343
|
+
const status = await getCuratorVaultStatus(provider, vault);
|
|
2344
|
+
const lzAdapter = status.lzAdapter;
|
|
2345
|
+
const bridgeSpecificParams = encodeBridgeParamsForQuote(params);
|
|
2346
|
+
const adapterContract = new Contract(lzAdapter, LZ_ADAPTER_ABI, provider);
|
|
2347
|
+
const nativeFee = await adapterContract.quoteBridgeFee.staticCall(
|
|
2348
|
+
bridgeSpecificParams
|
|
2349
|
+
);
|
|
2350
|
+
return nativeFee;
|
|
2351
|
+
}
|
|
2352
|
+
async function executeCuratorBridge(signer, vault, token, params) {
|
|
2353
|
+
const provider = signer.provider;
|
|
2354
|
+
const status = await getCuratorVaultStatus(provider, vault);
|
|
2355
|
+
const lzAdapter = status.lzAdapter;
|
|
2356
|
+
const fee = await quoteCuratorBridgeFee(provider, vault, params);
|
|
2357
|
+
const bridgeSpecificParams = encodeBridgeParams(params);
|
|
2358
|
+
const vaultContract = new Contract(vault, BRIDGE_FACET_ABI, signer);
|
|
2359
|
+
const tx = await vaultContract.executeBridging(
|
|
2360
|
+
getAddress(lzAdapter),
|
|
2361
|
+
getAddress(token),
|
|
2362
|
+
params.amount,
|
|
2363
|
+
bridgeSpecificParams,
|
|
2364
|
+
{ value: fee }
|
|
2365
|
+
);
|
|
2366
|
+
return tx.wait();
|
|
2367
|
+
}
|
|
2299
2368
|
|
|
2300
2369
|
// src/ethers/distribution.ts
|
|
2301
2370
|
async function getVaultDistribution(hubProvider, vault, spokeProviders) {
|
|
@@ -2536,6 +2605,6 @@ function asSdkSigner(signer) {
|
|
|
2536
2605
|
return signer;
|
|
2537
2606
|
}
|
|
2538
2607
|
|
|
2539
|
-
export { ActionType, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, DEX_ABI, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, REGISTRY_ABI, UNISWAP_V3_ROUTERS, VAULT_ABI, VAULT_ANALYSIS_ABI, VaultPausedError, 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 };
|
|
2608
|
+
export { ActionType, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, DEX_ABI, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, REGISTRY_ABI, UNISWAP_V3_ROUTERS, VAULT_ABI, VAULT_ANALYSIS_ABI, VaultPausedError, WrongChainError, asSdkSigner, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositCrossChainOracleOn, depositFromSpoke, depositFromSpokeAsync, depositMultiAsset, depositSimple, detectStargateOft, discoverVaultTopology, encodeBridgeParams, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, executeCuratorBridge, findBridgeRoute, 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, quoteCuratorBridgeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
|
|
2540
2609
|
//# sourceMappingURL=index.js.map
|
|
2541
2610
|
//# sourceMappingURL=index.js.map
|