@hot-labs/kit 1.5.4 → 1.6.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/.github/workflows/release.yml +1 -1
- package/README.md +5 -5
- package/build/HotBridgeWithdrawal.d.ts +10 -0
- package/build/HotBridgeWithdrawal.js +80 -0
- package/build/HotBridgeWithdrawal.js.map +1 -0
- package/build/{HotConnector.d.ts → HotKit.d.ts} +9 -5
- package/build/{HotConnector.js → HotKit.js} +14 -11
- package/build/HotKit.js.map +1 -0
- package/build/activity.d.ts +10 -12
- package/build/activity.js +28 -67
- package/build/activity.js.map +1 -1
- package/build/core/Intents.d.ts +6 -9
- package/build/core/Intents.js +28 -29
- package/build/core/Intents.js.map +1 -1
- package/build/core/OmniConnector.d.ts +3 -3
- package/build/core/OmniConnector.js +13 -13
- package/build/core/OmniConnector.js.map +1 -1
- package/build/core/OmniWallet.d.ts +3 -2
- package/build/core/OmniWallet.js +5 -5
- package/build/core/OmniWallet.js.map +1 -1
- package/build/core/chains.d.ts +2 -1
- package/build/core/chains.js +1 -0
- package/build/core/chains.js.map +1 -1
- package/build/core/exchange.d.ts +6 -9
- package/build/core/exchange.js +17 -93
- package/build/core/exchange.js.map +1 -1
- package/build/core/pendings.d.ts +43 -0
- package/build/core/pendings.js +169 -0
- package/build/core/pendings.js.map +1 -0
- package/build/core/telemetry.d.ts +3 -3
- package/build/core/telemetry.js +4 -4
- package/build/core/telemetry.js.map +1 -1
- package/build/cosmos/connector.d.ts +2 -2
- package/build/cosmos/connector.js +2 -2
- package/build/cosmos/connector.js.map +1 -1
- package/build/cosmos/index.d.ts +2 -2
- package/build/cosmos/index.js +1 -1
- package/build/cosmos/index.js.map +1 -1
- package/build/defaults.d.ts +1 -1
- package/build/evm/connector.d.ts +4 -4
- package/build/evm/connector.js +2 -2
- package/build/evm/connector.js.map +1 -1
- package/build/evm/index.d.ts +2 -2
- package/build/evm/index.js +1 -1
- package/build/evm/index.js.map +1 -1
- package/build/hocraft/connector.d.ts +3 -3
- package/build/hocraft/connector.js +7 -7
- package/build/hocraft/connector.js.map +1 -1
- package/build/hocraft/index.d.ts +2 -2
- package/build/hocraft/index.js +1 -1
- package/build/hocraft/index.js.map +1 -1
- package/build/hot-wallet/google.d.ts +2 -2
- package/build/hot-wallet/google.js +5 -5
- package/build/hot-wallet/google.js.map +1 -1
- package/build/hot-wallet/index.d.ts +2 -2
- package/build/hot-wallet/index.js +1 -1
- package/build/hot-wallet/index.js.map +1 -1
- package/build/index.d.ts +3 -1
- package/build/index.js +4 -1
- package/build/index.js.map +1 -1
- package/build/near/connector.d.ts +3 -3
- package/build/near/connector.js +4 -4
- package/build/near/connector.js.map +1 -1
- package/build/near/index.d.ts +2 -2
- package/build/near/index.js +1 -1
- package/build/near/index.js.map +1 -1
- package/build/solana/connector.d.ts +4 -4
- package/build/solana/connector.js +2 -2
- package/build/solana/connector.js.map +1 -1
- package/build/solana/index.d.ts +2 -2
- package/build/solana/index.js +1 -1
- package/build/solana/index.js.map +1 -1
- package/build/stellar/connector.d.ts +2 -2
- package/build/stellar/connector.js +3 -3
- package/build/stellar/connector.js.map +1 -1
- package/build/stellar/index.d.ts +2 -2
- package/build/stellar/index.js +1 -1
- package/build/stellar/index.js.map +1 -1
- package/build/storage.d.ts +10 -0
- package/build/storage.js +56 -0
- package/build/storage.js.map +1 -1
- package/build/ton/connector.d.ts +2 -2
- package/build/ton/connector.js +3 -3
- package/build/ton/connector.js.map +1 -1
- package/build/ton/index.d.ts +2 -2
- package/build/ton/index.js +1 -1
- package/build/ton/index.js.map +1 -1
- package/build/tron/connector.d.ts +2 -2
- package/build/tron/connector.js +2 -2
- package/build/tron/connector.js.map +1 -1
- package/build/tron/index.d.ts +2 -2
- package/build/tron/index.js +1 -1
- package/build/tron/index.js.map +1 -1
- package/build/ui/Popup.d.ts +2 -1
- package/build/ui/Popup.js +3 -3
- package/build/ui/Popup.js.map +1 -1
- package/build/ui/bridge/Bridge.d.ts +4 -4
- package/build/ui/bridge/Bridge.js +36 -40
- package/build/ui/bridge/Bridge.js.map +1 -1
- package/build/ui/bridge/SelectRecipient.d.ts +3 -3
- package/build/ui/bridge/SelectRecipient.js +2 -2
- package/build/ui/bridge/SelectSender.d.ts +3 -3
- package/build/ui/bridge/SelectSender.js +2 -2
- package/build/ui/bridge/SelectToken.d.ts +3 -3
- package/build/ui/bridge/SelectToken.js +12 -12
- package/build/ui/bridge/TokenCard.d.ts +10 -8
- package/build/ui/bridge/TokenCard.js +3 -3
- package/build/ui/bridge/TokenCard.js.map +1 -1
- package/build/ui/connect/AuthPopup.d.ts +8 -1
- package/build/ui/connect/AuthPopup.js +2 -20
- package/build/ui/connect/AuthPopup.js.map +1 -1
- package/build/ui/connect/ConnectWallet.d.ts +3 -3
- package/build/ui/connect/ConnectWallet.js +3 -3
- package/build/ui/connect/PrimaryWallet.d.ts +3 -3
- package/build/ui/connect/PrimaryWallet.js +2 -2
- package/build/ui/connect/PrimaryWallet.js.map +1 -1
- package/build/ui/icons/copy.d.ts +1 -0
- package/build/ui/icons/copy.js +5 -0
- package/build/ui/icons/copy.js.map +1 -0
- package/build/ui/icons/warning.d.ts +1 -0
- package/build/ui/icons/warning.js +5 -0
- package/build/ui/icons/warning.js.map +1 -0
- package/build/ui/profile/DepositFlow.d.ts +8 -0
- package/build/ui/profile/DepositFlow.js +13 -0
- package/build/ui/profile/DepositFlow.js.map +1 -0
- package/build/ui/profile/DepositQR.d.ts +4 -2
- package/build/ui/profile/DepositQR.js +25 -4
- package/build/ui/profile/DepositQR.js.map +1 -1
- package/build/ui/profile/Payment.d.ts +6 -9
- package/build/ui/profile/Payment.js +36 -28
- package/build/ui/profile/Payment.js.map +1 -1
- package/build/ui/profile/Profile.d.ts +3 -3
- package/build/ui/profile/Profile.js +18 -52
- package/build/ui/profile/Profile.js.map +1 -1
- package/build/ui/router.d.ts +14 -15
- package/build/ui/router.js +37 -16
- package/build/ui/router.js.map +1 -1
- package/build/ui/toast/index.d.ts +42 -0
- package/build/ui/toast/index.js +165 -0
- package/build/ui/toast/index.js.map +1 -0
- package/build/ui/uikit/button.js +1 -1
- package/build/ui/uikit/checkbox.d.ts +8 -0
- package/build/ui/uikit/checkbox.js +39 -0
- package/build/ui/uikit/checkbox.js.map +1 -0
- package/build/ui/uikit/text.js +27 -27
- package/package.json +1 -1
- package/src/HotBridgeWithdrawal.ts +80 -0
- package/src/{HotConnector.ts → HotKit.ts} +17 -13
- package/src/activity.ts +34 -69
- package/src/core/Intents.ts +22 -36
- package/src/core/OmniConnector.ts +12 -12
- package/src/core/OmniWallet.ts +6 -6
- package/src/core/chains.ts +1 -0
- package/src/core/exchange.ts +19 -89
- package/src/core/pendings.ts +181 -0
- package/src/core/telemetry.ts +3 -3
- package/src/cosmos/connector.ts +3 -3
- package/src/cosmos/index.ts +3 -3
- package/src/evm/connector.ts +3 -3
- package/src/evm/index.ts +2 -2
- package/src/hocraft/connector.ts +6 -6
- package/src/hocraft/index.ts +2 -2
- package/src/hot-wallet/google.ts +6 -6
- package/src/hot-wallet/index.ts +2 -2
- package/src/index.ts +6 -1
- package/src/near/connector.ts +3 -3
- package/src/near/index.ts +2 -2
- package/src/solana/connector.ts +3 -3
- package/src/solana/index.ts +2 -2
- package/src/stellar/connector.ts +4 -4
- package/src/stellar/index.ts +2 -2
- package/src/storage.ts +69 -0
- package/src/ton/connector.ts +4 -4
- package/src/ton/index.ts +2 -2
- package/src/tron/connector.ts +3 -3
- package/src/tron/index.ts +2 -2
- package/src/ui/Popup.tsx +4 -3
- package/src/ui/bridge/Bridge.tsx +43 -46
- package/src/ui/bridge/SelectRecipient.tsx +4 -4
- package/src/ui/bridge/SelectSender.tsx +4 -4
- package/src/ui/bridge/SelectToken.tsx +14 -14
- package/src/ui/bridge/TokenCard.tsx +31 -24
- package/src/ui/connect/AuthPopup.tsx +1 -24
- package/src/ui/connect/ConnectWallet.tsx +5 -5
- package/src/ui/connect/PrimaryWallet.tsx +3 -3
- package/src/ui/icons/copy.tsx +8 -0
- package/src/ui/icons/warning.tsx +10 -0
- package/src/ui/profile/DepositFlow.tsx +27 -0
- package/src/ui/profile/DepositQR.tsx +48 -17
- package/src/ui/profile/Payment.tsx +67 -37
- package/src/ui/profile/Profile.tsx +40 -68
- package/src/ui/router.tsx +48 -21
- package/src/ui/toast/index.tsx +238 -0
- package/src/ui/uikit/button.tsx +1 -1
- package/src/ui/uikit/checkbox.tsx +60 -0
- package/src/ui/uikit/text.tsx +27 -27
- package/build/HotConnector.js.map +0 -1
- package/build/ui/uikit/Toast.d.ts +0 -4
- package/build/ui/uikit/Toast.js +0 -33
- package/build/ui/uikit/Toast.js.map +0 -1
- package/src/ui/uikit/Toast.tsx +0 -45
- package/vite.config.ts +0 -17
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface ToastConfig {
|
|
2
|
+
id: string;
|
|
3
|
+
message: string;
|
|
4
|
+
type: "success" | "failed" | "pending";
|
|
5
|
+
progressText?: string;
|
|
6
|
+
progress?: number;
|
|
7
|
+
duration?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ToastController extends ToastConfig {
|
|
10
|
+
timer: NodeJS.Timeout | null;
|
|
11
|
+
update: (config: Partial<ToastConfig>) => void;
|
|
12
|
+
dismiss: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare class ToastManager {
|
|
15
|
+
root: HTMLDivElement | null;
|
|
16
|
+
toasts: ToastController[];
|
|
17
|
+
constructor();
|
|
18
|
+
mount(): void;
|
|
19
|
+
unmount(): void;
|
|
20
|
+
pending(message: string): ToastController & {
|
|
21
|
+
timer: NodeJS.Timeout | null;
|
|
22
|
+
update: (config: Partial<ToastConfig>) => void;
|
|
23
|
+
dismiss: () => void;
|
|
24
|
+
};
|
|
25
|
+
success(message: string): ToastController & {
|
|
26
|
+
timer: NodeJS.Timeout | null;
|
|
27
|
+
update: (config: Partial<ToastConfig>) => void;
|
|
28
|
+
dismiss: () => void;
|
|
29
|
+
};
|
|
30
|
+
failed(message: string): ToastController & {
|
|
31
|
+
timer: NodeJS.Timeout | null;
|
|
32
|
+
update: (config: Partial<ToastConfig>) => void;
|
|
33
|
+
dismiss: () => void;
|
|
34
|
+
};
|
|
35
|
+
present(config: Omit<ToastConfig, "id">): ToastController & {
|
|
36
|
+
timer: NodeJS.Timeout | null;
|
|
37
|
+
update: (config: Partial<ToastConfig>) => void;
|
|
38
|
+
dismiss: () => void;
|
|
39
|
+
};
|
|
40
|
+
update(id: string, config: Partial<Omit<ToastConfig, "id">>): void;
|
|
41
|
+
dismiss(id: string): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { observer } from "mobx-react-lite";
|
|
3
|
+
import { action, makeObservable, observable } from "mobx";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
import uuid4 from "uuid4";
|
|
7
|
+
import { PSmall } from "../uikit/text";
|
|
8
|
+
export class ToastManager {
|
|
9
|
+
root = null;
|
|
10
|
+
toasts = [];
|
|
11
|
+
constructor() {
|
|
12
|
+
makeObservable(this, {
|
|
13
|
+
toasts: observable,
|
|
14
|
+
present: action,
|
|
15
|
+
dismiss: action,
|
|
16
|
+
update: action,
|
|
17
|
+
mount: action,
|
|
18
|
+
unmount: action,
|
|
19
|
+
pending: action,
|
|
20
|
+
success: action,
|
|
21
|
+
failed: action,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
mount() {
|
|
25
|
+
if (document.getElementById("toast-root"))
|
|
26
|
+
return;
|
|
27
|
+
if (this.root)
|
|
28
|
+
return;
|
|
29
|
+
const root = document.createElement("div");
|
|
30
|
+
root.id = "toast-root";
|
|
31
|
+
document.body.appendChild(root);
|
|
32
|
+
createRoot(root).render(_jsx(ToastProvider, { manager: this }));
|
|
33
|
+
this.root = root;
|
|
34
|
+
}
|
|
35
|
+
unmount() {
|
|
36
|
+
if (!this.root)
|
|
37
|
+
return;
|
|
38
|
+
this.root.remove();
|
|
39
|
+
this.root = null;
|
|
40
|
+
}
|
|
41
|
+
pending(message) {
|
|
42
|
+
return this.present({ message, type: "pending", duration: Infinity });
|
|
43
|
+
}
|
|
44
|
+
success(message) {
|
|
45
|
+
return this.present({ message, type: "success" });
|
|
46
|
+
}
|
|
47
|
+
failed(message) {
|
|
48
|
+
return this.present({ message, type: "failed" });
|
|
49
|
+
}
|
|
50
|
+
present(config) {
|
|
51
|
+
this.mount();
|
|
52
|
+
const id = uuid4();
|
|
53
|
+
let timer = null;
|
|
54
|
+
if (config.duration !== Infinity) {
|
|
55
|
+
timer = setTimeout(() => this.dismiss(id), config.duration || 3000);
|
|
56
|
+
}
|
|
57
|
+
const toast = {
|
|
58
|
+
update: (config) => this.update(id, config),
|
|
59
|
+
dismiss: () => this.dismiss(id),
|
|
60
|
+
progressText: config.progressText,
|
|
61
|
+
message: config.message,
|
|
62
|
+
type: config.type,
|
|
63
|
+
timer: timer,
|
|
64
|
+
id,
|
|
65
|
+
};
|
|
66
|
+
this.toasts.unshift(toast);
|
|
67
|
+
return toast;
|
|
68
|
+
}
|
|
69
|
+
update(id, config) {
|
|
70
|
+
const toast = this.toasts.find((toast) => toast.id === id);
|
|
71
|
+
if (!toast)
|
|
72
|
+
return;
|
|
73
|
+
toast.message = config.message || toast.message;
|
|
74
|
+
toast.duration = config.duration || toast.duration;
|
|
75
|
+
toast.progress = config.progress || toast.progress;
|
|
76
|
+
toast.progressText = config.progressText || toast.progressText;
|
|
77
|
+
toast.type = config.type || toast.type;
|
|
78
|
+
if (config.duration) {
|
|
79
|
+
if (toast.timer)
|
|
80
|
+
clearTimeout(toast.timer);
|
|
81
|
+
if (config.duration === Infinity)
|
|
82
|
+
toast.timer = null;
|
|
83
|
+
else
|
|
84
|
+
toast.timer = setTimeout(() => this.dismiss(id), config.duration);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
dismiss(id) {
|
|
88
|
+
this.toasts = this.toasts.filter((toast) => toast.id !== id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const ToastProvider = observer(({ manager }) => {
|
|
92
|
+
return (_jsx(Root, { children: manager.toasts.map((toast) => (_jsx(Toast, { toast: toast }, toast.id))) }));
|
|
93
|
+
});
|
|
94
|
+
const Toast = observer(({ toast }) => {
|
|
95
|
+
return (_jsxs(Container, { onClick: () => toast.dismiss(), "$type": toast.type, children: [_jsxs(ToastHeader, { children: [toast.type === "success" && _jsx(SuccessIcon, {}), toast.type === "failed" && _jsx(ErrorIcon, {}), toast.type === "pending" && _jsx(CircleLoader, {}), _jsx(PSmall, { style: { color: "#fff", fontWeight: "bold" }, children: toast.message })] }), toast.progressText && (_jsx(ToastContent, { children: _jsx(PSmall, { children: toast.progressText }) }))] }));
|
|
96
|
+
});
|
|
97
|
+
const SuccessIcon = () => (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M11.7434 2.00439C17.2643 1.86277 21.8544 6.22285 21.9963 11.7437C22.138 17.2647 17.7771 21.8559 12.2561 21.9976C6.73539 22.139 2.14498 17.7781 2.00317 12.2573C1.86153 6.7364 6.22251 2.1462 11.7434 2.00439ZM18.0481 8.31299C17.7633 8.01235 17.2883 7.99898 16.9875 8.28369L10.5208 14.4097L7.00024 11.2095C6.69387 10.931 6.21934 10.9531 5.94067 11.2593C5.6623 11.5657 5.68436 12.0402 5.99048 12.3188L10.0276 15.9888L10.5422 16.4565L11.0471 15.978L18.0198 9.37354C18.3204 9.08874 18.3327 8.61369 18.0481 8.31299Z", fill: "#00DE93" }) }));
|
|
98
|
+
const ErrorIcon = () => (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M11.7424 2.00537C17.2633 1.86369 21.8534 6.22385 21.9954 11.7446C22.1368 17.2655 17.776 21.8569 12.2551 21.9985C6.73479 22.1396 2.14419 17.7787 2.0022 12.2583C1.86056 6.73754 6.22177 2.14744 11.7424 2.00537ZM12.0002 14.2505C11.586 14.2505 11.2502 14.5863 11.2502 15.0005V15.5005C11.2504 15.9146 11.5861 16.2505 12.0002 16.2505C12.4142 16.2503 12.7501 15.9145 12.7502 15.5005V15.0005C12.7502 14.5864 12.4143 14.2506 12.0002 14.2505ZM12.0002 7.25049C11.586 7.25049 11.2502 7.58627 11.2502 8.00049V13.0005C11.2504 13.4146 11.5861 13.7505 12.0002 13.7505C12.4142 13.7503 12.7501 13.4145 12.7502 13.0005V8.00049C12.7502 7.58637 12.4143 7.25065 12.0002 7.25049Z", fill: "#F34747" }) }));
|
|
99
|
+
const CircleLoader = () => (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", children: _jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "#FDBF1E", strokeWidth: "3", fill: "none", strokeLinecap: "round", strokeDasharray: "40", strokeDashoffset: "0", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) }) }));
|
|
100
|
+
const Root = styled.div `
|
|
101
|
+
position: fixed;
|
|
102
|
+
bottom: 48px;
|
|
103
|
+
left: 12px;
|
|
104
|
+
right: 12px;
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
gap: 12px;
|
|
108
|
+
z-index: 1000000000;
|
|
109
|
+
`;
|
|
110
|
+
const ToastContent = styled.div `
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
background: var(--surface-container, #1f1f1f);
|
|
114
|
+
padding: 8px 12px;
|
|
115
|
+
gap: 4px;
|
|
116
|
+
`;
|
|
117
|
+
const ToastHeader = styled.div `
|
|
118
|
+
display: flex;
|
|
119
|
+
padding: 12px;
|
|
120
|
+
align-items: center;
|
|
121
|
+
padding: 12px;
|
|
122
|
+
gap: 12px;
|
|
123
|
+
`;
|
|
124
|
+
const Container = styled.div `
|
|
125
|
+
border-radius: var(--border-radius-16, 16px);
|
|
126
|
+
border: 1px solid var(--border-border-default, #323232);
|
|
127
|
+
background: var(--surface-container-high, #272727);
|
|
128
|
+
box-shadow: -6px 6px 16px 0 rgba(0, 0, 0, 0.6);
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
position: relative;
|
|
131
|
+
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
width: 320px;
|
|
134
|
+
|
|
135
|
+
&::before {
|
|
136
|
+
content: "";
|
|
137
|
+
border-radius: 292px;
|
|
138
|
+
background: ${(props) => (props.$type === "success" ? "rgba(0, 222, 147, 0.08)" : props.$type === "failed" ? "rgba(243, 71, 71, 0.08)" : "rgba(253, 191, 30, 0.08)")};
|
|
139
|
+
filter: blur(14px);
|
|
140
|
+
position: absolute;
|
|
141
|
+
right: 33px;
|
|
142
|
+
top: -15px;
|
|
143
|
+
width: 292px;
|
|
144
|
+
height: 33px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:hover {
|
|
148
|
+
transform: scale(1.02);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
animation: fadeIn 0.3s ease-in-out;
|
|
152
|
+
transition: 0.2s transform;
|
|
153
|
+
|
|
154
|
+
@keyframes fadeIn {
|
|
155
|
+
from {
|
|
156
|
+
opacity: 0;
|
|
157
|
+
transform: translateY(8px);
|
|
158
|
+
}
|
|
159
|
+
to {
|
|
160
|
+
opacity: 1;
|
|
161
|
+
transform: translateY(0);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/toast/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAA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
4
|
+
children: React.ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const CheckboxWrap: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {
|
|
7
|
+
checked: boolean;
|
|
8
|
+
}>> & string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
export const Checkbox = ({ value, onChange, children }) => {
|
|
4
|
+
return (_jsxs(CheckboxWrap, { checked: value, children: [_jsxs("div", { children: [value && _jsx(CheckboxIcon, {}), _jsx("input", { type: "checkbox", checked: value, onChange: () => onChange(!value) })] }), children] }));
|
|
5
|
+
};
|
|
6
|
+
export const CheckboxWrap = styled.label `
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
gap: 8px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
|
|
13
|
+
div {
|
|
14
|
+
width: 16px;
|
|
15
|
+
height: 16px;
|
|
16
|
+
border-radius: 4px;
|
|
17
|
+
border: ${({ checked }) => (checked ? "transparent" : "1px solid rgba(255, 255, 255, 0.17)")};
|
|
18
|
+
background: ${({ checked }) => (checked ? "#fff" : "transparent")};
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
input {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
width: 16px;
|
|
29
|
+
height: 16px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const CheckboxIcon = () => {
|
|
37
|
+
return (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("rect", { width: "16", height: "16", rx: "4", fill: "#FDBF1E" }), _jsx("path", { d: "M11.4917 5.40918C11.642 5.26695 11.8796 5.27368 12.022 5.42383C12.1643 5.57419 12.1576 5.81172 12.0073 5.9541L7.25732 10.4541L7.00439 10.6934L6.74756 10.459L3.99756 7.95898C3.84459 7.81976 3.83325 7.58289 3.97217 7.42969C4.1114 7.27653 4.34821 7.26524 4.50146 7.4043L6.99365 9.66992L11.4917 5.40918Z", fill: "black", stroke: "black", "stroke-width": "1", "stroke-linecap": "round", "stroke-linejoin": "round" })] }));
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/ui/uikit/checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAqF,EAAE,EAAE;IAC3I,OAAO,CACL,MAAC,YAAY,IAAC,OAAO,EAAE,KAAK,aAC1B,0BACG,KAAK,IAAI,KAAC,YAAY,KAAG,EAC1B,gBAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAI,IACvE,EACL,QAAQ,IACI,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAsB;;;;;;;;;;;cAWhD,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,qCAAqC,CAAC;kBAC9E,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC;;;;;;;;;;;;;;;;;CAiBpE,CAAC;AAEF,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,OAAO,CACL,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,aAC5F,eAAM,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAC,SAAS,GAAG,EACrD,eACE,CAAC,EAAC,6SAA6S,EAC/S,IAAI,EAAC,OAAO,EACZ,MAAM,EAAC,OAAO,kBACD,GAAG,oBACD,OAAO,qBACN,OAAO,GACvB,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
package/build/ui/uikit/text.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
export const PSmall = styled.p `
|
|
3
|
-
color:
|
|
4
|
-
font-family:
|
|
5
|
-
font-size:
|
|
6
|
-
line-height:
|
|
3
|
+
color: #bfbfbf;
|
|
4
|
+
font-family: "Golos Text";
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
line-height: 20px;
|
|
7
7
|
letter-spacing: -0.14px;
|
|
8
8
|
font-style: normal;
|
|
9
9
|
font-weight: 400;
|
|
10
10
|
margin: 0;
|
|
11
11
|
`;
|
|
12
12
|
export const PMedium = styled.p `
|
|
13
|
-
color:
|
|
14
|
-
font-family:
|
|
15
|
-
font-size:
|
|
16
|
-
line-height:
|
|
13
|
+
color: #fff;
|
|
14
|
+
font-family: "Golos Text";
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
line-height: 22px;
|
|
17
17
|
letter-spacing: -0.16px;
|
|
18
18
|
font-style: normal;
|
|
19
19
|
font-weight: 500;
|
|
20
20
|
margin: 0;
|
|
21
21
|
`;
|
|
22
22
|
export const PLarge = styled.p `
|
|
23
|
-
color:
|
|
24
|
-
font-family:
|
|
25
|
-
font-size:
|
|
26
|
-
line-height:
|
|
23
|
+
color: #fff;
|
|
24
|
+
font-family: "Golos Text";
|
|
25
|
+
font-size: 18px;
|
|
26
|
+
line-height: 24px;
|
|
27
27
|
font-style: normal;
|
|
28
28
|
font-weight: 500;
|
|
29
29
|
letter-spacing: -0.18px;
|
|
30
30
|
margin: 0;
|
|
31
31
|
`;
|
|
32
32
|
export const PTiny = styled.p `
|
|
33
|
-
color:
|
|
34
|
-
font-family:
|
|
35
|
-
font-size:
|
|
36
|
-
line-height:
|
|
33
|
+
color: #fff;
|
|
34
|
+
font-family: "Golos Text";
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
line-height: 16px;
|
|
37
37
|
letter-spacing: -0.12px;
|
|
38
38
|
font-style: normal;
|
|
39
39
|
font-weight: 400;
|
|
40
40
|
margin: 0;
|
|
41
41
|
`;
|
|
42
42
|
export const H5 = styled.h5 `
|
|
43
|
-
color:
|
|
44
|
-
font-family:
|
|
45
|
-
font-size:
|
|
46
|
-
line-height:
|
|
43
|
+
color: #fff;
|
|
44
|
+
font-family: "Golos Text";
|
|
45
|
+
font-size: 24px;
|
|
46
|
+
line-height: 32px;
|
|
47
47
|
font-style: normal;
|
|
48
|
-
font-weight:
|
|
48
|
+
font-weight: bold;
|
|
49
49
|
margin: 0;
|
|
50
50
|
`;
|
|
51
51
|
export const H4 = styled.h4 `
|
|
52
52
|
color: var(--text-text-primary, #fff);
|
|
53
53
|
font-family: var(--font-family-headings, "Golos Text");
|
|
54
|
-
font-size:
|
|
55
|
-
line-height:
|
|
54
|
+
font-size: 32px;
|
|
55
|
+
line-height: 44px;
|
|
56
56
|
font-style: normal;
|
|
57
|
-
font-weight:
|
|
57
|
+
font-weight: bold;
|
|
58
58
|
margin: 0;
|
|
59
59
|
`;
|
|
60
60
|
export const H6 = styled.h6 `
|
|
61
61
|
color: var(--text-text-primary, #fff);
|
|
62
62
|
font-family: var(--font-family-headings, "Golos Text");
|
|
63
|
-
font-size:
|
|
63
|
+
font-size: 20px;
|
|
64
64
|
font-style: normal;
|
|
65
|
-
font-weight:
|
|
66
|
-
line-height:
|
|
65
|
+
font-weight: bold;
|
|
66
|
+
line-height: 28px;
|
|
67
67
|
margin: 0;
|
|
68
68
|
`;
|
|
69
69
|
//# sourceMappingURL=text.js.map
|
package/package.json
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { WithdrawArgsWithPending } from "@hot-labs/omni-sdk";
|
|
2
|
+
import { runInAction } from "mobx";
|
|
3
|
+
import { hex } from "@scure/base";
|
|
4
|
+
|
|
5
|
+
import type { HotKit } from "./HotKit";
|
|
6
|
+
|
|
7
|
+
import { chains, Network, OmniToken, WalletType } from "./core/chains";
|
|
8
|
+
import { ActivityController } from "./core/pendings";
|
|
9
|
+
import { tokens } from "./core/tokens";
|
|
10
|
+
|
|
11
|
+
export class HotBridgeWithdrawal extends ActivityController {
|
|
12
|
+
actionText = "Withdraw";
|
|
13
|
+
|
|
14
|
+
constructor(readonly args: WithdrawArgsWithPending, readonly kit: HotKit) {
|
|
15
|
+
super();
|
|
16
|
+
this.preview = tokens.get(this.args.token as OmniToken, this.args.chain);
|
|
17
|
+
this.title = `${this.preview.float(this.args.amount)} ${this.preview.symbol}`;
|
|
18
|
+
this.subtitle = new Date(this.args.timestamp).toLocaleString();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async action() {
|
|
22
|
+
try {
|
|
23
|
+
if (this.status === "pending") return;
|
|
24
|
+
runInAction(() => (this.status = "pending"));
|
|
25
|
+
|
|
26
|
+
if (this.args.chain === Network.Stellar) {
|
|
27
|
+
if (!this.kit.stellar) throw new Error("Stellar wallet not connected");
|
|
28
|
+
await this.kit.exchange.bridge.stellar.withdraw({
|
|
29
|
+
sendTransaction: (tx: any) => this.kit.stellar!.sendTransaction(tx),
|
|
30
|
+
sender: this.kit.stellar.address,
|
|
31
|
+
...this.args,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this.args.chain === Network.Solana) {
|
|
36
|
+
if (!this.kit.solana) throw new Error("Solana wallet not connected");
|
|
37
|
+
const solana = await this.kit.exchange.bridge.solana();
|
|
38
|
+
await solana.withdraw({
|
|
39
|
+
sendTransaction: (tx: any) => this.kit.solana!.sendTransaction(tx),
|
|
40
|
+
sender: this.kit.solana.address,
|
|
41
|
+
...this.args,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (this.args.chain === Network.Ton || this.args.chain === Network.OmniTon) {
|
|
46
|
+
if (!this.kit.ton) throw new Error("Ton wallet not connected");
|
|
47
|
+
await this.kit.exchange.bridge.ton.withdraw({
|
|
48
|
+
sendTransaction: (tx: any) => this.kit.ton!.sendTransaction(tx),
|
|
49
|
+
refundAddress: this.kit.ton.address,
|
|
50
|
+
...this.args,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (chains.get(this.args.chain).type === WalletType.EVM) {
|
|
55
|
+
if (!this.kit.evm) throw new Error("EVM wallet not connected");
|
|
56
|
+
await this.kit.exchange.bridge.evm.withdraw({
|
|
57
|
+
sendTransaction: (tx: any) => this.kit.evm!.sendTransaction(tx),
|
|
58
|
+
...this.args,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (this.args.chain === Network.Gonka) {
|
|
63
|
+
if (!this.kit.cosmos) throw new Error("Gonka wallet not connected");
|
|
64
|
+
const cosmos = await this.kit.exchange.bridge.cosmos();
|
|
65
|
+
await cosmos.withdraw({
|
|
66
|
+
sendTransaction: (tx: any) => this.kit.cosmos!.sendTransaction(tx),
|
|
67
|
+
senderPublicKey: hex.decode(this.kit.cosmos.publicKey!),
|
|
68
|
+
sender: this.kit.cosmos.address,
|
|
69
|
+
...this.args,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
await this.kit.exchange.bridge.clearPendingWithdrawals([this.args]).catch(() => {});
|
|
74
|
+
} finally {
|
|
75
|
+
runInAction(() => (this.status = "success"));
|
|
76
|
+
const wallet = this.kit.wallets.find((w) => w.type === chains.get(this.args.chain).type);
|
|
77
|
+
if (wallet) this.kit.activity.fetchPendingWithdrawalsByChain(this.args.chain, wallet);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -24,16 +24,18 @@ import type StellarWallet from "./stellar/wallet";
|
|
|
24
24
|
import type TonWallet from "./ton/wallet";
|
|
25
25
|
import type TronWallet from "./tron/wallet";
|
|
26
26
|
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
27
|
+
import * as Router from "./ui/router";
|
|
28
|
+
import { ToastManager } from "./ui/toast";
|
|
29
|
+
|
|
29
30
|
import { DataStorage, LocalStorage } from "./storage";
|
|
31
|
+
import { ConnectorType, OmniConnector } from "./core/OmniConnector";
|
|
30
32
|
import { Activity } from "./activity";
|
|
31
33
|
|
|
32
|
-
interface
|
|
34
|
+
interface HotKitOptions {
|
|
33
35
|
apiKey: string;
|
|
34
36
|
storage?: DataStorage;
|
|
35
37
|
chains?: Record<number, ChainConfig>;
|
|
36
|
-
connectors?: (((
|
|
38
|
+
connectors?: (((kit: HotKit) => Promise<OmniConnector>) | null | undefined)[];
|
|
37
39
|
walletConnect?: {
|
|
38
40
|
projectId?: string;
|
|
39
41
|
metadata?: {
|
|
@@ -45,11 +47,13 @@ interface HotConnectorOptions {
|
|
|
45
47
|
};
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
export class
|
|
50
|
+
export class HotKit {
|
|
49
51
|
public storage: DataStorage;
|
|
50
52
|
public connectors: OmniConnector[] = [];
|
|
51
53
|
public telemetry: Telemetry;
|
|
52
54
|
public exchange: Exchange;
|
|
55
|
+
public toast = new ToastManager();
|
|
56
|
+
public router = Router;
|
|
53
57
|
|
|
54
58
|
public activity: Activity;
|
|
55
59
|
public version = packageJson.version;
|
|
@@ -66,7 +70,7 @@ export class HotConnector {
|
|
|
66
70
|
metadata?: { name: string; description: string; url: string; icons: string[] };
|
|
67
71
|
} = { webWallet: "https://app.hot-labs.org" };
|
|
68
72
|
|
|
69
|
-
constructor(options?:
|
|
73
|
+
constructor(options?: HotKitOptions) {
|
|
70
74
|
makeObservable(this, {
|
|
71
75
|
priorityWallet: computed,
|
|
72
76
|
walletsTokens: computed,
|
|
@@ -89,7 +93,7 @@ export class HotConnector {
|
|
|
89
93
|
this.storage = options?.storage ?? new LocalStorage();
|
|
90
94
|
this.telemetry = new Telemetry(this);
|
|
91
95
|
this.activity = new Activity(this);
|
|
92
|
-
this.exchange = new Exchange();
|
|
96
|
+
this.exchange = new Exchange(this);
|
|
93
97
|
|
|
94
98
|
const connectors: OmniConnector[] = [];
|
|
95
99
|
const configConnectors = options?.connectors || defaultConnectors;
|
|
@@ -325,7 +329,7 @@ export class HotConnector {
|
|
|
325
329
|
return bBalance - aBalance;
|
|
326
330
|
})[0];
|
|
327
331
|
|
|
328
|
-
return openBridge(this, {
|
|
332
|
+
return this.router.openBridge(this, {
|
|
329
333
|
mobileFullscreen: true,
|
|
330
334
|
recipient: recipient,
|
|
331
335
|
to: originalToken,
|
|
@@ -342,7 +346,7 @@ export class HotConnector {
|
|
|
342
346
|
const sender = this.wallets.find((t) => t.type === orig.type)!;
|
|
343
347
|
const recipient = Recipient.fromWallet(this.wallets.find((w) => !!w.omniAddress));
|
|
344
348
|
|
|
345
|
-
return openBridge(this, {
|
|
349
|
+
return this.router.openBridge(this, {
|
|
346
350
|
mobileFullscreen: true,
|
|
347
351
|
sender: sender,
|
|
348
352
|
type: "exactOut",
|
|
@@ -355,18 +359,18 @@ export class HotConnector {
|
|
|
355
359
|
}
|
|
356
360
|
|
|
357
361
|
async openBridge() {
|
|
358
|
-
await openBridge(this);
|
|
362
|
+
await this.router.openBridge(this);
|
|
359
363
|
}
|
|
360
364
|
|
|
361
365
|
async openProfile() {
|
|
362
|
-
openProfile(this);
|
|
366
|
+
this.router.openProfile(this);
|
|
363
367
|
}
|
|
364
368
|
|
|
365
369
|
async connect(type?: WalletType) {
|
|
366
|
-
if (!type) return await openConnector(this);
|
|
370
|
+
if (!type) return await this.router.openConnector(this);
|
|
367
371
|
const connector = this.connectors.find((t) => t.type === ConnectorType.WALLET && t.walletTypes.includes(type));
|
|
368
372
|
if (!connector) throw new Error("Connector not found");
|
|
369
|
-
return await openWalletPicker(connector);
|
|
373
|
+
return await this.router.openWalletPicker(connector);
|
|
370
374
|
}
|
|
371
375
|
|
|
372
376
|
async disconnect(wallet: WalletType | OmniWallet) {
|