@hot-labs/kit 1.5.4 → 1.6.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/.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 +8 -12
- package/build/activity.js +16 -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 +32 -0
- package/build/core/pendings.js +143 -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 +17 -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 +22 -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 +151 -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 +47 -16
- package/src/ui/profile/Payment.tsx +67 -37
- package/src/ui/profile/Profile.tsx +39 -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
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { Token } from "../../core/token";
|
|
2
|
-
import {
|
|
2
|
+
import { HotKit } from "../../HotKit";
|
|
3
3
|
import { OmniWallet } from "../../core/OmniWallet";
|
|
4
4
|
export declare const TokenIcon: (({ token, wallet, withoutChain, size }: {
|
|
5
5
|
token: Token;
|
|
6
|
-
wallet?: OmniWallet;
|
|
6
|
+
wallet?: OmniWallet | "qr";
|
|
7
7
|
withoutChain?: boolean;
|
|
8
8
|
size?: number;
|
|
9
9
|
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
rightControl?: React.ReactNode;
|
|
12
|
+
interface TokenCardProps<T extends OmniWallet | "qr"> {
|
|
14
13
|
token: Token;
|
|
15
|
-
onSelect?: (token: Token, wallet?:
|
|
14
|
+
onSelect?: (token: Token, wallet?: T) => void;
|
|
16
15
|
amount?: bigint;
|
|
17
|
-
|
|
18
|
-
wallet?:
|
|
19
|
-
|
|
16
|
+
kit: HotKit;
|
|
17
|
+
wallet?: T;
|
|
18
|
+
rightControl?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const TokenCard: (<T extends OmniWallet | "qr">({ token, onSelect, amount, kit, wallet, rightControl }: TokenCardProps<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
20
21
|
displayName: string;
|
|
21
22
|
};
|
|
23
|
+
export {};
|
|
@@ -5,10 +5,10 @@ import { chains } from "../../core/chains";
|
|
|
5
5
|
import { formatter } from "../../core/utils";
|
|
6
6
|
import { ImageView } from "../uikit/image";
|
|
7
7
|
export const TokenIcon = observer(({ token, wallet, withoutChain, size = 40 }) => {
|
|
8
|
-
return (_jsxs("div", { style: { position: "relative", width: size, height: size, flexShrink: 0 }, children: [_jsx(ImageView, { src: token.icon, alt: token.symbol, size: size }), !withoutChain && _jsx(ImageView, { src: token.chainIcon, alt: token.symbol, size: size / 2 - 6, style: { position: "absolute", bottom: 0, right: 0 } }), token.isOmni && wallet?.type && _jsx(ImageView, { src: wallet.icon, alt: chains.getByType(wallet.type)?.[0]?.name || "", size: size / 2 - 6, style: { position: "absolute", bottom: 0, left: 0 } })] }));
|
|
8
|
+
return (_jsxs("div", { style: { position: "relative", width: size, height: size, flexShrink: 0 }, children: [_jsx(ImageView, { src: token.icon, alt: token.symbol, size: size }), !withoutChain && _jsx(ImageView, { src: token.chainIcon, alt: token.symbol, size: size / 2 - 6, style: { position: "absolute", bottom: 0, right: 0 } }), token.isOmni && wallet !== "qr" && wallet?.type && _jsx(ImageView, { src: wallet.icon, alt: chains.getByType(wallet.type)?.[0]?.name || "", size: size / 2 - 6, style: { position: "absolute", bottom: 0, left: 0 } })] }));
|
|
9
9
|
});
|
|
10
|
-
export const TokenCard = observer(({ token, onSelect, amount,
|
|
11
|
-
const balance = amount ||
|
|
10
|
+
export const TokenCard = observer(({ token, onSelect, amount, kit, wallet, rightControl }) => {
|
|
11
|
+
const balance = amount || (wallet === "qr" ? 0n : kit.balance(wallet, token));
|
|
12
12
|
const symbol = token.isOmni && !token.isMainOmni ? `${token.symbol} (${token.originalChainSymbol})` : token.symbol;
|
|
13
13
|
return (_jsxs(Card, { onClick: () => onSelect?.(token, wallet), children: [_jsx(TokenIcon, { token: token, wallet: wallet }), _jsxs(TokenWrap, { children: [_jsx(Text, { style: { textAlign: "left" }, children: symbol }), _jsxs(PSmall, { style: { textAlign: "left" }, children: ["$", formatter.amount(token.usd)] })] }), rightControl || (_jsxs(TokenWrap, { style: { textAlign: "right", paddingRight: 4, marginLeft: "auto", alignItems: "flex-end" }, children: [_jsx(Text, { children: token.readable(balance) }), _jsxs(PSmall, { children: ["$", token.readable(balance, token.usd)] })] }))] }, token.id));
|
|
14
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenCard.js","sourceRoot":"","sources":["../../../src/ui/bridge/TokenCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"TokenCard.js","sourceRoot":"","sources":["../../../src/ui/bridge/TokenCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,IAA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F,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;;;;;CASpB,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;CAY3B,CAAC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { OmniWallet } from "../../core/OmniWallet";
|
|
2
|
-
|
|
3
|
+
interface AuthIntentPopupProps {
|
|
4
|
+
wallet: OmniWallet;
|
|
5
|
+
onApprove: () => Promise<void>;
|
|
6
|
+
onReject: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const AuthPopup: React.FC<AuthIntentPopupProps>;
|
|
9
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import Popup
|
|
3
|
+
import Popup from "../Popup";
|
|
4
4
|
import { PopupButton } from "../styles";
|
|
5
5
|
const Loader = () => {
|
|
6
6
|
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 100 100", preserveAspectRatio: "xMidYMid", width: "48", height: "48", style: { shapeRendering: "auto", display: "block", background: "transparent" }, children: _jsx("circle", { strokeDasharray: "75.39822368615503 27.132741228718345", r: "16", strokeWidth: "4", stroke: "#000", fill: "none", cy: "50", cx: "50", children: _jsx("animateTransform", { keyTimes: "0;1", values: "0 50 50;360 50 50", dur: "1.408450704225352s", repeatCount: "indefinite", type: "rotate", attributeName: "transform" }) }) }));
|
|
7
7
|
};
|
|
8
|
-
const
|
|
8
|
+
export const AuthPopup = ({ onApprove, onReject }) => {
|
|
9
9
|
const [loading, setLoading] = useState(false);
|
|
10
10
|
const handleApprove = async () => {
|
|
11
11
|
try {
|
|
@@ -27,22 +27,4 @@ const AuthIntentPopupComponent = ({ onApprove, onReject }) => {
|
|
|
27
27
|
opacity: loading ? 0.5 : 1,
|
|
28
28
|
}, children: loading ? _jsx(Loader, {}) : "Sign message" })] }));
|
|
29
29
|
};
|
|
30
|
-
export const openAuthPopup = (wallet, then) => {
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
present((close) => {
|
|
33
|
-
return (_jsx(AuthIntentPopupComponent, { wallet: wallet, onReject: () => (close(), reject()), onApprove: async () => {
|
|
34
|
-
try {
|
|
35
|
-
const result = await then();
|
|
36
|
-
resolve(result);
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
reject(e);
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
close();
|
|
43
|
-
}
|
|
44
|
-
} }));
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
30
|
//# sourceMappingURL=AuthPopup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPopup.js","sourceRoot":"","sources":["../../../src/ui/connect/AuthPopup.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,
|
|
1
|
+
{"version":3,"file":"AuthPopup.js","sourceRoot":"","sources":["../../../src/ui/connect/AuthPopup.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,OAAO,KAAkB,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQxC,MAAM,MAAM,GAAa,GAAG,EAAE;IAC5B,OAAO,CACL,cAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,aAAa,EAAC,mBAAmB,EAAC,UAAU,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,YAChM,iBAAQ,eAAe,EAAC,sCAAsC,EAAC,CAAC,EAAC,IAAI,EAAC,WAAW,EAAC,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A,OAAO,CAAC,CAAC,CAAC,KAAC,MAAM,KAAG,CAAC,CAAC,CAAC,cAAc,GAC1B,IACR,CACT,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { OmniWallet } from "../../core/OmniWallet";
|
|
2
|
-
import {
|
|
2
|
+
import { HotKit } from "../../HotKit";
|
|
3
3
|
import { WalletType } from "../../core";
|
|
4
4
|
interface MultichainPopupProps {
|
|
5
|
-
|
|
5
|
+
kit: HotKit;
|
|
6
6
|
onClose: (wallet?: OmniWallet) => void;
|
|
7
7
|
title?: string;
|
|
8
8
|
walletType?: WalletType;
|
|
9
9
|
widget?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare const Connector: (({
|
|
11
|
+
export declare const Connector: (({ kit, onClose, title, walletType, widget }: MultichainPopupProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
export {};
|
|
@@ -7,9 +7,9 @@ import { PopupOption, PopupOptionInfo } from "../styles";
|
|
|
7
7
|
import { LogoutIcon } from "../icons/logout";
|
|
8
8
|
import { ImageView } from "../uikit/image";
|
|
9
9
|
import Popup from "../Popup";
|
|
10
|
-
export const Connector = observer(({
|
|
11
|
-
const onechain =
|
|
12
|
-
const social =
|
|
10
|
+
export const Connector = observer(({ kit, onClose, title, walletType, widget }) => {
|
|
11
|
+
const onechain = kit.connectors.filter((t) => t.type === ConnectorType.WALLET && (walletType == null || t.walletTypes.includes(walletType)) && t.options.length > 0);
|
|
12
|
+
const social = kit.connectors.filter((t) => t.type === ConnectorType.SOCIAL && (walletType == null || t.walletTypes.includes(walletType)));
|
|
13
13
|
const selectConnector = async (t) => {
|
|
14
14
|
if (t.wallets[0])
|
|
15
15
|
return t.disconnect();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const ConnectPrimaryWallet: ({
|
|
3
|
-
|
|
1
|
+
import { HotKit } from "../../HotKit";
|
|
2
|
+
declare const ConnectPrimaryWallet: ({ kit, onClose }: {
|
|
3
|
+
kit: HotKit;
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default ConnectPrimaryWallet;
|
|
@@ -4,9 +4,9 @@ import Popup from "../Popup";
|
|
|
4
4
|
import { PopupButton } from "../styles";
|
|
5
5
|
import { Connector } from "./ConnectWallet";
|
|
6
6
|
import { chains, WalletType } from "../../core";
|
|
7
|
-
const ConnectPrimaryWallet = ({
|
|
7
|
+
const ConnectPrimaryWallet = ({ kit, onClose }) => {
|
|
8
8
|
const [openConnect, setOpenConnect] = useState(false);
|
|
9
|
-
return (_jsx(Popup, { onClose: onClose, header: _jsx("p", { children: "Connect main wallet" }), children: openConnect ? (_jsx(Connector, { widget: true, walletType: WalletType.OMNI,
|
|
9
|
+
return (_jsx(Popup, { onClose: onClose, header: _jsx("p", { children: "Connect main wallet" }), children: openConnect ? (_jsx(Connector, { widget: true, walletType: WalletType.OMNI, kit: kit, onClose: onClose })) : (_jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", width: "100%", height: 300 }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 24, marginTop: 48 }, children: [_jsx(WalletIcon, {}), _jsx(BindIcon, {}), _jsx("img", { src: chains.get(-4).logo, style: { marginLeft: -4, width: 64, height: 64, borderRadius: "50%" } })] }), _jsx("p", { style: { marginTop: 24, fontSize: 20, fontWeight: "bold" }, children: "Connect your primary wallet" }), _jsx("p", { style: { marginTop: 8, fontSize: 16, color: "#c6c6c6" }, children: "Your HEX Balance will be tied to this wallet." }), _jsx(PopupButton, { style: { marginTop: "auto" }, onClick: () => setOpenConnect(true), children: "Connect wallet" })] })) }));
|
|
10
10
|
};
|
|
11
11
|
const WalletIcon = () => {
|
|
12
12
|
return (_jsxs("svg", { width: "56", height: "56", viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M45.333 6C48.6467 6 51.333 8.68629 51.333 12V15.333H52C55.3136 15.333 57.9998 18.0195 58 21.333V30.1826C60.191 31.2759 62 33.3016 62 35.5244V39.333C62 41.9566 60.3157 44.1858 57.9697 45.001C57.9878 45.1091 58 45.2197 58 45.333V53.333C58 56.6467 55.3137 59.333 52 59.333H12C8.68629 59.333 6 56.6467 6 53.333V12C6 8.68629 8.68629 6 12 6H45.333ZM10 53.333C10 54.4376 10.8954 55.333 12 55.333H52C53.1046 55.333 54 54.4376 54 53.333V45.333C54 45.2208 54.0115 45.1111 54.0293 45.0039L48 44C43.9499 44 41.333 42.0501 41.333 38C41.333 33.9499 43.9499 30.667 48 30.667L54 29.4658V21.333C53.9998 20.2286 53.1045 19.333 52 19.333H10V53.333ZM48 33.333C46.159 33.333 44 36.1591 44 38C44 39.8409 46.159 41.333 48 41.333H56C57.1046 41.333 58 40.4376 58 39.333V36.667C58 35.9442 57.0444 34.7412 56.0752 33.9951C56.0502 33.996 56.0252 34 56 34C55.4082 34 54.8779 33.7416 54.5117 33.333H48ZM12 10C10.8954 10 10 10.8954 10 12V15.333H47.333V12C47.333 10.8954 46.4376 10 45.333 10H12Z", fill: "#EBDEDC" }), _jsx("path", { d: "M42.9756 6.00781C46.1457 6.16859 48.667 8.7899 48.667 12V15.333H49.333C52.6466 15.333 55.3328 18.0195 55.333 21.333V30.0371C58.3331 30.3686 60.667 32.9115 60.667 36V38.667C60.6668 41.7553 58.3329 44.2973 55.333 44.6289V50.667C55.3328 53.9806 52.6466 56.667 49.333 56.667H12C8.6864 56.667 6.00018 53.9805 6 50.667V12C6 8.68629 8.6863 6 12 6H42.667L42.9756 6.00781ZM10 50.667C10.0002 51.7714 10.8955 52.667 12 52.667H49.333C50.4375 52.667 51.3328 51.7714 51.333 50.667V44.667H48C43.9501 44.6668 40.667 41.383 40.667 37.333C40.6672 33.2832 43.9502 30.0002 48 30H51.333V21.333C51.3328 20.2286 50.4375 19.333 49.333 19.333H10V50.667ZM48 34C46.1593 34.0002 44.6672 35.4923 44.667 37.333C44.667 39.1738 46.1592 40.6668 48 40.667H54.667C55.7713 40.6668 56.6668 39.7713 56.667 38.667V36C56.667 34.8955 55.7714 34.0002 54.667 34H48ZM12 10C10.8954 10 10 10.8954 10 12V15.333H44.667V12C44.667 10.9645 43.8796 10.1132 42.8711 10.0107L42.667 10H12Z", fill: "#EBDEDC" })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimaryWallet.js","sourceRoot":"","sources":["../../../src/ui/connect/PrimaryWallet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,oBAAoB,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"PrimaryWallet.js","sourceRoot":"","sources":["../../../src/ui/connect/PrimaryWallet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,oBAAoB,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAwC,EAAE,EAAE;IACtF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEtD,OAAO,CACL,KAAC,KAAK,IAAC,OA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MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,OAAO,CACL,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,aAC5F,eACE,CAAC,EAAC,q8BAAq8B,EACv8B,IAAI,EAAC,SAAS,GACd,EACF,eACE,CAAC,EAAC,w6BAAw6B,EAC16B,IAAI,EAAC,SAAS,GACd,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;IACpB,OAAO,CACL,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,aAC5F,eACE,CAAC,EAAC,0tCAA0tC,EAC5tC,IAAI,EAAC,SAAS,GACd,EACF,eACE,CAAC,EAAC,g5CAAg5C,EACl5C,IAAI,EAAC,SAAS,GACd,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CopyIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export default function CopyIcon(props) {
|
|
3
|
+
return (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { d: "M16.5 3C17.3284 3 18 3.67157 18 4.5V5H7.5C6.67157 5 6 5.67157 6 6.5V19H5.5C4.67157 19 4 18.3284 4 17.5V4.5C4 3.67157 4.67157 3 5.5 3H16.5Z", fill: "currentColor" }), _jsx("path", { d: "M8.5 6.75H18.5C18.9142 6.75 19.25 7.08579 19.25 7.5V19.5C19.25 19.9142 18.9142 20.25 18.5 20.25H8.5C8.08579 20.25 7.75 19.9142 7.75 19.5V7.5C7.75 7.08579 8.08579 6.75 8.5 6.75Z", stroke: "currentColor", "stroke-width": "1.5" })] }));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../src/ui/icons/copy.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAoC;IACnE,OAAO,CACL,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,KAAK,KAAK,aACtG,eAAM,CAAC,EAAC,4IAA4I,EAAC,IAAI,EAAC,cAAc,GAAG,EAC3K,eAAM,CAAC,EAAC,kLAAkL,EAAC,MAAM,EAAC,cAAc,kBAAc,KAAK,GAAG,IAClO,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WarningIcon: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const WarningIcon = (props) => {
|
|
3
|
+
return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: _jsx("path", { d: "M11.7427 2.00439C17.2636 1.86272 21.8537 6.22376 21.9956 11.7446C22.1371 17.2653 17.777 21.8556 12.2563 21.9976C6.73553 22.139 2.14412 17.7782 2.00244 12.2573C1.86095 6.73664 6.22204 2.14639 11.7427 2.00439ZM12.0005 9.75049C11.5863 9.75049 11.2505 10.0863 11.2505 10.5005V15.5005C11.2507 15.9145 11.5864 16.2505 12.0005 16.2505C12.4144 16.2503 12.7503 15.9144 12.7505 15.5005V10.5005C12.7505 10.0864 12.4145 9.75071 12.0005 9.75049ZM12.0005 7.25049C11.5863 7.25049 11.2505 7.58627 11.2505 8.00049V8.50049C11.2507 8.91452 11.5864 9.25049 12.0005 9.25049C12.4144 9.25027 12.7503 8.91438 12.7505 8.50049V8.00049C12.7505 7.58641 12.4145 7.25071 12.0005 7.25049Z", fill: "#F3AE47" }) }));
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=warning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warning.js","sourceRoot":"","sources":["../../../src/ui/icons/warning.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAoC,EAAE,EAAE;IAClE,OAAO,CACL,cAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B,KAAK,KAAK,YACtG,eACE,CAAC,EAAC,mpBAAmpB,EACrpB,IAAI,EAAC,SAAS,GACd,GACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import Popup from "../Popup";
|
|
4
|
+
import { ActionButton } from "../uikit/button";
|
|
5
|
+
import { SelectTokenPopup } from "../bridge/SelectToken";
|
|
6
|
+
export const DepositFlow = ({ kit, onClose }) => {
|
|
7
|
+
const [token, setToken] = useState(null);
|
|
8
|
+
if (token == null) {
|
|
9
|
+
return _jsx(SelectTokenPopup, { kit: kit, onClose: onClose, onSelect: (t) => setToken(t) });
|
|
10
|
+
}
|
|
11
|
+
return (_jsx(Popup, { header: _jsxs("p", { children: ["Deposit ", token.symbol] }), children: _jsx(ActionButton, { onClick: onClose, children: "Deposit" }) }));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=DepositFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepositFlow.js","sourceRoot":"","sources":["../../../src/ui/profile/DepositFlow.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQzD,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,KAAC,gBAAgB,IAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAI,CAAC;IACxF,CAAC;IAED,OAAO,CACL,KAAC,KAAK,IAAC,MAAM,EAAE,oCAAY,KAAK,CAAC,MAAM,IAAK,YAC1C,KAAC,YAAY,IAAC,OAAO,EAAE,OAAO,wBAAwB,GAChD,CACT,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { HotKit } from "../../HotKit";
|
|
1
2
|
import { BridgeReview } from "../../core/exchange";
|
|
2
|
-
declare const DepositQR: (({ review, onConfirm, onCancel }: {
|
|
3
|
+
declare const DepositQR: (({ kit, review, onConfirm, onCancel }: {
|
|
4
|
+
kit: HotKit;
|
|
3
5
|
review: BridgeReview;
|
|
4
6
|
onConfirm: () => void;
|
|
5
|
-
onCancel
|
|
7
|
+
onCancel?: () => void;
|
|
6
8
|
}) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
7
9
|
displayName: string;
|
|
8
10
|
};
|
|
@@ -3,10 +3,11 @@ import { useEffect, useRef, useState } from "react";
|
|
|
3
3
|
import QRCodeStyling from "qr-code-styling";
|
|
4
4
|
import { observer } from "mobx-react-lite";
|
|
5
5
|
import styled from "styled-components";
|
|
6
|
-
import {
|
|
6
|
+
import { WarningIcon } from "../icons/warning";
|
|
7
7
|
import { ActionButton, Button } from "../uikit/button";
|
|
8
8
|
import { PMedium, PSmall } from "../uikit/text";
|
|
9
|
-
|
|
9
|
+
import CopyIcon from "../icons/copy";
|
|
10
|
+
const DepositQR = observer(({ kit, review, onConfirm, onCancel }) => {
|
|
10
11
|
const qrCodeRef = useRef(null);
|
|
11
12
|
const [qrCode] = useState(() => {
|
|
12
13
|
if (review.qoute === "deposit" || review.qoute === "withdraw")
|
|
@@ -30,9 +31,29 @@ const DepositQR = observer(({ review, onConfirm, onCancel }) => {
|
|
|
30
31
|
}, []);
|
|
31
32
|
if (review.qoute === "deposit" || review.qoute === "withdraw")
|
|
32
33
|
return null;
|
|
33
|
-
|
|
34
|
+
const depositAddress = review.qoute.depositAddress;
|
|
35
|
+
const handleCopy = async () => {
|
|
36
|
+
try {
|
|
37
|
+
await navigator.clipboard.writeText(depositAddress);
|
|
38
|
+
kit.toast.success("Address copied to clipboard");
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
kit.toast.failed("Failed to copy address");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return (_jsxs("div", { style: { position: "relative", width: "100%", height: "100%", gap: 8, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", flex: 1 }, children: [onCancel != null && (_jsx(CloseButton, { onClick: onCancel, children: _jsx(PSmall, { children: "Back" }) })), _jsx("div", { ref: qrCodeRef, style: { marginTop: "auto", borderRadius: 12, padding: "4px 4px 0 4px", border: "1px solid #2d2d2d", background: "#1c1c1c", textAlign: "left" } }), _jsxs(PMedium, { style: { textAlign: "center", marginTop: 16, color: "#ababab", width: "100%" }, children: ["Send ", _jsx(Pre, { children: review.qoute.amountInFormatted }), " ", _jsx(Pre, { children: review.from.symbol }), " on ", _jsx(Pre, { children: review.from.chainName }), " chain to:"] }), _jsxs("div", { style: { width: "100%", justifyContent: "center", display: "flex", gap: 4 }, children: [_jsx(Pre, { style: { fontSize: 14, fontWeight: "bold", padding: 0, background: "transparent", border: "none" }, children: depositAddress }), _jsx(Button, { onClick: handleCopy, children: _jsx(CopyIcon, { width: 16, height: 16, color: "#ababab" }) })] }), _jsxs(WarningBadge, { children: [_jsx(WarningIcon, { color: "#F3AE47", style: { marginTop: 4, flexShrink: 0 } }), _jsxs(PSmall, { style: { color: "#F3AE47", fontWeight: "bold" }, children: ["Only deposit ", review.from.symbol, " from ", review.from.chainName, " network.", _jsx("br", {}), "Depositing other assets or using a different network will result in loss of funds"] })] }), _jsx(ActionButton, { style: { marginTop: 12 }, onClick: onConfirm, children: "I sent the funds" })] }));
|
|
34
45
|
});
|
|
35
|
-
const
|
|
46
|
+
const WarningBadge = styled.div `
|
|
47
|
+
border-radius: 8px;
|
|
48
|
+
border: 1px solid var(--border-border-orange, #f3ae47);
|
|
49
|
+
background: var(--surface-warning, #3f311d);
|
|
50
|
+
padding: 8px;
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 8px;
|
|
53
|
+
text-align: left;
|
|
54
|
+
margin-top: 12px;
|
|
55
|
+
`;
|
|
56
|
+
const Pre = styled.code `
|
|
36
57
|
display: inline;
|
|
37
58
|
background: #2d2d2d;
|
|
38
59
|
padding: 0 2px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DepositQR.js","sourceRoot":"","sources":["../../../src/ui/profile/DepositQR.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,C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YAAY,IAAC,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,iCAE3C,IACX,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;CAS9B,CAAC;AAEF,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;;;;;;;CAYtB,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;;;;;;;;;;;;;;CAcjC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { Intents } from "../../core";
|
|
2
|
-
import {
|
|
2
|
+
import { BridgePending } from "../../core/pendings";
|
|
3
3
|
import { Token } from "../../core/token";
|
|
4
|
-
import {
|
|
4
|
+
import { HotKit } from "../../HotKit";
|
|
5
5
|
interface PaymentProps {
|
|
6
6
|
onReject: (message: string) => void;
|
|
7
|
-
onConfirm: (
|
|
8
|
-
depositQoute?: BridgeReview;
|
|
9
|
-
processing?: () => Promise<BridgeReview>;
|
|
10
|
-
}) => Promise<void>;
|
|
7
|
+
onConfirm: (pending?: BridgePending) => Promise<void>;
|
|
11
8
|
close: () => void;
|
|
9
|
+
title?: string;
|
|
12
10
|
excludedTokens?: string[];
|
|
13
11
|
allowedTokens?: string[];
|
|
14
12
|
prepaidAmount: bigint;
|
|
15
13
|
payableToken: Token;
|
|
16
14
|
needAmount: bigint;
|
|
17
|
-
connector: HotConnector;
|
|
18
15
|
intents: Intents;
|
|
19
|
-
|
|
16
|
+
kit: HotKit;
|
|
20
17
|
}
|
|
21
|
-
export declare const Payment: (({
|
|
18
|
+
export declare const Payment: (({ kit, intents, title, allowedTokens, excludedTokens, prepaidAmount, payableToken, needAmount, onReject, onConfirm, close }: PaymentProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
22
19
|
displayName: string;
|
|
23
20
|
};
|
|
24
21
|
export {};
|
|
@@ -4,6 +4,8 @@ import { useEffect, useState } from "react";
|
|
|
4
4
|
import styled from "styled-components";
|
|
5
5
|
import { HelpIcon } from "../icons/help";
|
|
6
6
|
import { WalletIcon } from "../icons/wallet";
|
|
7
|
+
import { QRIcon } from "../icons/qr";
|
|
8
|
+
import { tokens } from "../../core";
|
|
7
9
|
import { formatter } from "../../core/utils";
|
|
8
10
|
import { HorizontalStepper } from "../uikit/Stepper";
|
|
9
11
|
import { ActionButton } from "../uikit/button";
|
|
@@ -11,8 +13,8 @@ import { H6, PSmall } from "../uikit/text";
|
|
|
11
13
|
import { Loader } from "../uikit/loader";
|
|
12
14
|
import { PopupOption, PopupOptionInfo } from "../styles";
|
|
13
15
|
import { TokenCard } from "../bridge/TokenCard";
|
|
14
|
-
import { openConnector } from "../router";
|
|
15
16
|
import Popup from "../Popup";
|
|
17
|
+
import DepositQR from "./DepositQR";
|
|
16
18
|
const animations = {
|
|
17
19
|
success: "https://hex.exchange/success.json",
|
|
18
20
|
failed: "https://hex.exchange/error.json",
|
|
@@ -20,17 +22,17 @@ const animations = {
|
|
|
20
22
|
};
|
|
21
23
|
const PAY_SLIPPAGE = 0.002;
|
|
22
24
|
const STABLE_SLIPPAGE = 0.001;
|
|
23
|
-
export const Payment = observer(({
|
|
25
|
+
export const Payment = observer(({ kit, intents, title = "Payment", allowedTokens, excludedTokens, prepaidAmount, payableToken, needAmount, onReject, onConfirm, close }) => {
|
|
24
26
|
useState(() => {
|
|
25
27
|
fetch(animations.loading);
|
|
26
28
|
fetch(animations.success);
|
|
27
29
|
fetch(animations.failed);
|
|
28
30
|
});
|
|
29
31
|
useEffect(() => {
|
|
30
|
-
if (
|
|
32
|
+
if (kit.wallets.length !== 0)
|
|
31
33
|
return;
|
|
32
|
-
openConnector(
|
|
33
|
-
}, [
|
|
34
|
+
kit.router.openConnector(kit);
|
|
35
|
+
}, [kit.wallets.length]);
|
|
34
36
|
const [flow, setFlow] = useState(needAmount === 0n ? { step: "transfer" } : null);
|
|
35
37
|
const paymentTitle = title || `Pay ${payableToken.readable(needAmount)} ${payableToken.symbol}`;
|
|
36
38
|
const showPrepaidToken = payableToken.float(prepaidAmount) >= 0.001;
|
|
@@ -40,32 +42,32 @@ export const Payment = observer(({ connector, intents, title = "Payment", allowe
|
|
|
40
42
|
setFlow({ token: from, wallet, review: undefined, step: "sign" });
|
|
41
43
|
const isStableFrom = from.symbol === "USDT" || from.symbol === "USDC";
|
|
42
44
|
const isStableTo = payableToken.symbol === "USDT" || payableToken.symbol === "USDC";
|
|
43
|
-
const isDirectDeposit =
|
|
45
|
+
const isDirectDeposit = kit.exchange.isDirectDeposit(from, payableToken);
|
|
44
46
|
const isStable = isStableFrom && isStableTo;
|
|
45
47
|
let tasks = [];
|
|
46
|
-
if (isStable && !isDirectDeposit) {
|
|
48
|
+
if (isStable && !isDirectDeposit && wallet !== "qr") {
|
|
47
49
|
const slippages = [0.0005, 0.001, 0.0015];
|
|
48
50
|
tasks = slippages.map((slippage) => {
|
|
49
51
|
const extra = (needAmount * BigInt(Math.floor(slippage * 1000))) / BigInt(1000);
|
|
50
|
-
return
|
|
52
|
+
return kit.exchange.reviewSwap({
|
|
51
53
|
amount: from.int(payableToken.float(needAmount + extra)),
|
|
52
54
|
recipient: intents.signer,
|
|
53
55
|
slippage: slippage,
|
|
54
56
|
sender: wallet,
|
|
55
|
-
refund: wallet,
|
|
56
57
|
type: "exactIn",
|
|
57
58
|
to: payableToken,
|
|
59
|
+
refund: wallet,
|
|
58
60
|
from,
|
|
59
61
|
});
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
|
-
const exectOutReview = await
|
|
64
|
+
const exectOutReview = await kit.exchange
|
|
63
65
|
.reviewSwap({
|
|
64
66
|
slippage: isStable ? STABLE_SLIPPAGE : PAY_SLIPPAGE,
|
|
67
|
+
refund: wallet === "qr" ? kit.priorityWallet : wallet,
|
|
65
68
|
recipient: intents.signer,
|
|
66
69
|
amount: needAmount,
|
|
67
70
|
sender: wallet,
|
|
68
|
-
refund: wallet,
|
|
69
71
|
type: "exactOut",
|
|
70
72
|
to: payableToken,
|
|
71
73
|
from,
|
|
@@ -108,14 +110,14 @@ export const Payment = observer(({ connector, intents, title = "Payment", allowe
|
|
|
108
110
|
setFlow((t) => (t ? { ...t, step: "loading" } : null));
|
|
109
111
|
if (flow?.review == null) {
|
|
110
112
|
await intents.sign();
|
|
111
|
-
await onConfirm(
|
|
113
|
+
await onConfirm();
|
|
112
114
|
setFlow({ loading: false, step: "success" });
|
|
113
115
|
setTimeout(() => close(), 2000);
|
|
114
116
|
return;
|
|
115
117
|
}
|
|
116
118
|
flow.review.logger = console;
|
|
117
|
-
const result = await
|
|
118
|
-
await onConfirm(
|
|
119
|
+
const result = await kit.exchange.makeSwap(flow.review);
|
|
120
|
+
await onConfirm(result);
|
|
119
121
|
setFlow({ loading: false, step: "success" });
|
|
120
122
|
setTimeout(() => close(), 2000);
|
|
121
123
|
}
|
|
@@ -135,35 +137,41 @@ export const Payment = observer(({ connector, intents, title = "Payment", allowe
|
|
|
135
137
|
return (_jsxs(Popup, { header: _jsx("p", { children: paymentTitle }), children: [_jsxs("div", { style: { width: "100%", height: 400, gap: 8, display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }, children: [_jsx("dotlottie-wc", { src: animations.failed, speed: "1", style: { width: 300, height: 300 }, mode: "forward", loop: true, autoplay: true }, "error"), _jsx("p", { style: { fontSize: 24, marginTop: -32, fontWeight: "bold" }, children: "Transaction failed" }), _jsx("p", { style: { fontSize: 14, width: "80%", textAlign: "center", overflowY: "auto", lineBreak: "anywhere" }, children: formatter.serializeError(flow.error) })] }), _jsx(ActionButton, { onClick: () => onReject(formatter.serializeError(flow.error)), children: "Close" })] }));
|
|
136
138
|
}
|
|
137
139
|
if (flow?.step === "transfer") {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
if (flow.wallet === "qr") {
|
|
141
|
+
return (_jsxs(Popup, { onClose: () => onReject("closed"), header: _jsx("p", { children: paymentTitle }), children: [_jsx(HorizontalStepper, { steps: [{ label: "Select" }, { label: "Review" }, { label: "Confirm" }], currentStep: 2 }), _jsx(DepositQR, { kit: kit, review: flow.review, onConfirm: confirmPaymentStep })] }));
|
|
142
|
+
}
|
|
143
|
+
return (_jsxs(Popup, { onClose: () => onReject("closed"), header: _jsx("p", { children: paymentTitle }), children: [_jsx(HorizontalStepper, { style: { marginBottom: 24 }, steps: [{ label: "Select" }, { label: "Review" }, { label: "Confirm" }], currentStep: 2 }), _jsxs("div", { style: { textAlign: "left" }, children: [_jsx(H6, { children: "Confirm transfer" }), _jsx(PSmall, { children: "Transfer approved. Click confirm to make the payment." })] }), _jsxs("div", { style: { marginTop: 8, position: "relative", width: "100%", display: "flex", flexDirection: "column", gap: 8 }, children: [showPrepaidToken && _jsx(TokenCard, { token: payableToken, kit: kit, wallet: intents.signer, amount: prepaidAmount }), flow.token != null && (_jsx(TokenCard //
|
|
144
|
+
, { kit: kit, token: flow.token, wallet: flow.wallet, amount: flow.review == null ? needAmount : flow.review?.amountIn ?? 0n })), showPrepaidToken && flow.token != null && (_jsx(PlusButton, { children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [_jsx("rect", { x: "11", y: "4", width: "2", height: "16", rx: "1", fill: "#fff" }), _jsx("rect", { x: "4", y: "11", width: "16", height: "2", rx: "1", fill: "#fff" })] }) }))] }), flow.review && flow.review.amountOut - flow.review.minAmountOut > 0n && (_jsxs("div", { style: { marginTop: 8, display: "flex", gap: 8 }, children: [_jsx(HelpIcon, { style: { flexShrink: 0, marginTop: 4, width: 20, height: 20 } }), _jsxs(PSmall, { style: { textAlign: "left" }, children: ["Due to slippage, your HEX balance may return up to", " ", _jsxs("b", { children: [flow.review.to.readable(flow.review.amountOut - flow.review.minAmountOut), " ", flow.review.to.symbol] }), " ", "after the transaction is completed"] })] })), _jsx(ActionButton, { style: { marginTop: 24 }, onClick: confirmPaymentStep, children: flow?.loading ? "Transferring..." : "Confirm transfer" })] }));
|
|
140
145
|
}
|
|
141
146
|
if (flow?.step === "sign") {
|
|
142
147
|
const rightControl = _jsx("div", { style: { paddingRight: 4, marginLeft: "auto", alignItems: "flex-end" }, children: flow.error ? _jsx(ErrorIcon, {}) : _jsx(Loader, {}) });
|
|
143
|
-
return (_jsxs(Popup, { onClose: () => onReject("closed"), header: _jsx("p", { children: title }), children: [_jsx(HorizontalStepper, { style: { marginBottom: 24 }, steps: [{ label: "Select" }, { label: "Review" }, { label: "Confirm" }], currentStep: 1 }), _jsxs("div", { style: { textAlign: "left" }, children: [_jsx(H6, { children: "Approve transfer" }), _jsx(PSmall, { children: "Click the button below to approve the transfer" })] }), _jsxs("div", { style: { marginTop: 8, position: "relative", width: "100%", display: "flex", flexDirection: "column", gap: 8 }, children: [showPrepaidToken && _jsx(TokenCard, { token: payableToken,
|
|
144
|
-
, {
|
|
148
|
+
return (_jsxs(Popup, { onClose: () => onReject("closed"), header: _jsx("p", { children: title }), children: [_jsx(HorizontalStepper, { style: { marginBottom: 24 }, steps: [{ label: "Select" }, { label: "Review" }, { label: "Confirm" }], currentStep: 1 }), _jsxs("div", { style: { textAlign: "left" }, children: [_jsx(H6, { children: "Approve transfer" }), _jsx(PSmall, { children: "Click the button below to approve the transfer" })] }), _jsxs("div", { style: { marginTop: 8, position: "relative", width: "100%", display: "flex", flexDirection: "column", gap: 8 }, children: [showPrepaidToken && _jsx(TokenCard, { token: payableToken, kit: kit, wallet: intents.signer, amount: prepaidAmount }), flow.token != null && (_jsx(TokenCard //
|
|
149
|
+
, { kit: kit, token: flow.token, wallet: flow.wallet, rightControl: flow.review ? undefined : rightControl, amount: flow.review == null ? needAmount : flow.review?.amountIn ?? 0n })), showPrepaidToken && flow.token != null && (_jsx(PlusButton, { children: _jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [_jsx("rect", { x: "11", y: "4", width: "2", height: "16", rx: "1", fill: "#fff" }), _jsx("rect", { x: "4", y: "11", width: "16", height: "2", rx: "1", fill: "#fff" })] }) }))] }), flow.review && flow.review.amountOut - flow.review.minAmountOut > 0n && (_jsxs("div", { style: { marginTop: 8, display: "flex", gap: 8 }, children: [_jsx(HelpIcon, { style: { flexShrink: 0, marginTop: 4, width: 20, height: 20 } }), _jsxs(PSmall, { style: { textAlign: "left" }, children: ["Due to slippage, your HEX balance may return up to", " ", _jsxs("b", { children: [flow.review.to.readable(flow.review.amountOut - flow.review.minAmountOut), " ", flow.review.to.symbol] }), " ", "after the transaction is completed"] })] })), flow.error ? (_jsxs(_Fragment, { children: [_jsx(ActionButton, { "$stroke": true, style: { marginTop: 24 }, onClick: () => selectToken(flow.token, flow.wallet), children: "Try again" }), _jsx(ActionButton, { style: { marginTop: 8 }, onClick: () => setFlow(null), children: "Select another token" })] })) : (_jsx(ActionButton, { style: { marginTop: 24 }, disabled: !flow?.review, onClick: signStep, children: flow?.loading ? "Approving..." : flow?.review ? "Approve transfer" : "Quoting..." }))] }));
|
|
145
150
|
}
|
|
146
|
-
const
|
|
147
|
-
const otherTokens = connector.walletsTokens.filter((t) => t.token.symbol !== "USDT" && t.token.symbol !== "USDC");
|
|
148
|
-
const renderToken = (token, wallet, balance) => {
|
|
149
|
-
if (token.id === payableToken.id && connector.priorityWallet?.type === wallet.type)
|
|
150
|
-
return null;
|
|
151
|
-
const availableBalance = token.float(balance) - token.reserve;
|
|
151
|
+
const availableTokens = kit.walletsTokens.filter(({ token }) => {
|
|
152
152
|
// Allow only tokens in the allowedTokens list
|
|
153
153
|
if (allowedTokens != null && !allowedTokens?.includes(token.id))
|
|
154
|
-
return
|
|
154
|
+
return false;
|
|
155
155
|
// Exclude tokens in the excludedTokens list
|
|
156
156
|
if (excludedTokens != null && excludedTokens?.includes(token.id))
|
|
157
|
+
return false;
|
|
158
|
+
return true;
|
|
159
|
+
});
|
|
160
|
+
const recommendedTokens = availableTokens.filter((t) => t.token.symbol === "USDT" || t.token.symbol === "USDC");
|
|
161
|
+
const otherTokens = availableTokens.filter((t) => t.token.symbol !== "USDT" && t.token.symbol !== "USDC");
|
|
162
|
+
const renderToken = (token, wallet, balance) => {
|
|
163
|
+
if (token.id === payableToken.id && kit.priorityWallet?.type === wallet.type)
|
|
157
164
|
return null;
|
|
165
|
+
const availableBalance = token.float(balance) - token.reserve;
|
|
158
166
|
// same token as need and enough balance is direct deposit
|
|
159
167
|
if (token.originalId === payableToken.originalId && availableBalance >= payableToken.float(needAmount)) {
|
|
160
|
-
return _jsx(TokenCard, { token: token, onSelect: selectToken,
|
|
168
|
+
return _jsx(TokenCard, { token: token, onSelect: selectToken, kit: kit, wallet: wallet }, token.id);
|
|
161
169
|
}
|
|
162
170
|
if (availableBalance * token.usd <= payableToken.usd * payableToken.float(needAmount) * (1 + PAY_SLIPPAGE))
|
|
163
171
|
return null;
|
|
164
|
-
return _jsx(TokenCard, { token: token, onSelect: selectToken,
|
|
172
|
+
return _jsx(TokenCard, { token: token, onSelect: selectToken, kit: kit, wallet: wallet }, token.id);
|
|
165
173
|
};
|
|
166
|
-
return (_jsxs(Popup, { onClose: () => onReject("closed"), header: _jsx("p", { children: title }), children: [_jsx(HorizontalStepper, { style: { marginBottom: 24 }, steps: [{ label: "Select" }, { label: "Review" }, { label: "Confirm" }], currentStep: 0 }), recommendedTokens.map(({ token, wallet, balance }) => renderToken(token, wallet, balance)), otherTokens.map(({ token, wallet, balance }) => renderToken(token, wallet, balance)), _jsxs(PopupOption, { style: { marginTop: 8 }, onClick: () => openConnector(
|
|
174
|
+
return (_jsxs(Popup, { onClose: () => onReject("closed"), header: _jsx("p", { children: title }), children: [_jsx(HorizontalStepper, { style: { marginBottom: 24 }, steps: [{ label: "Select" }, { label: "Review" }, { label: "Confirm" }], currentStep: 0 }), recommendedTokens.map(({ token, wallet, balance }) => renderToken(token, wallet, balance)), otherTokens.map(({ token, wallet, balance }) => renderToken(token, wallet, balance)), kit.connectors.every((t) => !t.walletTypes.includes(payableToken.originalChain)) && (_jsxs(PopupOption, { style: { marginTop: 8 }, onClick: () => selectToken(tokens.get(payableToken.originalAddress, payableToken.originalChain), "qr"), children: [_jsx("div", { style: { width: 44, height: 44, borderRadius: 16, background: "#000", display: "flex", alignItems: "center", justifyContent: "center" }, children: _jsx(QRIcon, {}) }), _jsxs(PopupOptionInfo, { children: [_jsx("p", { children: "Send via QR code" }), _jsx("span", { className: "wallet-address", children: "Transfer from CEX or external wallet" })] })] })), _jsxs(PopupOption, { style: { marginTop: 8 }, onClick: () => kit.router.openConnector(kit), children: [_jsx("div", { style: { width: 44, height: 44, borderRadius: 16, background: "#000", display: "flex", alignItems: "center", justifyContent: "center" }, children: _jsx(WalletIcon, {}) }), _jsxs(PopupOptionInfo, { children: [_jsx("p", { children: "Don't find the right token?" }), _jsx("span", { className: "wallet-address", children: "Connect another wallet" })] })] })] }));
|
|
167
175
|
});
|
|
168
176
|
const ErrorIcon = () => {
|
|
169
177
|
return (_jsxs("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-label": "Failed", style: { display: "block", margin: "0 auto" }, children: [_jsx("circle", { cx: "14", cy: "14", r: "13", stroke: "#E74C3C", strokeWidth: "2" }), _jsx("path", { d: "M9 9l10 10M19 9l-10 10", stroke: "#E74C3C", strokeWidth: "2.5", strokeLinecap: "round" })] }));
|