@xswap-link/sdk 0.6.6 → 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/CHANGELOG.md +12 -0
- package/dist/index.global.js +146 -147
- package/dist/index.js +8 -9
- package/dist/index.mjs +7 -8
- package/package.json +6 -5
- package/src/components/Swap/HistoryView/index.tsx +1 -1
- package/src/components/TxConfigForm/index.tsx +55 -49
- package/src/components/TxStatusButton/index.tsx +1 -1
- package/src/components/global.css +2 -0
- package/tsup.config.ts +2 -2
- package/dist/index.global.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xswap-link/sdk",
|
|
3
|
-
"version": "0.6.
|
|
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",
|
|
@@ -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
|
|
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 &&
|
|
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
|
-
<
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
|
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
|
|
175
|
+
throw new Error("XPay was incorrectly initialized");
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
xpayRoot.render(
|
package/tsup.config.ts
CHANGED
|
@@ -10,7 +10,7 @@ export default defineConfig(() => {
|
|
|
10
10
|
clean: true,
|
|
11
11
|
minify: true,
|
|
12
12
|
splitting: false,
|
|
13
|
-
sourcemap:
|
|
13
|
+
sourcemap: false,
|
|
14
14
|
noExternal: ["ethers"],
|
|
15
15
|
outDir: "dist",
|
|
16
16
|
esbuildOptions(options) {
|
|
@@ -37,7 +37,7 @@ export default defineConfig(() => {
|
|
|
37
37
|
globalName: "XPay",
|
|
38
38
|
minify: true,
|
|
39
39
|
splitting: false,
|
|
40
|
-
sourcemap:
|
|
40
|
+
sourcemap: false,
|
|
41
41
|
target: "chrome110.0",
|
|
42
42
|
outDir: "dist",
|
|
43
43
|
platform: "browser",
|