@xswap-link/sdk 0.1.3 → 0.1.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @xswap-link/xswap-sdk
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 1c0c46a: fix button display styling and logic
8
+
3
9
  ## 0.1.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.css CHANGED
@@ -1060,44 +1060,6 @@ video {
1060
1060
  background-color: #252525;
1061
1061
  border-radius: 4px;
1062
1062
  }
1063
- button {
1064
- width: 100%;
1065
- }
1066
- button {
1067
- cursor: pointer;
1068
- }
1069
- button {
1070
- border-radius: 1rem;
1071
- }
1072
- button {
1073
- border-style: none;
1074
- }
1075
- button {
1076
- background-image: linear-gradient(to right, var(--tw-gradient-stops));
1077
- }
1078
- button {
1079
- --tw-gradient-from: #3681c6 var(--tw-gradient-from-position);
1080
- --tw-gradient-to: rgb(54 129 198 / 0) var(--tw-gradient-to-position);
1081
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
1082
- }
1083
- button {
1084
- --tw-gradient-to: #2b4a9d var(--tw-gradient-to-position);
1085
- }
1086
- button {
1087
- padding-top: 1rem;
1088
- padding-bottom: 1rem;
1089
- }
1090
- button {
1091
- font-size: 1.25rem;
1092
- line-height: 1.75rem;
1093
- }
1094
- button {
1095
- --tw-text-opacity: 1;
1096
- color: rgb(255 255 255 / var(--tw-text-opacity));
1097
- }
1098
- button:disabled {
1099
- opacity: 0.25;
1100
- }
1101
1063
  .globalBorder {
1102
1064
  border: 1px solid rgba(255, 255, 255, 0.1);
1103
1065
  }
@@ -1123,6 +1085,9 @@ video {
1123
1085
  outline: 2px solid transparent;
1124
1086
  outline-offset: 2px;
1125
1087
  }
1088
+ .disabled\:opacity-25:disabled {
1089
+ opacity: 0.25;
1090
+ }
1126
1091
  @media (min-width: 640px) {
1127
1092
  .sm\:h-6 {
1128
1093
  height: 1.5rem;
package/dist/index.js CHANGED
@@ -2305,8 +2305,23 @@ var Description = ({ description }) => {
2305
2305
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex flex-col items-start rounded-lg px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-full flex gap-4 items-start justify-between text-xl", children: description }) });
2306
2306
  };
2307
2307
 
2308
- // src/components/TxConfigForm/Form.tsx
2308
+ // src/components/TxConfigForm/Button.tsx
2309
2309
  var import_jsx_runtime37 = require("react/jsx-runtime");
2310
+ var Button = ({ children, onClick, type, disabled }) => {
2311
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2312
+ "button",
2313
+ {
2314
+ className: "text-white border-none rounded-2xl text-xl py-4 cursor-pointer w-full bg-gradient-to-r from-[#3681c6] to-[#2b4a9d] disabled:opacity-25",
2315
+ onClick,
2316
+ type,
2317
+ disabled,
2318
+ children
2319
+ }
2320
+ );
2321
+ };
2322
+
2323
+ // src/components/TxConfigForm/Form.tsx
2324
+ var import_jsx_runtime38 = require("react/jsx-runtime");
2310
2325
  var Form = ({
2311
2326
  dstChainId,
2312
2327
  dstTokenAddr,
@@ -2437,13 +2452,13 @@ var Form = ({
2437
2452
  const handleSwitchChain = async () => {
2438
2453
  await switchChainAsync({ chainId: Number(srcChain?.chainId) });
2439
2454
  };
2440
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
2455
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
2441
2456
  "form",
2442
2457
  {
2443
2458
  className: "flex flex-col gap-2 z-10 my-0 mx-auto p-4 rounded-3xl overflow-hidden font-light w-x_mobile sm:w-x_desktop",
2444
2459
  onSubmit: handleSubmit,
2445
2460
  children: [
2446
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2461
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2447
2462
  TopBar,
2448
2463
  {
2449
2464
  signer,
@@ -2452,7 +2467,7 @@ var Form = ({
2452
2467
  setSettingsShown
2453
2468
  }
2454
2469
  ),
2455
- settingsShown && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2470
+ settingsShown && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2456
2471
  Settings,
2457
2472
  {
2458
2473
  expressChecked,
@@ -2462,9 +2477,9 @@ var Form = ({
2462
2477
  setSlippage
2463
2478
  }
2464
2479
  ),
2465
- historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(History, { signer, supportedChains }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex flex-col gap-2", children: [
2466
- desc && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Description, { description: desc }),
2467
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2480
+ historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(History, { signer, supportedChains }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-2", children: [
2481
+ desc && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Description, { description: desc }),
2482
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2468
2483
  SwapPanel,
2469
2484
  {
2470
2485
  amount,
@@ -2479,7 +2494,7 @@ var Form = ({
2479
2494
  setSrcChain
2480
2495
  }
2481
2496
  ),
2482
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2497
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2483
2498
  Summary,
2484
2499
  {
2485
2500
  isGettingRoute,
@@ -2488,7 +2503,7 @@ var Form = ({
2488
2503
  dstChain
2489
2504
  }
2490
2505
  ),
2491
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2506
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2492
2507
  FeesDetails,
2493
2508
  {
2494
2509
  route,
@@ -2501,17 +2516,9 @@ var Form = ({
2501
2516
  setFeesDetailsShown
2502
2517
  }
2503
2518
  ),
2504
- formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ErrorField, { error: formError }),
2505
- srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2506
- "button",
2507
- {
2508
- disabled: !signer,
2509
- type: "button",
2510
- onClick: handleSwitchChain,
2511
- children: "Switch chain"
2512
- }
2513
- ) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
2514
- "button",
2519
+ formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ErrorField, { error: formError }),
2520
+ signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2521
+ Button,
2515
2522
  {
2516
2523
  type: "submit",
2517
2524
  disabled: !signer || !route || isGettingRoute,
@@ -2525,7 +2532,7 @@ var Form = ({
2525
2532
  };
2526
2533
 
2527
2534
  // src/components/TxConfigForm/index.tsx
2528
- var import_jsx_runtime38 = require("react/jsx-runtime");
2535
+ var import_jsx_runtime39 = require("react/jsx-runtime");
2529
2536
  var TxConfigForm = ({
2530
2537
  dstChainId,
2531
2538
  dstTokenAddr,
@@ -2547,13 +2554,13 @@ var TxConfigForm = ({
2547
2554
  () => getWagmiConfig(supportedChains),
2548
2555
  supportedChains
2549
2556
  );
2550
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_wagmi3.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2557
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_wagmi3.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2551
2558
  "div",
2552
2559
  {
2553
2560
  className: "top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10",
2554
2561
  onClick: onBackdropClick,
2555
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "relative bg-black rounded-3xl w-lg overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]", children: [
2556
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2562
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "relative bg-black rounded-3xl w-lg overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]", children: [
2563
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2557
2564
  Form,
2558
2565
  {
2559
2566
  dstChainId,
@@ -2564,19 +2571,19 @@ var TxConfigForm = ({
2564
2571
  onSubmit
2565
2572
  }
2566
2573
  ),
2567
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2574
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2568
2575
  "div",
2569
2576
  {
2570
2577
  className: "absolute top-7 right-4 cursor-pointer text-white",
2571
2578
  onClick: onClose,
2572
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CloseIcon, {})
2579
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CloseIcon, {})
2573
2580
  }
2574
2581
  ),
2575
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "swappage__poweredby", children: [
2576
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "Powered by" }),
2577
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(XSwapBadgeIcon, {}),
2578
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: "\u2715" }),
2579
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChainlinkCCIPIcon, {})
2582
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "swappage__poweredby", children: [
2583
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "Powered by" }),
2584
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(XSwapBadgeIcon, {}),
2585
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: "\u2715" }),
2586
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChainlinkCCIPIcon, {})
2580
2587
  ] })
2581
2588
  ] })
2582
2589
  }
@@ -2592,7 +2599,7 @@ var openTxConfigForm = async ({
2592
2599
  try {
2593
2600
  return await new Promise((resolve) => {
2594
2601
  txConfigFormRoot.render(
2595
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
2602
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2596
2603
  TxConfigForm,
2597
2604
  {
2598
2605
  dstChainId,
@@ -2626,7 +2633,7 @@ if (typeof document !== "undefined") {
2626
2633
  // src/components/TxHistoryButton/index.tsx
2627
2634
  var import_react12 = require("react");
2628
2635
  var import_client2 = require("react-dom/client");
2629
- var import_jsx_runtime39 = require("react/jsx-runtime");
2636
+ var import_jsx_runtime40 = require("react/jsx-runtime");
2630
2637
  var TxHistoryButton = ({ transaction }) => {
2631
2638
  const {
2632
2639
  fromChain,
@@ -2641,15 +2648,15 @@ var TxHistoryButton = ({ transaction }) => {
2641
2648
  explorer
2642
2649
  } = transaction;
2643
2650
  const [isWide, setIsWide] = (0, import_react12.useState)(false);
2644
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-2", onClick: () => setIsWide((x) => !x), children: [
2645
- isWide && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
2651
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-2", onClick: () => setIsWide((x) => !x), children: [
2652
+ isWide && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
2646
2653
  "div",
2647
2654
  {
2648
2655
  className: `flex items-center min-w-60 sm:w-[520px] text-white h-14 px-4 text-sm gap-3 rounded-xl bg-gradient-to-r ${isDone ? "from-[rgba(76,175,80,0.1)] to-[rgba(46,125,50,0.1)] border border-solid border-x_green_dark" : "from-[rgba(54,129,198,0.1)] to-[rgba(43,74,157,0.1)] border border-solid border-x_blue_dark"}`,
2649
2656
  children: [
2650
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-between flex-col gap-2 sm:gap-5 sm:flex-row w-full", children: [
2651
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-2", children: [
2652
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2657
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex justify-between flex-col gap-2 sm:gap-5 sm:flex-row w-full", children: [
2658
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
2659
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2653
2660
  "img",
2654
2661
  {
2655
2662
  className: "w-5 h-5",
@@ -2657,16 +2664,16 @@ var TxHistoryButton = ({ transaction }) => {
2657
2664
  alt: "source chain"
2658
2665
  }
2659
2666
  ),
2660
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: fromChain }),
2661
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ArrowRightIcon, {}) }),
2662
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { className: "w-5 h-5", src: toChainImage, alt: "to chain" }),
2663
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: toChain })
2667
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: fromChain }),
2668
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ArrowRightIcon, {}) }),
2669
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { className: "w-5 h-5", src: toChainImage, alt: "to chain" }),
2670
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: toChain })
2664
2671
  ] }),
2665
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-2", children: [
2666
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: "Sent" }),
2667
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: fromAmount }),
2668
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { children: fromToken }),
2669
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2672
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
2673
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: "Sent" }),
2674
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: fromAmount }),
2675
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: fromToken }),
2676
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2670
2677
  "img",
2671
2678
  {
2672
2679
  className: "w-5 h-5",
@@ -2676,7 +2683,7 @@ var TxHistoryButton = ({ transaction }) => {
2676
2683
  )
2677
2684
  ] })
2678
2685
  ] }),
2679
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2686
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2680
2687
  "a",
2681
2688
  {
2682
2689
  href: explorer,
@@ -2684,22 +2691,22 @@ var TxHistoryButton = ({ transaction }) => {
2684
2691
  rel: "noreferrer",
2685
2692
  className: "no-underline cursor-pointer",
2686
2693
  "aria-label": "Show the transaction in the chain explorer",
2687
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ArrowUpRightIcon, {}) })
2694
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ArrowUpRightIcon, {}) })
2688
2695
  }
2689
2696
  )
2690
2697
  ]
2691
2698
  }
2692
2699
  ),
2693
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
2700
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
2694
2701
  "div",
2695
2702
  {
2696
2703
  className: `text-white rounded-xl cursor-pointer bg-gradient-to-r
2697
2704
  ${isDone ? "from-[rgba(76,175,80,0.1)] to-[rgba(46,125,50,0.1)] border border-solid border-x_green_dark" : "from-[rgba(54,129,198,0.1)] to-[rgba(43,74,157,0.1)] border border-solid border-x_blue_dark"}`,
2698
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex gap-2 items-center h-14 w-20 justify-center", children: [
2699
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ArrowLeftIcon, {}),
2700
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CheckIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
2701
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "w-5 h-5", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(XSwapLogo, {}) }),
2702
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CircularProgressIcon, {}) })
2705
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-2 items-center h-14 w-20 justify-center", children: [
2706
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ArrowLeftIcon, {}),
2707
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CheckIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
2708
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-5 h-5", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(XSwapLogo, {}) }),
2709
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CircularProgressIcon, {}) })
2703
2710
  ] }) })
2704
2711
  ] })
2705
2712
  }
@@ -2734,14 +2741,14 @@ historyElement.setAttribute(
2734
2741
  document.body.appendChild(historyElement);
2735
2742
  var txHistoryButtonRoot = (0, import_client2.createRoot)(historyElement);
2736
2743
  var renderTxHistoryButtons = () => {
2737
- const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TxHistoryButton, { transaction: item }, item.txHash));
2744
+ const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TxHistoryButton, { transaction: item }, item.txHash));
2738
2745
  txHistoryButtonRoot.render(buttons);
2739
2746
  };
2740
2747
 
2741
2748
  // src/components/Skeleton/index.tsx
2742
- var import_jsx_runtime40 = require("react/jsx-runtime");
2749
+ var import_jsx_runtime41 = require("react/jsx-runtime");
2743
2750
  var Skeleton = ({ width, height }) => {
2744
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: `bg-current rounded animate-pulse ${width} ${height}` });
2751
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: `bg-current rounded animate-pulse ${width} ${height}` });
2745
2752
  };
2746
2753
  // Annotate the CommonJS export names for ESM import in node:
2747
2754
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -2228,8 +2228,23 @@ var Description = ({ description }) => {
2228
2228
  return /* @__PURE__ */ jsx35("div", { className: "flex flex-col items-start rounded-lg px-4 py-2", children: /* @__PURE__ */ jsx35("div", { className: "w-full flex gap-4 items-start justify-between text-xl", children: description }) });
2229
2229
  };
2230
2230
 
2231
+ // src/components/TxConfigForm/Button.tsx
2232
+ import { jsx as jsx36 } from "react/jsx-runtime";
2233
+ var Button = ({ children, onClick, type, disabled }) => {
2234
+ return /* @__PURE__ */ jsx36(
2235
+ "button",
2236
+ {
2237
+ className: "text-white border-none rounded-2xl text-xl py-4 cursor-pointer w-full bg-gradient-to-r from-[#3681c6] to-[#2b4a9d] disabled:opacity-25",
2238
+ onClick,
2239
+ type,
2240
+ disabled,
2241
+ children
2242
+ }
2243
+ );
2244
+ };
2245
+
2231
2246
  // src/components/TxConfigForm/Form.tsx
2232
- import { jsx as jsx36, jsxs as jsxs16 } from "react/jsx-runtime";
2247
+ import { jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
2233
2248
  var Form = ({
2234
2249
  dstChainId,
2235
2250
  dstTokenAddr,
@@ -2366,7 +2381,7 @@ var Form = ({
2366
2381
  className: "flex flex-col gap-2 z-10 my-0 mx-auto p-4 rounded-3xl overflow-hidden font-light w-x_mobile sm:w-x_desktop",
2367
2382
  onSubmit: handleSubmit,
2368
2383
  children: [
2369
- /* @__PURE__ */ jsx36(
2384
+ /* @__PURE__ */ jsx37(
2370
2385
  TopBar,
2371
2386
  {
2372
2387
  signer,
@@ -2375,7 +2390,7 @@ var Form = ({
2375
2390
  setSettingsShown
2376
2391
  }
2377
2392
  ),
2378
- settingsShown && /* @__PURE__ */ jsx36(
2393
+ settingsShown && /* @__PURE__ */ jsx37(
2379
2394
  Settings,
2380
2395
  {
2381
2396
  expressChecked,
@@ -2385,9 +2400,9 @@ var Form = ({
2385
2400
  setSlippage
2386
2401
  }
2387
2402
  ),
2388
- historyTabShown ? /* @__PURE__ */ jsx36(History, { signer, supportedChains }) : /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
2389
- desc && /* @__PURE__ */ jsx36(Description, { description: desc }),
2390
- /* @__PURE__ */ jsx36(
2403
+ historyTabShown ? /* @__PURE__ */ jsx37(History, { signer, supportedChains }) : /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
2404
+ desc && /* @__PURE__ */ jsx37(Description, { description: desc }),
2405
+ /* @__PURE__ */ jsx37(
2391
2406
  SwapPanel,
2392
2407
  {
2393
2408
  amount,
@@ -2402,7 +2417,7 @@ var Form = ({
2402
2417
  setSrcChain
2403
2418
  }
2404
2419
  ),
2405
- /* @__PURE__ */ jsx36(
2420
+ /* @__PURE__ */ jsx37(
2406
2421
  Summary,
2407
2422
  {
2408
2423
  isGettingRoute,
@@ -2411,7 +2426,7 @@ var Form = ({
2411
2426
  dstChain
2412
2427
  }
2413
2428
  ),
2414
- /* @__PURE__ */ jsx36(
2429
+ /* @__PURE__ */ jsx37(
2415
2430
  FeesDetails,
2416
2431
  {
2417
2432
  route,
@@ -2424,17 +2439,9 @@ var Form = ({
2424
2439
  setFeesDetailsShown
2425
2440
  }
2426
2441
  ),
2427
- formError.length > 0 && /* @__PURE__ */ jsx36(ErrorField, { error: formError }),
2428
- srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ jsx36(
2429
- "button",
2430
- {
2431
- disabled: !signer,
2432
- type: "button",
2433
- onClick: handleSwitchChain,
2434
- children: "Switch chain"
2435
- }
2436
- ) : /* @__PURE__ */ jsx36(
2437
- "button",
2442
+ formError.length > 0 && /* @__PURE__ */ jsx37(ErrorField, { error: formError }),
2443
+ signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ jsx37(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ jsx37(
2444
+ Button,
2438
2445
  {
2439
2446
  type: "submit",
2440
2447
  disabled: !signer || !route || isGettingRoute,
@@ -2448,7 +2455,7 @@ var Form = ({
2448
2455
  };
2449
2456
 
2450
2457
  // src/components/TxConfigForm/index.tsx
2451
- import { jsx as jsx37, jsxs as jsxs17 } from "react/jsx-runtime";
2458
+ import { jsx as jsx38, jsxs as jsxs17 } from "react/jsx-runtime";
2452
2459
  var TxConfigForm = ({
2453
2460
  dstChainId,
2454
2461
  dstTokenAddr,
@@ -2470,13 +2477,13 @@ var TxConfigForm = ({
2470
2477
  () => getWagmiConfig(supportedChains),
2471
2478
  supportedChains
2472
2479
  );
2473
- return /* @__PURE__ */ jsx37(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx37(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx37(
2480
+ return /* @__PURE__ */ jsx38(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx38(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx38(
2474
2481
  "div",
2475
2482
  {
2476
2483
  className: "top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10",
2477
2484
  onClick: onBackdropClick,
2478
2485
  children: /* @__PURE__ */ jsxs17("div", { className: "relative bg-black rounded-3xl w-lg overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]", children: [
2479
- /* @__PURE__ */ jsx37(
2486
+ /* @__PURE__ */ jsx38(
2480
2487
  Form,
2481
2488
  {
2482
2489
  dstChainId,
@@ -2487,19 +2494,19 @@ var TxConfigForm = ({
2487
2494
  onSubmit
2488
2495
  }
2489
2496
  ),
2490
- /* @__PURE__ */ jsx37(
2497
+ /* @__PURE__ */ jsx38(
2491
2498
  "div",
2492
2499
  {
2493
2500
  className: "absolute top-7 right-4 cursor-pointer text-white",
2494
2501
  onClick: onClose,
2495
- children: /* @__PURE__ */ jsx37(CloseIcon, {})
2502
+ children: /* @__PURE__ */ jsx38(CloseIcon, {})
2496
2503
  }
2497
2504
  ),
2498
2505
  /* @__PURE__ */ jsxs17("div", { className: "swappage__poweredby", children: [
2499
- /* @__PURE__ */ jsx37("span", { children: "Powered by" }),
2500
- /* @__PURE__ */ jsx37(XSwapBadgeIcon, {}),
2501
- /* @__PURE__ */ jsx37("span", { children: "\u2715" }),
2502
- /* @__PURE__ */ jsx37(ChainlinkCCIPIcon, {})
2506
+ /* @__PURE__ */ jsx38("span", { children: "Powered by" }),
2507
+ /* @__PURE__ */ jsx38(XSwapBadgeIcon, {}),
2508
+ /* @__PURE__ */ jsx38("span", { children: "\u2715" }),
2509
+ /* @__PURE__ */ jsx38(ChainlinkCCIPIcon, {})
2503
2510
  ] })
2504
2511
  ] })
2505
2512
  }
@@ -2515,7 +2522,7 @@ var openTxConfigForm = async ({
2515
2522
  try {
2516
2523
  return await new Promise((resolve) => {
2517
2524
  txConfigFormRoot.render(
2518
- /* @__PURE__ */ jsx37(
2525
+ /* @__PURE__ */ jsx38(
2519
2526
  TxConfigForm,
2520
2527
  {
2521
2528
  dstChainId,
@@ -2549,7 +2556,7 @@ if (typeof document !== "undefined") {
2549
2556
  // src/components/TxHistoryButton/index.tsx
2550
2557
  import { useState as useState9 } from "react";
2551
2558
  import { createRoot as createRoot2 } from "react-dom/client";
2552
- import { Fragment as Fragment6, jsx as jsx38, jsxs as jsxs18 } from "react/jsx-runtime";
2559
+ import { Fragment as Fragment6, jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
2553
2560
  var TxHistoryButton = ({ transaction }) => {
2554
2561
  const {
2555
2562
  fromChain,
@@ -2572,7 +2579,7 @@ var TxHistoryButton = ({ transaction }) => {
2572
2579
  children: [
2573
2580
  /* @__PURE__ */ jsxs18("div", { className: "flex justify-between flex-col gap-2 sm:gap-5 sm:flex-row w-full", children: [
2574
2581
  /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
2575
- /* @__PURE__ */ jsx38(
2582
+ /* @__PURE__ */ jsx39(
2576
2583
  "img",
2577
2584
  {
2578
2585
  className: "w-5 h-5",
@@ -2580,16 +2587,16 @@ var TxHistoryButton = ({ transaction }) => {
2580
2587
  alt: "source chain"
2581
2588
  }
2582
2589
  ),
2583
- /* @__PURE__ */ jsx38("div", { children: fromChain }),
2584
- /* @__PURE__ */ jsx38("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx38(ArrowRightIcon, {}) }),
2585
- /* @__PURE__ */ jsx38("img", { className: "w-5 h-5", src: toChainImage, alt: "to chain" }),
2586
- /* @__PURE__ */ jsx38("div", { children: toChain })
2590
+ /* @__PURE__ */ jsx39("div", { children: fromChain }),
2591
+ /* @__PURE__ */ jsx39("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx39(ArrowRightIcon, {}) }),
2592
+ /* @__PURE__ */ jsx39("img", { className: "w-5 h-5", src: toChainImage, alt: "to chain" }),
2593
+ /* @__PURE__ */ jsx39("div", { children: toChain })
2587
2594
  ] }),
2588
2595
  /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
2589
- /* @__PURE__ */ jsx38("div", { children: "Sent" }),
2590
- /* @__PURE__ */ jsx38("div", { children: fromAmount }),
2591
- /* @__PURE__ */ jsx38("div", { children: fromToken }),
2592
- /* @__PURE__ */ jsx38(
2596
+ /* @__PURE__ */ jsx39("div", { children: "Sent" }),
2597
+ /* @__PURE__ */ jsx39("div", { children: fromAmount }),
2598
+ /* @__PURE__ */ jsx39("div", { children: fromToken }),
2599
+ /* @__PURE__ */ jsx39(
2593
2600
  "img",
2594
2601
  {
2595
2602
  className: "w-5 h-5",
@@ -2599,7 +2606,7 @@ var TxHistoryButton = ({ transaction }) => {
2599
2606
  )
2600
2607
  ] })
2601
2608
  ] }),
2602
- /* @__PURE__ */ jsx38(
2609
+ /* @__PURE__ */ jsx39(
2603
2610
  "a",
2604
2611
  {
2605
2612
  href: explorer,
@@ -2607,22 +2614,22 @@ var TxHistoryButton = ({ transaction }) => {
2607
2614
  rel: "noreferrer",
2608
2615
  className: "no-underline cursor-pointer",
2609
2616
  "aria-label": "Show the transaction in the chain explorer",
2610
- children: /* @__PURE__ */ jsx38("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx38(ArrowUpRightIcon, {}) })
2617
+ children: /* @__PURE__ */ jsx39("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx39(ArrowUpRightIcon, {}) })
2611
2618
  }
2612
2619
  )
2613
2620
  ]
2614
2621
  }
2615
2622
  ),
2616
- /* @__PURE__ */ jsx38(
2623
+ /* @__PURE__ */ jsx39(
2617
2624
  "div",
2618
2625
  {
2619
2626
  className: `text-white rounded-xl cursor-pointer bg-gradient-to-r
2620
2627
  ${isDone ? "from-[rgba(76,175,80,0.1)] to-[rgba(46,125,50,0.1)] border border-solid border-x_green_dark" : "from-[rgba(54,129,198,0.1)] to-[rgba(43,74,157,0.1)] border border-solid border-x_blue_dark"}`,
2621
2628
  children: /* @__PURE__ */ jsxs18("div", { className: "flex gap-2 items-center h-14 w-20 justify-center", children: [
2622
- /* @__PURE__ */ jsx38(ArrowLeftIcon, {}),
2623
- /* @__PURE__ */ jsx38("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ jsx38("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ jsx38(CheckIcon, {}) }) : /* @__PURE__ */ jsxs18(Fragment6, { children: [
2624
- /* @__PURE__ */ jsx38("div", { className: "w-5 h-5", children: /* @__PURE__ */ jsx38(XSwapLogo, {}) }),
2625
- /* @__PURE__ */ jsx38("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ jsx38(CircularProgressIcon, {}) })
2629
+ /* @__PURE__ */ jsx39(ArrowLeftIcon, {}),
2630
+ /* @__PURE__ */ jsx39("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ jsx39("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ jsx39(CheckIcon, {}) }) : /* @__PURE__ */ jsxs18(Fragment6, { children: [
2631
+ /* @__PURE__ */ jsx39("div", { className: "w-5 h-5", children: /* @__PURE__ */ jsx39(XSwapLogo, {}) }),
2632
+ /* @__PURE__ */ jsx39("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ jsx39(CircularProgressIcon, {}) })
2626
2633
  ] }) })
2627
2634
  ] })
2628
2635
  }
@@ -2657,14 +2664,14 @@ historyElement.setAttribute(
2657
2664
  document.body.appendChild(historyElement);
2658
2665
  var txHistoryButtonRoot = createRoot2(historyElement);
2659
2666
  var renderTxHistoryButtons = () => {
2660
- const buttons = renderedTransactions.map((item) => /* @__PURE__ */ jsx38(TxHistoryButton, { transaction: item }, item.txHash));
2667
+ const buttons = renderedTransactions.map((item) => /* @__PURE__ */ jsx39(TxHistoryButton, { transaction: item }, item.txHash));
2661
2668
  txHistoryButtonRoot.render(buttons);
2662
2669
  };
2663
2670
 
2664
2671
  // src/components/Skeleton/index.tsx
2665
- import { jsx as jsx39 } from "react/jsx-runtime";
2672
+ import { jsx as jsx40 } from "react/jsx-runtime";
2666
2673
  var Skeleton = ({ width, height }) => {
2667
- return /* @__PURE__ */ jsx39("div", { className: `bg-current rounded animate-pulse ${width} ${height}` });
2674
+ return /* @__PURE__ */ jsx40("div", { className: `bg-current rounded animate-pulse ${width} ${height}` });
2668
2675
  };
2669
2676
  export {
2670
2677
  ADDRESSES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xswap-link/sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "JavaScript SDK for XSwap platform",
5
5
  "homepage": "https://github.com/xswap-link/xswap-sdk",
6
6
  "repository": {
@@ -0,0 +1,20 @@
1
+ import { FC, ReactNode } from "react";
2
+
3
+ interface Props {
4
+ children: ReactNode;
5
+ onClick?: () => void;
6
+ type?: "submit" | "reset" | "button";
7
+ disabled?: boolean;
8
+ }
9
+ export const Button: FC<Props> = ({ children, onClick, type, disabled }) => {
10
+ return (
11
+ <button
12
+ className="text-white border-none rounded-2xl text-xl py-4 cursor-pointer w-full bg-gradient-to-r from-[#3681c6] to-[#2b4a9d] disabled:opacity-25"
13
+ onClick={onClick}
14
+ type={type}
15
+ disabled={disabled}
16
+ >
17
+ {children}
18
+ </button>
19
+ );
20
+ };
@@ -18,6 +18,7 @@ import { SwapPanel } from "./SwapPanel";
18
18
  import { ErrorField } from "./ErrorField";
19
19
  import { Description } from "./Description";
20
20
  import { DEFAULT_SOURCE_CHAIN_ID } from "@src/constants";
21
+ import { Button } from "./Button";
21
22
 
22
23
  export const Form = ({
23
24
  dstChainId,
@@ -233,21 +234,19 @@ export const Form = ({
233
234
  setFeesDetailsShown={setFeesDetailsShown}
234
235
  />
235
236
  {formError.length > 0 && <ErrorField error={formError} />}
236
- {srcChain && srcChain.chainId !== account.chainId?.toString() ? (
237
- <button
238
- disabled={!signer}
239
- type="button"
240
- onClick={handleSwitchChain}
241
- >
237
+ {signer &&
238
+ srcChain &&
239
+ srcChain.chainId !== account.chainId?.toString() ? (
240
+ <Button type="button" onClick={handleSwitchChain}>
242
241
  Switch chain
243
- </button>
242
+ </Button>
244
243
  ) : (
245
- <button
244
+ <Button
246
245
  type="submit"
247
246
  disabled={!signer || !route || isGettingRoute}
248
247
  >
249
248
  Submit
250
- </button>
249
+ </Button>
251
250
  )}
252
251
  </div>
253
252
  )}
@@ -24,10 +24,6 @@
24
24
  border-radius: 4px;
25
25
  }
26
26
 
27
- button {
28
- @apply text-white border-none rounded-2xl text-xl py-4 cursor-pointer w-full bg-gradient-to-r from-[#3681c6] to-[#2b4a9d] disabled:opacity-25;
29
- }
30
-
31
27
  .globalBorder {
32
28
  border: 1px solid rgba(255, 255, 255, 0.1);
33
29
  }