@jimmygu/sfa-sdk-test 1.0.14 → 1.0.16

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.d.mts CHANGED
@@ -601,6 +601,7 @@ interface GetAllQuoteParams {
601
601
  fee: number;
602
602
  }[];
603
603
  swapType?: "EXACT_INPUT" | "EXACT_OUTPUT";
604
+ isProxy?: boolean;
604
605
  };
605
606
  }
606
607
  /**
package/dist/index.d.ts CHANGED
@@ -601,6 +601,7 @@ interface GetAllQuoteParams {
601
601
  fee: number;
602
602
  }[];
603
603
  swapType?: "EXACT_INPUT" | "EXACT_OUTPUT";
604
+ isProxy?: boolean;
604
605
  };
605
606
  }
606
607
  /**
package/dist/index.js CHANGED
@@ -657,6 +657,7 @@ var OneClickService = class {
657
657
  amountWei,
658
658
  appFees = [],
659
659
  swapType = "EXACT_INPUT",
660
+ isProxy = true,
660
661
  ...restParams
661
662
  } = params;
662
663
  const isExactOutput = swapType === "EXACT_OUTPUT";
@@ -692,7 +693,7 @@ var OneClickService = class {
692
693
  try {
693
694
  let netFee = (0, import_big.default)(params.amount).div(10 ** params.fromToken.decimals).minus((0, import_big.default)(res.data?.quote?.amountOut || 0).div(10 ** params.toToken.decimals));
694
695
  if (isExactOutput) {
695
- netFee = (0, import_big.default)(res.data?.quote?.amountIn || 0).div(10 ** params.toToken.decimals).minus((0, import_big.default)(params.amount).div(10 ** params.fromToken.decimals));
696
+ netFee = (0, import_big.default)(res.data?.quote?.amountIn || 0).div(10 ** params.fromToken.decimals).minus((0, import_big.default)(params.amount).div(10 ** params.toToken.decimals));
696
697
  }
697
698
  const bridgeFeeValue = BridgeFee.reduce((acc, item) => {
698
699
  return acc.plus((0, import_big.default)(params.amount).div(10 ** params.fromToken.decimals).times((0, import_big.default)(item.fee).div(1e4)));
@@ -726,7 +727,7 @@ var OneClickService = class {
726
727
  console.log("oneclick estimate failed: %o", error);
727
728
  }
728
729
  const proxyAddress = ONECLICK_PROXY[params.fromToken.chainName];
729
- if (proxyAddress) {
730
+ if (proxyAddress && isProxy) {
730
731
  const proxyResult = await params.wallet.quote(Service.OneClick, {
731
732
  proxyAddress,
732
733
  abi: ONECLICK_PROXY_ABI,
@@ -4609,6 +4610,7 @@ var SFA = class {
4609
4610
  _params.refundType = "ORIGIN_CHAIN";
4610
4611
  _params.appFees = params.oneclickParams?.appFees;
4611
4612
  _params.swapType = params.oneclickParams?.swapType;
4613
+ _params.isProxy = params.oneclickParams?.isProxy;
4612
4614
  }
4613
4615
  if (service === Service.Usdt0) {
4614
4616
  _params.originChain = params.fromToken.chainName;
@@ -4830,7 +4832,8 @@ var HyperliquidService = class {
4830
4832
  amount: params.amountWei,
4831
4833
  refundType: "ORIGIN_CHAIN",
4832
4834
  appFees: params.oneclickParams?.appFees,
4833
- swapType: "EXACT_OUTPUT"
4835
+ swapType: "EXACT_OUTPUT",
4836
+ isProxy: false
4834
4837
  };
4835
4838
  try {
4836
4839
  const quoteRes = await ServiceMap[Service.OneClick].quote(quoteParams);
package/dist/index.mjs CHANGED
@@ -595,6 +595,7 @@ var OneClickService = class {
595
595
  amountWei,
596
596
  appFees = [],
597
597
  swapType = "EXACT_INPUT",
598
+ isProxy = true,
598
599
  ...restParams
599
600
  } = params;
600
601
  const isExactOutput = swapType === "EXACT_OUTPUT";
@@ -630,7 +631,7 @@ var OneClickService = class {
630
631
  try {
631
632
  let netFee = Big(params.amount).div(10 ** params.fromToken.decimals).minus(Big(res.data?.quote?.amountOut || 0).div(10 ** params.toToken.decimals));
632
633
  if (isExactOutput) {
633
- netFee = Big(res.data?.quote?.amountIn || 0).div(10 ** params.toToken.decimals).minus(Big(params.amount).div(10 ** params.fromToken.decimals));
634
+ netFee = Big(res.data?.quote?.amountIn || 0).div(10 ** params.fromToken.decimals).minus(Big(params.amount).div(10 ** params.toToken.decimals));
634
635
  }
635
636
  const bridgeFeeValue = BridgeFee.reduce((acc, item) => {
636
637
  return acc.plus(Big(params.amount).div(10 ** params.fromToken.decimals).times(Big(item.fee).div(1e4)));
@@ -664,7 +665,7 @@ var OneClickService = class {
664
665
  console.log("oneclick estimate failed: %o", error);
665
666
  }
666
667
  const proxyAddress = ONECLICK_PROXY[params.fromToken.chainName];
667
- if (proxyAddress) {
668
+ if (proxyAddress && isProxy) {
668
669
  const proxyResult = await params.wallet.quote(Service.OneClick, {
669
670
  proxyAddress,
670
671
  abi: ONECLICK_PROXY_ABI,
@@ -4547,6 +4548,7 @@ var SFA = class {
4547
4548
  _params.refundType = "ORIGIN_CHAIN";
4548
4549
  _params.appFees = params.oneclickParams?.appFees;
4549
4550
  _params.swapType = params.oneclickParams?.swapType;
4551
+ _params.isProxy = params.oneclickParams?.isProxy;
4550
4552
  }
4551
4553
  if (service === Service.Usdt0) {
4552
4554
  _params.originChain = params.fromToken.chainName;
@@ -4768,7 +4770,8 @@ var HyperliquidService = class {
4768
4770
  amount: params.amountWei,
4769
4771
  refundType: "ORIGIN_CHAIN",
4770
4772
  appFees: params.oneclickParams?.appFees,
4771
- swapType: "EXACT_OUTPUT"
4773
+ swapType: "EXACT_OUTPUT",
4774
+ isProxy: false
4772
4775
  };
4773
4776
  try {
4774
4777
  const quoteRes = await ServiceMap[Service.OneClick].quote(quoteParams);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimmygu/sfa-sdk-test",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "TypeScript SDK for StableFlow AI API - Cross-chain token swap solution",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",