@hot-labs/kit 1.1.2 → 1.2.0-alpha.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/README.md +9 -2
- package/package.json +4 -8
- package/src/HotConnector.ts +31 -21
- package/src/OmniConnector.ts +9 -10
- package/src/OmniWallet.ts +25 -24
- package/src/core/Intents.ts +151 -222
- package/src/core/api.ts +4 -37
- package/src/core/bridge.ts +2 -3
- package/src/core/index.ts +1 -1
- package/src/{near/rpc.ts → core/nearRpc.ts} +11 -4
- package/src/core/types.ts +0 -21
- package/src/core/utils.ts +1 -17
- package/src/cosmos/connector.ts +26 -22
- package/src/cosmos/wallet.ts +8 -3
- package/src/evm/connector.ts +0 -5
- package/src/evm/wallet.ts +6 -9
- package/src/exchange.ts +30 -24
- package/src/hot-wallet/google.ts +5 -12
- package/src/index.ts +0 -2
- package/src/near/connector.ts +2 -2
- package/src/near/wallet.ts +9 -4
- package/src/solana/connector.ts +8 -9
- package/src/solana/injected/solana-wallet.ts +6 -6
- package/src/solana/{WalletStandard.ts → protocol.ts} +4 -2
- package/src/solana/wallet.ts +20 -11
- package/src/stellar/connector.ts +6 -1
- package/src/stellar/wallet.ts +17 -17
- package/src/ton/connector.ts +5 -1
- package/src/ton/wallet.ts +3 -3
- package/src/ui/Popup.tsx +4 -12
- package/src/ui/connect/AuthPopup.tsx +1 -2
- package/src/ui/connect/ConnectWallet.tsx +6 -12
- package/src/ui/icons/arrow-right.tsx +2 -2
- package/src/ui/icons/close.tsx +1 -1
- package/src/ui/icons/exchange.tsx +4 -4
- package/src/ui/icons/logout.tsx +6 -6
- package/src/ui/icons/pending.tsx +4 -2
- package/src/ui/icons/qr.tsx +2 -1
- package/src/ui/icons/search.tsx +4 -4
- package/src/ui/icons/switch.tsx +4 -4
- package/src/ui/icons/wallet.tsx +4 -2
- package/src/ui/payment/Bridge.tsx +6 -25
- package/src/ui/payment/Payment.tsx +46 -241
- package/src/ui/payment/Profile.tsx +8 -10
- package/src/ui/payment/SelectToken.tsx +1 -1
- package/src/ui/payment/TokenCard.tsx +18 -22
- package/src/ui/router.tsx +16 -56
- package/src/ui/styles.ts +0 -2
- package/build/HotConnector.d.ts +0 -103
- package/build/HotConnector.js +0 -300
- package/build/HotConnector.js.map +0 -1
- package/build/OmniConnector.d.ts +0 -90
- package/build/OmniConnector.js +0 -121
- package/build/OmniConnector.js.map +0 -1
- package/build/OmniWallet.d.ts +0 -35
- package/build/OmniWallet.js +0 -56
- package/build/OmniWallet.js.map +0 -1
- package/build/activity.d.ts +0 -18
- package/build/activity.js +0 -87
- package/build/activity.js.map +0 -1
- package/build/core/Intents.d.ts +0 -100
- package/build/core/Intents.js +0 -472
- package/build/core/Intents.js.map +0 -1
- package/build/core/api.d.ts +0 -48
- package/build/core/api.js +0 -93
- package/build/core/api.js.map +0 -1
- package/build/core/bridge.d.ts +0 -3
- package/build/core/bridge.js +0 -36
- package/build/core/bridge.js.map +0 -1
- package/build/core/chains.d.ts +0 -115
- package/build/core/chains.js +0 -381
- package/build/core/chains.js.map +0 -1
- package/build/core/defaultTokens.d.ts +0 -17
- package/build/core/defaultTokens.js +0 -1079
- package/build/core/defaultTokens.js.map +0 -1
- package/build/core/events.d.ts +0 -42
- package/build/core/events.js +0 -64
- package/build/core/events.js.map +0 -1
- package/build/core/index.d.ts +0 -10
- package/build/core/index.js +0 -11
- package/build/core/index.js.map +0 -1
- package/build/core/recipient.d.ts +0 -10
- package/build/core/recipient.js +0 -40
- package/build/core/recipient.js.map +0 -1
- package/build/core/token.d.ts +0 -36
- package/build/core/token.js +0 -103
- package/build/core/token.js.map +0 -1
- package/build/core/tokens.d.ts +0 -14
- package/build/core/tokens.js +0 -59
- package/build/core/tokens.js.map +0 -1
- package/build/core/types.d.ts +0 -60
- package/build/core/types.js +0 -2
- package/build/core/types.js.map +0 -1
- package/build/core/utils.d.ts +0 -25
- package/build/core/utils.js +0 -170
- package/build/core/utils.js.map +0 -1
- package/build/cosmos/connector.d.ts +0 -36
- package/build/cosmos/connector.js +0 -211
- package/build/cosmos/connector.js.map +0 -1
- package/build/cosmos/helpers.d.ts +0 -2
- package/build/cosmos/helpers.js +0 -29
- package/build/cosmos/helpers.js.map +0 -1
- package/build/cosmos/index.d.ts +0 -6
- package/build/cosmos/index.js +0 -5
- package/build/cosmos/index.js.map +0 -1
- package/build/cosmos/wallet.d.ts +0 -26
- package/build/cosmos/wallet.js +0 -51
- package/build/cosmos/wallet.js.map +0 -1
- package/build/defaults.d.ts +0 -1
- package/build/defaults.js +0 -7
- package/build/defaults.js.map +0 -1
- package/build/evm/abi.d.ts +0 -17
- package/build/evm/abi.js +0 -38
- package/build/evm/abi.js.map +0 -1
- package/build/evm/connector.d.ts +0 -29
- package/build/evm/connector.js +0 -118
- package/build/evm/connector.js.map +0 -1
- package/build/evm/index.d.ts +0 -6
- package/build/evm/index.js +0 -5
- package/build/evm/index.js.map +0 -1
- package/build/evm/injected.d.ts +0 -1
- package/build/evm/injected.js +0 -33
- package/build/evm/injected.js.map +0 -1
- package/build/evm/wallet.d.ts +0 -42
- package/build/evm/wallet.js +0 -130
- package/build/evm/wallet.js.map +0 -1
- package/build/exchange.d.ts +0 -68
- package/build/exchange.js +0 -384
- package/build/exchange.js.map +0 -1
- package/build/hot-wallet/google.d.ts +0 -25
- package/build/hot-wallet/google.js +0 -117
- package/build/hot-wallet/google.js.map +0 -1
- package/build/hot-wallet/iframe.d.ts +0 -36
- package/build/hot-wallet/iframe.js +0 -140
- package/build/hot-wallet/iframe.js.map +0 -1
- package/build/hot-wallet/index.d.ts +0 -5
- package/build/hot-wallet/index.js +0 -4
- package/build/hot-wallet/index.js.map +0 -1
- package/build/hot-wallet/proxy.d.ts +0 -8
- package/build/hot-wallet/proxy.js +0 -45
- package/build/hot-wallet/proxy.js.map +0 -1
- package/build/index.d.ts +0 -6
- package/build/index.js +0 -7
- package/build/index.js.map +0 -1
- package/build/near/connector.d.ts +0 -18
- package/build/near/connector.js +0 -58
- package/build/near/connector.js.map +0 -1
- package/build/near/index.d.ts +0 -7
- package/build/near/index.js +0 -5
- package/build/near/index.js.map +0 -1
- package/build/near/rpc.d.ts +0 -23
- package/build/near/rpc.js +0 -161
- package/build/near/rpc.js.map +0 -1
- package/build/near/wallet.d.ts +0 -53
- package/build/near/wallet.js +0 -190
- package/build/near/wallet.js.map +0 -1
- package/build/solana/WalletStandard.d.ts +0 -25
- package/build/solana/WalletStandard.js +0 -56
- package/build/solana/WalletStandard.js.map +0 -1
- package/build/solana/connector.d.ts +0 -30
- package/build/solana/connector.js +0 -139
- package/build/solana/connector.js.map +0 -1
- package/build/solana/index.d.ts +0 -6
- package/build/solana/index.js +0 -5
- package/build/solana/index.js.map +0 -1
- package/build/solana/injected/account.d.ts +0 -11
- package/build/solana/injected/account.js +0 -41
- package/build/solana/injected/account.js.map +0 -1
- package/build/solana/injected/index.d.ts +0 -1
- package/build/solana/injected/index.js +0 -82
- package/build/solana/injected/index.js.map +0 -1
- package/build/solana/injected/register.d.ts +0 -2
- package/build/solana/injected/register.js +0 -41
- package/build/solana/injected/register.js.map +0 -1
- package/build/solana/injected/solana-wallet.d.ts +0 -34
- package/build/solana/injected/solana-wallet.js +0 -223
- package/build/solana/injected/solana-wallet.js.map +0 -1
- package/build/solana/injected/utils.d.ts +0 -32
- package/build/solana/injected/utils.js +0 -36
- package/build/solana/injected/utils.js.map +0 -1
- package/build/solana/wallet.d.ts +0 -40
- package/build/solana/wallet.js +0 -181
- package/build/solana/wallet.js.map +0 -1
- package/build/solana/walletStandartList.d.ts +0 -102
- package/build/solana/walletStandartList.js +0 -150
- package/build/solana/walletStandartList.js.map +0 -1
- package/build/stellar/connector.d.ts +0 -29
- package/build/stellar/connector.js +0 -64
- package/build/stellar/connector.js.map +0 -1
- package/build/stellar/freigher.d.ts +0 -46
- package/build/stellar/freigher.js +0 -110
- package/build/stellar/freigher.js.map +0 -1
- package/build/stellar/hotWallet.d.ts +0 -33
- package/build/stellar/hotWallet.js +0 -28
- package/build/stellar/hotWallet.js.map +0 -1
- package/build/stellar/index.d.ts +0 -6
- package/build/stellar/index.js +0 -5
- package/build/stellar/index.js.map +0 -1
- package/build/stellar/wallet.d.ts +0 -67
- package/build/stellar/wallet.js +0 -212
- package/build/stellar/wallet.js.map +0 -1
- package/build/storage.d.ts +0 -10
- package/build/storage.js +0 -12
- package/build/storage.js.map +0 -1
- package/build/ton/connector.d.ts +0 -24
- package/build/ton/connector.js +0 -111
- package/build/ton/connector.js.map +0 -1
- package/build/ton/index.d.ts +0 -7
- package/build/ton/index.js +0 -5
- package/build/ton/index.js.map +0 -1
- package/build/ton/injected.d.ts +0 -1
- package/build/ton/injected.js +0 -49
- package/build/ton/injected.js.map +0 -1
- package/build/ton/utils.d.ts +0 -45
- package/build/ton/utils.js +0 -63
- package/build/ton/utils.js.map +0 -1
- package/build/ton/wallet.d.ts +0 -54
- package/build/ton/wallet.js +0 -138
- package/build/ton/wallet.js.map +0 -1
- package/build/tron/connector.d.ts +0 -51
- package/build/tron/connector.js +0 -65
- package/build/tron/connector.js.map +0 -1
- package/build/tron/index.d.ts +0 -6
- package/build/tron/index.js +0 -5
- package/build/tron/index.js.map +0 -1
- package/build/tron/wallet.d.ts +0 -52
- package/build/tron/wallet.js +0 -122
- package/build/tron/wallet.js.map +0 -1
- package/build/ui/Popup.d.ts +0 -12
- package/build/ui/Popup.js +0 -43
- package/build/ui/Popup.js.map +0 -1
- package/build/ui/Toast.d.ts +0 -4
- package/build/ui/Toast.js +0 -33
- package/build/ui/Toast.js.map +0 -1
- package/build/ui/connect/AuthPopup.d.ts +0 -2
- package/build/ui/connect/AuthPopup.js +0 -48
- package/build/ui/connect/AuthPopup.js.map +0 -1
- package/build/ui/connect/ConnectWallet.d.ts +0 -14
- package/build/ui/connect/ConnectWallet.js +0 -22
- package/build/ui/connect/ConnectWallet.js.map +0 -1
- package/build/ui/connect/LogoutPopup.d.ts +0 -10
- package/build/ui/connect/LogoutPopup.js +0 -8
- package/build/ui/connect/LogoutPopup.js.map +0 -1
- package/build/ui/connect/PrimaryWallet.d.ts +0 -6
- package/build/ui/connect/PrimaryWallet.js +0 -18
- package/build/ui/connect/PrimaryWallet.js.map +0 -1
- package/build/ui/connect/WCPopup.d.ts +0 -13
- package/build/ui/connect/WCPopup.js +0 -81
- package/build/ui/connect/WCPopup.js.map +0 -1
- package/build/ui/connect/WCRequest.d.ts +0 -9
- package/build/ui/connect/WCRequest.js +0 -13
- package/build/ui/connect/WCRequest.js.map +0 -1
- package/build/ui/connect/WalletPicker.d.ts +0 -11
- package/build/ui/connect/WalletPicker.js +0 -48
- package/build/ui/connect/WalletPicker.js.map +0 -1
- package/build/ui/icons/arrow-right.d.ts +0 -1
- package/build/ui/icons/arrow-right.js +0 -5
- package/build/ui/icons/arrow-right.js.map +0 -1
- package/build/ui/icons/close.d.ts +0 -1
- package/build/ui/icons/close.js +0 -5
- package/build/ui/icons/close.js.map +0 -1
- package/build/ui/icons/exchange.d.ts +0 -6
- package/build/ui/icons/exchange.js +0 -6
- package/build/ui/icons/exchange.js.map +0 -1
- package/build/ui/icons/logout.d.ts +0 -1
- package/build/ui/icons/logout.js +0 -3
- package/build/ui/icons/logout.js.map +0 -1
- package/build/ui/icons/pending.d.ts +0 -1
- package/build/ui/icons/pending.js +0 -5
- package/build/ui/icons/pending.js.map +0 -1
- package/build/ui/icons/qr.d.ts +0 -1
- package/build/ui/icons/qr.js +0 -5
- package/build/ui/icons/qr.js.map +0 -1
- package/build/ui/icons/search.d.ts +0 -1
- package/build/ui/icons/search.js +0 -5
- package/build/ui/icons/search.js.map +0 -1
- package/build/ui/icons/switch.d.ts +0 -1
- package/build/ui/icons/switch.js +0 -5
- package/build/ui/icons/switch.js.map +0 -1
- package/build/ui/icons/wallet.d.ts +0 -1
- package/build/ui/icons/wallet.js +0 -5
- package/build/ui/icons/wallet.js.map +0 -1
- package/build/ui/payment/Bridge.d.ts +0 -29
- package/build/ui/payment/Bridge.js +0 -373
- package/build/ui/payment/Bridge.js.map +0 -1
- package/build/ui/payment/DepositQR.d.ts +0 -9
- package/build/ui/payment/DepositQR.js +0 -56
- package/build/ui/payment/DepositQR.js.map +0 -1
- package/build/ui/payment/Payment.d.ts +0 -23
- package/build/ui/payment/Payment.js +0 -136
- package/build/ui/payment/Payment.js.map +0 -1
- package/build/ui/payment/Profile.d.ts +0 -8
- package/build/ui/payment/Profile.js +0 -110
- package/build/ui/payment/Profile.js.map +0 -1
- package/build/ui/payment/SelectRecipient.d.ts +0 -14
- package/build/ui/payment/SelectRecipient.js +0 -68
- package/build/ui/payment/SelectRecipient.js.map +0 -1
- package/build/ui/payment/SelectSender.d.ts +0 -13
- package/build/ui/payment/SelectSender.js +0 -23
- package/build/ui/payment/SelectSender.js.map +0 -1
- package/build/ui/payment/SelectToken.d.ts +0 -13
- package/build/ui/payment/SelectToken.js +0 -92
- package/build/ui/payment/SelectToken.js.map +0 -1
- package/build/ui/payment/Stepper.d.ts +0 -13
- package/build/ui/payment/Stepper.js +0 -22
- package/build/ui/payment/Stepper.js.map +0 -1
- package/build/ui/payment/TokenCard.d.ts +0 -25
- package/build/ui/payment/TokenCard.js +0 -63
- package/build/ui/payment/TokenCard.js.map +0 -1
- package/build/ui/router.d.ts +0 -51
- package/build/ui/router.js +0 -68
- package/build/ui/router.js.map +0 -1
- package/build/ui/styles.d.ts +0 -13
- package/build/ui/styles.js +0 -290
- package/build/ui/styles.js.map +0 -1
- package/src/tron/connector.ts +0 -89
- package/src/tron/index.ts +0 -7
- package/src/tron/wallet.ts +0 -146
- package/src/ui/Toast.tsx +0 -45
- package/src/ui/connect/PrimaryWallet.tsx +0 -65
- package/src/ui/payment/Stepper.tsx +0 -50
- /package/src/solana/{walletStandartList.ts → wallets.ts} +0 -0
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Token } from "../../core/token";
|
|
2
|
-
import { HotConnector } from "../../HotConnector";
|
|
3
|
-
import { OmniWallet } from "../../OmniWallet";
|
|
4
|
-
export declare const ImageView: ({ src, size, alt, style }: {
|
|
5
|
-
src: string;
|
|
6
|
-
size?: number;
|
|
7
|
-
alt: string;
|
|
8
|
-
style?: React.CSSProperties;
|
|
9
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const TokenIcon: (({ token, wallet }: {
|
|
11
|
-
token: Token;
|
|
12
|
-
wallet?: OmniWallet;
|
|
13
|
-
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
16
|
-
export declare const TokenCard: (({ token, onSelect, amount, hot, wallet, rightControl }: {
|
|
17
|
-
rightControl?: React.ReactNode;
|
|
18
|
-
token: Token;
|
|
19
|
-
onSelect?: (token: Token, wallet?: OmniWallet) => void;
|
|
20
|
-
amount?: bigint;
|
|
21
|
-
hot: HotConnector;
|
|
22
|
-
wallet?: OmniWallet;
|
|
23
|
-
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
24
|
-
displayName: string;
|
|
25
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { observer } from "mobx-react-lite";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import styled from "styled-components";
|
|
5
|
-
import { chains } from "../../core/chains";
|
|
6
|
-
import { formatter } from "../../core/utils";
|
|
7
|
-
import { PopupOption } from "../styles";
|
|
8
|
-
const images = {
|
|
9
|
-
cached: new Map(),
|
|
10
|
-
cache(url) {
|
|
11
|
-
if (this.cached.has(url))
|
|
12
|
-
return this.cached.get(url);
|
|
13
|
-
const promise = new Promise((resolve, reject) => {
|
|
14
|
-
const img = new Image();
|
|
15
|
-
img.src = url;
|
|
16
|
-
img.onload = () => resolve();
|
|
17
|
-
img.onerror = () => reject(new Error("Failed to load image"));
|
|
18
|
-
});
|
|
19
|
-
this.cached.set(url, promise);
|
|
20
|
-
return promise;
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
var ImageState;
|
|
24
|
-
(function (ImageState) {
|
|
25
|
-
ImageState["Loading"] = "loading";
|
|
26
|
-
ImageState["Loaded"] = "loaded";
|
|
27
|
-
ImageState["Error"] = "error";
|
|
28
|
-
})(ImageState || (ImageState = {}));
|
|
29
|
-
export const ImageView = ({ src, size = 40, alt, style }) => {
|
|
30
|
-
const [icon, setIcon] = useState(ImageState.Loading);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
setIcon(ImageState.Loading);
|
|
33
|
-
images
|
|
34
|
-
.cache(src)
|
|
35
|
-
.then(() => setIcon(ImageState.Loaded))
|
|
36
|
-
.catch(() => setIcon(ImageState.Error));
|
|
37
|
-
}, [src]);
|
|
38
|
-
if (icon === ImageState.Loaded) {
|
|
39
|
-
return _jsx("img", { src: src, alt: alt, style: { objectFit: "contain", width: size, height: size, borderRadius: "50%", ...style } });
|
|
40
|
-
}
|
|
41
|
-
return (_jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: size, height: size, borderRadius: "50%", backgroundColor: "#0e0e0e", ...style }, children: _jsx("p", { style: { fontWeight: "bold", fontSize: size / 2, color: "#ffffff" }, children: alt.charAt(0)?.toUpperCase() }) }));
|
|
42
|
-
};
|
|
43
|
-
export const TokenIcon = observer(({ token, wallet }) => {
|
|
44
|
-
return (_jsxs("div", { style: { position: "relative", width: 40, height: 40 }, children: [_jsx(ImageView, { src: token.icon, alt: token.symbol, size: 40 }), _jsx(ImageView, { src: token.chainIcon, alt: token.symbol, size: 14, style: { position: "absolute", bottom: 0, right: 0 } }), token.chain === -4 && wallet?.type && _jsx(ImageView, { src: wallet.icon, alt: chains.getByType(wallet.type)?.[0]?.name || "", size: 14, style: { position: "absolute", bottom: 0, left: 0 } })] }));
|
|
45
|
-
});
|
|
46
|
-
export const TokenCard = observer(({ token, onSelect, amount, hot, wallet, rightControl }) => {
|
|
47
|
-
const balance = amount || hot.balance(wallet, token);
|
|
48
|
-
const symbol = token.chain === -4 && !token.isMainOmni ? `${token.symbol} (${token.originalChainSymbol})` : token.symbol;
|
|
49
|
-
return (_jsxs(PopupOption, { onClick: () => onSelect?.(token, wallet), children: [_jsx(TokenIcon, { token: token, wallet: wallet }), _jsxs(TokenWrap, { style: { marginTop: -2, textAlign: "left" }, children: [_jsx("p", { style: { textAlign: "left", fontSize: 20, fontWeight: "bold" }, children: symbol }), _jsxs("p", { style: { textAlign: "left", fontSize: 14, color: "#c6c6c6" }, children: ["$", formatter.amount(token.usd)] })] }), rightControl || (_jsxs(TokenWrap, { style: { paddingRight: 4, marginLeft: "auto", alignItems: "flex-end" }, children: [_jsx("p", { style: { textAlign: "right", fontSize: 20 }, children: token.readable(balance) }), _jsxs("p", { style: { textAlign: "right", fontSize: 14, color: "#c6c6c6" }, children: ["$", token.readable(balance, token.usd)] })] }))] }, token.id));
|
|
50
|
-
});
|
|
51
|
-
const TokenWrap = styled.div `
|
|
52
|
-
display: flex;
|
|
53
|
-
flex-direction: column;
|
|
54
|
-
gap: 4px;
|
|
55
|
-
|
|
56
|
-
&,
|
|
57
|
-
p {
|
|
58
|
-
white-space: nowrap;
|
|
59
|
-
overflow: hidden;
|
|
60
|
-
text-overflow: ellipsis;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
//# sourceMappingURL=TokenCard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenCard.js","sourceRoot":"","sources":["../../../src/ui/payment/TokenCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,GAAG;IACb,MAAM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,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,aACpD,YAAG,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,YAAG,MAAM,GAAK,EAC/E,aAAG,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAK,IACzF,EAEX,YAAY,IAAI,CACf,MAAC,SAAS,IAAC,KAAK,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,aAC/E,YAAG,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,YAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAK,EAC7E,aAAG,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,IAAK,IACjG,CACb,KAbe,KAAK,CAAC,EAAE,CAcZ,CACf,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;CAW3B,CAAC"}
|
package/build/ui/router.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { HotConnector } from "../HotConnector";
|
|
2
|
-
import { OmniConnector } from "../OmniConnector";
|
|
3
|
-
import { OmniWallet } from "../OmniWallet";
|
|
4
|
-
import { BridgeReview } from "../exchange";
|
|
5
|
-
import { WalletType } from "../core/chains";
|
|
6
|
-
import { Recipient } from "../core/recipient";
|
|
7
|
-
import { Intents } from "../core/Intents";
|
|
8
|
-
import { Token } from "../core/token";
|
|
9
|
-
import { BridgeProps } from "./payment/Bridge";
|
|
10
|
-
export declare const openPayment: (connector: HotConnector, { intents, title, allowedTokens, prepaidAmount, payableToken, needAmount, onConfirm, }: {
|
|
11
|
-
intents: Intents;
|
|
12
|
-
title?: string;
|
|
13
|
-
allowedTokens?: string[];
|
|
14
|
-
prepaidAmount: bigint;
|
|
15
|
-
payableToken: Token;
|
|
16
|
-
needAmount: bigint;
|
|
17
|
-
onConfirm: (args: {
|
|
18
|
-
depositQoute?: BridgeReview;
|
|
19
|
-
processing?: () => Promise<BridgeReview>;
|
|
20
|
-
}) => Promise<void>;
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
export declare const openLogoutPopup: (connector: OmniConnector) => Promise<void>;
|
|
23
|
-
export declare const openBridge: (hot: HotConnector, setup?: BridgeProps["setup"]) => Promise<BridgeReview>;
|
|
24
|
-
export declare const openConnector: (hot: HotConnector) => Promise<void>;
|
|
25
|
-
export declare const openConnectPrimaryWallet: (hot: HotConnector) => Promise<void>;
|
|
26
|
-
export declare const openProfile: (hot: HotConnector) => void;
|
|
27
|
-
export declare const openSelectTokenPopup: ({ hot, initialChain, onSelect }: {
|
|
28
|
-
hot: HotConnector;
|
|
29
|
-
initialChain?: number;
|
|
30
|
-
onSelect: (token: Token, wallet?: OmniWallet) => void;
|
|
31
|
-
}) => void;
|
|
32
|
-
export declare const openWalletPicker: (connector: OmniConnector, onSelect?: (wallet: OmniWallet) => void) => void;
|
|
33
|
-
export declare const openSelectSender: (props: {
|
|
34
|
-
hot: HotConnector;
|
|
35
|
-
type: WalletType;
|
|
36
|
-
onSelect: (wallet?: OmniWallet | "qr") => void;
|
|
37
|
-
}) => void;
|
|
38
|
-
export declare const openSelectRecipient: (props: {
|
|
39
|
-
hot: HotConnector;
|
|
40
|
-
recipient?: Recipient;
|
|
41
|
-
type: WalletType;
|
|
42
|
-
onSelect: (wallet?: Recipient) => void;
|
|
43
|
-
}) => void;
|
|
44
|
-
export declare const openWCRequest: <T>(args: {
|
|
45
|
-
task: () => Promise<T>;
|
|
46
|
-
deeplink?: string;
|
|
47
|
-
name: string;
|
|
48
|
-
icon: string;
|
|
49
|
-
request: any;
|
|
50
|
-
}) => Promise<T>;
|
|
51
|
-
export declare const openToast: (message: string) => () => void;
|
package/build/ui/router.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { present } from "./Popup";
|
|
3
|
-
import { SelectTokenPopup } from "./payment/SelectToken";
|
|
4
|
-
import { SelectRecipient } from "./payment/SelectRecipient";
|
|
5
|
-
import { SelectSender } from "./payment/SelectSender";
|
|
6
|
-
import { Payment } from "./payment/Payment";
|
|
7
|
-
import { Profile } from "./payment/Profile";
|
|
8
|
-
import { Bridge } from "./payment/Bridge";
|
|
9
|
-
import ConnectPrimaryWallet from "./connect/PrimaryWallet";
|
|
10
|
-
import { LogoutPopup } from "./connect/LogoutPopup";
|
|
11
|
-
import { WalletPicker } from "./connect/WalletPicker";
|
|
12
|
-
import { Connector } from "./connect/ConnectWallet";
|
|
13
|
-
import { WCRequest } from "./connect/WCRequest";
|
|
14
|
-
import Toast from "./Toast";
|
|
15
|
-
export const openPayment = (connector, { intents, title, allowedTokens, prepaidAmount, payableToken, needAmount, onConfirm, }) => {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
present((close) => (_jsx(Payment //
|
|
18
|
-
, { close: () => (close(), resolve()), onReject: () => (close(), reject(new Error("User rejected"))), onConfirm: (args) => onConfirm(args).finally(() => close()), prepaidAmount: prepaidAmount, allowedTokens: allowedTokens, payableToken: payableToken, needAmount: needAmount, connector: connector, intents: intents, title: title })));
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
export const openLogoutPopup = (connector) => {
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
present((close) => {
|
|
24
|
-
return (_jsx(LogoutPopup //
|
|
25
|
-
, { connector: connector, onApprove: () => (close(), resolve()), onReject: () => (close(), reject(new Error("User rejected"))) }));
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
export const openBridge = (hot, setup) => {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
present((close) => (_jsx(Bridge //
|
|
32
|
-
, { hot: hot, setup: setup, onProcess: resolve, onClose: () => (close(), reject(new Error("User rejected"))) })));
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
export const openConnector = (hot) => {
|
|
36
|
-
return new Promise((resolve) => {
|
|
37
|
-
present((close) => _jsx(Connector, { hot: hot, onClose: () => (resolve(), close()) }));
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
export const openConnectPrimaryWallet = (hot) => {
|
|
41
|
-
return new Promise((resolve) => {
|
|
42
|
-
present((close) => _jsx(ConnectPrimaryWallet, { hot: hot, onClose: () => (close(), resolve()) }));
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
export const openProfile = (hot) => {
|
|
46
|
-
present((close) => _jsx(Profile, { hot: hot, onClose: close }));
|
|
47
|
-
};
|
|
48
|
-
export const openSelectTokenPopup = ({ hot, initialChain, onSelect }) => {
|
|
49
|
-
present((close) => _jsx(SelectTokenPopup, { hot: hot, initialChain: initialChain, onClose: close, onSelect: (t, w) => (onSelect(t, w), close()) }));
|
|
50
|
-
};
|
|
51
|
-
export const openWalletPicker = (connector, onSelect) => {
|
|
52
|
-
present((close) => _jsx(WalletPicker, { initialConnector: connector, onSelect: onSelect, onClose: close }));
|
|
53
|
-
};
|
|
54
|
-
export const openSelectSender = (props) => {
|
|
55
|
-
present((close) => _jsx(SelectSender, { ...props, onClose: close }));
|
|
56
|
-
};
|
|
57
|
-
export const openSelectRecipient = (props) => {
|
|
58
|
-
present((close) => _jsx(SelectRecipient, { ...props, onClose: close }));
|
|
59
|
-
};
|
|
60
|
-
export const openWCRequest = (args) => {
|
|
61
|
-
const taskPromise = args.task();
|
|
62
|
-
present((close) => _jsx(WCRequest, { deeplink: args.deeplink, name: args.name, icon: args.icon, onClose: close, task: taskPromise }));
|
|
63
|
-
return taskPromise;
|
|
64
|
-
};
|
|
65
|
-
export const openToast = (message) => {
|
|
66
|
-
return present(() => _jsx(Toast, { message: message }));
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=router.js.map
|
package/build/ui/router.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/ui/router.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,SAAuB,EACvB,EACE,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,SAAS,GASV,EACD,EAAE;IACF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,C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,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,GAAI,CAAC,CAAC;IAChI,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IAC3C,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,KAAC,KAAK,IAAC,OAAO,EAAE,OAAO,GAAI,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
package/build/ui/styles.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const ModalContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
-
export declare const ModalOverlay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
-
export declare const ModalContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
|
-
$mobileFullscreen?: boolean;
|
|
5
|
-
}>> & string;
|
|
6
|
-
export declare const ModalHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
-
export declare const ModalBody: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
-
export declare const Footer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
|
-
export declare const GetWalletLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
10
|
-
export declare const PopupOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
11
|
-
export declare const PopupOptionInfo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
-
export declare const PopupButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
13
|
-
export declare const PopupRoot: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
package/build/ui/styles.js
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import styled, { css } from "styled-components";
|
|
2
|
-
const font = `-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`;
|
|
3
|
-
export const ModalContainer = styled.div `
|
|
4
|
-
position: fixed;
|
|
5
|
-
top: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 100%;
|
|
9
|
-
z-index: 100000000;
|
|
10
|
-
display: flex;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
align-items: center;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
transition: opacity 0.2s ease-in-out;
|
|
15
|
-
pointer-events: all;
|
|
16
|
-
|
|
17
|
-
@media (max-width: 600px) {
|
|
18
|
-
justify-content: flex-end;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
export const ModalOverlay = styled.div `
|
|
22
|
-
position: absolute;
|
|
23
|
-
top: 0;
|
|
24
|
-
left: 0;
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
z-index: 100000000;
|
|
28
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
29
|
-
backdrop-filter: blur(10px);
|
|
30
|
-
z-index: 1;
|
|
31
|
-
`;
|
|
32
|
-
export const ModalContent = styled.div `
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
align-items: center;
|
|
36
|
-
max-width: 420px;
|
|
37
|
-
max-height: 660px;
|
|
38
|
-
width: 100%;
|
|
39
|
-
border-radius: 24px;
|
|
40
|
-
background: #0d0d0d;
|
|
41
|
-
border: 1.5px solid rgba(255, 255, 255, 0.1);
|
|
42
|
-
transition: transform 0.2s ease-in-out;
|
|
43
|
-
z-index: 2;
|
|
44
|
-
|
|
45
|
-
@media (max-width: 600px) {
|
|
46
|
-
max-width: 100%;
|
|
47
|
-
width: 100%;
|
|
48
|
-
max-height: 90%;
|
|
49
|
-
border-bottom-left-radius: 0;
|
|
50
|
-
border-bottom-right-radius: 0;
|
|
51
|
-
border: none;
|
|
52
|
-
border-top: 1.5px solid rgba(255, 255, 255, 0.1);
|
|
53
|
-
|
|
54
|
-
${(props) => props.$mobileFullscreen &&
|
|
55
|
-
css `
|
|
56
|
-
border-bottom-left-radius: 0;
|
|
57
|
-
border-bottom-right-radius: 0;
|
|
58
|
-
height: 100%;
|
|
59
|
-
border-radius: 0;
|
|
60
|
-
max-height: 100%;
|
|
61
|
-
border: none;
|
|
62
|
-
`}
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
export const ModalHeader = styled.div `
|
|
66
|
-
display: flex;
|
|
67
|
-
padding: 16px;
|
|
68
|
-
gap: 16px;
|
|
69
|
-
align-self: stretch;
|
|
70
|
-
align-items: center;
|
|
71
|
-
justify-content: center;
|
|
72
|
-
position: relative;
|
|
73
|
-
|
|
74
|
-
button {
|
|
75
|
-
position: absolute;
|
|
76
|
-
right: 16px;
|
|
77
|
-
top: 16px;
|
|
78
|
-
width: 32px;
|
|
79
|
-
height: 32px;
|
|
80
|
-
border-radius: 12px;
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
transition: background 0.2s ease-in-out;
|
|
83
|
-
border: none;
|
|
84
|
-
background: none;
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: center;
|
|
87
|
-
justify-content: center;
|
|
88
|
-
|
|
89
|
-
&:hover {
|
|
90
|
-
background: rgba(255, 255, 255, 0.04);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
p {
|
|
95
|
-
color: #fff;
|
|
96
|
-
text-align: center;
|
|
97
|
-
font-size: 24px;
|
|
98
|
-
font-style: normal;
|
|
99
|
-
font-weight: 600;
|
|
100
|
-
line-height: normal;
|
|
101
|
-
margin: 0;
|
|
102
|
-
}
|
|
103
|
-
`;
|
|
104
|
-
export const ModalBody = styled.div `
|
|
105
|
-
display: flex;
|
|
106
|
-
padding: 16px;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
align-items: flex-start;
|
|
109
|
-
text-align: center;
|
|
110
|
-
gap: 4px;
|
|
111
|
-
overflow: auto;
|
|
112
|
-
border-radius: 24px;
|
|
113
|
-
background: rgba(255, 255, 255, 0.08);
|
|
114
|
-
width: 100%;
|
|
115
|
-
flex: 1;
|
|
116
|
-
|
|
117
|
-
textarea {
|
|
118
|
-
width: 100%;
|
|
119
|
-
padding: 12px;
|
|
120
|
-
border-radius: 12px;
|
|
121
|
-
background: #0d0d0d;
|
|
122
|
-
color: #fff;
|
|
123
|
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
124
|
-
outline: none;
|
|
125
|
-
font-size: 12px;
|
|
126
|
-
transition: background 0.2s ease-in-out;
|
|
127
|
-
font-family: monospace;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
p {
|
|
131
|
-
color: rgba(255, 255, 255, 0.9);
|
|
132
|
-
text-align: center;
|
|
133
|
-
font-size: 16px;
|
|
134
|
-
font-style: normal;
|
|
135
|
-
font-weight: 500;
|
|
136
|
-
line-height: normal;
|
|
137
|
-
letter-spacing: -0.8px;
|
|
138
|
-
}
|
|
139
|
-
`;
|
|
140
|
-
export const Footer = styled.div `
|
|
141
|
-
width: 100%;
|
|
142
|
-
display: flex;
|
|
143
|
-
align-items: center;
|
|
144
|
-
justify-content: flex-start;
|
|
145
|
-
padding: 16px 24px;
|
|
146
|
-
color: #fff;
|
|
147
|
-
gap: 12px;
|
|
148
|
-
|
|
149
|
-
img {
|
|
150
|
-
width: 24px;
|
|
151
|
-
height: 24px;
|
|
152
|
-
border-radius: 50%;
|
|
153
|
-
object-fit: cover;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
* {
|
|
157
|
-
white-space: nowrap;
|
|
158
|
-
overflow: hidden;
|
|
159
|
-
text-overflow: ellipsis;
|
|
160
|
-
}
|
|
161
|
-
`;
|
|
162
|
-
export const GetWalletLink = styled.a `
|
|
163
|
-
color: #fff;
|
|
164
|
-
text-align: center;
|
|
165
|
-
font-size: 16px;
|
|
166
|
-
font-style: normal;
|
|
167
|
-
font-weight: 500;
|
|
168
|
-
margin-left: auto;
|
|
169
|
-
text-decoration: none;
|
|
170
|
-
transition: opacity 0.2s ease-in-out;
|
|
171
|
-
opacity: 0.8;
|
|
172
|
-
|
|
173
|
-
&:hover {
|
|
174
|
-
opacity: 1;
|
|
175
|
-
}
|
|
176
|
-
`;
|
|
177
|
-
export const PopupOption = styled.button `
|
|
178
|
-
display: flex;
|
|
179
|
-
padding: 8px;
|
|
180
|
-
align-items: center;
|
|
181
|
-
align-self: stretch;
|
|
182
|
-
cursor: pointer;
|
|
183
|
-
transition: background 0.2s ease-in-out;
|
|
184
|
-
border-radius: 24px;
|
|
185
|
-
outline: none;
|
|
186
|
-
border: none;
|
|
187
|
-
background: transparent;
|
|
188
|
-
width: 100%;
|
|
189
|
-
gap: 12px;
|
|
190
|
-
|
|
191
|
-
img {
|
|
192
|
-
width: 44px;
|
|
193
|
-
height: 44px;
|
|
194
|
-
border-radius: 16px;
|
|
195
|
-
object-fit: cover;
|
|
196
|
-
flex-shrink: 0;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
&:hover {
|
|
200
|
-
background: rgba(255, 255, 255, 0.04);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
p {
|
|
204
|
-
color: rgba(255, 255, 255, 0.9);
|
|
205
|
-
text-align: center;
|
|
206
|
-
font-size: 18px;
|
|
207
|
-
font-style: normal;
|
|
208
|
-
font-weight: 600;
|
|
209
|
-
line-height: normal;
|
|
210
|
-
letter-spacing: -0.36px;
|
|
211
|
-
margin: 0;
|
|
212
|
-
}
|
|
213
|
-
`;
|
|
214
|
-
export const PopupOptionInfo = styled.div `
|
|
215
|
-
display: flex;
|
|
216
|
-
flex-direction: column;
|
|
217
|
-
align-items: flex-start;
|
|
218
|
-
text-align: left;
|
|
219
|
-
flex: 1;
|
|
220
|
-
margin-top: -2px;
|
|
221
|
-
|
|
222
|
-
.wallet-address {
|
|
223
|
-
color: rgba(255, 255, 255, 0.5);
|
|
224
|
-
font-size: 14px;
|
|
225
|
-
font-style: normal;
|
|
226
|
-
font-weight: 400;
|
|
227
|
-
line-height: normal;
|
|
228
|
-
}
|
|
229
|
-
`;
|
|
230
|
-
export const PopupButton = styled.button `
|
|
231
|
-
width: 100%;
|
|
232
|
-
padding: 12px;
|
|
233
|
-
border-radius: 24px;
|
|
234
|
-
background: rgb(221, 221, 221);
|
|
235
|
-
color: rgb(20, 20, 20) !important;
|
|
236
|
-
font-weight: bold;
|
|
237
|
-
border: none;
|
|
238
|
-
cursor: pointer;
|
|
239
|
-
font-size: 16px;
|
|
240
|
-
transition: background 0.2s ease-in-out;
|
|
241
|
-
margin-top: 16px;
|
|
242
|
-
height: 56px;
|
|
243
|
-
|
|
244
|
-
&:hover {
|
|
245
|
-
background: rgb(160, 160, 160);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
&:disabled {
|
|
249
|
-
opacity: 0.5;
|
|
250
|
-
cursor: not-allowed;
|
|
251
|
-
}
|
|
252
|
-
`;
|
|
253
|
-
export const PopupRoot = styled.div `
|
|
254
|
-
height: 100%;
|
|
255
|
-
width: 100%;
|
|
256
|
-
|
|
257
|
-
h1,
|
|
258
|
-
h2,
|
|
259
|
-
h3,
|
|
260
|
-
h4,
|
|
261
|
-
h5,
|
|
262
|
-
h6,
|
|
263
|
-
p {
|
|
264
|
-
font-family: ${font};
|
|
265
|
-
margin: 0;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/* Hide scrollbar for all scrollable elements inside PopupRoot */
|
|
269
|
-
&::-webkit-scrollbar {
|
|
270
|
-
display: none;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
scrollbar-width: none; /* Firefox */
|
|
274
|
-
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
275
|
-
|
|
276
|
-
/* Also hide scrollbars for all inner elements */
|
|
277
|
-
* {
|
|
278
|
-
-webkit-tap-highlight-color: transparent;
|
|
279
|
-
font-family: ${font};
|
|
280
|
-
scrollbar-width: none;
|
|
281
|
-
-ms-overflow-style: none;
|
|
282
|
-
box-sizing: border-box;
|
|
283
|
-
color: #fff;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
*::-webkit-scrollbar {
|
|
287
|
-
display: none;
|
|
288
|
-
}
|
|
289
|
-
`;
|
|
290
|
-
//# sourceMappingURL=styles.js.map
|
package/build/ui/styles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/ui/styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM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GAAG,CAAA;;;;;;;;;;;mBAWhB,IAAI;;;;;;;;;;;;;;;mBAeJ,IAAI;;;;;;;;;;CAUtB,CAAC"}
|
package/src/tron/connector.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { WalletType } from "../core/chains";
|
|
2
|
-
import { ConnectorType, OmniConnector } from "../OmniConnector";
|
|
3
|
-
import { HotConnector } from "../HotConnector";
|
|
4
|
-
import TronWallet from "./wallet";
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
interface Window {
|
|
8
|
-
tronLink?: {
|
|
9
|
-
ready?: boolean;
|
|
10
|
-
request?: (args: { method: string; params?: any }) => Promise<any>;
|
|
11
|
-
tronWeb?: {
|
|
12
|
-
defaultAddress?: { base58?: string; hex?: string };
|
|
13
|
-
address?: { toHex?: (address: string) => string };
|
|
14
|
-
contract?: () => { at: (address: string) => Promise<any> };
|
|
15
|
-
trx?: {
|
|
16
|
-
getBalance?: (address: string) => Promise<number | string>;
|
|
17
|
-
sendTransaction?: (to: string, amount: number | string) => Promise<any>;
|
|
18
|
-
signMessageV2?: (message: string) => Promise<string>;
|
|
19
|
-
signMessage?: (message: string) => Promise<string>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const TRONLINK = {
|
|
27
|
-
id: "tronlink",
|
|
28
|
-
name: "Tron Link",
|
|
29
|
-
type: window?.tronLink ? ("extension" as const) : ("external" as const),
|
|
30
|
-
icon: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png",
|
|
31
|
-
download: "https://www.tronlink.org/",
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
class TronConnector extends OmniConnector<TronWallet> {
|
|
35
|
-
type = ConnectorType.WALLET;
|
|
36
|
-
walletTypes = [WalletType.Tron, WalletType.OMNI];
|
|
37
|
-
icon = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png";
|
|
38
|
-
name = "TRON Wallet";
|
|
39
|
-
options = [TRONLINK];
|
|
40
|
-
id = "tron";
|
|
41
|
-
|
|
42
|
-
constructor(wibe3: HotConnector) {
|
|
43
|
-
super(wibe3);
|
|
44
|
-
|
|
45
|
-
this.syncFromProvider().catch(() => this.removeStorage());
|
|
46
|
-
window.addEventListener("message", () => {
|
|
47
|
-
this.syncFromProvider().catch(() => {});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private async syncFromProvider() {
|
|
52
|
-
const stored = (await this.getStorage().catch(() => ({} as any))) as { type?: string; id?: string; address?: string };
|
|
53
|
-
if (stored.type !== "wallet" || stored.id !== TRONLINK.id) return;
|
|
54
|
-
|
|
55
|
-
const tronWeb = window?.tronLink?.tronWeb;
|
|
56
|
-
const address = tronWeb?.defaultAddress?.base58;
|
|
57
|
-
if (!window?.tronLink?.ready || !address) return;
|
|
58
|
-
|
|
59
|
-
const current = this.wallets[0]?.address;
|
|
60
|
-
if (current === address) return;
|
|
61
|
-
|
|
62
|
-
if (this.wallets.length > 0) this.removeWallet();
|
|
63
|
-
await this.setStorage({ type: "wallet", id: TRONLINK.id, address });
|
|
64
|
-
this.setWallet(new TronWallet(this, address, tronWeb as any));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async connect(id: string = TRONLINK.id) {
|
|
68
|
-
if (id !== TRONLINK.id) throw new Error("Wallet not found");
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
if (this.wallets.length > 0) this.removeWallet();
|
|
72
|
-
|
|
73
|
-
const res = await window?.tronLink?.request?.({ method: "tron_requestAccounts" });
|
|
74
|
-
if (res?.code !== 200) throw new Error("Failed to connect to TronLink");
|
|
75
|
-
if (!window?.tronLink?.tronWeb) throw new Error("TronLink not found");
|
|
76
|
-
|
|
77
|
-
const address = window?.tronLink?.tronWeb?.defaultAddress?.base58;
|
|
78
|
-
if (!address) throw new Error("No account found");
|
|
79
|
-
|
|
80
|
-
await this.setStorage({ type: "wallet", id: TRONLINK.id, address });
|
|
81
|
-
return this.setWallet(new TronWallet(this, address, window.tronLink.tronWeb));
|
|
82
|
-
} catch (e) {
|
|
83
|
-
await this.removeStorage();
|
|
84
|
-
throw e;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default TronConnector;
|
package/src/tron/index.ts
DELETED