@xswap-link/sdk 0.3.2 → 0.3.3

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
@@ -59,7 +59,7 @@ var xswap_config_default = {
59
59
  };
60
60
 
61
61
  // package.json
62
- var version = "0.3.2";
62
+ var version = "0.3.3";
63
63
 
64
64
  // src/components/WaitingForInit/index.tsx
65
65
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -667,11 +667,11 @@ var getErc20Balances = async (chain, wallet) => {
667
667
  };
668
668
 
669
669
  // src/utils/numbers.ts
670
- var import_bignumber = require("bignumber.js");
670
+ var import_bignumber = __toESM(require("bignumber.js"));
671
671
  var import_ethers2 = require("ethers");
672
672
  var safeBigNumberFrom = (value) => {
673
- import_bignumber.BigNumber.config({ DECIMAL_PLACES: 0 });
674
- return import_ethers2.BigNumber.from(new import_bignumber.BigNumber(value).div(1).toFixed());
673
+ import_bignumber.default.config({ DECIMAL_PLACES: 0 });
674
+ return import_ethers2.BigNumber.from(new import_bignumber.default(value).div(1).toFixed());
675
675
  };
676
676
  var weiToHumanReadable = ({
677
677
  amount,
@@ -680,8 +680,8 @@ var weiToHumanReadable = ({
680
680
  prettifySmallNumber = false
681
681
  }) => {
682
682
  const decimalsFactor = Math.pow(10, decimals);
683
- import_bignumber.BigNumber.config({ DECIMAL_PLACES: precisionFractionalPlaces });
684
- const res = new import_bignumber.BigNumber(amount).div(decimalsFactor).toFixed();
683
+ import_bignumber.default.config({ DECIMAL_PLACES: precisionFractionalPlaces });
684
+ const res = new import_bignumber.default(amount).div(decimalsFactor).toFixed();
685
685
  if (prettifySmallNumber && res === "0" && amount !== "0") {
686
686
  return `<${(1 / 10 ** precisionFractionalPlaces).toFixed(
687
687
  precisionFractionalPlaces
@@ -2115,8 +2115,8 @@ var ChainListElement = ({
2115
2115
  };
2116
2116
 
2117
2117
  // src/components/TxConfigForm/BalanceComponent.tsx
2118
- var import_react8 = require("react");
2119
2118
  var import_bignumber3 = __toESM(require("bignumber.js"));
2119
+ var import_react8 = require("react");
2120
2120
  var import_jsx_runtime40 = require("react/jsx-runtime");
2121
2121
  var BalanceComponent = ({ srcToken, balances }) => {
2122
2122
  const balanceText = (0, import_react8.useMemo)(() => {
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ var xswap_config_default = {
23
23
  };
24
24
 
25
25
  // package.json
26
- var version = "0.3.2";
26
+ var version = "0.3.3";
27
27
 
28
28
  // src/components/WaitingForInit/index.tsx
29
29
  import { jsx } from "react/jsx-runtime";
@@ -631,7 +631,7 @@ var getErc20Balances = async (chain, wallet) => {
631
631
  };
632
632
 
633
633
  // src/utils/numbers.ts
634
- import { BigNumber as BigNumberJS } from "bignumber.js";
634
+ import BigNumberJS from "bignumber.js";
635
635
  import { BigNumber as BigNumber2, utils } from "ethers";
636
636
  var safeBigNumberFrom = (value) => {
637
637
  BigNumberJS.config({ DECIMAL_PLACES: 0 });
@@ -2085,8 +2085,8 @@ var ChainListElement = ({
2085
2085
  };
2086
2086
 
2087
2087
  // src/components/TxConfigForm/BalanceComponent.tsx
2088
- import { useMemo as useMemo4 } from "react";
2089
2088
  import BigNumber3 from "bignumber.js";
2089
+ import { useMemo as useMemo4 } from "react";
2090
2090
  import { Fragment as Fragment5, jsx as jsx39, jsxs as jsxs17 } from "react/jsx-runtime";
2091
2091
  var BalanceComponent = ({ srcToken, balances }) => {
2092
2092
  const balanceText = useMemo4(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xswap-link/sdk",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "JavaScript SDK for XSwap platform",
5
5
  "homepage": "https://github.com/xswap-link/xswap-sdk",
6
6
  "repository": {
@@ -18,11 +18,14 @@
18
18
  "main": "dist/index.js",
19
19
  "module": "dist/index.mjs",
20
20
  "types": "dist/index.d.ts",
21
+ "unpkg": "dist/index.global.js",
22
+ "jsdelivr": "dist/index.global.js",
21
23
  "exports": {
22
24
  ".": {
23
25
  "import": "./dist/index.mjs",
24
26
  "require": "./dist/index.js",
25
- "types": "./dist/index.d.ts"
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.global.js"
26
29
  },
27
30
  "./styles": "./dist/index.css"
28
31
  },
@@ -55,7 +58,7 @@
55
58
  "tailwindcss": "^3.4.3",
56
59
  "ts-jest": "^29.1.2",
57
60
  "ts-node": "^10.9.2",
58
- "tsup": "^8.0.2",
61
+ "tsup": "^8.1.0",
59
62
  "typescript": "^5.3.3"
60
63
  },
61
64
  "peerDependencies": {
@@ -64,8 +67,12 @@
64
67
  "react": ">=16 || <=18",
65
68
  "react-dom": ">=16 || <=18"
66
69
  },
70
+ "optionalDependencies": {
71
+ "pino-pretty": "^v7.6.0"
72
+ },
67
73
  "scripts": {
68
- "build": "tsup src/index.ts --format cjs,esm --dts",
74
+ "build": "tsup src/index.ts --format cjs,esm --dts && pnpm build:cdn",
75
+ "build:cdn": "tsup src/index.ts --format iife --minify --global-name XPay",
69
76
  "watch": "pnpm build && nodemon",
70
77
  "release": "pnpm build && changeset publish",
71
78
  "lint": "tsc && eslint . --ext .ts",
@@ -1,8 +1,8 @@
1
- import { FC, useMemo } from "react";
1
+ import { MINIMUM_DISPLAYED_TOKEN_AMOUNT } from "@src/constants";
2
2
  import { Token, TokenBalances } from "@src/models";
3
3
  import { weiToHumanReadable } from "@src/utils";
4
4
  import BigNumber from "bignumber.js";
5
- import { MINIMUM_DISPLAYED_TOKEN_AMOUNT } from "@src/constants";
5
+ import { FC, useMemo } from "react";
6
6
 
7
7
  interface Props {
8
8
  srcToken: Token | undefined;
@@ -10,6 +10,7 @@ interface Props {
10
10
  }
11
11
 
12
12
  export const BalanceComponent: FC<Props> = ({ srcToken, balances }) => {
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
14
  const balanceText = useMemo(() => {
14
15
  if (!balances || !srcToken) return "0";
15
16
  if (balances[srcToken.address]?.toString() === "0") return "0";
@@ -1,4 +1,4 @@
1
- import { BigNumber as BigNumberJS } from "bignumber.js";
1
+ import BigNumberJS from "bignumber.js";
2
2
  import { BigNumber, utils } from "ethers";
3
3
 
4
4
  export const safeBigNumberFrom = (value: string) => {