@coin-voyage/swapkit 0.2.0 → 0.4.0-beta.0
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/dist/components/connected-wallets.d.ts +1 -1
- package/dist/components/connected-wallets.js +37 -14
- package/dist/components/connected-wallets.test.d.ts +1 -0
- package/dist/components/connected-wallets.test.js +104 -0
- package/dist/components/styles.d.ts +2 -0
- package/dist/components/styles.js +27 -0
- package/dist/components/swap-recipient.test.d.ts +1 -0
- package/dist/components/swap-recipient.test.js +105 -0
- package/dist/components/swap.d.ts +1 -1
- package/dist/components/swap.js +20 -19
- package/dist/components/swap.test.d.ts +1 -0
- package/dist/components/swap.test.js +76 -0
- package/dist/components/token-picker.d.ts +3 -1
- package/dist/components/token-picker.js +20 -10
- package/dist/components/token-picker.test.d.ts +1 -0
- package/dist/components/token-picker.test.js +43 -0
- package/dist/components/wallet-connector.d.ts +4 -2
- package/dist/components/wallet-connector.js +89 -20
- package/dist/components/wallet-connector.test.d.ts +1 -0
- package/dist/components/wallet-connector.test.js +143 -0
- package/dist/hooks/use-order-status.d.ts +1 -1
- package/dist/hooks/use-token-data.d.ts +1 -1
- package/dist/hooks/use-token-data.js +2 -2
- package/dist/hooks/use-token-data.test.d.ts +1 -0
- package/dist/hooks/use-token-data.test.js +36 -0
- package/dist/lib/amount-input.d.ts +1 -0
- package/dist/lib/amount-input.js +7 -0
- package/dist/lib/amount-input.test.d.ts +1 -0
- package/dist/lib/amount-input.test.js +17 -0
- package/dist/lib/output-wallet.d.ts +1 -2
- package/dist/lib/output-wallet.js +2 -2
- package/dist/lib/output-wallet.test.d.ts +1 -0
- package/dist/lib/output-wallet.test.js +26 -0
- package/dist/providers/swapkit-context.d.ts +1 -1
- package/dist/providers/swapkit-provider.d.ts +1 -1
- package/dist/providers/swapkit-provider.js +4 -2
- package/dist/providers/swapkit-provider.test.d.ts +1 -0
- package/dist/providers/swapkit-provider.test.js +20 -0
- package/dist/styles/root.js +1 -1
- package/dist/styles/theme.js +1 -1
- package/dist/types.d.ts +2 -1
- package/package.json +8 -8
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// @vitest-environment jsdom
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
import { describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { SwapKitProvider } from "./swapkit-provider";
|
|
6
|
+
const useConnectCallback = vi.fn();
|
|
7
|
+
vi.mock("@coin-voyage/crypto/evm", () => ({
|
|
8
|
+
useInWagmiContext: () => true,
|
|
9
|
+
}));
|
|
10
|
+
vi.mock("@coin-voyage/crypto/hooks", () => ({
|
|
11
|
+
useConnectCallback: (props) => useConnectCallback(props),
|
|
12
|
+
}));
|
|
13
|
+
describe("SwapKitProvider", () => {
|
|
14
|
+
it("listens for connected-provider address changes", () => {
|
|
15
|
+
const onConnect = vi.fn();
|
|
16
|
+
const onDisconnect = vi.fn();
|
|
17
|
+
render(_jsx(SwapKitProvider, { apiKey: "public-api-key", onConnect: onConnect, onDisconnect: onDisconnect, children: _jsx("div", {}) }));
|
|
18
|
+
expect(useConnectCallback).toHaveBeenCalledWith({ onConnect, onDisconnect });
|
|
19
|
+
});
|
|
20
|
+
});
|
package/dist/styles/root.js
CHANGED
|
@@ -42,7 +42,7 @@ export const SwapKitRoot = styled.div `
|
|
|
42
42
|
display: block;
|
|
43
43
|
width: 100%;
|
|
44
44
|
color: var(--sk-text);
|
|
45
|
-
background:
|
|
45
|
+
background: ${({ $customTheme }) => $customTheme.background ?? "transparent"};
|
|
46
46
|
font-family: var(--sk-font-family);
|
|
47
47
|
font-size: 16px;
|
|
48
48
|
text-align: left;
|
package/dist/styles/theme.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { APIEnvironment } from "@coin-voyage/shared/api";
|
|
2
|
+
import type { useConnectCallbackProps } from "@coin-voyage/crypto/hooks";
|
|
2
3
|
import type { CurrencyBase } from "@coin-voyage/shared/types";
|
|
3
4
|
import type { ReactNode } from "react";
|
|
4
5
|
export type SwapKitMode = "light" | "dark" | "auto";
|
|
@@ -20,7 +21,7 @@ export interface SwapKitTheme {
|
|
|
20
21
|
shadow: string;
|
|
21
22
|
radius: string;
|
|
22
23
|
}
|
|
23
|
-
export interface SwapKitProviderProps {
|
|
24
|
+
export interface SwapKitProviderProps extends Pick<useConnectCallbackProps, "onConnect" | "onDisconnect"> {
|
|
24
25
|
apiKey: string;
|
|
25
26
|
environment?: APIEnvironment;
|
|
26
27
|
mode?: SwapKitMode;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.4.0-beta.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "Lars <lars@coinvoyage.io>",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"LICENSE"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@coin-voyage/crypto": "3.
|
|
26
|
-
"@coin-voyage/shared": "3.
|
|
25
|
+
"@coin-voyage/crypto": "3.6.0-beta.0",
|
|
26
|
+
"@coin-voyage/shared": "3.6.0-beta.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@testing-library/react": "^16.3.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typescript-plugin-styled-components": "^3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@bigmi/react": "^0.
|
|
39
|
+
"@bigmi/react": "^0.9.1",
|
|
40
40
|
"@mysten/dapp-kit-react": "^2.1.4",
|
|
41
41
|
"@solana/wallet-adapter-react": "^0.15.39",
|
|
42
42
|
"@tanstack/react-query": "^5.90.6",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"scripts": {
|
|
57
57
|
"watch": "tsc -w -p ./tsconfig.json",
|
|
58
58
|
"build": "tsc --build --force",
|
|
59
|
-
"test": "vitest run --config ./vitest.config.ts",
|
|
60
|
-
"test:coverage": "vitest run --coverage --maxWorkers=1 --no-file-parallelism --config ./vitest.config.ts",
|
|
61
59
|
"clean": "rm -rf dist tsconfig.tsbuildinfo coverage",
|
|
60
|
+
"release:build": "pnpm clean && pnpm build",
|
|
62
61
|
"pre:release": "pnpm version prerelease --preid=beta",
|
|
63
62
|
"pre:publish": "pnpm publish --access public --tag beta --no-git-checks",
|
|
64
63
|
"pre:steps": "pnpm pre:release && pnpm pre:publish",
|
|
65
|
-
"release:build": "pnpm clean && pnpm build",
|
|
66
64
|
"release": "pnpm publish --access public --no-git-checks",
|
|
67
|
-
"type-check": "tsc --noEmit"
|
|
65
|
+
"type-check": "tsc --noEmit",
|
|
66
|
+
"test": "vitest run --config ./vitest.config.ts",
|
|
67
|
+
"test:coverage": "vitest run --coverage --maxWorkers=1 --no-file-parallelism --config ./vitest.config.ts"
|
|
68
68
|
}
|
|
69
69
|
}
|