@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.js CHANGED
@@ -2338,7 +2338,7 @@ async function getNearQuote(sourceChain, destChain, amount, destToken, sourceTok
2338
2338
  throw new Error("Recipient address is required for NEAR Quote");
2339
2339
  }
2340
2340
  const refundAddress = senderAddress || recipient;
2341
- console.log(`[NearService] Requesting Quote: ${sourceChain} -> ${destChain}`, { amount, sourceAsset, destAsset, options });
2341
+ console.log(`[NearService] Requesting Quote: ${sourceChain} -> ${destChain}`, JSON.stringify({ amount, sourceAsset, destAsset, options }, null, 2));
2342
2342
  const quoteRequest = {
2343
2343
  dry: options?.dry || false,
2344
2344
  swapType: oneClickSdkTypescript.QuoteRequest.swapType.EXACT_INPUT,
@@ -2357,12 +2357,12 @@ async function getNearQuote(sourceChain, destChain, amount, destToken, sourceTok
2357
2357
  quoteWaitingTimeMs: 1e4
2358
2358
  };
2359
2359
  const quote = await oneClickSdkTypescript.OneClickService.getQuote(quoteRequest);
2360
- if (!quote.quote?.depositAddress) {
2360
+ if (!options?.dry && !quote.quote?.depositAddress) {
2361
2361
  throw new Error("No deposit address returned from 1-Click Quote");
2362
2362
  }
2363
2363
  return {
2364
2364
  quote,
2365
- depositAddress: quote.quote.depositAddress,
2365
+ depositAddress: quote.quote?.depositAddress || "",
2366
2366
  amountAtomicTotal: BigInt(amountAtomicTotal),
2367
2367
  amountAtomicNet
2368
2368
  };
@@ -2376,7 +2376,12 @@ async function getNearSimulation(sourceChain, destChain, amount, destToken, sour
2376
2376
  const isDev = process.env.NEXT_PUBLIC_ENVIROMENT === "development" || process.env.NODE_ENV === "development";
2377
2377
  const usedFee = isDev ? PlatformFees.DEV : PlatformFees.EVM_TO_OTHER;
2378
2378
  const MIN_AMOUNT = usedFee;
2379
- const netAmountBridged = (amountNum - usedFee).toFixed(6);
2379
+ const sourceConfig = NETWORKS[sourceChain];
2380
+ const sourceAssetInfo = sourceConfig?.crossChainInformation?.nearIntentInformation?.assetsId.find(
2381
+ (a) => a.name === (sourceToken || "USDC")
2382
+ ) || sourceConfig?.crossChainInformation?.nearIntentInformation?.assetsId[0];
2383
+ const decimals = sourceAssetInfo?.decimals || (sourceChain === "Stellar" ? 7 : 6);
2384
+ const netAmountBridged = (amountNum - usedFee).toFixed(decimals);
2380
2385
  if (parseFloat(netAmountBridged) <= 0) {
2381
2386
  return {
2382
2387
  success: false,