@xswap-link/sdk 0.6.7 → 0.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xswap-link/sdk",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "JavaScript SDK for XSwap platform",
5
5
  "homepage": "https://github.com/xswap-link/xswap-sdk",
6
6
  "repository": {
@@ -41,19 +41,18 @@
41
41
  "date-fns": "^3.6.0",
42
42
  "ethers": "5.7.2",
43
43
  "notistack": "^3.0.1",
44
+ "react-error-boundary": "^4.1.0",
44
45
  "react-virtuoso": "^4.7.12",
45
46
  "viem": "2.x",
46
47
  "wagmi": "^2.8.5"
47
48
  },
48
49
  "devDependencies": {
49
- "react": "^18.2.0",
50
- "react-dom": "^18.2.0",
51
- "@types/react": "^18.2.0",
52
- "@types/react-dom": "^18.2.0",
53
50
  "@changesets/cli": "^2.27.1",
54
51
  "@types/async-retry": "^1.4.8",
55
52
  "@types/jest": "^29.5.12",
56
53
  "@types/node": "^20.11.17",
54
+ "@types/react": "^18.2.0",
55
+ "@types/react-dom": "^18.2.0",
57
56
  "@typescript-eslint/eslint-plugin": "^7.1.0",
58
57
  "@typescript-eslint/parser": "^7.1.0",
59
58
  "eslint": "^8.57.0",
@@ -64,6 +63,8 @@
64
63
  "nodemon": "^3.1.0",
65
64
  "postcss-import": "^16.1.0",
66
65
  "postcss-minify": "^1.1.0",
66
+ "react": "^18.2.0",
67
+ "react-dom": "^18.2.0",
67
68
  "tailwindcss": "^3.4.3",
68
69
  "ts-jest": "^29.1.2",
69
70
  "tsup": "^8.1.0",
@@ -30,5 +30,5 @@ export const HistoryView = () => {
30
30
  );
31
31
  }, [history, historyLoadedOnce]);
32
32
 
33
- return <div className="h-[50vh] overflow-hidden">{view}</div>;
33
+ return <div className="h-[40vh] overflow-hidden">{view}</div>;
34
34
  };
@@ -9,9 +9,10 @@ import {
9
9
  import { ModalProvider } from "@src/context/ModalProvider";
10
10
  import { Chain, ModalIntegrationPayload, Route } from "@src/models";
11
11
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
12
- import { FC, MouseEvent, useEffect, useMemo, useState } from "react";
12
+ import { FC, MouseEvent, useEffect, useMemo } from "react";
13
13
  import { useReconnect, WagmiProvider } from "wagmi";
14
14
  import { changeHostVariableColor } from "../../../localTheme";
15
+ import { ErrorBoundary } from "react-error-boundary";
15
16
 
16
17
  export type TxConfigFormPayload = Omit<
17
18
  ModalIntegrationPayload,
@@ -74,12 +75,11 @@ export const TxConfigForm = ({
74
75
  overlay: false;
75
76
  }
76
77
  )) => {
77
- const [backdropClickDisabled, setBackdropClickDisabled] = useState(false);
78
78
  const onBackdropClick = (e: MouseEvent) => {
79
79
  e.stopPropagation();
80
80
  e.nativeEvent.stopImmediatePropagation();
81
81
 
82
- if (e.target === e.currentTarget && !backdropClickDisabled && overlay) {
82
+ if (e.target === e.currentTarget && overlay) {
83
83
  onClose();
84
84
  }
85
85
  };
@@ -94,52 +94,58 @@ export const TxConfigForm = ({
94
94
  }, [lightTheme, styles]);
95
95
 
96
96
  return (
97
- <WagmiProvider config={wagmiConfig}>
98
- <QueryClientProvider client={queryClient}>
99
- <WagmiReload />
100
- <HistoryProvider>
101
- <SwapProvider
102
- integrationConfig={{
103
- integratorId,
104
- dstChainId,
105
- dstTokenAddr,
106
- srcChainId,
107
- srcTokenAddr,
108
- customContractCalls,
109
- desc,
110
- dstDisplayTokenAddr,
111
- defaultWalletPicker,
112
- }}
113
- supportedChains={supportedChains}
114
- wagmiConfig={wagmiConfig}
115
- overlay={overlay}
116
- >
117
- <TransactionProvider>
118
- <TxUIWrapper>
119
- <ModalProvider>
120
- {overlay ? (
121
- <div
122
- className="top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10"
123
- onMouseDown={onBackdropClick}
124
- >
125
- <div className="relative bg-t_bg_primary rounded-3xl overflow-auto text-t_text_primary border-2 border-solid border-[rgba(255,255,255,0.1)] min-w-x_modal max-w-x_modal min-h-[432px] w-full">
126
- <Swap onSubmit={onSubmit} onClose={onClose} />
97
+ <ErrorBoundary
98
+ FallbackComponent={() => (
99
+ <div>Something went wrong, please contact XSwap.</div>
100
+ )}
101
+ >
102
+ <WagmiProvider config={wagmiConfig}>
103
+ <QueryClientProvider client={queryClient}>
104
+ <WagmiReload />
105
+ <HistoryProvider>
106
+ <SwapProvider
107
+ integrationConfig={{
108
+ integratorId,
109
+ dstChainId,
110
+ dstTokenAddr,
111
+ srcChainId,
112
+ srcTokenAddr,
113
+ customContractCalls,
114
+ desc,
115
+ dstDisplayTokenAddr,
116
+ defaultWalletPicker,
117
+ }}
118
+ supportedChains={supportedChains}
119
+ wagmiConfig={wagmiConfig}
120
+ overlay={overlay}
121
+ >
122
+ <TransactionProvider>
123
+ <TxUIWrapper>
124
+ <ModalProvider>
125
+ {overlay ? (
126
+ <div
127
+ className="top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10"
128
+ onMouseDown={onBackdropClick}
129
+ >
130
+ <div className="relative bg-t_bg_primary rounded-3xl overflow-auto text-t_text_primary border-2 border-solid border-[rgba(255,255,255,0.1)] min-w-x_modal max-w-x_modal min-h-[432px] w-full">
131
+ <Swap onSubmit={onSubmit} onClose={onClose} />
132
+ <PoweredBy />
133
+ </div>
134
+ </div>
135
+ ) : (
136
+ <div className="bg-t_bg_primary rounded-3xl overflow-auto text-t_text_primary border-2 border-solid border-[rgba(255,255,255,0.1)] min-h-[432px] w-full">
137
+ <Swap onSubmit={() => {}} onClose={() => {}} />
127
138
  <PoweredBy />
128
139
  </div>
129
- </div>
130
- ) : (
131
- <div className="bg-t_bg_primary rounded-3xl overflow-auto text-t_text_primary border-2 border-solid border-[rgba(255,255,255,0.1)] min-h-[432px] w-full">
132
- <Swap onSubmit={() => {}} onClose={() => {}} />
133
- <PoweredBy />
134
- </div>
135
- )}
136
- </ModalProvider>
137
- </TxUIWrapper>
138
- </TransactionProvider>
139
- </SwapProvider>
140
- </HistoryProvider>
141
- </QueryClientProvider>
142
- </WagmiProvider>
140
+ )}
141
+ </ModalProvider>
142
+ </TxUIWrapper>
143
+ </TransactionProvider>
144
+ </SwapProvider>
145
+ </HistoryProvider>
146
+ </QueryClientProvider>
147
+ </WagmiProvider>
148
+ </ErrorBoundary>
143
149
  );
144
150
  };
145
151
 
@@ -159,14 +165,14 @@ export const openTxConfigForm = async ({
159
165
  }: TxConfigFormPayload): Promise<Route> => {
160
166
  try {
161
167
  if (xpayRoot === null) {
162
- throw new Error("XPay was incorrectly initialised");
168
+ throw new Error("XPay was incorrectly initialized");
163
169
  }
164
170
 
165
171
  await waitForInitialization();
166
172
 
167
173
  return await new Promise(() => {
168
174
  if (xpayRoot === null) {
169
- throw new Error("XPay was incorrectly initialised");
175
+ throw new Error("XPay was incorrectly initialized");
170
176
  }
171
177
 
172
178
  xpayRoot.render(
@@ -117,7 +117,7 @@ export const renderTxStatusButtons = () => {
117
117
  ));
118
118
 
119
119
  if (xpayTxStatusRoot === null) {
120
- throw new Error("XPay was incorrectly initialised");
120
+ throw new Error("XPay was incorrectly initialized");
121
121
  }
122
122
 
123
123
  xpayTxStatusRoot.render(
@@ -4,6 +4,8 @@
4
4
 
5
5
  :host {
6
6
  color: white;
7
+ line-height: 1.5rem;
8
+ font-size: 1rem;
7
9
 
8
10
  /* Works on Firefox */
9
11
  * {