@oydual31/more-vaults-sdk 0.3.1 → 0.3.3

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,4 +1,4 @@
1
- import { Address, WalletClient, PublicClient, Hash } from 'viem';
1
+ import { Address, PublicClient, WalletClient, Hash } from 'viem';
2
2
 
3
3
  /**
4
4
  * Wait for a transaction receipt with generous timeout and retry logic.
@@ -193,6 +193,17 @@ declare function waitForAsyncRequest(publicClient: PublicClient, vault: Address,
193
193
  refunded: boolean;
194
194
  result: bigint;
195
195
  }) => void): Promise<AsyncRequestFinalResult>;
196
+ /**
197
+ * Detect whether an OFT address is a Stargate V2 pool by calling `stargateType()`.
198
+ *
199
+ * Stargate pools implement this function (returns 0=Pool, 1=OFT).
200
+ * Standard OFTs revert because they don't have it.
201
+ *
202
+ * @param publicClient Viem public client on the OFT's chain
203
+ * @param oft OFT contract address
204
+ * @returns true if the contract is a Stargate V2 pool/OFT
205
+ */
206
+ declare function detectStargateOft(publicClient: PublicClient, oft: Address): Promise<boolean>;
196
207
 
197
208
  interface UserPosition {
198
209
  /** Vault share balance */
@@ -618,4 +629,4 @@ declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<
618
629
  */
619
630
  declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, amount: bigint, userAddress: Address): Promise<bigint>;
620
631
 
621
- export { type AsyncRequestFinalResult as A, getVaultDistribution as B, getVaultDistributionWithTopology as C, type DepositBlockReason as D, getVaultMetadata as E, getVaultStatus as F, getVaultSummary as G, getVaultTopology as H, type InboundRoute as I, isAsyncMode as J, isOnHubChain as K, previewDeposit as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, previewRedeem as P, quoteLzFee as Q, quoteRouteDepositFee as R, type SpokeBalance as S, waitForAsyncRequest as T, type UserBalances as U, type VaultDistribution as V, waitForTx as W, type AsyncRequestStatus as a, type AsyncRequestStatusInfo as b, type DepositEligibility as c, type InboundRouteWithBalance as d, type MultiChainUserPosition as e, type OutboundRoute as f, type UserPosition as g, type VaultMetadata as h, type VaultMode as i, type VaultStatus as j, type VaultSummary as k, type VaultTopology as l, canDeposit as m, discoverVaultTopology as n, ensureAllowance as o, getAllVaultChainIds as p, getAsyncRequestStatus as q, getAsyncRequestStatusLabel as r, getFullVaultTopology as s, getInboundRoutes as t, getMaxWithdrawable as u, getOutboundRoutes as v, getUserBalances as w, getUserBalancesForRoutes as x, getUserPosition as y, getUserPositionMultiChain as z };
632
+ export { type AsyncRequestFinalResult as A, getUserPositionMultiChain as B, getVaultDistribution as C, type DepositBlockReason as D, getVaultDistributionWithTopology as E, getVaultMetadata as F, getVaultStatus as G, getVaultSummary as H, type InboundRoute as I, getVaultTopology as J, isAsyncMode as K, isOnHubChain as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, previewDeposit as P, previewRedeem as Q, quoteLzFee as R, type SpokeBalance as S, quoteRouteDepositFee as T, type UserBalances as U, type VaultDistribution as V, waitForAsyncRequest as W, waitForTx as X, type AsyncRequestStatus as a, type AsyncRequestStatusInfo as b, type DepositEligibility as c, type InboundRouteWithBalance as d, type MultiChainUserPosition as e, type OutboundRoute as f, type UserPosition as g, type VaultMetadata as h, type VaultMode as i, type VaultStatus as j, type VaultSummary as k, type VaultTopology as l, canDeposit as m, detectStargateOft as n, discoverVaultTopology as o, ensureAllowance as p, getAllVaultChainIds as q, getAsyncRequestStatus as r, getAsyncRequestStatusLabel as s, getFullVaultTopology as t, getInboundRoutes as u, getMaxWithdrawable as v, getOutboundRoutes as w, getUserBalances as x, getUserBalancesForRoutes as y, getUserPosition as z };
@@ -1,4 +1,4 @@
1
- import { Address, WalletClient, PublicClient, Hash } from 'viem';
1
+ import { Address, PublicClient, WalletClient, Hash } from 'viem';
2
2
 
3
3
  /**
4
4
  * Wait for a transaction receipt with generous timeout and retry logic.
@@ -193,6 +193,17 @@ declare function waitForAsyncRequest(publicClient: PublicClient, vault: Address,
193
193
  refunded: boolean;
194
194
  result: bigint;
195
195
  }) => void): Promise<AsyncRequestFinalResult>;
196
+ /**
197
+ * Detect whether an OFT address is a Stargate V2 pool by calling `stargateType()`.
198
+ *
199
+ * Stargate pools implement this function (returns 0=Pool, 1=OFT).
200
+ * Standard OFTs revert because they don't have it.
201
+ *
202
+ * @param publicClient Viem public client on the OFT's chain
203
+ * @param oft OFT contract address
204
+ * @returns true if the contract is a Stargate V2 pool/OFT
205
+ */
206
+ declare function detectStargateOft(publicClient: PublicClient, oft: Address): Promise<boolean>;
196
207
 
197
208
  interface UserPosition {
198
209
  /** Vault share balance */
@@ -618,4 +629,4 @@ declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<
618
629
  */
619
630
  declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, amount: bigint, userAddress: Address): Promise<bigint>;
620
631
 
621
- export { type AsyncRequestFinalResult as A, getVaultDistribution as B, getVaultDistributionWithTopology as C, type DepositBlockReason as D, getVaultMetadata as E, getVaultStatus as F, getVaultSummary as G, getVaultTopology as H, type InboundRoute as I, isAsyncMode as J, isOnHubChain as K, previewDeposit as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, previewRedeem as P, quoteLzFee as Q, quoteRouteDepositFee as R, type SpokeBalance as S, waitForAsyncRequest as T, type UserBalances as U, type VaultDistribution as V, waitForTx as W, type AsyncRequestStatus as a, type AsyncRequestStatusInfo as b, type DepositEligibility as c, type InboundRouteWithBalance as d, type MultiChainUserPosition as e, type OutboundRoute as f, type UserPosition as g, type VaultMetadata as h, type VaultMode as i, type VaultStatus as j, type VaultSummary as k, type VaultTopology as l, canDeposit as m, discoverVaultTopology as n, ensureAllowance as o, getAllVaultChainIds as p, getAsyncRequestStatus as q, getAsyncRequestStatusLabel as r, getFullVaultTopology as s, getInboundRoutes as t, getMaxWithdrawable as u, getOutboundRoutes as v, getUserBalances as w, getUserBalancesForRoutes as x, getUserPosition as y, getUserPositionMultiChain as z };
632
+ export { type AsyncRequestFinalResult as A, getUserPositionMultiChain as B, getVaultDistribution as C, type DepositBlockReason as D, getVaultDistributionWithTopology as E, getVaultMetadata as F, getVaultStatus as G, getVaultSummary as H, type InboundRoute as I, getVaultTopology as J, isAsyncMode as K, isOnHubChain as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, previewDeposit as P, previewRedeem as Q, quoteLzFee as R, type SpokeBalance as S, quoteRouteDepositFee as T, type UserBalances as U, type VaultDistribution as V, waitForAsyncRequest as W, waitForTx as X, type AsyncRequestStatus as a, type AsyncRequestStatusInfo as b, type DepositEligibility as c, type InboundRouteWithBalance as d, type MultiChainUserPosition as e, type OutboundRoute as f, type UserPosition as g, type VaultMetadata as h, type VaultMode as i, type VaultStatus as j, type VaultSummary as k, type VaultTopology as l, canDeposit as m, detectStargateOft as n, discoverVaultTopology as o, ensureAllowance as p, getAllVaultChainIds as q, getAsyncRequestStatus as r, getAsyncRequestStatusLabel as s, getFullVaultTopology as t, getInboundRoutes as u, getMaxWithdrawable as v, getOutboundRoutes as w, getUserBalances as x, getUserBalancesForRoutes as y, getUserPosition as z };
@@ -387,6 +387,18 @@ var LZ_TIMEOUTS = {
387
387
  FULL_SPOKE_REDEEM: 36e5
388
388
  // 60 min
389
389
  };
390
+ var UNISWAP_V3_ROUTERS = {
391
+ [8453]: "0x2626664c2603336E57B271c5C0b26F421741e481",
392
+ // Base — SwapRouter02 (no deadline)
393
+ [1]: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
394
+ // Ethereum — SwapRouter
395
+ [42161]: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
396
+ // Arbitrum — SwapRouter
397
+ [10]: "0xE592427A0AEce92De3Edee1F18E0157C05861564",
398
+ // Optimism — SwapRouter
399
+ [747]: "0xeEDC6Ff75e1b10B903D9013c358e446a73d35341"
400
+ // Flow EVM — FlowSwap V3 SwapRouter
401
+ };
390
402
  var USDC_STARGATE_OFT = Object.fromEntries(
391
403
  Object.entries(OFT_ROUTES.stgUSDC).map(([k, v]) => [k, v.oft])
392
404
  );
@@ -1458,6 +1470,27 @@ async function waitForAsyncRequest(publicClient, vault, guid, pollInterval = 3e4
1458
1470
  `[MoreVaults] Async request ${guid} did not finalize within ${timeout / 1e3}s. The request may still complete \u2014 check https://layerzeroscan.com/tx/${guid}`
1459
1471
  );
1460
1472
  }
1473
+ var STARGATE_TYPE_ABI = [
1474
+ {
1475
+ type: "function",
1476
+ name: "stargateType",
1477
+ inputs: [],
1478
+ outputs: [{ type: "uint8" }],
1479
+ stateMutability: "view"
1480
+ }
1481
+ ];
1482
+ async function detectStargateOft(publicClient, oft) {
1483
+ try {
1484
+ await publicClient.readContract({
1485
+ address: viem.getAddress(oft),
1486
+ abi: STARGATE_TYPE_ABI,
1487
+ functionName: "stargateType"
1488
+ });
1489
+ return true;
1490
+ } catch {
1491
+ return false;
1492
+ }
1493
+ }
1461
1494
  var PUBLIC_RPCS = {
1462
1495
  1: [
1463
1496
  "https://ethereum-rpc.publicnode.com",
@@ -1856,21 +1889,11 @@ var COMPOSER_ABI = [
1856
1889
  stateMutability: "view"
1857
1890
  }
1858
1891
  ];
1859
- var STARGATE_ASSETS = /* @__PURE__ */ new Set(["stgUSDC", "USDT", "WETH"]);
1860
1892
  function buildLzComposeOption(gas, nativeValue) {
1861
1893
  const gasHex = gas.toString(16).padStart(32, "0");
1862
1894
  const valueHex = nativeValue.toString(16).padStart(32, "0");
1863
1895
  return `0x00030300220000${gasHex}${valueHex}`;
1864
1896
  }
1865
- function isStargateOft(oft) {
1866
- for (const [symbol, chainMap] of Object.entries(OFT_ROUTES)) {
1867
- if (!STARGATE_ASSETS.has(symbol)) continue;
1868
- for (const entry of Object.values(chainMap)) {
1869
- if (viem.getAddress(entry.oft) === oft) return true;
1870
- }
1871
- }
1872
- return false;
1873
- }
1874
1897
  async function resolveComposeNativeValue(hubClient, vault, composerAddress, spokeEid, receiverBytes32) {
1875
1898
  const [readFeeResult, shareOftResult] = await Promise.allSettled([
1876
1899
  hubClient.readContract({
@@ -1934,7 +1957,7 @@ async function depositFromSpoke(walletClient, publicClient, vault, spokeOFT, hub
1934
1957
  if (composerAddress === viem.zeroAddress) throw new Error(`No composer registered for vault ${vault} on hub chainId ${hubChainId}`);
1935
1958
  const composerBytes32 = viem.pad(composerAddress, { size: 32 });
1936
1959
  const receiverBytes32 = viem.pad(viem.getAddress(receiver), { size: 32 });
1937
- const isStargate = isStargateOft(oft);
1960
+ const isStargate = await detectStargateOft(publicClient, oft);
1938
1961
  let resolvedExtraOptions;
1939
1962
  if (extraOptions !== "0x") {
1940
1963
  resolvedExtraOptions = extraOptions;
@@ -2031,7 +2054,7 @@ async function depositFromSpoke(walletClient, publicClient, vault, spokeOFT, hub
2031
2054
  account,
2032
2055
  chain: walletClient.chain
2033
2056
  });
2034
- const stargate = isStargateOft(viem.getAddress(spokeOFT));
2057
+ const stargate = isStargate;
2035
2058
  let composeData;
2036
2059
  if (stargate) {
2037
2060
  const hubBlockStart = await hubClient.getBlockNumber();
@@ -2065,7 +2088,7 @@ async function quoteDepositFromSpokeFee(publicClient, vault, spokeOFT, hubEid, s
2065
2088
  args: [viem.getAddress(vault)]
2066
2089
  });
2067
2090
  const composerBytes32 = viem.pad(composerAddress, { size: 32 });
2068
- const isStargate = isStargateOft(oft);
2091
+ const isStargate = await detectStargateOft(publicClient, oft);
2069
2092
  let resolvedExtraOptions;
2070
2093
  if (extraOptions !== "0x") {
2071
2094
  resolvedExtraOptions = extraOptions;
@@ -2134,13 +2157,16 @@ async function waitForCompose(hubPublicClient, composeData, receiver, pollInterv
2134
2157
  const endpoint = viem.getAddress(composeData.endpoint);
2135
2158
  const receiverNeedle = viem.getAddress(receiver).slice(2).toLowerCase();
2136
2159
  const startBlock = composeData.hubBlockStart;
2137
- const knownFromAddresses = [];
2138
2160
  const hubChainId = composeData.hubChainId;
2139
- for (const [symbol, chainMap] of Object.entries(OFT_ROUTES)) {
2140
- if (!STARGATE_ASSETS.has(symbol)) continue;
2161
+ const candidateAddresses = [];
2162
+ for (const chainMap of Object.values(OFT_ROUTES)) {
2141
2163
  const entry = chainMap[hubChainId];
2142
- if (entry) knownFromAddresses.push(viem.getAddress(entry.oft));
2164
+ if (entry) candidateAddresses.push(viem.getAddress(entry.oft));
2143
2165
  }
2166
+ const stargateChecks = await Promise.all(
2167
+ candidateAddresses.map(async (addr) => ({ addr, isSg: await detectStargateOft(hubPublicClient, addr) }))
2168
+ );
2169
+ const knownFromAddresses = stargateChecks.filter((c) => c.isSg).map((c) => c.addr);
2144
2170
  let attempt = 0;
2145
2171
  let scannedUpTo = startBlock - 1n;
2146
2172
  while (Date.now() < deadline) {
@@ -2473,14 +2499,7 @@ async function preflightSpokeDeposit(spokePublicClient, vault, spokeOFT, hubEid,
2473
2499
  Have: ${spokeNativeBalance} wei`
2474
2500
  );
2475
2501
  }
2476
- const STARGATE_ASSETS3 = /* @__PURE__ */ new Set(["stgUSDC", "USDT", "WETH"]);
2477
- let isStargate = false;
2478
- for (const [symbol, chainMap] of Object.entries(OFT_ROUTES)) {
2479
- if (!STARGATE_ASSETS3.has(symbol)) continue;
2480
- for (const entry of Object.values(chainMap)) {
2481
- if (viem.getAddress(entry.oft) === oft) isStargate = true;
2482
- }
2483
- }
2502
+ const isStargate = await detectStargateOft(spokePublicClient, oft);
2484
2503
  let hubNativeBalance = 0n;
2485
2504
  let estimatedComposeFee = 0n;
2486
2505
  if (isStargate) {
@@ -2982,7 +3001,6 @@ async function bridgeAssetsToSpoke(walletClient, publicClient, assetOFT, spokeCh
2982
3001
  });
2983
3002
  return { txHash };
2984
3003
  }
2985
- var STARGATE_ASSETS2 = /* @__PURE__ */ new Set(["stgUSDC", "USDT", "WETH"]);
2986
3004
  var FACTORY_COMPOSER_ABI2 = [
2987
3005
  {
2988
3006
  type: "function",
@@ -3032,7 +3050,6 @@ async function resolveRedeemAddresses(hubPublicClient, vault, hubChainId, spokeC
3032
3050
  const spokeShareOft = viem.getAddress(`0x${spokeShareOftBytes32.slice(-40)}`);
3033
3051
  let hubAssetOft = null;
3034
3052
  let spokeAsset = null;
3035
- let isStargate = false;
3036
3053
  let symbol = "";
3037
3054
  for (const [sym, chainMap] of Object.entries(OFT_ROUTES)) {
3038
3055
  const hubEntry = chainMap[hubChainId];
@@ -3041,7 +3058,6 @@ async function resolveRedeemAddresses(hubPublicClient, vault, hubChainId, spokeC
3041
3058
  if (viem.getAddress(hubEntry.token) === viem.getAddress(hubAsset)) {
3042
3059
  hubAssetOft = viem.getAddress(hubEntry.oft);
3043
3060
  spokeAsset = viem.getAddress(spokeEntry.token);
3044
- isStargate = STARGATE_ASSETS2.has(sym);
3045
3061
  symbol = sym;
3046
3062
  break;
3047
3063
  }
@@ -3051,6 +3067,7 @@ async function resolveRedeemAddresses(hubPublicClient, vault, hubChainId, spokeC
3051
3067
  `[MoreVaults] No OFT route found for vault asset ${hubAsset} between hub chain ${hubChainId} and spoke chain ${spokeChainId}`
3052
3068
  );
3053
3069
  }
3070
+ const isStargate = await detectStargateOft(hubPublicClient, hubAssetOft);
3054
3071
  return {
3055
3072
  hubChainId,
3056
3073
  spokeChainId,
@@ -3638,6 +3655,45 @@ async function checkProtocolWhitelist(publicClient, vault, protocols) {
3638
3655
  }
3639
3656
  return out;
3640
3657
  }
3658
+ async function getVaultAssetBreakdown(publicClient, vault) {
3659
+ const v = viem.getAddress(vault);
3660
+ const availableRaw = await publicClient.readContract({
3661
+ address: v,
3662
+ abi: VAULT_ANALYSIS_ABI,
3663
+ functionName: "getAvailableAssets"
3664
+ });
3665
+ const addresses = availableRaw.map(viem.getAddress);
3666
+ const results = await publicClient.multicall({
3667
+ contracts: [
3668
+ // Per-asset: balanceOf, name, symbol, decimals
3669
+ ...addresses.flatMap((addr) => [
3670
+ { address: addr, abi: ERC20_ABI, functionName: "balanceOf", args: [v] },
3671
+ { address: addr, abi: METADATA_ABI, functionName: "name" },
3672
+ { address: addr, abi: METADATA_ABI, functionName: "symbol" },
3673
+ { address: addr, abi: METADATA_ABI, functionName: "decimals" }
3674
+ ]),
3675
+ // Vault totals
3676
+ { address: v, abi: VAULT_ABI, functionName: "totalAssets" },
3677
+ { address: v, abi: VAULT_ABI, functionName: "totalSupply" },
3678
+ { address: v, abi: METADATA_ABI, functionName: "decimals" }
3679
+ ],
3680
+ allowFailure: true
3681
+ });
3682
+ const perAssetFields = 4;
3683
+ const assets = addresses.map((addr, i) => {
3684
+ const base = i * perAssetFields;
3685
+ const balance = results[base]?.status === "success" ? results[base].result : 0n;
3686
+ const name = results[base + 1]?.status === "success" ? results[base + 1].result : "";
3687
+ const symbol = results[base + 2]?.status === "success" ? results[base + 2].result : "";
3688
+ const decimals = results[base + 3]?.status === "success" ? results[base + 3].result : 18;
3689
+ return { address: addr, name, symbol, decimals, balance };
3690
+ });
3691
+ const totalsBase = addresses.length * perAssetFields;
3692
+ const totalAssets = results[totalsBase]?.status === "success" ? results[totalsBase].result : 0n;
3693
+ const totalSupply = results[totalsBase + 1]?.status === "success" ? results[totalsBase + 1].result : 0n;
3694
+ const underlyingDecimals = results[totalsBase + 2]?.status === "success" ? results[totalsBase + 2].result : 6;
3695
+ return { assets, totalAssets, totalSupply, underlyingDecimals };
3696
+ }
3641
3697
  function encodeCuratorAction(action) {
3642
3698
  switch (action.type) {
3643
3699
  case "swap":
@@ -3783,6 +3839,114 @@ async function vetoActions(walletClient, publicClient, vault, nonces) {
3783
3839
  });
3784
3840
  return { txHash };
3785
3841
  }
3842
+ var UNISWAP_V3_SWAP_ROUTER_ABI = [
3843
+ {
3844
+ type: "function",
3845
+ name: "exactInputSingle",
3846
+ inputs: [
3847
+ {
3848
+ type: "tuple",
3849
+ name: "params",
3850
+ components: [
3851
+ { name: "tokenIn", type: "address" },
3852
+ { name: "tokenOut", type: "address" },
3853
+ { name: "fee", type: "uint24" },
3854
+ { name: "recipient", type: "address" },
3855
+ { name: "deadline", type: "uint256" },
3856
+ { name: "amountIn", type: "uint256" },
3857
+ { name: "amountOutMinimum", type: "uint256" },
3858
+ { name: "sqrtPriceLimitX96", type: "uint160" }
3859
+ ]
3860
+ }
3861
+ ],
3862
+ outputs: [{ name: "amountOut", type: "uint256" }],
3863
+ stateMutability: "payable"
3864
+ }
3865
+ ];
3866
+ var UNISWAP_V3_SWAP_ROUTER02_ABI = [
3867
+ {
3868
+ type: "function",
3869
+ name: "exactInputSingle",
3870
+ inputs: [
3871
+ {
3872
+ type: "tuple",
3873
+ name: "params",
3874
+ components: [
3875
+ { name: "tokenIn", type: "address" },
3876
+ { name: "tokenOut", type: "address" },
3877
+ { name: "fee", type: "uint24" },
3878
+ { name: "recipient", type: "address" },
3879
+ { name: "amountIn", type: "uint256" },
3880
+ { name: "amountOutMinimum", type: "uint256" },
3881
+ { name: "sqrtPriceLimitX96", type: "uint160" }
3882
+ ]
3883
+ }
3884
+ ],
3885
+ outputs: [{ name: "amountOut", type: "uint256" }],
3886
+ stateMutability: "payable"
3887
+ }
3888
+ ];
3889
+ var SWAP_ROUTER02_CHAINS = /* @__PURE__ */ new Set([8453]);
3890
+ function encodeUniswapV3SwapCalldata(params) {
3891
+ const { chainId, tokenIn, tokenOut, fee, amountIn, minAmountOut, recipient } = params;
3892
+ const router = UNISWAP_V3_ROUTERS[chainId];
3893
+ if (!router) {
3894
+ throw new Error(
3895
+ `[MoreVaults] No Uniswap V3 router configured for chainId ${chainId}. Supported chains: ${Object.keys(UNISWAP_V3_ROUTERS).join(", ")}`
3896
+ );
3897
+ }
3898
+ let swapCallData;
3899
+ if (SWAP_ROUTER02_CHAINS.has(chainId)) {
3900
+ swapCallData = viem.encodeFunctionData({
3901
+ abi: UNISWAP_V3_SWAP_ROUTER02_ABI,
3902
+ functionName: "exactInputSingle",
3903
+ args: [
3904
+ {
3905
+ tokenIn,
3906
+ tokenOut,
3907
+ fee,
3908
+ recipient,
3909
+ amountIn,
3910
+ amountOutMinimum: minAmountOut,
3911
+ sqrtPriceLimitX96: 0n
3912
+ }
3913
+ ]
3914
+ });
3915
+ } else {
3916
+ const deadline = BigInt(Math.floor(Date.now() / 1e3) + 1200);
3917
+ swapCallData = viem.encodeFunctionData({
3918
+ abi: UNISWAP_V3_SWAP_ROUTER_ABI,
3919
+ functionName: "exactInputSingle",
3920
+ args: [
3921
+ {
3922
+ tokenIn,
3923
+ tokenOut,
3924
+ fee,
3925
+ recipient,
3926
+ deadline,
3927
+ amountIn,
3928
+ amountOutMinimum: minAmountOut,
3929
+ sqrtPriceLimitX96: 0n
3930
+ }
3931
+ ]
3932
+ });
3933
+ }
3934
+ return { targetContract: router, swapCallData };
3935
+ }
3936
+ function buildUniswapV3Swap(params) {
3937
+ const { targetContract, swapCallData } = encodeUniswapV3SwapCalldata(params);
3938
+ return {
3939
+ type: "swap",
3940
+ params: {
3941
+ targetContract,
3942
+ tokenIn: params.tokenIn,
3943
+ tokenOut: params.tokenOut,
3944
+ maxAmountIn: params.amountIn,
3945
+ minAmountOut: params.minAmountOut,
3946
+ swapCallData
3947
+ }
3948
+ };
3949
+ }
3786
3950
 
3787
3951
  // src/viem/wagmiCompat.ts
3788
3952
  function asSdkClient(client) {
@@ -3822,6 +3986,7 @@ exports.OFT_ROUTES = OFT_ROUTES;
3822
3986
  exports.OMNI_FACTORY_ADDRESS = OMNI_FACTORY_ADDRESS;
3823
3987
  exports.REGISTRY_ABI = REGISTRY_ABI;
3824
3988
  exports.STARGATE_TAXI_CMD = STARGATE_TAXI_CMD;
3989
+ exports.UNISWAP_V3_ROUTERS = UNISWAP_V3_ROUTERS;
3825
3990
  exports.USDC_STARGATE_OFT = USDC_STARGATE_OFT;
3826
3991
  exports.USDC_TOKEN = USDC_TOKEN;
3827
3992
  exports.VAULT_ABI = VAULT_ABI;
@@ -3832,6 +3997,7 @@ exports.asSdkClient = asSdkClient;
3832
3997
  exports.bridgeAssetsToSpoke = bridgeAssetsToSpoke;
3833
3998
  exports.bridgeSharesToHub = bridgeSharesToHub;
3834
3999
  exports.buildCuratorBatch = buildCuratorBatch;
4000
+ exports.buildUniswapV3Swap = buildUniswapV3Swap;
3835
4001
  exports.canDeposit = canDeposit;
3836
4002
  exports.checkProtocolWhitelist = checkProtocolWhitelist;
3837
4003
  exports.depositAsync = depositAsync;
@@ -3840,8 +4006,10 @@ exports.depositFromSpoke = depositFromSpoke;
3840
4006
  exports.depositFromSpokeAsync = depositFromSpoke;
3841
4007
  exports.depositMultiAsset = depositMultiAsset;
3842
4008
  exports.depositSimple = depositSimple;
4009
+ exports.detectStargateOft = detectStargateOft;
3843
4010
  exports.discoverVaultTopology = discoverVaultTopology;
3844
4011
  exports.encodeCuratorAction = encodeCuratorAction;
4012
+ exports.encodeUniswapV3SwapCalldata = encodeUniswapV3SwapCalldata;
3845
4013
  exports.ensureAllowance = ensureAllowance;
3846
4014
  exports.executeActions = executeActions;
3847
4015
  exports.executeCompose = executeCompose;
@@ -3859,6 +4027,7 @@ exports.getUserBalancesForRoutes = getUserBalancesForRoutes;
3859
4027
  exports.getUserPosition = getUserPosition;
3860
4028
  exports.getUserPositionMultiChain = getUserPositionMultiChain;
3861
4029
  exports.getVaultAnalysis = getVaultAnalysis;
4030
+ exports.getVaultAssetBreakdown = getVaultAssetBreakdown;
3862
4031
  exports.getVaultDistribution = getVaultDistribution;
3863
4032
  exports.getVaultDistributionWithTopology = getVaultDistributionWithTopology;
3864
4033
  exports.getVaultMetadata = getVaultMetadata;