@oydual31/more-vaults-sdk 0.2.6 → 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.
@@ -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-z7s_5ooO.cjs';
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 steps happen on different chains and cannot be combined.
1602
- * The frontend must switch chains between steps.
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 vault shares to bridge
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 (quote via OFT.quoteSend)
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 };
@@ -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-z7s_5ooO.js';
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 steps happen on different chains and cannot be combined.
1602
- * The frontend must switch chains between steps.
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 vault shares to bridge
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 (quote via OFT.quoteSend)
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 };
@@ -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,24 +3070,34 @@ 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 };
3056
- const balance = await spokeClient.readContract({
3057
- address: spokeOft,
3058
- abi: ERC20_ABI,
3059
- functionName: "balanceOf",
3060
- args: [u]
3076
+ if (!spokeClient) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
3077
+ const [rawBalance, spokeOftDecimals] = await spokeClient.multicall({
3078
+ contracts: [
3079
+ { address: spokeOft, abi: ERC20_ABI, functionName: "balanceOf", args: [u] },
3080
+ { address: spokeOft, abi: METADATA_ABI, functionName: "decimals" }
3081
+ ],
3082
+ allowFailure: false
3061
3083
  });
3062
- return { chainId: spokeChainId, balance };
3084
+ let balance;
3085
+ if (spokeOftDecimals > decimals) {
3086
+ balance = rawBalance / 10n ** BigInt(spokeOftDecimals - decimals);
3087
+ } else if (spokeOftDecimals < decimals) {
3088
+ balance = rawBalance * 10n ** BigInt(decimals - spokeOftDecimals);
3089
+ } else {
3090
+ balance = rawBalance;
3091
+ }
3092
+ return { chainId: spokeChainId, balance, rawBalance };
3063
3093
  } catch {
3064
- return { chainId: spokeChainId, balance: 0n };
3094
+ return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
3065
3095
  }
3066
3096
  });
3067
3097
  const results = await Promise.all(spokePromises);
3068
- for (const { chainId, balance } of results) {
3098
+ for (const { chainId, balance, rawBalance } of results) {
3069
3099
  spokeShares[chainId] = balance;
3100
+ rawSpokeShares[chainId] = rawBalance;
3070
3101
  }
3071
3102
  }
3072
3103
  }
@@ -3086,6 +3117,7 @@ async function getUserPositionMultiChain(vault, user) {
3086
3117
  return {
3087
3118
  hubShares,
3088
3119
  spokeShares,
3120
+ rawSpokeShares,
3089
3121
  totalShares,
3090
3122
  estimatedAssets,
3091
3123
  sharePrice,
@@ -3157,6 +3189,6 @@ function asSdkClient(client) {
3157
3189
  return client;
3158
3190
  }
3159
3191
 
3160
- 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 };
3161
3193
  //# sourceMappingURL=index.js.map
3162
3194
  //# sourceMappingURL=index.js.map