@oydual31/more-vaults-sdk 0.2.7 → 0.2.9

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.
@@ -331,9 +331,12 @@ declare function getVaultSummary(publicClient: PublicClient, vault: Address): Pr
331
331
  interface MultiChainUserPosition {
332
332
  /** Shares held directly on the hub vault (vault.balanceOf) */
333
333
  hubShares: bigint;
334
- /** Per-spoke SHARE_OFT balances: { [chainId]: bigint } */
334
+ /** Per-spoke SHARE_OFT balances normalized to vault decimals: { [chainId]: bigint } */
335
335
  spokeShares: Record<number, bigint>;
336
- /** hubShares + sum of all spokeShares */
336
+ /** Per-spoke SHARE_OFT raw balances in OFT native decimals: { [chainId]: bigint }
337
+ * Use these for bridgeSharesToHub() and quoteShareBridgeFee() */
338
+ rawSpokeShares: Record<number, bigint>;
339
+ /** hubShares + sum of all spokeShares (in vault decimals) */
337
340
  totalShares: bigint;
338
341
  /** convertToAssets(totalShares) on the hub */
339
342
  estimatedAssets: bigint;
@@ -331,9 +331,12 @@ declare function getVaultSummary(publicClient: PublicClient, vault: Address): Pr
331
331
  interface MultiChainUserPosition {
332
332
  /** Shares held directly on the hub vault (vault.balanceOf) */
333
333
  hubShares: bigint;
334
- /** Per-spoke SHARE_OFT balances: { [chainId]: bigint } */
334
+ /** Per-spoke SHARE_OFT balances normalized to vault decimals: { [chainId]: bigint } */
335
335
  spokeShares: Record<number, bigint>;
336
- /** hubShares + sum of all spokeShares */
336
+ /** Per-spoke SHARE_OFT raw balances in OFT native decimals: { [chainId]: bigint }
337
+ * Use these for bridgeSharesToHub() and quoteShareBridgeFee() */
338
+ rawSpokeShares: Record<number, bigint>;
339
+ /** hubShares + sum of all spokeShares (in vault decimals) */
337
340
  totalShares: bigint;
338
341
  /** convertToAssets(totalShares) on the hub */
339
342
  estimatedAssets: bigint;
@@ -98,10 +98,12 @@ var OFT_ROUTES = {
98
98
  ]: { oft: "0x19cFCE47eD54a88614648DC3f19A5980097007dD", token: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" }
99
99
  },
100
100
  /**
101
- * PYUSDPayPal USD OFT (issued by PayPal/Flow).
101
+ * USDF — USD Flow OFT. Bridges PYUSD (Ethereum) USDF (Flow EVM).
102
+ * On Ethereum: underlying is PayPal USD (PYUSD, 0x6c3ea9...).
103
+ * On Flow: the OFT itself IS the token (USDF, 0x2aabea...).
102
104
  * Routes verified: Eth→Flow ✓
103
105
  */
104
- PYUSD: {
106
+ USDF: {
105
107
  [
106
108
  747
107
109
  /* flowEVMMainnet */
@@ -111,6 +113,23 @@ var OFT_ROUTES = {
111
113
  /* ethereum */
112
114
  ]: { oft: "0xfa0e06b54986ad96de87a8c56fea76fbd8d493f8", token: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8" }
113
115
  },
116
+ /**
117
+ * PYUSD — PayPal USD bridged via OFTAdapter (Paxos / LayerZero).
118
+ * Lock/mint architecture: locks PYUSD on Arbitrum, mints PYUSD0 on Flow EVM.
119
+ * On Arbitrum: OFTAdapter wraps native PYUSD (0x46850a...).
120
+ * On Flow: OFTAdapter wraps PYUSD0 (0x99aF3E...), which is the native Paxos token.
121
+ * Routes verified: Arb↔Flow ✓ (EID 30336). No Eth or Base peers.
122
+ */
123
+ PYUSD: {
124
+ [
125
+ 747
126
+ /* flowEVMMainnet */
127
+ ]: { oft: "0x26d27d5AF2F6f1c14F40013C8619d97aaf015509", token: "0x99aF3EeA856556646C98c8B9b2548Fe815240750" },
128
+ [
129
+ 42161
130
+ /* arbitrum */
131
+ ]: { oft: "0x3CD2b89C49D130C08f1d683225b2e5DeB63ff876", token: "0x46850aD61C2B7d64d08c9C754F45254596696984" }
132
+ },
114
133
  /**
115
134
  * WFLOW — Wrapped FLOW NativeOFTAdapter (issued by Flow Foundation).
116
135
  * Routes verified: Eth→Flow ✓
@@ -2587,6 +2606,26 @@ async function smartRedeem(walletClient, publicClient, addresses, shares, receiv
2587
2606
  }
2588
2607
  return redeemShares(walletClient, publicClient, addresses, shares, receiver, owner);
2589
2608
  }
2609
+ async function quoteShareBridgeFee(spokePublicClient, shareOFT, hubChainEid, amountLD, receiver) {
2610
+ const oft = viem.getAddress(shareOFT);
2611
+ const toBytes32 = viem.pad(viem.getAddress(receiver), { size: 32 });
2612
+ const sendParam = {
2613
+ dstEid: hubChainEid,
2614
+ to: toBytes32,
2615
+ amountLD,
2616
+ minAmountLD: amountLD,
2617
+ extraOptions: "0x",
2618
+ composeMsg: "0x",
2619
+ oftCmd: "0x"
2620
+ };
2621
+ const feeResult = await spokePublicClient.readContract({
2622
+ address: oft,
2623
+ abi: OFT_ABI,
2624
+ functionName: "quoteSend",
2625
+ args: [sendParam, false]
2626
+ });
2627
+ return feeResult.nativeFee;
2628
+ }
2590
2629
  async function bridgeSharesToHub(walletClient, publicClient, shareOFT, hubChainEid, shares, receiver, lzFee) {
2591
2630
  const account = walletClient.account;
2592
2631
  const oft = viem.getAddress(shareOFT);
@@ -3020,6 +3059,7 @@ async function getUserPositionMultiChain(vault, user) {
3020
3059
  });
3021
3060
  const [withdrawShares, timelockEndsAt] = withdrawalRequest;
3022
3061
  const spokeShares = {};
3062
+ const rawSpokeShares = {};
3023
3063
  if (topo.spokeChainIds.length > 0) {
3024
3064
  let hubShareOft = null;
3025
3065
  try {
@@ -3042,7 +3082,7 @@ async function getUserPositionMultiChain(vault, user) {
3042
3082
  const spokePromises = topo.spokeChainIds.map(async (spokeChainId) => {
3043
3083
  try {
3044
3084
  const spokeEid = CHAIN_ID_TO_EID[spokeChainId];
3045
- if (!spokeEid) return { chainId: spokeChainId, balance: 0n };
3085
+ if (!spokeEid) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
3046
3086
  const spokeOftBytes32 = await hubClient.readContract({
3047
3087
  address: hubShareOft,
3048
3088
  abi: OFT_ABI,
@@ -3051,10 +3091,10 @@ async function getUserPositionMultiChain(vault, user) {
3051
3091
  });
3052
3092
  const spokeOft = viem.getAddress(`0x${spokeOftBytes32.slice(-40)}`);
3053
3093
  if (spokeOft === "0x0000000000000000000000000000000000000000") {
3054
- return { chainId: spokeChainId, balance: 0n };
3094
+ return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
3055
3095
  }
3056
3096
  const spokeClient = createChainClient(spokeChainId);
3057
- if (!spokeClient) return { chainId: spokeChainId, balance: 0n };
3097
+ if (!spokeClient) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
3058
3098
  const [rawBalance, spokeOftDecimals] = await spokeClient.multicall({
3059
3099
  contracts: [
3060
3100
  { address: spokeOft, abi: ERC20_ABI, functionName: "balanceOf", args: [u] },
@@ -3070,14 +3110,15 @@ async function getUserPositionMultiChain(vault, user) {
3070
3110
  } else {
3071
3111
  balance = rawBalance;
3072
3112
  }
3073
- return { chainId: spokeChainId, balance };
3113
+ return { chainId: spokeChainId, balance, rawBalance };
3074
3114
  } catch {
3075
- return { chainId: spokeChainId, balance: 0n };
3115
+ return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
3076
3116
  }
3077
3117
  });
3078
3118
  const results = await Promise.all(spokePromises);
3079
- for (const { chainId, balance } of results) {
3119
+ for (const { chainId, balance, rawBalance } of results) {
3080
3120
  spokeShares[chainId] = balance;
3121
+ rawSpokeShares[chainId] = rawBalance;
3081
3122
  }
3082
3123
  }
3083
3124
  }
@@ -3097,6 +3138,7 @@ async function getUserPositionMultiChain(vault, user) {
3097
3138
  return {
3098
3139
  hubShares,
3099
3140
  spokeShares,
3141
+ rawSpokeShares,
3100
3142
  totalShares,
3101
3143
  estimatedAssets,
3102
3144
  sharePrice,
@@ -3242,6 +3284,7 @@ exports.quoteComposeFee = quoteComposeFee;
3242
3284
  exports.quoteDepositFromSpokeFee = quoteDepositFromSpokeFee;
3243
3285
  exports.quoteLzFee = quoteLzFee;
3244
3286
  exports.quoteRouteDepositFee = quoteRouteDepositFee;
3287
+ exports.quoteShareBridgeFee = quoteShareBridgeFee;
3245
3288
  exports.redeemAsync = redeemAsync;
3246
3289
  exports.redeemShares = redeemShares;
3247
3290
  exports.requestRedeem = requestRedeem;