@1llet.xyz/erc4337-gasless-sdk 0.4.41 → 0.4.44

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/index.mjs CHANGED
@@ -2314,7 +2314,7 @@ async function getNearQuote(sourceChain, destChain, amount, destToken, sourceTok
2314
2314
  throw new Error("Recipient address is required for NEAR Quote");
2315
2315
  }
2316
2316
  const refundAddress = senderAddress || recipient;
2317
- console.log(`[NearService] Requesting Quote: ${sourceChain} -> ${destChain}`, { amount, sourceAsset, destAsset, options });
2317
+ console.log(`[NearService] Requesting Quote: ${sourceChain} -> ${destChain}`, JSON.stringify({ amount, sourceAsset, destAsset, options }, null, 2));
2318
2318
  const quoteRequest = {
2319
2319
  dry: options?.dry || false,
2320
2320
  swapType: QuoteRequest.swapType.EXACT_INPUT,
@@ -2333,12 +2333,12 @@ async function getNearQuote(sourceChain, destChain, amount, destToken, sourceTok
2333
2333
  quoteWaitingTimeMs: 1e4
2334
2334
  };
2335
2335
  const quote = await OneClickService.getQuote(quoteRequest);
2336
- if (!quote.quote?.depositAddress) {
2336
+ if (!options?.dry && !quote.quote?.depositAddress) {
2337
2337
  throw new Error("No deposit address returned from 1-Click Quote");
2338
2338
  }
2339
2339
  return {
2340
2340
  quote,
2341
- depositAddress: quote.quote.depositAddress,
2341
+ depositAddress: quote.quote?.depositAddress || "",
2342
2342
  amountAtomicTotal: BigInt(amountAtomicTotal),
2343
2343
  amountAtomicNet
2344
2344
  };
@@ -2352,7 +2352,12 @@ async function getNearSimulation(sourceChain, destChain, amount, destToken, sour
2352
2352
  const isDev = process.env.NEXT_PUBLIC_ENVIROMENT === "development" || process.env.NODE_ENV === "development";
2353
2353
  const usedFee = isDev ? PlatformFees.DEV : PlatformFees.EVM_TO_OTHER;
2354
2354
  const MIN_AMOUNT = usedFee;
2355
- const netAmountBridged = (amountNum - usedFee).toFixed(6);
2355
+ const sourceConfig = NETWORKS[sourceChain];
2356
+ const sourceAssetInfo = sourceConfig?.crossChainInformation?.nearIntentInformation?.assetsId.find(
2357
+ (a) => a.name === (sourceToken || "USDC")
2358
+ ) || sourceConfig?.crossChainInformation?.nearIntentInformation?.assetsId[0];
2359
+ const decimals = sourceAssetInfo?.decimals || (sourceChain === "Stellar" ? 7 : 6);
2360
+ const netAmountBridged = (amountNum - usedFee).toFixed(decimals);
2356
2361
  if (parseFloat(netAmountBridged) <= 0) {
2357
2362
  return {
2358
2363
  success: false,