@ab-org/predicate-market-sdk 0.1.1 → 1.0.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/dist/index.d.ts +672 -22
- package/dist/index.js +4700 -23
- package/package.json +6 -5
- package/dist/auth/autoReconnect.d.ts +0 -11
- package/dist/auth/autoReconnect.js +0 -36
- package/dist/auth/bundledConfig.d.ts +0 -2
- package/dist/auth/bundledConfig.js +0 -19
- package/dist/auth/config.d.ts +0 -29
- package/dist/auth/config.js +0 -53
- package/dist/auth/google.d.ts +0 -43
- package/dist/auth/google.js +0 -147
- package/dist/auth/oidcRelay.d.ts +0 -11
- package/dist/auth/oidcRelay.js +0 -107
- package/dist/auth/twitter.d.ts +0 -7
- package/dist/auth/twitter.js +0 -94
- package/dist/auth/walletAccount.d.ts +0 -20
- package/dist/auth/walletAccount.js +0 -267
- package/dist/constants/chains.d.ts +0 -2
- package/dist/constants/chains.js +0 -3
- package/dist/modules/api.d.ts +0 -149
- package/dist/modules/api.js +0 -95
- package/dist/modules/balanceQuery.d.ts +0 -27
- package/dist/modules/balanceQuery.js +0 -60
- package/dist/modules/deposit.d.ts +0 -31
- package/dist/modules/deposit.js +0 -58
- package/dist/modules/marketData.d.ts +0 -8
- package/dist/modules/marketData.js +0 -107
- package/dist/modules/withdraw.d.ts +0 -31
- package/dist/modules/withdraw.js +0 -61
- package/dist/modules/withdrawDirect.d.ts +0 -14
- package/dist/modules/withdrawDirect.js +0 -33
- package/dist/modules/withdrawExecutor.d.ts +0 -56
- package/dist/modules/withdrawExecutor.js +0 -210
- package/dist/policyAdapter.d.ts +0 -11
- package/dist/policyAdapter.js +0 -38
- package/dist/types.d.ts +0 -62
- package/dist/types.js +0 -1
- package/dist/ui/DepositModal.d.ts +0 -36
- package/dist/ui/DepositModal.js +0 -354
- package/dist/ui/SignInModal.d.ts +0 -22
- package/dist/ui/SignInModal.js +0 -77
- package/dist/ui/SignInModal.sections.d.ts +0 -33
- package/dist/ui/SignInModal.sections.js +0 -45
- package/dist/ui/SignInModal.shared.d.ts +0 -15
- package/dist/ui/SignInModal.shared.js +0 -126
- package/dist/ui/WalletSelectionModal.d.ts +0 -14
- package/dist/ui/WalletSelectionModal.js +0 -54
- package/dist/ui/WithdrawModal.d.ts +0 -57
- package/dist/ui/WithdrawModal.js +0 -574
- package/dist/ui/components/CloseButton.d.ts +0 -4
- package/dist/ui/components/CloseButton.js +0 -15
- package/dist/ui/components/Countdown.d.ts +0 -16
- package/dist/ui/components/Countdown.js +0 -42
- package/dist/ui/components/DepositDetailsPanel.d.ts +0 -8
- package/dist/ui/components/DepositDetailsPanel.js +0 -143
- package/dist/ui/components/DropdownField.d.ts +0 -19
- package/dist/ui/components/DropdownField.js +0 -81
- package/dist/ui/components/Field.d.ts +0 -10
- package/dist/ui/components/Field.js +0 -21
- package/dist/ui/components/LoginRequiredOverlay.d.ts +0 -6
- package/dist/ui/components/LoginRequiredOverlay.js +0 -31
- package/dist/ui/components/ModalCard.d.ts +0 -9
- package/dist/ui/components/ModalCard.js +0 -14
- package/dist/ui/components/ModalFrame.d.ts +0 -9
- package/dist/ui/components/ModalFrame.js +0 -18
- package/dist/ui/components/PrimaryButton.d.ts +0 -2
- package/dist/ui/components/PrimaryButton.js +0 -14
- package/dist/ui/components/QRCodePanel.d.ts +0 -4
- package/dist/ui/components/QRCodePanel.js +0 -43
- package/dist/ui/components/Select.d.ts +0 -12
- package/dist/ui/components/Select.js +0 -29
- package/dist/ui/components/StepIndicator.d.ts +0 -7
- package/dist/ui/components/StepIndicator.js +0 -35
- package/dist/ui/components/Success.d.ts +0 -1
- package/dist/ui/components/Success.js +0 -4
- package/dist/ui/components/Toast.d.ts +0 -8
- package/dist/ui/components/Toast.js +0 -51
- package/dist/ui/hooks/useSession.d.ts +0 -2
- package/dist/ui/hooks/useSession.js +0 -10
- package/dist/ui/signInTypes.d.ts +0 -28
- package/dist/ui/signInTypes.js +0 -1
- package/dist/ui/theme.d.ts +0 -31
- package/dist/ui/theme.js +0 -31
- package/dist/ui/useSignInModalController.d.ts +0 -25
- package/dist/ui/useSignInModalController.js +0 -119
- package/dist/utils/env.d.ts +0 -1
- package/dist/utils/env.js +0 -63
- package/dist/utils/explorer.d.ts +0 -3
- package/dist/utils/explorer.js +0 -47
- package/dist/walletUtils.d.ts +0 -3
- package/dist/walletUtils.js +0 -3
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { InjectedWalletRegistryItem } from "@ab-org/sdk-core";
|
|
2
|
-
import type { SocialProvider, WalletItem } from "./signInTypes.js";
|
|
3
|
-
export declare const GoogleIcon: () => import("react/jsx-runtime.js").JSX.Element;
|
|
4
|
-
export declare const XIcon: () => import("react/jsx-runtime.js").JSX.Element;
|
|
5
|
-
export declare const ExpandIcon: ({ expanded }: {
|
|
6
|
-
expanded: boolean;
|
|
7
|
-
}) => import("react/jsx-runtime.js").JSX.Element;
|
|
8
|
-
export declare const SpinnerIcon: () => import("react/jsx-runtime.js").JSX.Element;
|
|
9
|
-
export declare const defaultSocialProviders: SocialProvider[];
|
|
10
|
-
export declare function resolveWalletItems(wallets: WalletItem[] | undefined, defaultWalletRegistry: InjectedWalletRegistryItem[]): WalletItem[];
|
|
11
|
-
export declare function resolveSocialProviders(socialProviders: SocialProvider[] | undefined): SocialProvider[];
|
|
12
|
-
export declare const DefaultWalletIcon: ({ walletId, name, }: {
|
|
13
|
-
walletId: string;
|
|
14
|
-
name: string;
|
|
15
|
-
}) => import("react/jsx-runtime.js").JSX.Element;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { colors, fonts } from "./theme.js";
|
|
3
|
-
export const GoogleIcon = () => (_jsxs("svg", { width: "21", height: "21", viewBox: "0 0 21 21", fill: "none", children: [_jsx("path", { d: "M20.3 10.73c0-.79-.07-1.54-.19-2.27H10.5v4.51h5.5a4.69 4.69 0 0 1-2.04 3.09v2.57h3.3c1.93-1.78 3.04-4.4 3.04-7.9Z", fill: "#4285F4" }), _jsx("path", { d: "M10.5 21c2.76 0 5.07-.91 6.76-2.47l-3.3-2.57c-.92.61-2.09.97-3.46.97-2.66 0-4.91-1.8-5.71-4.22H1.39v2.65A10.5 10.5 0 0 0 10.5 21Z", fill: "#34A853" }), _jsx("path", { d: "M4.79 12.71A6.3 6.3 0 0 1 4.46 10.5c0-.77.13-1.51.33-2.21V5.64H1.39A10.5 10.5 0 0 0 0 10.5c0 1.7.41 3.3 1.39 4.86l3.4-2.65Z", fill: "#FBBC05" }), _jsx("path", { d: "M10.5 4.07c1.5 0 2.84.51 3.9 1.52l2.92-2.92C15.56 1.02 13.26 0 10.5 0A10.5 10.5 0 0 0 1.39 5.64l3.4 2.65C5.59 5.87 7.84 4.07 10.5 4.07Z", fill: "#EA4335" })] }));
|
|
4
|
-
export const XIcon = () => (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231 5.45-6.231Zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77Z", fill: "white" }) }));
|
|
5
|
-
export const ExpandIcon = ({ expanded }) => (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", style: { transform: expanded ? "rotate(180deg)" : undefined, transition: "transform 0.2s" }, children: [_jsx("path", { d: "M5 9L9 13L13 9", stroke: colors.textSecondary, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M11 9L15 13L19 9", stroke: colors.textSecondary, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
6
|
-
export const SpinnerIcon = () => (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", style: { animation: "spin 1s linear infinite" }, children: [_jsx("circle", { cx: "10", cy: "10", r: "8", stroke: "rgba(255,255,255,0.2)", strokeWidth: "2.5" }), _jsx("path", { d: "M10 2a8 8 0 0 1 8 8", stroke: colors.textPrimary, strokeWidth: "2.5", strokeLinecap: "round" }), _jsx("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })] }));
|
|
7
|
-
export const defaultSocialProviders = [
|
|
8
|
-
{ id: "google", label: "Continue with Google", icon: _jsx(GoogleIcon, {}) },
|
|
9
|
-
{ id: "x", label: "Continue with X", icon: _jsx(XIcon, {}) },
|
|
10
|
-
];
|
|
11
|
-
export function resolveWalletItems(wallets, defaultWalletRegistry) {
|
|
12
|
-
const walletMap = new Map(defaultWalletRegistry.map((item) => [
|
|
13
|
-
item.id,
|
|
14
|
-
{
|
|
15
|
-
name: item.title,
|
|
16
|
-
installed: item.installed,
|
|
17
|
-
installUrl: item.installUrl,
|
|
18
|
-
},
|
|
19
|
-
]));
|
|
20
|
-
if (wallets === undefined) {
|
|
21
|
-
return defaultWalletRegistry.map((item) => ({
|
|
22
|
-
id: item.id,
|
|
23
|
-
name: item.title,
|
|
24
|
-
icon: undefined,
|
|
25
|
-
installed: item.installed,
|
|
26
|
-
installUrl: item.installUrl,
|
|
27
|
-
}));
|
|
28
|
-
}
|
|
29
|
-
if (wallets.length === 0) {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
return wallets.map((wallet) => {
|
|
33
|
-
const fallback = walletMap.get(wallet.id);
|
|
34
|
-
return {
|
|
35
|
-
...wallet,
|
|
36
|
-
name: wallet.name ?? fallback?.name ?? wallet.id,
|
|
37
|
-
installed: wallet.installed ?? fallback?.installed,
|
|
38
|
-
installUrl: wallet.installUrl ?? fallback?.installUrl,
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
export function resolveSocialProviders(socialProviders) {
|
|
43
|
-
if (socialProviders === undefined) {
|
|
44
|
-
return defaultSocialProviders;
|
|
45
|
-
}
|
|
46
|
-
if (socialProviders.length === 0) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
const defaultProviderMap = new Map(defaultSocialProviders.map((provider) => [provider.id, provider]));
|
|
50
|
-
return socialProviders.map((provider) => {
|
|
51
|
-
const fallback = defaultProviderMap.get(provider.id);
|
|
52
|
-
return {
|
|
53
|
-
...provider,
|
|
54
|
-
label: provider.label ?? fallback?.label ?? provider.id,
|
|
55
|
-
icon: provider.icon ?? fallback?.icon,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const IconFrame = ({ background, children, }) => (_jsx("div", { style: {
|
|
60
|
-
width: 48,
|
|
61
|
-
height: 48,
|
|
62
|
-
borderRadius: 12,
|
|
63
|
-
background,
|
|
64
|
-
display: "flex",
|
|
65
|
-
alignItems: "center",
|
|
66
|
-
justifyContent: "center",
|
|
67
|
-
overflow: "hidden",
|
|
68
|
-
}, children: children }));
|
|
69
|
-
const MetaMaskWalletIcon = () => (_jsx(IconFrame, { background: "#1A0F07", children: _jsxs("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", children: [_jsx("path", { d: "M8 6L15 11L12 14L8 6Z", fill: "#E17726" }), _jsx("path", { d: "M24 6L17 11L20 14L24 6Z", fill: "#E27625" }), _jsx("path", { d: "M11 19L15 22V17L11 19Z", fill: "#F6851B" }), _jsx("path", { d: "M21 19L17 22V17L21 19Z", fill: "#F6851B" }), _jsx("path", { d: "M12 14L15 11V17L11 19L12 14Z", fill: "#763D16" }), _jsx("path", { d: "M20 14L17 11V17L21 19L20 14Z", fill: "#763D16" })] }) }));
|
|
70
|
-
const OKXWalletIcon = () => (_jsx(IconFrame, { background: "#FFFFFF", children: _jsxs("svg", { width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: [_jsx("rect", { x: "2", y: "2", width: "8", height: "8", rx: "2", fill: "#050608" }), _jsx("rect", { x: "11", y: "2", width: "8", height: "8", rx: "2", fill: "#050608" }), _jsx("rect", { x: "20", y: "2", width: "8", height: "8", rx: "2", fill: "#050608" }), _jsx("rect", { x: "2", y: "11", width: "8", height: "8", rx: "2", fill: "#050608" }), _jsx("rect", { x: "20", y: "11", width: "8", height: "8", rx: "2", fill: "#050608" }), _jsx("rect", { x: "2", y: "20", width: "8", height: "8", rx: "2", fill: "#050608" }), _jsx("rect", { x: "11", y: "20", width: "8", height: "8", rx: "2", fill: "#050608" }), _jsx("rect", { x: "20", y: "20", width: "8", height: "8", rx: "2", fill: "#050608" })] }) }));
|
|
71
|
-
const CoinbaseWalletIcon = () => (_jsx(IconFrame, { background: "#0052FF", children: _jsxs("svg", { width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: [_jsx("circle", { cx: "15", cy: "15", r: "10", stroke: "white", strokeWidth: "4" }), _jsx("rect", { x: "9", y: "13", width: "12", height: "4", rx: "2", fill: "white" })] }) }));
|
|
72
|
-
const TrustWalletIcon = () => (_jsx(IconFrame, { background: "#3375FF", children: _jsxs("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", children: [_jsx("path", { d: "M14 4L21 6.6V12.8C21 17.1 18.1 20.9 14 22.4C9.9 20.9 7 17.1 7 12.8V6.6L14 4Z", fill: "white" }), _jsx("path", { d: "M14 8L17 9.1V12.3C17 14.7 15.7 16.8 14 17.6C12.3 16.8 11 14.7 11 12.3V9.1L14 8Z", fill: "#3375FF" })] }) }));
|
|
73
|
-
const PhantomWalletIcon = () => (_jsx(IconFrame, { background: "linear-gradient(135deg, #6C47FF 0%, #9B6BFF 100%)", children: _jsxs("svg", { width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: [_jsx("path", { d: "M8 18.5C8 14.4 11.2 11 15.3 11H20.4C21.8 11 23 12.2 23 13.6C23 15 21.8 16.2 20.4 16.2H14.7", stroke: "white", strokeWidth: "3", strokeLinecap: "round" }), _jsx("path", { d: "M10.5 14H19.5", stroke: "white", strokeWidth: "3", strokeLinecap: "round" }), _jsx("circle", { cx: "12", cy: "20", r: "1.4", fill: "white" }), _jsx("circle", { cx: "18", cy: "20", r: "1.4", fill: "white" })] }) }));
|
|
74
|
-
const RabbyWalletIcon = () => (_jsx(IconFrame, { background: "#EBF2FF", children: _jsxs("svg", { width: "30", height: "30", viewBox: "0 0 30 30", fill: "none", children: [_jsx("path", { d: "M11 7L13.5 13", stroke: "#7084FF", strokeWidth: "3", strokeLinecap: "round" }), _jsx("path", { d: "M19 7L16.5 13", stroke: "#7084FF", strokeWidth: "3", strokeLinecap: "round" }), _jsx("rect", { x: "8", y: "12", width: "14", height: "11", rx: "6", fill: "#7084FF" }), _jsx("circle", { cx: "13", cy: "17", r: "1.4", fill: "white" }), _jsx("circle", { cx: "17", cy: "17", r: "1.4", fill: "white" }), _jsx("path", { d: "M13 20C13.6 20.4 14.3 20.6 15 20.6C15.7 20.6 16.4 20.4 17 20", stroke: "white", strokeWidth: "1.8", strokeLinecap: "round" })] }) }));
|
|
75
|
-
/** Rainbow icon from wallet-adaptor-base (rainbowWallet.svg) */
|
|
76
|
-
const RainbowWalletIcon = () => (_jsx(IconFrame, { background: "linear-gradient(180deg, #174299 0%, #001E59 100%)", children: _jsxs("svg", { width: "32", height: "32", viewBox: "0 0 120 120", fill: "none", style: { overflow: "hidden", borderRadius: 12 }, children: [_jsxs("defs", { children: [_jsxs("radialGradient", { id: "rainbow_r1", cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(26 94) rotate(-90) scale(74)", children: [_jsx("stop", { offset: "0.770277", stopColor: "#FF4000" }), _jsx("stop", { offset: "1", stopColor: "#8754C9" })] }), _jsxs("linearGradient", { id: "rainbow_l2", x1: "83", y1: "97", x2: "100", y2: "97", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#FF4000" }), _jsx("stop", { offset: "1", stopColor: "#8754C9" })] }), _jsxs("linearGradient", { id: "rainbow_l3", x1: "23", y1: "20", x2: "23", y2: "37", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#8754C9" }), _jsx("stop", { offset: "1", stopColor: "#FF4000" })] }), _jsxs("radialGradient", { id: "rainbow_r4", cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(26 94) rotate(-90) scale(58)", children: [_jsx("stop", { offset: "0.723929", stopColor: "#FFF700" }), _jsx("stop", { offset: "1", stopColor: "#FF9901" })] }), _jsxs("linearGradient", { id: "rainbow_l5", x1: "68", y1: "97", x2: "84", y2: "97", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#FFF700" }), _jsx("stop", { offset: "1", stopColor: "#FF9901" })] }), _jsxs("linearGradient", { id: "rainbow_l6", x1: "23", y1: "52", x2: "23", y2: "36", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#FFF700" }), _jsx("stop", { offset: "1", stopColor: "#FF9901" })] }), _jsxs("radialGradient", { id: "rainbow_r7", cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(26 94) rotate(-90) scale(42)", children: [_jsx("stop", { offset: "0.59513", stopColor: "#00AAFF" }), _jsx("stop", { offset: "1", stopColor: "#01DA40" })] }), _jsxs("radialGradient", { id: "rainbow_r8", cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(51 97) scale(17 45.3333)", children: [_jsx("stop", { stopColor: "#00AAFF" }), _jsx("stop", { offset: "1", stopColor: "#01DA40" })] }), _jsxs("radialGradient", { id: "rainbow_r9", cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(23 69) rotate(-90) scale(17 322.37)", children: [_jsx("stop", { stopColor: "#00AAFF" }), _jsx("stop", { offset: "1", stopColor: "#01DA40" })] })] }), _jsx("path", { d: "M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z", fill: "url(#rainbow_r1)" }), _jsx("path", { d: "M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z", fill: "url(#rainbow_l2)" }), _jsx("path", { d: "M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z", fill: "url(#rainbow_l3)" }), _jsx("path", { d: "M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z", fill: "url(#rainbow_r4)" }), _jsx("path", { d: "M68 94H84V100H68V94Z", fill: "url(#rainbow_l5)" }), _jsx("path", { d: "M20 52L20 36L26 36L26 52H20Z", fill: "url(#rainbow_l6)" }), _jsx("path", { d: "M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z", fill: "url(#rainbow_r7)" }), _jsx("path", { d: "M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z", fill: "url(#rainbow_r8)" }), _jsx("path", { d: "M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z", fill: "url(#rainbow_r9)" })] }) }));
|
|
77
|
-
/** Zerion icon from wallet-adaptor-base (zerionWallet.svg) */
|
|
78
|
-
const ZerionWalletIcon = () => (_jsx(IconFrame, { background: "#2962EF", children: _jsx("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", children: _jsx("path", { fill: "#fff", d: "M6.073 7c-.48 0-.665.593-.262.841l10.073 6.074a.577.577 0 0 0 .758-.139l4.43-5.814c.3-.404-.004-.962-.525-.962H6.073ZM21.904 21c.48 0 .67-.596.267-.844l-10.075-6.073a.569.569 0 0 0-.751.146l-4.437 5.813c-.301.404.012.958.534.958h14.462Z" }) }) }));
|
|
79
|
-
/** Brave Wallet icon from wallet-adaptor-base (braveWallet.svg), scaled */
|
|
80
|
-
const BraveWalletIcon = () => (_jsx(IconFrame, { background: "#FFF", children: _jsxs("svg", { width: "32", height: "32", viewBox: "-100 -100 2970 2970", fill: "none", style: { overflow: "hidden", borderRadius: 12 }, children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: "brave_a", y1: "51%", y2: "51%", children: [_jsx("stop", { offset: "0.4", stopColor: "#f50" }), _jsx("stop", { offset: "0.6", stopColor: "#ff2000" })] }), _jsxs("linearGradient", { id: "brave_b", x1: "2%", y1: "51%", x2: "51%", y2: "51%", children: [_jsx("stop", { offset: "0", stopColor: "#ff452a" }), _jsx("stop", { offset: "1", stopColor: "#ff2000" })] })] }), _jsx("path", { fill: "url(#brave_a)", d: "m2395 723 60-147-170-176c-92-92-288-38-288-38l-222-252H992L769 363s-196-53-288 37L311 575l60 147-75 218 250 953c52 204 87 283 234 387l457 310c44 27 98 74 147 74s103-47 147-74l457-310c147-104 182-183 234-387l250-953z" }), _jsx("path", { fill: "#fff", d: "M1935 524s287 347 287 420c0 75-36 94-72 133l-215 230c-20 20-63 54-38 113 25 60 60 134 20 210-40 77-110 128-155 120a820 820 0 0 1-190-90c-38-25-160-126-160-165s126-110 150-124c23-16 130-78 132-102s2-30-30-90-88-140-80-192c10-52 100-80 167-105l207-78c16-8 12-15-36-20-48-4-183-22-244-5s-163 43-173 57c-8 14-16 14-7 62l58 315c4 40 12 67-30 77-44 10-117 27-142 27s-99-17-142-27-35-37-30-77c4-40 48-268 57-315 10-48 1-48-7-62-10-14-113-40-174-57-60-17-196 1-244 6-48 4-52 10-36 20l207 77c66 25 158 53 167 105 10 53-47 132-80 192s-32 66-30 90 110 86 132 102c24 15 150 85 150 124s-119 140-159 165a820 820 0 0 1-190 90c-45 8-115-43-156-120-40-76-4-150 20-210 25-60-17-92-38-113l-215-230c-35-37-71-57-71-131s287-420 287-420l273 44c32 0 103-27 168-50 65-20 110-22 110-22s44 0 110 22 136 50 168 50c33 0 275-47 275-47zm-215 1328c18 10 7 32-10 44l-254 198c-20 20-52 50-73 50s-52-30-73-50a13200 13200 0 0 0-255-198c-16-12-27-33-10-44l150-80a870 870 0 0 1 188-73c15 0 110 34 187 73l150 80z" }), _jsx("path", { fill: "url(#brave_b)", d: "m1999 363-224-253H992L769 363s-196-53-288 37c0 0 260-23 350 123l276 47c32 0 103-27 168-50 65-20 110-22 110-22s44 0 110 22 136 50 168 50c33 0 275-47 275-47 90-146 350-123 350-123-92-92-288-38-288-38" })] }) }));
|
|
81
|
-
/** Bitget icon from wallet-adaptor-base (bitgetWallet.svg) */
|
|
82
|
-
const BitgetWalletIcon = () => (_jsx(IconFrame, { background: "#001F29", children: _jsx("svg", { width: "28", height: "28", viewBox: "0 0 512 512", fill: "none", children: _jsx("path", { d: "M219.948 95.7022C201.623 95.6929 183.33 95.6835 164.941 95.7116C153.822 95.7116 149.651 109.671 157.921 117.939L283.098 243.117C287.004 246.69 289.441 250.574 289.53 255.693C289.441 260.812 287.004 264.696 283.098 268.269L157.921 393.446C149.651 401.715 153.822 415.674 164.941 415.674C183.33 415.702 201.623 415.693 219.948 415.683C229.122 415.679 238.305 415.674 247.511 415.674C259.555 415.674 266.72 409.24 273.154 402.805L386.047 289.912C395.057 280.902 403.119 268.939 403.009 255.693C403.119 242.447 395.057 230.484 386.047 221.474L273.154 108.58C266.72 102.146 259.555 95.7116 247.511 95.7116C238.305 95.7116 229.122 95.7069 219.948 95.7022Z", fill: "#00F0FF" }) }) }));
|
|
83
|
-
const walletIconTheme = {
|
|
84
|
-
metamask: "#F6851B",
|
|
85
|
-
okx: "#050608",
|
|
86
|
-
coinbase: "#0052FF",
|
|
87
|
-
trust: "#3375FF",
|
|
88
|
-
phantom: "#6C47FF",
|
|
89
|
-
rabby: "#7084FF",
|
|
90
|
-
rainbow: "#123F99",
|
|
91
|
-
zerion: "#2962EF",
|
|
92
|
-
brave: "#FF452A",
|
|
93
|
-
bitget: "#00F0FF",
|
|
94
|
-
};
|
|
95
|
-
const WalletPlaceholder = ({ walletId, name }) => (_jsx(IconFrame, { background: walletIconTheme[walletId] ?? colors.cardRaised, children: _jsx("span", { style: {
|
|
96
|
-
fontSize: 14,
|
|
97
|
-
fontWeight: 700,
|
|
98
|
-
color: walletIconTheme[walletId] ? "#FFFFFF" : colors.textSecondary,
|
|
99
|
-
fontFamily: fonts.family,
|
|
100
|
-
}, children: name.slice(0, 2).toUpperCase() }) }));
|
|
101
|
-
export const DefaultWalletIcon = ({ walletId, name, }) => {
|
|
102
|
-
switch (walletId) {
|
|
103
|
-
case "metamask":
|
|
104
|
-
return _jsx(MetaMaskWalletIcon, {});
|
|
105
|
-
case "okx":
|
|
106
|
-
return _jsx(OKXWalletIcon, {});
|
|
107
|
-
case "coinbase":
|
|
108
|
-
return _jsx(CoinbaseWalletIcon, {});
|
|
109
|
-
case "trust":
|
|
110
|
-
return _jsx(TrustWalletIcon, {});
|
|
111
|
-
case "phantom":
|
|
112
|
-
return _jsx(PhantomWalletIcon, {});
|
|
113
|
-
case "rabby":
|
|
114
|
-
return _jsx(RabbyWalletIcon, {});
|
|
115
|
-
case "rainbow":
|
|
116
|
-
return _jsx(RainbowWalletIcon, {});
|
|
117
|
-
case "zerion":
|
|
118
|
-
return _jsx(ZerionWalletIcon, {});
|
|
119
|
-
case "brave":
|
|
120
|
-
return _jsx(BraveWalletIcon, {});
|
|
121
|
-
case "bitget":
|
|
122
|
-
return _jsx(BitgetWalletIcon, {});
|
|
123
|
-
default:
|
|
124
|
-
return _jsx(WalletPlaceholder, { walletId: walletId, name: name });
|
|
125
|
-
}
|
|
126
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
export interface WalletOption {
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
description: string;
|
|
6
|
-
category: "social" | "plugin";
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
export interface WalletSelectionModalProps {
|
|
10
|
-
title?: string;
|
|
11
|
-
options: WalletOption[];
|
|
12
|
-
onSelect?: (id: string) => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const WalletSelectionModal: ({ title, options, onSelect, }: WalletSelectionModalProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { colors, fonts, radii } from "./theme.js";
|
|
3
|
-
const placeholderIcon = (label) => (_jsx("div", { style: {
|
|
4
|
-
width: 40,
|
|
5
|
-
height: 40,
|
|
6
|
-
borderRadius: "12px",
|
|
7
|
-
background: colors.cardRaised,
|
|
8
|
-
display: "flex",
|
|
9
|
-
alignItems: "center",
|
|
10
|
-
justifyContent: "center",
|
|
11
|
-
color: colors.textSecondary,
|
|
12
|
-
fontWeight: 600,
|
|
13
|
-
}, children: label.slice(0, 2).toUpperCase() }));
|
|
14
|
-
export const WalletSelectionModal = ({ title = "Connect Wallet", options, onSelect, }) => {
|
|
15
|
-
const sections = [
|
|
16
|
-
{
|
|
17
|
-
id: "social",
|
|
18
|
-
label: "Social Wallets",
|
|
19
|
-
items: options.filter((item) => item.category === "social"),
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "plugin",
|
|
23
|
-
label: "Plugin Wallets",
|
|
24
|
-
items: options.filter((item) => item.category === "plugin"),
|
|
25
|
-
},
|
|
26
|
-
].filter((section) => section.items.length > 0);
|
|
27
|
-
return (_jsxs("div", { style: {
|
|
28
|
-
width: "min(720px, 90vw)",
|
|
29
|
-
background: colors.card,
|
|
30
|
-
borderRadius: radii.xl,
|
|
31
|
-
border: `1px solid ${colors.border}`,
|
|
32
|
-
padding: "40px",
|
|
33
|
-
display: "flex",
|
|
34
|
-
flexDirection: "column",
|
|
35
|
-
gap: 32,
|
|
36
|
-
color: colors.textPrimary,
|
|
37
|
-
fontFamily: fonts.family,
|
|
38
|
-
}, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 26, fontWeight: 600 }, children: title }), _jsx("p", { style: { color: colors.textSecondary, marginTop: 8 }, children: "Choose social or plugin wallets" })] }), sections.map((section) => (_jsxs("section", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [_jsx("div", { style: { fontSize: 14, textTransform: "uppercase", letterSpacing: 1.5, color: colors.textSecondary }, children: section.label }), _jsx("div", { style: {
|
|
39
|
-
display: "grid",
|
|
40
|
-
gap: 16,
|
|
41
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))",
|
|
42
|
-
}, children: section.items.map((option) => (_jsxs("button", { onClick: () => onSelect?.(option.id), style: {
|
|
43
|
-
borderRadius: radii.lg,
|
|
44
|
-
border: `1px solid ${colors.border}`,
|
|
45
|
-
background: colors.cardRaised,
|
|
46
|
-
padding: "20px",
|
|
47
|
-
display: "flex",
|
|
48
|
-
gap: 14,
|
|
49
|
-
alignItems: "center",
|
|
50
|
-
textAlign: "left",
|
|
51
|
-
cursor: "pointer",
|
|
52
|
-
color: colors.textPrimary,
|
|
53
|
-
}, children: [option.icon ?? placeholderIcon(option.label), _jsxs("div", { children: [_jsx("div", { style: { fontWeight: 600 }, children: option.label }), _jsx("div", { style: { color: colors.textSecondary, fontSize: 14 }, children: option.description })] })] }, option.id))) })] }, section.id)))] }));
|
|
54
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { ChangeEventHandler } from "react";
|
|
2
|
-
import { type SelectOption } from "./components/DropdownField.js";
|
|
3
|
-
import { type WithdrawOrderResponseData } from "../modules/api.js";
|
|
4
|
-
export type WithdrawUiStatus = "idle" | "pending" | "success" | "manual_review";
|
|
5
|
-
export interface WithdrawModalProps {
|
|
6
|
-
address?: string;
|
|
7
|
-
token?: string;
|
|
8
|
-
tokenSymbol?: string;
|
|
9
|
-
chain?: string;
|
|
10
|
-
amount?: string;
|
|
11
|
-
balance?: string;
|
|
12
|
-
status?: WithdrawUiStatus;
|
|
13
|
-
receiveAmount?: string;
|
|
14
|
-
txHash?: string;
|
|
15
|
-
eta?: string;
|
|
16
|
-
tokenOptions?: SelectOption[];
|
|
17
|
-
chainOptions?: SelectOption[];
|
|
18
|
-
/** 使用 Merchant API:getChains 拉取 token/chain,quote(withdraw) 询价 */
|
|
19
|
-
useMerchantApi?: boolean;
|
|
20
|
-
/** 创建订单后传入,用于轮询提现订单状态 */
|
|
21
|
-
orderId?: string;
|
|
22
|
-
/** 提现模式:direct 直接提现,cross_chain 跨链提现 */
|
|
23
|
-
withdrawMode?: "direct" | "cross_chain";
|
|
24
|
-
/**
|
|
25
|
-
* 直接提现模式(无 orderId)下的结果数据;
|
|
26
|
-
* 将用来构造一个与 getWithdrawOrder 返回值兼容的对象,从而复用“有 orderId”时的全部交互与展示。
|
|
27
|
-
* 最少建议提供:status、dst_token_amount、target_chain_id、target_address(必要时包含 dst_tx_hash / out_tx_hash、fee)。
|
|
28
|
-
*/
|
|
29
|
-
withdrawDirectResult?: Partial<WithdrawOrderResponseData>;
|
|
30
|
-
/** 成功页 Fee 展示:优先用订单接口返回的 fee,若后端未返回则用此值(如询价时的 fee),均无则显示 "—" */
|
|
31
|
-
feeDisplay?: string;
|
|
32
|
-
/** 广播后的 funding tx 所在链 id,与 txHash 一起用于展示「查看交易」链接 */
|
|
33
|
-
fundingChainId?: string;
|
|
34
|
-
/** 构建链上交易浏览器链接(已弃用,使用 getExplorerUrl) */
|
|
35
|
-
explorerTxUrl?: (chainId: string, txHash: string) => string;
|
|
36
|
-
onShowToast?: (message: string) => void;
|
|
37
|
-
onAddressChange?: ChangeEventHandler<HTMLInputElement>;
|
|
38
|
-
onTokenSelect?: (id: string) => void;
|
|
39
|
-
onChainSelect?: (id: string) => void;
|
|
40
|
-
onAmountChange?: ChangeEventHandler<HTMLInputElement>;
|
|
41
|
-
onMaxClick?: () => void;
|
|
42
|
-
/** 提交时传入当前表单值(收款地址、金额、所选 token、链上合约地址、所选 chain),由调用方执行提现 */
|
|
43
|
-
onSubmit?: (payload: {
|
|
44
|
-
toAddress: string;
|
|
45
|
-
amount: string;
|
|
46
|
-
token: string;
|
|
47
|
-
tokenAddress: string;
|
|
48
|
-
chain: string;
|
|
49
|
-
}) => void;
|
|
50
|
-
/** 提现订单状态变为 completed 时调用,用于调用方刷新余额等 */
|
|
51
|
-
onWithdrawCompleted?: () => void;
|
|
52
|
-
/** 点击「Start another withdrawal」时调用;应由调用方清空 orderId、重置 amount,恢复到待提交状态(不关弹层)。未传则退化为 onClose。 */
|
|
53
|
-
onStartAnotherWithdrawal?: () => void;
|
|
54
|
-
onSignIn?: () => void;
|
|
55
|
-
onClose?: () => void;
|
|
56
|
-
}
|
|
57
|
-
export declare const WithdrawModal: ({ address, token, tokenSymbol, chain, amount, balance, status, receiveAmount: receiveAmountProp, txHash, tokenOptions: tokenOptionsProp, chainOptions: chainOptionsProp, useMerchantApi, orderId, withdrawMode, withdrawDirectResult, feeDisplay, fundingChainId, onShowToast, onAddressChange, onTokenSelect, onChainSelect, onAmountChange, onMaxClick, onSubmit, onWithdrawCompleted, onStartAnotherWithdrawal, onSignIn, onClose, }: WithdrawModalProps) => import("react/jsx-runtime.js").JSX.Element;
|