@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.
Files changed (41) hide show
  1. package/LICENSE +8 -8
  2. package/README.md +68 -68
  3. package/dist/components/currency-panel.d.ts +17 -0
  4. package/dist/components/currency-panel.js +22 -0
  5. package/dist/components/execution-modal.js +28 -5
  6. package/dist/components/execution-modal.test.d.ts +1 -0
  7. package/dist/components/execution-modal.test.js +92 -0
  8. package/dist/components/manual-wallet-modal.d.ts +8 -0
  9. package/dist/components/manual-wallet-modal.js +19 -0
  10. package/dist/components/output-wallet-selector.d.ts +7 -0
  11. package/dist/components/output-wallet-selector.js +10 -0
  12. package/dist/components/quote-breakdown.d.ts +5 -0
  13. package/dist/components/quote-breakdown.js +13 -0
  14. package/dist/components/styles.d.ts +1 -0
  15. package/dist/components/styles.js +1294 -1282
  16. package/dist/components/swap-recipient.test.js +29 -1
  17. package/dist/components/swap-settings.d.ts +9 -0
  18. package/dist/components/swap-settings.js +24 -0
  19. package/dist/components/swap.d.ts +2 -28
  20. package/dist/components/swap.js +27 -312
  21. package/dist/components/token-picker.test.js +11 -0
  22. package/dist/hooks/use-dismiss.d.ts +3 -0
  23. package/dist/hooks/use-dismiss.js +26 -0
  24. package/dist/hooks/use-swap-notifications.d.ts +10 -0
  25. package/dist/hooks/use-swap-notifications.js +53 -0
  26. package/dist/hooks/use-swap-quote.js +49 -51
  27. package/dist/hooks/use-swap.d.ts +47 -0
  28. package/dist/hooks/use-swap.js +189 -0
  29. package/dist/hooks/use-token-data.js +3 -3
  30. package/dist/hooks/use-token-data.test.js +33 -3
  31. package/dist/lib/currency-selection.js +6 -4
  32. package/dist/lib/currency-selection.test.d.ts +1 -0
  33. package/dist/lib/currency-selection.test.js +16 -0
  34. package/dist/lib/format.d.ts +5 -0
  35. package/dist/lib/format.js +20 -0
  36. package/dist/lib/quote.d.ts +10 -1
  37. package/dist/lib/quote.js +12 -0
  38. package/dist/lib/slippage.d.ts +11 -0
  39. package/dist/lib/slippage.js +17 -0
  40. package/dist/styles/root.js +59 -59
  41. package/package.json +10 -4
@@ -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.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
- "types": "./dist/index.d.ts"
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/crypto": "3.6.0",
26
- "@coin-voyage/shared": "3.6.0"
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",