@rango-dev/widget-embedded 0.43.1-next.5 → 0.43.1-next.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.43.1-next.5",
3
+ "version": "0.43.1-next.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -54,4 +54,4 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  }
57
- }
57
+ }
@@ -123,9 +123,7 @@ export function WalletList(props: PropTypes) {
123
123
  ? getConciseAddress(address, ACCOUNT_ADDRESS_MAX_CHARACTERS)
124
124
  : '';
125
125
  const isConnectedButDifferentThanTargetNamespace =
126
- isConnected && wallet.isHub
127
- ? !conciseAddress
128
- : !!wallet.needsNamespace && !conciseAddress;
126
+ isConnected && !!wallet.needsNamespace && !conciseAddress;
129
127
 
130
128
  const experimentalChain = isExperimentalChain(blockchains(), chain);
131
129
 
@@ -41,14 +41,18 @@ export function getUsdExchangeRate(params: {
41
41
  if (!toTokenUsdPrice || !fromTokenUsdPrice) {
42
42
  return { rawValue: '0', displayValue: '0' };
43
43
  }
44
-
45
44
  const toPrice = new BigNumber(toTokenUsdPrice);
46
45
  const fromPrice = new BigNumber(fromTokenUsdPrice);
47
46
  const rawValue = toPrice.dividedBy(fromPrice);
48
47
  let displayValue: string;
49
48
 
50
49
  if (rawValue.isLessThan(1)) {
51
- displayValue = rawValue.toFixed(SMALL_VALUE_DECIMALS);
50
+ /*
51
+ * Format the number with up to SMALL_VALUE_DECIMALS digits after the decimal point,
52
+ * then remove any trailing zeros.
53
+ * Example: "0.120000" → "0.12", "0.00000000000010" → "0.0000000000001"
54
+ */
55
+ displayValue = rawValue.toFixed(SMALL_VALUE_DECIMALS).replace(/\.?0+$/, '');
52
56
  } else if (rawValue.toFixed(0).length > LARGE_VALUE_MAX_DIGITS) {
53
57
  displayValue = rawValue.toFixed(0).slice(0, LARGE_VALUE_MAX_DIGITS);
54
58
  } else {