@oydual31/more-vaults-sdk 0.2.6 → 0.2.7

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.
@@ -3055,12 +3055,21 @@ async function getUserPositionMultiChain(vault, user) {
3055
3055
  }
3056
3056
  const spokeClient = createChainClient(spokeChainId);
3057
3057
  if (!spokeClient) return { chainId: spokeChainId, balance: 0n };
3058
- const balance = await spokeClient.readContract({
3059
- address: spokeOft,
3060
- abi: ERC20_ABI,
3061
- functionName: "balanceOf",
3062
- args: [u]
3058
+ const [rawBalance, spokeOftDecimals] = await spokeClient.multicall({
3059
+ contracts: [
3060
+ { address: spokeOft, abi: ERC20_ABI, functionName: "balanceOf", args: [u] },
3061
+ { address: spokeOft, abi: METADATA_ABI, functionName: "decimals" }
3062
+ ],
3063
+ allowFailure: false
3063
3064
  });
3065
+ let balance;
3066
+ if (spokeOftDecimals > decimals) {
3067
+ balance = rawBalance / 10n ** BigInt(spokeOftDecimals - decimals);
3068
+ } else if (spokeOftDecimals < decimals) {
3069
+ balance = rawBalance * 10n ** BigInt(decimals - spokeOftDecimals);
3070
+ } else {
3071
+ balance = rawBalance;
3072
+ }
3064
3073
  return { chainId: spokeChainId, balance };
3065
3074
  } catch {
3066
3075
  return { chainId: spokeChainId, balance: 0n };