@coin-voyage/swapkit 0.4.0 → 0.5.1
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/LICENSE +8 -8
- package/README.md +68 -68
- package/dist/components/currency-panel.d.ts +17 -0
- package/dist/components/currency-panel.js +22 -0
- package/dist/components/execution-modal.js +28 -5
- package/dist/components/execution-modal.test.d.ts +1 -0
- package/dist/components/execution-modal.test.js +92 -0
- package/dist/components/manual-wallet-modal.d.ts +8 -0
- package/dist/components/manual-wallet-modal.js +19 -0
- package/dist/components/output-wallet-selector.d.ts +7 -0
- package/dist/components/output-wallet-selector.js +10 -0
- package/dist/components/quote-breakdown.d.ts +5 -0
- package/dist/components/quote-breakdown.js +13 -0
- package/dist/components/styles.d.ts +1 -0
- package/dist/components/styles.js +1294 -1282
- package/dist/components/swap-recipient.test.js +29 -1
- package/dist/components/swap-settings.d.ts +9 -0
- package/dist/components/swap-settings.js +24 -0
- package/dist/components/swap.d.ts +2 -28
- package/dist/components/swap.js +27 -312
- package/dist/components/token-picker.test.js +11 -0
- package/dist/hooks/use-dismiss.d.ts +3 -0
- package/dist/hooks/use-dismiss.js +26 -0
- package/dist/hooks/use-swap-notifications.d.ts +10 -0
- package/dist/hooks/use-swap-notifications.js +53 -0
- package/dist/hooks/use-swap-quote.js +49 -51
- package/dist/hooks/use-swap.d.ts +47 -0
- package/dist/hooks/use-swap.js +189 -0
- package/dist/hooks/use-token-data.js +3 -3
- package/dist/hooks/use-token-data.test.js +33 -3
- package/dist/lib/currency-selection.js +6 -4
- package/dist/lib/currency-selection.test.d.ts +1 -0
- package/dist/lib/currency-selection.test.js +16 -0
- package/dist/lib/format.d.ts +5 -0
- package/dist/lib/format.js +20 -0
- package/dist/lib/quote.d.ts +10 -1
- package/dist/lib/quote.js +12 -0
- package/dist/lib/slippage.d.ts +11 -0
- package/dist/lib/slippage.js +17 -0
- package/dist/styles/root.js +59 -59
- package/package.json +10 -4
package/dist/styles/root.js
CHANGED
|
@@ -2,23 +2,23 @@ import { css } from "styled-components";
|
|
|
2
2
|
import styled from "./styled";
|
|
3
3
|
import { darkTheme, lightTheme } from "./theme";
|
|
4
4
|
function variables(theme) {
|
|
5
|
-
return css `
|
|
6
|
-
--sk-font-family: ${theme.fontFamily};
|
|
7
|
-
--sk-background: ${theme.background};
|
|
8
|
-
--sk-surface: ${theme.surface};
|
|
9
|
-
--sk-surface-elevated: ${theme.surfaceElevated};
|
|
10
|
-
--sk-border: ${theme.border};
|
|
11
|
-
--sk-text: ${theme.text};
|
|
12
|
-
--sk-text-muted: ${theme.textMuted};
|
|
13
|
-
--sk-accent: ${theme.accent};
|
|
14
|
-
--sk-accent-hover: ${theme.accentHover};
|
|
15
|
-
--sk-accent-text: ${theme.accentText};
|
|
16
|
-
--sk-danger: ${theme.danger};
|
|
17
|
-
--sk-warning: ${theme.warning};
|
|
18
|
-
--sk-success: ${theme.success};
|
|
19
|
-
--sk-overlay: ${theme.overlay};
|
|
20
|
-
--sk-shadow: ${theme.shadow};
|
|
21
|
-
--sk-radius: ${theme.radius};
|
|
5
|
+
return css `
|
|
6
|
+
--sk-font-family: ${theme.fontFamily};
|
|
7
|
+
--sk-background: ${theme.background};
|
|
8
|
+
--sk-surface: ${theme.surface};
|
|
9
|
+
--sk-surface-elevated: ${theme.surfaceElevated};
|
|
10
|
+
--sk-border: ${theme.border};
|
|
11
|
+
--sk-text: ${theme.text};
|
|
12
|
+
--sk-text-muted: ${theme.textMuted};
|
|
13
|
+
--sk-accent: ${theme.accent};
|
|
14
|
+
--sk-accent-hover: ${theme.accentHover};
|
|
15
|
+
--sk-accent-text: ${theme.accentText};
|
|
16
|
+
--sk-danger: ${theme.danger};
|
|
17
|
+
--sk-warning: ${theme.warning};
|
|
18
|
+
--sk-success: ${theme.success};
|
|
19
|
+
--sk-overlay: ${theme.overlay};
|
|
20
|
+
--sk-shadow: ${theme.shadow};
|
|
21
|
+
--sk-radius: ${theme.radius};
|
|
22
22
|
`;
|
|
23
23
|
}
|
|
24
24
|
function modeVariables(mode, customTheme) {
|
|
@@ -28,48 +28,48 @@ function modeVariables(mode, customTheme) {
|
|
|
28
28
|
return variables(light);
|
|
29
29
|
if (mode === "dark")
|
|
30
30
|
return variables(dark);
|
|
31
|
-
return css `
|
|
32
|
-
${variables(light)}
|
|
33
|
-
@media (prefers-color-scheme: dark) {
|
|
34
|
-
${variables(dark)}
|
|
35
|
-
}
|
|
31
|
+
return css `
|
|
32
|
+
${variables(light)}
|
|
33
|
+
@media (prefers-color-scheme: dark) {
|
|
34
|
+
${variables(dark)}
|
|
35
|
+
}
|
|
36
36
|
`;
|
|
37
37
|
}
|
|
38
|
-
export const SwapKitRoot = styled.div `
|
|
39
|
-
${({ $mode, $customTheme }) => modeVariables($mode, $customTheme)}
|
|
40
|
-
|
|
41
|
-
all: initial;
|
|
42
|
-
display: block;
|
|
43
|
-
width: 100%;
|
|
44
|
-
color: var(--sk-text);
|
|
45
|
-
background: ${({ $customTheme }) => $customTheme.background ?? "transparent"};
|
|
46
|
-
font-family: var(--sk-font-family);
|
|
47
|
-
font-size: 16px;
|
|
48
|
-
text-align: left;
|
|
49
|
-
text-rendering: optimizeLegibility;
|
|
50
|
-
-webkit-font-smoothing: antialiased;
|
|
51
|
-
|
|
52
|
-
&,
|
|
53
|
-
* {
|
|
54
|
-
box-sizing: border-box;
|
|
55
|
-
font-family: var(--sk-font-family);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
button,
|
|
59
|
-
input {
|
|
60
|
-
font-family: var(--sk-font-family);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
button:focus-visible,
|
|
64
|
-
input:focus-visible,
|
|
65
|
-
a:focus-visible {
|
|
66
|
-
outline: 2px solid var(--sk-accent);
|
|
67
|
-
outline-offset: 2px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
img,
|
|
71
|
-
svg {
|
|
72
|
-
display: block;
|
|
73
|
-
max-width: 100%;
|
|
74
|
-
}
|
|
38
|
+
export const SwapKitRoot = styled.div `
|
|
39
|
+
${({ $mode, $customTheme }) => modeVariables($mode, $customTheme)}
|
|
40
|
+
|
|
41
|
+
all: initial;
|
|
42
|
+
display: block;
|
|
43
|
+
width: 100%;
|
|
44
|
+
color: var(--sk-text);
|
|
45
|
+
background: ${({ $customTheme }) => $customTheme.background ?? "transparent"};
|
|
46
|
+
font-family: var(--sk-font-family);
|
|
47
|
+
font-size: 16px;
|
|
48
|
+
text-align: left;
|
|
49
|
+
text-rendering: optimizeLegibility;
|
|
50
|
+
-webkit-font-smoothing: antialiased;
|
|
51
|
+
|
|
52
|
+
&,
|
|
53
|
+
* {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
font-family: var(--sk-font-family);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
button,
|
|
59
|
+
input {
|
|
60
|
+
font-family: var(--sk-font-family);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
button:focus-visible,
|
|
64
|
+
input:focus-visible,
|
|
65
|
+
a:focus-visible {
|
|
66
|
+
outline: 2px solid var(--sk-accent);
|
|
67
|
+
outline-offset: 2px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
img,
|
|
71
|
+
svg {
|
|
72
|
+
display: block;
|
|
73
|
+
max-width: 100%;
|
|
74
|
+
}
|
|
75
75
|
`;
|
package/package.json
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coin-voyage/swapkit",
|
|
3
3
|
"description": "A reusable cross-chain swap component for CoinVoyage.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "Lars <lars@coinvoyage.io>",
|
|
8
8
|
"homepage": "https://coinvoyage.io",
|
|
9
9
|
"license": "BSD-2-Clause",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/coin-voyage/coin-voyage-pay.git",
|
|
13
|
+
"directory": "packages/swapkit"
|
|
14
|
+
},
|
|
10
15
|
"type": "module",
|
|
11
16
|
"main": "./dist/index.js",
|
|
12
17
|
"types": "./dist/index.d.ts",
|
|
13
18
|
"exports": {
|
|
14
19
|
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
15
21
|
"import": "./dist/index.js",
|
|
16
|
-
"
|
|
22
|
+
"default": "./dist/index.js"
|
|
17
23
|
}
|
|
18
24
|
},
|
|
19
25
|
"files": [
|
|
@@ -22,8 +28,8 @@
|
|
|
22
28
|
"LICENSE"
|
|
23
29
|
],
|
|
24
30
|
"dependencies": {
|
|
25
|
-
"@coin-voyage/
|
|
26
|
-
"@coin-voyage/
|
|
31
|
+
"@coin-voyage/shared": "3.7.2",
|
|
32
|
+
"@coin-voyage/crypto": "3.7.2"
|
|
27
33
|
},
|
|
28
34
|
"devDependencies": {
|
|
29
35
|
"@testing-library/react": "^16.3.0",
|