@skip-go/widget 2.4.7 → 2.4.8

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.
Files changed (2) hide show
  1. package/build/index.es.js +13 -13
  2. package/package.json +1 -1
package/build/index.es.js CHANGED
@@ -4044,8 +4044,9 @@ priceImpactPercent, priceImpactThresholdReached, route, sourceAsset, sourceChain
4044
4044
  maximumFractionDigits: 6,
4045
4045
  });
4046
4046
  return {
4047
- inAsset: `${computed} ${feeAsset.symbol}`,
4048
- inUSD: usdFeeAmount && `${formatUSD(usdFeeAmount)}`,
4047
+ assetAmount: Number(computed),
4048
+ formattedAssetAmount: `${computed} ${feeAsset.symbol}`,
4049
+ formattedUsdAmount: usdFeeAmount ? `${formatUSD(usdFeeAmount)}` : undefined
4049
4050
  };
4050
4051
  }
4051
4052
  if (axelarTransferOperation) {
@@ -4054,8 +4055,9 @@ priceImpactPercent, priceImpactThresholdReached, route, sourceAsset, sourceChain
4054
4055
  maximumFractionDigits: 6,
4055
4056
  });
4056
4057
  return {
4057
- inAsset: `${computed} ${feeAsset.symbol}`,
4058
- inUSD: `${formatUSD(usdFeeAmount)}`,
4058
+ assetAmount: Number(computed),
4059
+ formattedAssetAmount: `${computed} ${feeAsset.symbol}`,
4060
+ formattedUsdAmount: usdFeeAmount ? `${formatUSD(usdFeeAmount)}` : undefined
4059
4061
  };
4060
4062
  }
4061
4063
  }, [axelarTransferOperation, hyperlaneTransferOperation]);
@@ -4073,17 +4075,15 @@ priceImpactPercent, priceImpactThresholdReached, route, sourceAsset, sourceChain
4073
4075
  maximumFractionDigits: 6,
4074
4076
  });
4075
4077
  return {
4076
- amount: Number(inAsset),
4077
- inAsset: `${inAsset} ${fee[0].originAsset.symbol}`,
4078
- inUSD: `${formatUSD(computedUsd)}`,
4078
+ assetAmount: Number(inAsset),
4079
+ formattedAssetAmount: `${inAsset} ${fee[0].originAsset.symbol}`,
4080
+ formattedUsdAmount: `${formatUSD(computedUsd)}`
4079
4081
  };
4080
4082
  }, [isSmartRelay, route.estimatedFees]);
4081
4083
  const totalAmountOut = useMemo(() => {
4082
- if (isSmartRelay) {
4083
- return String(parseFloat(amountOut) + ((smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.amount) || 0));
4084
- }
4085
- return amountOut;
4086
- }, [amountOut, isSmartRelay, smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.amount]);
4084
+ var _a, _b;
4085
+ return String(parseFloat(amountOut) + ((_a = smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.assetAmount) !== null && _a !== void 0 ? _a : 0) + ((_b = bridgingFee === null || bridgingFee === void 0 ? void 0 : bridgingFee.assetAmount) !== null && _b !== void 0 ? _b : 0));
4086
+ }, [amountOut, smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.assetAmount, bridgingFee === null || bridgingFee === void 0 ? void 0 : bridgingFee.assetAmount]);
4087
4087
  if (!(sourceChain && sourceAsset && destinationChain && destinationAsset)) {
4088
4088
  return null;
4089
4089
  }
@@ -4092,7 +4092,7 @@ priceImpactPercent, priceImpactThresholdReached, route, sourceAsset, sourceChain
4092
4092
  return (jsxs("div", { children: [jsxs("button", { className: "mr-2 tabular-nums", onClick: toggle, children: ["1 ", ((_a = left.recommendedSymbol) !== null && _a !== void 0 ? _a : '').replace(/\sEthereum$/, ''), " =", ' ', conversion.toLocaleString('en-US', {
4093
4093
  maximumFractionDigits: 4,
4094
4094
  }), ' ', ((_b = right.recommendedSymbol) !== null && _b !== void 0 ? _b : '').replace(/\sEthereum$/, '')] }), jsx("span", { className: "tabular-nums text-neutral-400", children: jsx(UsdValue, { error: null, chainId: right.chainID, denom: right.denom, coingeckoID: right.coingeckoID, value: conversion.toString() }) })] }));
4095
- } }), jsx("div", { className: "flex-grow" }), jsxs(Collapsible.Trigger, { className: cn('relative flex items-center gap-1 text-xs', "before:absolute before:-inset-2 before:content-['']", 'text-neutral-400'), children: [jsxs("span", { className: cn('animate-slide-left-and-fade tabular-nums text-neutral-400 transition-opacity', detailsOpen && 'hidden'), children: ["Slippage: ", slippage, "%"] }), jsx(ChevronDownIcon$1, { className: cn('h-4 w-4 transition', detailsOpen ? 'rotate-180' : 'rotate-0') })] })] }), jsx(Collapsible.Content, { className: cn('overflow-hidden', 'data-[state=open]:animate-collapsible-open', 'data-[state=closed]:animate-collapsible-closed'), children: jsxs("dl", { className: cn('mb-2 mt-4 grid grid-cols-2 gap-2', '[&_dt]:text-start [&_dt]:text-neutral-400', '[&_dd]:text-end [&_dd]:tabular-nums'), children: [priceImpactPercent ? (jsxs(Fragment, { children: [jsx("dt", { className: priceImpactThresholdReached ? 'text-red-500' : '', children: "Price Impact" }), jsx("dd", { className: priceImpactThresholdReached ? 'text-red-500' : '', children: formatPercent(priceImpactPercent) })] })) : null, jsx("dt", { children: "Slippage" }), jsxs("dd", { children: [jsx(SimpleTooltip, { label: "Click to change maximum slippage", children: jsx(StyledThemedButton, { className: cn('mr-1 inline-flex items-center gap-1 p-1 text-xs transition-colors', 'text-red-500', 'rounded'), onClick: () => disclosure.open('settingsDialog'), children: jsx(PencilSquareIcon, { className: "h-3 w-3" }) }) }), slippage, "%"] }), sourceFeeAsset && (jsxs(Fragment, { children: [jsx("dt", { children: "Estimated Transaction Fee" }), sourceChain.chainID !== 'stride-1' ? (jsxs("dd", { children: [gasRequired !== null && gasRequired !== void 0 ? gasRequired : '-', " ", sourceFeeAsset.recommendedSymbol] })) : (jsx("dd", { children: "--" }))] })), bridgingFee && (jsxs(Fragment, { children: [jsx("dt", { children: "Bridging Fee" }), jsxs("dd", { children: [(_b = bridgingFee === null || bridgingFee === void 0 ? void 0 : bridgingFee.inAsset) !== null && _b !== void 0 ? _b : '-', ' ', jsx("span", { className: "text-sm tabular-nums text-neutral-400", children: (_c = bridgingFee === null || bridgingFee === void 0 ? void 0 : bridgingFee.inUSD) !== null && _c !== void 0 ? _c : '-' })] })] })), smartRelayFee && (jsxs(Fragment, { children: [jsx("dt", { children: "Relayer Fee" }), jsxs("dd", { children: [(_d = smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.inAsset) !== null && _d !== void 0 ? _d : '-', ' ', jsx("span", { className: "text-sm tabular-nums text-neutral-400", children: (_e = smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.inUSD) !== null && _e !== void 0 ? _e : '-' })] })] }))] }) })] }));
4095
+ } }), jsx("div", { className: "flex-grow" }), jsxs(Collapsible.Trigger, { className: cn('relative flex items-center gap-1 text-xs', "before:absolute before:-inset-2 before:content-['']", 'text-neutral-400'), children: [jsxs("span", { className: cn('animate-slide-left-and-fade tabular-nums text-neutral-400 transition-opacity', detailsOpen && 'hidden'), children: ["Slippage: ", slippage, "%"] }), jsx(ChevronDownIcon$1, { className: cn('h-4 w-4 transition', detailsOpen ? 'rotate-180' : 'rotate-0') })] })] }), jsx(Collapsible.Content, { className: cn('overflow-hidden', 'data-[state=open]:animate-collapsible-open', 'data-[state=closed]:animate-collapsible-closed'), children: jsxs("dl", { className: cn('mb-2 mt-4 grid grid-cols-2 gap-2', '[&_dt]:text-start [&_dt]:text-neutral-400', '[&_dd]:text-end [&_dd]:tabular-nums'), children: [priceImpactPercent ? (jsxs(Fragment, { children: [jsx("dt", { className: priceImpactThresholdReached ? 'text-red-500' : '', children: "Price Impact" }), jsx("dd", { className: priceImpactThresholdReached ? 'text-red-500' : '', children: formatPercent(priceImpactPercent) })] })) : null, jsx("dt", { children: "Slippage" }), jsxs("dd", { children: [jsx(SimpleTooltip, { label: "Click to change maximum slippage", children: jsx(StyledThemedButton, { className: cn('mr-1 inline-flex items-center gap-1 p-1 text-xs transition-colors', 'text-red-500', 'rounded'), onClick: () => disclosure.open('settingsDialog'), children: jsx(PencilSquareIcon, { className: "h-3 w-3" }) }) }), slippage, "%"] }), sourceFeeAsset && (jsxs(Fragment, { children: [jsx("dt", { children: "Estimated Transaction Fee" }), sourceChain.chainID !== 'stride-1' ? (jsxs("dd", { children: [gasRequired !== null && gasRequired !== void 0 ? gasRequired : '-', " ", sourceFeeAsset.recommendedSymbol] })) : (jsx("dd", { children: "--" }))] })), bridgingFee && (jsxs(Fragment, { children: [jsx("dt", { children: "Bridging Fee" }), jsxs("dd", { children: [(_b = bridgingFee === null || bridgingFee === void 0 ? void 0 : bridgingFee.formattedAssetAmount) !== null && _b !== void 0 ? _b : '-', ' ', jsx("span", { className: "text-sm tabular-nums text-neutral-400", children: (_c = bridgingFee === null || bridgingFee === void 0 ? void 0 : bridgingFee.formattedUsdAmount) !== null && _c !== void 0 ? _c : '-' })] })] })), smartRelayFee && (jsxs(Fragment, { children: [jsx("dt", { children: "Relayer Fee" }), jsxs("dd", { children: [(_d = smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.formattedAssetAmount) !== null && _d !== void 0 ? _d : '-', ' ', jsx("span", { className: "text-sm tabular-nums text-neutral-400", children: (_e = smartRelayFee === null || smartRelayFee === void 0 ? void 0 : smartRelayFee.formattedUsdAmount) !== null && _e !== void 0 ? _e : '-' })] })] }))] }) })] }));
4096
4096
  };
4097
4097
 
4098
4098
  const iconMap = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@skip-go/widget",
3
3
  "description": "Swap widget",
4
- "version": "2.4.7",
4
+ "version": "2.4.8",
5
5
  "repository": "https://github.com/skip-mev/widget",
6
6
  "type": "module",
7
7
  "exports": {