@oydual31/more-vaults-sdk 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/index.cjs +9 -6
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +9 -6
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-z7s_5ooO.d.cts → spokeRoutes-FgKCJQYa.d.cts} +5 -2
- package/dist/{spokeRoutes-z7s_5ooO.d.ts → spokeRoutes-FgKCJQYa.d.ts} +5 -2
- package/dist/viem/index.cjs +30 -6
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +22 -11
- package/dist/viem/index.d.ts +22 -11
- package/dist/viem/index.js +30 -7
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/index.ts +1 -0
- package/src/viem/redeemFlows.ts +50 -10
- package/src/viem/userHelpers.ts +14 -8
package/dist/viem/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hash, Address, WalletClient, PublicClient } from 'viem';
|
|
2
2
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-
|
|
3
|
+
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-FgKCJQYa.cjs';
|
|
4
4
|
|
|
5
5
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
6
|
declare const CHAIN_IDS: {
|
|
@@ -1590,6 +1590,21 @@ declare function redeemAsync(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1590
1590
|
* @returns RedeemResult or AsyncRequestResult depending on vault mode
|
|
1591
1591
|
*/
|
|
1592
1592
|
declare function smartRedeem(walletClient: WalletClient, publicClient: PublicClient, addresses: VaultAddresses, shares: bigint, receiver: Address, owner: Address, extraOptions?: `0x${string}`): Promise<RedeemResult | AsyncRequestResult>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Quote the LZ fee for bridging shares from spoke to hub via SHARE_OFT.
|
|
1595
|
+
*
|
|
1596
|
+
* **IMPORTANT**: `amountLD` must be in SHARE_OFT native decimals (e.g. 18),
|
|
1597
|
+
* NOT vault decimals (e.g. 8). Use the raw `SHARE_OFT.balanceOf(user)` value,
|
|
1598
|
+
* or `getUserPositionMultiChain().rawSpokeShares[chainId]`.
|
|
1599
|
+
*
|
|
1600
|
+
* @param spokePublicClient Public client on the SPOKE chain
|
|
1601
|
+
* @param shareOFT SHARE_OFT address on the spoke chain
|
|
1602
|
+
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1603
|
+
* @param amountLD Shares in SHARE_OFT native decimals (raw balanceOf)
|
|
1604
|
+
* @param receiver Receiver address on the hub chain
|
|
1605
|
+
* @returns LZ native fee in wei
|
|
1606
|
+
*/
|
|
1607
|
+
declare function quoteShareBridgeFee(spokePublicClient: PublicClient, shareOFT: Address, hubChainEid: number, amountLD: bigint, receiver: Address): Promise<bigint>;
|
|
1593
1608
|
/**
|
|
1594
1609
|
* R6 — Bridge shares from spoke to hub chain via OFT.
|
|
1595
1610
|
*
|
|
@@ -1598,24 +1613,20 @@ declare function smartRedeem(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1598
1613
|
* 2. `smartRedeem()` — redeem shares on hub → underlying (auto-detects async)
|
|
1599
1614
|
* 3. `bridgeAssetsToSpoke()` — bridge assets from hub → spoke via asset OFT
|
|
1600
1615
|
*
|
|
1601
|
-
* The
|
|
1602
|
-
*
|
|
1616
|
+
* **IMPORTANT**: The `shares` parameter must be in SHARE_OFT decimals (the raw
|
|
1617
|
+
* `balanceOf` from the spoke OFT), NOT in vault decimals. Use the user's actual
|
|
1618
|
+
* SHARE_OFT balance, or convert with `vaultShares * 10^(oftDecimals - vaultDecimals)`.
|
|
1603
1619
|
*
|
|
1604
1620
|
* **User transactions on spoke chain**: 1 approve (shares to shareOFT) + 1 OFT.send().
|
|
1605
1621
|
* **Gas**: Requires native token on spoke for LZ fees, and gas on hub for steps 2+3.
|
|
1606
1622
|
*
|
|
1607
|
-
* ## Tested flows
|
|
1608
|
-
*
|
|
1609
|
-
* - [x] SHARE_OFT bridge (Eth→Base, vault 0x8f74...ba6):
|
|
1610
|
-
* Delivery ~7 min. Required enforcedOptions on Eth SHARE_OFT for dstEid=30184.
|
|
1611
|
-
*
|
|
1612
1623
|
* @param walletClient Wallet client on the SPOKE chain
|
|
1613
1624
|
* @param publicClient Public client on the SPOKE chain
|
|
1614
1625
|
* @param shareOFT OFTAdapter address for vault shares on the spoke chain
|
|
1615
1626
|
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1616
|
-
* @param shares Amount of
|
|
1627
|
+
* @param shares Amount of shares in SHARE_OFT decimals (use raw balanceOf)
|
|
1617
1628
|
* @param receiver Receiver address on the HUB chain
|
|
1618
|
-
* @param lzFee msg.value for OFT send (
|
|
1629
|
+
* @param lzFee msg.value for OFT send (from quoteShareBridgeFee)
|
|
1619
1630
|
* @returns Transaction hash of the OFT.send() call
|
|
1620
1631
|
*/
|
|
1621
1632
|
declare function bridgeSharesToHub(walletClient: WalletClient, publicClient: PublicClient, shareOFT: Address, hubChainEid: number, shares: bigint, receiver: Address, lzFee: bigint): Promise<{
|
|
@@ -1830,4 +1841,4 @@ declare function preflightSpokeRedeem(route: {
|
|
|
1830
1841
|
*/
|
|
1831
1842
|
declare function asSdkClient(client: unknown): PublicClient;
|
|
1832
1843
|
|
|
1833
|
-
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
|
1844
|
+
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
package/dist/viem/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hash, Address, WalletClient, PublicClient } from 'viem';
|
|
2
2
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-
|
|
3
|
+
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-FgKCJQYa.js';
|
|
4
4
|
|
|
5
5
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
6
|
declare const CHAIN_IDS: {
|
|
@@ -1590,6 +1590,21 @@ declare function redeemAsync(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1590
1590
|
* @returns RedeemResult or AsyncRequestResult depending on vault mode
|
|
1591
1591
|
*/
|
|
1592
1592
|
declare function smartRedeem(walletClient: WalletClient, publicClient: PublicClient, addresses: VaultAddresses, shares: bigint, receiver: Address, owner: Address, extraOptions?: `0x${string}`): Promise<RedeemResult | AsyncRequestResult>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Quote the LZ fee for bridging shares from spoke to hub via SHARE_OFT.
|
|
1595
|
+
*
|
|
1596
|
+
* **IMPORTANT**: `amountLD` must be in SHARE_OFT native decimals (e.g. 18),
|
|
1597
|
+
* NOT vault decimals (e.g. 8). Use the raw `SHARE_OFT.balanceOf(user)` value,
|
|
1598
|
+
* or `getUserPositionMultiChain().rawSpokeShares[chainId]`.
|
|
1599
|
+
*
|
|
1600
|
+
* @param spokePublicClient Public client on the SPOKE chain
|
|
1601
|
+
* @param shareOFT SHARE_OFT address on the spoke chain
|
|
1602
|
+
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1603
|
+
* @param amountLD Shares in SHARE_OFT native decimals (raw balanceOf)
|
|
1604
|
+
* @param receiver Receiver address on the hub chain
|
|
1605
|
+
* @returns LZ native fee in wei
|
|
1606
|
+
*/
|
|
1607
|
+
declare function quoteShareBridgeFee(spokePublicClient: PublicClient, shareOFT: Address, hubChainEid: number, amountLD: bigint, receiver: Address): Promise<bigint>;
|
|
1593
1608
|
/**
|
|
1594
1609
|
* R6 — Bridge shares from spoke to hub chain via OFT.
|
|
1595
1610
|
*
|
|
@@ -1598,24 +1613,20 @@ declare function smartRedeem(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1598
1613
|
* 2. `smartRedeem()` — redeem shares on hub → underlying (auto-detects async)
|
|
1599
1614
|
* 3. `bridgeAssetsToSpoke()` — bridge assets from hub → spoke via asset OFT
|
|
1600
1615
|
*
|
|
1601
|
-
* The
|
|
1602
|
-
*
|
|
1616
|
+
* **IMPORTANT**: The `shares` parameter must be in SHARE_OFT decimals (the raw
|
|
1617
|
+
* `balanceOf` from the spoke OFT), NOT in vault decimals. Use the user's actual
|
|
1618
|
+
* SHARE_OFT balance, or convert with `vaultShares * 10^(oftDecimals - vaultDecimals)`.
|
|
1603
1619
|
*
|
|
1604
1620
|
* **User transactions on spoke chain**: 1 approve (shares to shareOFT) + 1 OFT.send().
|
|
1605
1621
|
* **Gas**: Requires native token on spoke for LZ fees, and gas on hub for steps 2+3.
|
|
1606
1622
|
*
|
|
1607
|
-
* ## Tested flows
|
|
1608
|
-
*
|
|
1609
|
-
* - [x] SHARE_OFT bridge (Eth→Base, vault 0x8f74...ba6):
|
|
1610
|
-
* Delivery ~7 min. Required enforcedOptions on Eth SHARE_OFT for dstEid=30184.
|
|
1611
|
-
*
|
|
1612
1623
|
* @param walletClient Wallet client on the SPOKE chain
|
|
1613
1624
|
* @param publicClient Public client on the SPOKE chain
|
|
1614
1625
|
* @param shareOFT OFTAdapter address for vault shares on the spoke chain
|
|
1615
1626
|
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1616
|
-
* @param shares Amount of
|
|
1627
|
+
* @param shares Amount of shares in SHARE_OFT decimals (use raw balanceOf)
|
|
1617
1628
|
* @param receiver Receiver address on the HUB chain
|
|
1618
|
-
* @param lzFee msg.value for OFT send (
|
|
1629
|
+
* @param lzFee msg.value for OFT send (from quoteShareBridgeFee)
|
|
1619
1630
|
* @returns Transaction hash of the OFT.send() call
|
|
1620
1631
|
*/
|
|
1621
1632
|
declare function bridgeSharesToHub(walletClient: WalletClient, publicClient: PublicClient, shareOFT: Address, hubChainEid: number, shares: bigint, receiver: Address, lzFee: bigint): Promise<{
|
|
@@ -1830,4 +1841,4 @@ declare function preflightSpokeRedeem(route: {
|
|
|
1830
1841
|
*/
|
|
1831
1842
|
declare function asSdkClient(client: unknown): PublicClient;
|
|
1832
1843
|
|
|
1833
|
-
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
|
1844
|
+
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
package/dist/viem/index.js
CHANGED
|
@@ -2585,6 +2585,26 @@ async function smartRedeem(walletClient, publicClient, addresses, shares, receiv
|
|
|
2585
2585
|
}
|
|
2586
2586
|
return redeemShares(walletClient, publicClient, addresses, shares, receiver, owner);
|
|
2587
2587
|
}
|
|
2588
|
+
async function quoteShareBridgeFee(spokePublicClient, shareOFT, hubChainEid, amountLD, receiver) {
|
|
2589
|
+
const oft = getAddress(shareOFT);
|
|
2590
|
+
const toBytes32 = pad(getAddress(receiver), { size: 32 });
|
|
2591
|
+
const sendParam = {
|
|
2592
|
+
dstEid: hubChainEid,
|
|
2593
|
+
to: toBytes32,
|
|
2594
|
+
amountLD,
|
|
2595
|
+
minAmountLD: amountLD,
|
|
2596
|
+
extraOptions: "0x",
|
|
2597
|
+
composeMsg: "0x",
|
|
2598
|
+
oftCmd: "0x"
|
|
2599
|
+
};
|
|
2600
|
+
const feeResult = await spokePublicClient.readContract({
|
|
2601
|
+
address: oft,
|
|
2602
|
+
abi: OFT_ABI,
|
|
2603
|
+
functionName: "quoteSend",
|
|
2604
|
+
args: [sendParam, false]
|
|
2605
|
+
});
|
|
2606
|
+
return feeResult.nativeFee;
|
|
2607
|
+
}
|
|
2588
2608
|
async function bridgeSharesToHub(walletClient, publicClient, shareOFT, hubChainEid, shares, receiver, lzFee) {
|
|
2589
2609
|
const account = walletClient.account;
|
|
2590
2610
|
const oft = getAddress(shareOFT);
|
|
@@ -3018,6 +3038,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3018
3038
|
});
|
|
3019
3039
|
const [withdrawShares, timelockEndsAt] = withdrawalRequest;
|
|
3020
3040
|
const spokeShares = {};
|
|
3041
|
+
const rawSpokeShares = {};
|
|
3021
3042
|
if (topo.spokeChainIds.length > 0) {
|
|
3022
3043
|
let hubShareOft = null;
|
|
3023
3044
|
try {
|
|
@@ -3040,7 +3061,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3040
3061
|
const spokePromises = topo.spokeChainIds.map(async (spokeChainId) => {
|
|
3041
3062
|
try {
|
|
3042
3063
|
const spokeEid = CHAIN_ID_TO_EID[spokeChainId];
|
|
3043
|
-
if (!spokeEid) return { chainId: spokeChainId, balance: 0n };
|
|
3064
|
+
if (!spokeEid) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3044
3065
|
const spokeOftBytes32 = await hubClient.readContract({
|
|
3045
3066
|
address: hubShareOft,
|
|
3046
3067
|
abi: OFT_ABI,
|
|
@@ -3049,10 +3070,10 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3049
3070
|
});
|
|
3050
3071
|
const spokeOft = getAddress(`0x${spokeOftBytes32.slice(-40)}`);
|
|
3051
3072
|
if (spokeOft === "0x0000000000000000000000000000000000000000") {
|
|
3052
|
-
return { chainId: spokeChainId, balance: 0n };
|
|
3073
|
+
return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3053
3074
|
}
|
|
3054
3075
|
const spokeClient = createChainClient(spokeChainId);
|
|
3055
|
-
if (!spokeClient) return { chainId: spokeChainId, balance: 0n };
|
|
3076
|
+
if (!spokeClient) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3056
3077
|
const [rawBalance, spokeOftDecimals] = await spokeClient.multicall({
|
|
3057
3078
|
contracts: [
|
|
3058
3079
|
{ address: spokeOft, abi: ERC20_ABI, functionName: "balanceOf", args: [u] },
|
|
@@ -3068,14 +3089,15 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3068
3089
|
} else {
|
|
3069
3090
|
balance = rawBalance;
|
|
3070
3091
|
}
|
|
3071
|
-
return { chainId: spokeChainId, balance };
|
|
3092
|
+
return { chainId: spokeChainId, balance, rawBalance };
|
|
3072
3093
|
} catch {
|
|
3073
|
-
return { chainId: spokeChainId, balance: 0n };
|
|
3094
|
+
return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3074
3095
|
}
|
|
3075
3096
|
});
|
|
3076
3097
|
const results = await Promise.all(spokePromises);
|
|
3077
|
-
for (const { chainId, balance } of results) {
|
|
3098
|
+
for (const { chainId, balance, rawBalance } of results) {
|
|
3078
3099
|
spokeShares[chainId] = balance;
|
|
3100
|
+
rawSpokeShares[chainId] = rawBalance;
|
|
3079
3101
|
}
|
|
3080
3102
|
}
|
|
3081
3103
|
}
|
|
@@ -3095,6 +3117,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3095
3117
|
return {
|
|
3096
3118
|
hubShares,
|
|
3097
3119
|
spokeShares,
|
|
3120
|
+
rawSpokeShares,
|
|
3098
3121
|
totalShares,
|
|
3099
3122
|
estimatedAssets,
|
|
3100
3123
|
sharePrice,
|
|
@@ -3166,6 +3189,6 @@ function asSdkClient(client) {
|
|
|
3166
3189
|
return client;
|
|
3167
3190
|
}
|
|
3168
3191
|
|
|
3169
|
-
export { ActionType, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, STARGATE_TAXI_CMD, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, canDeposit, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, ensureAllowance, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3192
|
+
export { ActionType, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, STARGATE_TAXI_CMD, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, canDeposit, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, ensureAllowance, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3170
3193
|
//# sourceMappingURL=index.js.map
|
|
3171
3194
|
//# sourceMappingURL=index.js.map
|