@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,274 +1,79 @@
|
|
|
1
1
|
import { observer } from "mobx-react-lite";
|
|
2
|
-
import { useEffect
|
|
2
|
+
import { useEffect } from "react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Commitment, Intents } from "../../core";
|
|
4
|
+
import { HotConnector } from "../../HotConnector";
|
|
5
|
+
import { openBridge, openConnector } from "../router";
|
|
7
6
|
import { Recipient } from "../../core/recipient";
|
|
8
|
-
import { Token } from "../../core/token";
|
|
9
|
-
|
|
10
7
|
import { BridgeReview } from "../../exchange";
|
|
11
|
-
import { openConnector } from "../router";
|
|
12
|
-
|
|
13
8
|
import { OmniWallet } from "../../OmniWallet";
|
|
14
|
-
import {
|
|
9
|
+
import { Network } from "../../core/chains";
|
|
10
|
+
import { Token } from "../../core/token";
|
|
15
11
|
import Popup from "../Popup";
|
|
16
12
|
|
|
17
13
|
import { TokenCard } from "./TokenCard";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
14
|
+
import { PopupOption, PopupOptionInfo } from "../styles";
|
|
15
|
+
import { WalletIcon } from "../icons/wallet";
|
|
20
16
|
|
|
21
17
|
interface PaymentProps {
|
|
22
|
-
intents: Intents;
|
|
23
|
-
title?: string;
|
|
24
|
-
allowedTokens?: string[];
|
|
25
|
-
prepaidAmount: bigint;
|
|
26
|
-
payableToken: Token;
|
|
27
|
-
needAmount: bigint;
|
|
28
18
|
connector: HotConnector;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
token: Token;
|
|
20
|
+
amount: bigint;
|
|
21
|
+
recipient?: Recipient;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
onProcess: (task: Promise<BridgeReview>) => void;
|
|
32
24
|
}
|
|
33
25
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
failed: "https://hex.exchange/error.json",
|
|
37
|
-
loading: "https://hex.exchange/loading.json",
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const PAY_SLIPPAGE = 0.002;
|
|
41
|
-
|
|
42
|
-
const serializeError = (error: any) => {
|
|
43
|
-
try {
|
|
44
|
-
if (error instanceof Error) return error.message;
|
|
45
|
-
if (typeof error === "object" && Object.keys(error).length > 0) return JSON.stringify(error);
|
|
46
|
-
if (typeof error === "string" || typeof error === "number") return error.toString();
|
|
47
|
-
return "";
|
|
48
|
-
} catch (error) {
|
|
49
|
-
return "Unknown error";
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const Payment = observer(({ connector, intents, title = "Payment", allowedTokens, prepaidAmount, payableToken, needAmount, onReject, onConfirm, close }: PaymentProps) => {
|
|
54
|
-
useState(() => {
|
|
55
|
-
fetch(animations.loading);
|
|
56
|
-
fetch(animations.success);
|
|
57
|
-
fetch(animations.failed);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (connector.wallets.length !== 0) return;
|
|
62
|
-
openConnector(connector);
|
|
63
|
-
}, [connector.wallets.length]);
|
|
64
|
-
|
|
65
|
-
const [flow, setFlow] = useState<{
|
|
66
|
-
token?: Token;
|
|
67
|
-
wallet?: OmniWallet;
|
|
68
|
-
commitment?: Commitment;
|
|
69
|
-
review?: BridgeReview;
|
|
70
|
-
success?: { depositQoute?: BridgeReview; processing?: () => Promise<BridgeReview> };
|
|
71
|
-
step?: "selectToken" | "sign" | "transfer" | "success" | "error" | "loading";
|
|
72
|
-
loading?: boolean;
|
|
73
|
-
error?: any;
|
|
74
|
-
} | null>(needAmount === 0n ? { step: "transfer" } : null);
|
|
75
|
-
|
|
76
|
-
const paymentTitle = title || `Pay ${payableToken.readable(needAmount)} ${payableToken.symbol}`;
|
|
77
|
-
|
|
26
|
+
export const Payment = observer(({ connector, recipient, token: need, amount: needAmount, onProcess, onClose }: PaymentProps) => {
|
|
27
|
+
const title = `Need ${need.readable(needAmount)} ${need.symbol}`;
|
|
78
28
|
const selectToken = async (from: Token, wallet?: OmniWallet) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
setFlow({ token: from, wallet, review: undefined, step: "sign" });
|
|
83
|
-
const review = await connector.exchange.reviewSwap({
|
|
84
|
-
recipient: Recipient.fromWallet(intents.signer)!,
|
|
85
|
-
amount: needAmount + (needAmount * BigInt(Math.floor(PAY_SLIPPAGE * 1000))) / BigInt(1000),
|
|
86
|
-
slippage: PAY_SLIPPAGE,
|
|
29
|
+
onProcess(
|
|
30
|
+
openBridge(connector, {
|
|
87
31
|
sender: wallet,
|
|
88
|
-
|
|
32
|
+
autoClose: true,
|
|
89
33
|
type: "exactOut",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const signStep = async () => {
|
|
101
|
-
try {
|
|
102
|
-
setFlow((t) => (t ? { ...t, step: "sign", loading: true } : null));
|
|
103
|
-
await intents.sign();
|
|
104
|
-
setFlow((t) => (t ? { ...t, step: "transfer", loading: false } : null));
|
|
105
|
-
} catch (error) {
|
|
106
|
-
console.error(error);
|
|
107
|
-
setFlow((t) => (t ? { ...t, step: "error", loading: false, error } : null));
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const confirmPaymentStep = async () => {
|
|
113
|
-
try {
|
|
114
|
-
setFlow((t) => (t ? { ...t, step: "loading" } : null));
|
|
115
|
-
|
|
116
|
-
if (flow?.review == null) {
|
|
117
|
-
await intents.sign();
|
|
118
|
-
return setFlow({ step: "success", loading: false });
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const result = await connector.exchange.makeSwap(flow.review, { log: () => {} });
|
|
122
|
-
await onConfirm({ depositQoute: result.review, processing: result.processing });
|
|
123
|
-
setFlow({ loading: false, step: "success" });
|
|
124
|
-
setTimeout(() => close(), 2000);
|
|
125
|
-
} catch (error) {
|
|
126
|
-
console.error(error);
|
|
127
|
-
setFlow((t) => (t ? { ...t, step: "error", loading: false, error } : null));
|
|
128
|
-
throw error;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
if (flow?.step === "success") {
|
|
133
|
-
return (
|
|
134
|
-
<Popup header={<p>{paymentTitle}</p>}>
|
|
135
|
-
<div style={{ width: "100%", height: 400, display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }}>
|
|
136
|
-
{/* @ts-expect-error: dotlottie-wc is not typed */}
|
|
137
|
-
<dotlottie-wc key="success" src={animations.success} speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
|
|
138
|
-
<p style={{ fontSize: 24, marginTop: -32, fontWeight: "bold" }}>Transaction successful</p>
|
|
139
|
-
</div>
|
|
140
|
-
<PopupButton style={{ marginTop: "auto" }} onClick={() => close()}>
|
|
141
|
-
Continue
|
|
142
|
-
</PopupButton>
|
|
143
|
-
</Popup>
|
|
34
|
+
recipient: recipient || Recipient.fromWallet(connector.priorityWallet!),
|
|
35
|
+
readonlyTo: recipient ? true : false,
|
|
36
|
+
amount: need.float(needAmount),
|
|
37
|
+
readonlyAmount: true,
|
|
38
|
+
title: title,
|
|
39
|
+
from: from,
|
|
40
|
+
to: need,
|
|
41
|
+
})
|
|
144
42
|
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (flow?.step === "loading") {
|
|
148
|
-
return (
|
|
149
|
-
<Popup header={<p>{paymentTitle}</p>}>
|
|
150
|
-
<div style={{ width: "100%", height: 400, display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }}>
|
|
151
|
-
{/* @ts-expect-error: dotlottie-wc is not typed */}
|
|
152
|
-
<dotlottie-wc key="loading" src={animations.loading} speed="1" style={{ marginTop: -64, width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
|
|
153
|
-
<p style={{ fontSize: 24, marginTop: -16, fontWeight: "bold" }}>Transaction processing</p>
|
|
154
|
-
</div>
|
|
155
|
-
</Popup>
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (flow?.step === "error") {
|
|
160
|
-
return (
|
|
161
|
-
<Popup header={<p>{paymentTitle}</p>}>
|
|
162
|
-
<div style={{ width: "100%", height: 400, gap: 8, display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }}>
|
|
163
|
-
{/* @ts-expect-error: dotlottie-wc is not typed */}
|
|
164
|
-
<dotlottie-wc key="error" src={animations.failed} speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
|
|
165
|
-
<p style={{ fontSize: 24, marginTop: -32, fontWeight: "bold" }}>Transaction failed</p>
|
|
166
|
-
<p style={{ fontSize: 14, width: "80%", textAlign: "center", overflowY: "auto", lineBreak: "anywhere" }}>{serializeError(flow.error)}</p>
|
|
167
|
-
</div>
|
|
168
|
-
<PopupButton onClick={() => onReject(serializeError(flow.error))}>Close</PopupButton>
|
|
169
|
-
</Popup>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (flow?.step === "transfer") {
|
|
174
|
-
return (
|
|
175
|
-
<Popup onClose={() => onReject("closed")} header={<p>{paymentTitle}</p>}>
|
|
176
|
-
<HorizontalStepper steps={[{ label: "Select" }, { label: "Review" }, { label: "Confirm" }]} currentStep={2} />
|
|
177
|
-
|
|
178
|
-
{prepaidAmount > 0n && <TokenCard token={payableToken} hot={connector} wallet={intents.signer} amount={prepaidAmount} />}
|
|
179
|
-
|
|
180
|
-
{flow.token != null && (
|
|
181
|
-
<TokenCard //
|
|
182
|
-
hot={connector}
|
|
183
|
-
token={flow.token}
|
|
184
|
-
wallet={flow.wallet}
|
|
185
|
-
amount={flow.review == null ? needAmount : flow.review?.amountIn ?? 0n}
|
|
186
|
-
/>
|
|
187
|
-
)}
|
|
188
|
-
|
|
189
|
-
<PopupButton style={{ marginTop: 24 }} onClick={confirmPaymentStep}>
|
|
190
|
-
{flow?.loading ? "Confirming..." : "Confirm transaction"}
|
|
191
|
-
</PopupButton>
|
|
192
|
-
</Popup>
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (flow?.step === "sign") {
|
|
197
|
-
const rightControl = <div style={{ paddingRight: 4, marginLeft: "auto", alignItems: "flex-end" }}>{flow.error ? <ErrorIcon /> : <Loader />}</div>;
|
|
198
|
-
|
|
199
|
-
return (
|
|
200
|
-
<Popup onClose={() => onReject("closed")} header={<p>{title}</p>}>
|
|
201
|
-
<HorizontalStepper steps={[{ label: "Select" }, { label: "Review" }, { label: "Confirm" }]} currentStep={1} />
|
|
202
|
-
|
|
203
|
-
{prepaidAmount > 0n && <TokenCard token={payableToken} hot={connector} wallet={intents.signer} amount={prepaidAmount} />}
|
|
204
|
-
|
|
205
|
-
{flow.token != null && (
|
|
206
|
-
<TokenCard //
|
|
207
|
-
hot={connector}
|
|
208
|
-
token={flow.token}
|
|
209
|
-
wallet={flow.wallet}
|
|
210
|
-
rightControl={flow.review ? undefined : rightControl}
|
|
211
|
-
amount={flow.review == null ? needAmount : flow.review?.amountIn ?? 0n}
|
|
212
|
-
/>
|
|
213
|
-
)}
|
|
214
|
-
|
|
215
|
-
{flow.error ? (
|
|
216
|
-
<PopupButton style={{ marginTop: 24 }} onClick={() => setFlow(null)}>
|
|
217
|
-
Select another token
|
|
218
|
-
</PopupButton>
|
|
219
|
-
) : (
|
|
220
|
-
<PopupButton style={{ marginTop: 24 }} disabled={!flow?.review} onClick={signStep}>
|
|
221
|
-
{flow?.loading ? "Signing..." : flow?.review ? "Sign review" : "Quoting..."}
|
|
222
|
-
</PopupButton>
|
|
223
|
-
)}
|
|
224
|
-
</Popup>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const recommendedTokens = connector.walletsTokens.filter((t) => t.token.symbol === "USDT" || t.token.symbol === "USDC");
|
|
229
|
-
const otherTokens = connector.walletsTokens.filter((t) => t.token.symbol !== "USDT" && t.token.symbol !== "USDC");
|
|
230
|
-
|
|
231
|
-
const renderToken = (token: Token, wallet: OmniWallet, balance: bigint) => {
|
|
232
|
-
if (token.id === payableToken.id) return null;
|
|
233
|
-
const availableBalance = token.float(balance) - token.reserve;
|
|
43
|
+
};
|
|
234
44
|
|
|
235
|
-
|
|
236
|
-
if (
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (connector.wallets.length !== 0) return;
|
|
47
|
+
openConnector(connector);
|
|
48
|
+
}, [connector.wallets.length, connector]);
|
|
237
49
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
50
|
+
return (
|
|
51
|
+
<Popup onClose={onClose} header={<p>{title}</p>}>
|
|
52
|
+
{connector.walletsTokens.map(({ token, wallet, balance }) => {
|
|
53
|
+
if (token.id === need.id) return null;
|
|
54
|
+
const availableBalance = token.float(balance) - token.reserve;
|
|
242
55
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
56
|
+
if (need.originalChain === Network.Gonka || need.originalChain === Network.Juno) {
|
|
57
|
+
if (token.id === need.id) return null;
|
|
58
|
+
if (token.originalAddress !== need.originalAddress) return null;
|
|
246
59
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
60
|
+
if (availableBalance < need.float(needAmount)) return null;
|
|
61
|
+
return <TokenCard key={token.id} token={token} onSelect={selectToken} hot={connector} wallet={wallet} />;
|
|
62
|
+
}
|
|
250
63
|
|
|
251
|
-
|
|
252
|
-
|
|
64
|
+
if (availableBalance * token.usd <= need.usd * need.float(needAmount)) return null;
|
|
65
|
+
return <TokenCard key={token.id} token={token} onSelect={selectToken} hot={connector} wallet={wallet} />;
|
|
66
|
+
})}
|
|
253
67
|
|
|
254
68
|
<PopupOption onClick={() => openConnector(connector)}>
|
|
255
69
|
<div style={{ width: 44, height: 44, borderRadius: 16, background: "#000", display: "flex", alignItems: "center", justifyContent: "center" }}>
|
|
256
70
|
<WalletIcon />
|
|
257
71
|
</div>
|
|
258
72
|
<PopupOptionInfo>
|
|
259
|
-
<p>
|
|
260
|
-
<span className="wallet-address">
|
|
73
|
+
<p>Connect wallet</p>
|
|
74
|
+
<span className="wallet-address">To more pay options</span>
|
|
261
75
|
</PopupOptionInfo>
|
|
262
76
|
</PopupOption>
|
|
263
77
|
</Popup>
|
|
264
78
|
);
|
|
265
79
|
});
|
|
266
|
-
|
|
267
|
-
const ErrorIcon = () => {
|
|
268
|
-
return (
|
|
269
|
-
<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" }}>
|
|
270
|
-
<circle cx="14" cy="14" r="13" stroke="#E74C3C" strokeWidth="2" />
|
|
271
|
-
<path d="M9 9l10 10M19 9l-10 10" stroke="#E74C3C" strokeWidth="2.5" strokeLinecap="round" />
|
|
272
|
-
</svg>
|
|
273
|
-
);
|
|
274
|
-
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { observer } from "mobx-react-lite";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import { useEffect } from "react";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
4
|
|
|
5
5
|
import { LogoutIcon } from "../icons/logout";
|
|
6
6
|
import { openBridge, openConnector } from "../router";
|
|
@@ -72,15 +72,13 @@ export const Profile = observer(({ hot, onClose }: { hot: HotConnector; onClose:
|
|
|
72
72
|
return (
|
|
73
73
|
<Popup onClose={onClose}>
|
|
74
74
|
<div style={{ display: "flex", flexWrap: "wrap", width: "100%", gap: 8 }}>
|
|
75
|
-
{hot.
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
))
|
|
83
|
-
)}
|
|
75
|
+
{hot.wallets.map((wallet) => (
|
|
76
|
+
<WalletCard onClick={() => wallet.disconnect()}>
|
|
77
|
+
<ImageView src={wallet.icon} alt={wallet.connector.name} size={20} />
|
|
78
|
+
<div>{formatter.truncateAddress(wallet.address, 8)}</div>
|
|
79
|
+
<LogoutIcon width={20} height={20} />
|
|
80
|
+
</WalletCard>
|
|
81
|
+
))}
|
|
84
82
|
|
|
85
83
|
{hot.wallets.length < 6 && (
|
|
86
84
|
<WalletCard style={{ paddingLeft: 12, paddingRight: 12 }} onClick={() => openConnector(hot)}>
|
|
@@ -7,11 +7,11 @@ import { Token } from "../../core/token";
|
|
|
7
7
|
import { HotConnector } from "../../HotConnector";
|
|
8
8
|
import { OmniWallet } from "../../OmniWallet";
|
|
9
9
|
import { Network, OmniToken } from "../../core/chains";
|
|
10
|
-
import { tokens } from "../../core/tokens";
|
|
11
10
|
import { PopupOption } from "../styles";
|
|
12
11
|
import Popup from "../Popup";
|
|
13
12
|
|
|
14
13
|
import { TokenCard, ImageView } from "./TokenCard";
|
|
14
|
+
import { tokens } from "../../core/tokens";
|
|
15
15
|
|
|
16
16
|
interface SelectTokenPopupProps {
|
|
17
17
|
hot: HotConnector;
|
|
@@ -58,35 +58,31 @@ export const TokenIcon = observer(({ token, wallet }: { token: Token; wallet?: O
|
|
|
58
58
|
<div style={{ position: "relative", width: 40, height: 40 }}>
|
|
59
59
|
<ImageView src={token.icon} alt={token.symbol} size={40} />
|
|
60
60
|
<ImageView src={token.chainIcon} alt={token.symbol} size={14} style={{ position: "absolute", bottom: 0, right: 0 }} />
|
|
61
|
-
{token.chain === -4 && wallet?.type && <ImageView src={wallet.icon} alt={chains.
|
|
61
|
+
{token.chain === -4 && wallet?.type && <ImageView src={wallet.icon} alt={chains.get(wallet.type)?.name || ""} size={14} style={{ position: "absolute", bottom: 0, left: 0 }} />}
|
|
62
62
|
</div>
|
|
63
63
|
);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
export const TokenCard = observer(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const symbol = token.chain === -4 && !token.isMainOmni ? `${token.symbol} (${token.originalChainSymbol})` : token.symbol;
|
|
66
|
+
export const TokenCard = observer(({ token, onSelect, hot, wallet }: { token: Token; onSelect: (token: Token, wallet?: OmniWallet) => void; hot: HotConnector; wallet?: OmniWallet }) => {
|
|
67
|
+
const balance = hot.balance(wallet, token);
|
|
68
|
+
const symbol = token.chain === -4 && !token.isMainOmni ? `${token.originalChainSymbol}_${token.symbol}` : token.symbol;
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
return (
|
|
71
|
+
<PopupOption key={token.id} onClick={() => onSelect(token, wallet)}>
|
|
72
|
+
<TokenIcon token={token} wallet={wallet} />
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
<TokenWrap style={{ marginTop: -2, textAlign: "left" }}>
|
|
75
|
+
<p style={{ textAlign: "left", fontSize: 20, fontWeight: "bold" }}>{symbol}</p>
|
|
76
|
+
<p style={{ textAlign: "left", fontSize: 14, color: "#c6c6c6" }}>${formatter.amount(token.usd)}</p>
|
|
77
|
+
</TokenWrap>
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
);
|
|
79
|
+
<TokenWrap style={{ paddingRight: 4, marginLeft: "auto", alignItems: "flex-end" }}>
|
|
80
|
+
<p style={{ textAlign: "right", fontSize: 20 }}>{token.readable(balance)}</p>
|
|
81
|
+
<p style={{ textAlign: "right", fontSize: 14, color: "#c6c6c6" }}>${token.readable(balance, token.usd)}</p>
|
|
82
|
+
</TokenWrap>
|
|
83
|
+
</PopupOption>
|
|
84
|
+
);
|
|
85
|
+
});
|
|
90
86
|
|
|
91
87
|
const TokenWrap = styled.div`
|
|
92
88
|
display: flex;
|
package/src/ui/router.tsx
CHANGED
|
@@ -1,62 +1,34 @@
|
|
|
1
1
|
import { HotConnector } from "../HotConnector";
|
|
2
2
|
import { OmniConnector } from "../OmniConnector";
|
|
3
|
-
import { OmniWallet } from "../OmniWallet";
|
|
4
|
-
|
|
5
3
|
import { BridgeReview } from "../exchange";
|
|
4
|
+
import { Token } from "../core/token";
|
|
5
|
+
import { OmniWallet } from "../OmniWallet";
|
|
6
6
|
import { WalletType } from "../core/chains";
|
|
7
7
|
import { Recipient } from "../core/recipient";
|
|
8
|
-
import { Intents } from "../core/Intents";
|
|
9
|
-
import { Token } from "../core/token";
|
|
10
8
|
|
|
11
9
|
import { present } from "./Popup";
|
|
12
|
-
import { SelectTokenPopup } from "./payment/SelectToken";
|
|
13
|
-
import { SelectRecipient } from "./payment/SelectRecipient";
|
|
14
|
-
import { SelectSender } from "./payment/SelectSender";
|
|
15
|
-
import { BridgeProps } from "./payment/Bridge";
|
|
16
10
|
import { Payment } from "./payment/Payment";
|
|
17
|
-
import { Profile } from "./payment/Profile";
|
|
18
|
-
import { Bridge } from "./payment/Bridge";
|
|
19
|
-
|
|
20
|
-
import ConnectPrimaryWallet from "./connect/PrimaryWallet";
|
|
21
11
|
import { LogoutPopup } from "./connect/LogoutPopup";
|
|
12
|
+
import { Bridge } from "./payment/Bridge";
|
|
13
|
+
import { Profile } from "./payment/Profile";
|
|
14
|
+
import { SelectTokenPopup } from "./payment/SelectToken";
|
|
22
15
|
import { WalletPicker } from "./connect/WalletPicker";
|
|
16
|
+
import { BridgeProps } from "./payment/Bridge";
|
|
23
17
|
import { Connector } from "./connect/ConnectWallet";
|
|
18
|
+
import { SelectSender } from "./payment/SelectSender";
|
|
19
|
+
import { SelectRecipient } from "./payment/SelectRecipient";
|
|
24
20
|
import { WCRequest } from "./connect/WCRequest";
|
|
25
|
-
import Toast from "./Toast";
|
|
26
21
|
|
|
27
|
-
export const openPayment = (
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
intents,
|
|
31
|
-
title,
|
|
32
|
-
allowedTokens,
|
|
33
|
-
prepaidAmount,
|
|
34
|
-
payableToken,
|
|
35
|
-
needAmount,
|
|
36
|
-
onConfirm,
|
|
37
|
-
}: {
|
|
38
|
-
intents: Intents;
|
|
39
|
-
title?: string;
|
|
40
|
-
allowedTokens?: string[];
|
|
41
|
-
prepaidAmount: bigint;
|
|
42
|
-
payableToken: Token;
|
|
43
|
-
needAmount: bigint;
|
|
44
|
-
onConfirm: (args: { depositQoute?: BridgeReview; processing?: () => Promise<BridgeReview> }) => Promise<void>;
|
|
45
|
-
}
|
|
46
|
-
) => {
|
|
47
|
-
return new Promise<void>((resolve, reject) => {
|
|
22
|
+
export const openPayment = (connector: HotConnector, token: Token, amount: bigint, recipient?: Recipient) => {
|
|
23
|
+
return new Promise<Promise<BridgeReview>>((resolve, reject) => {
|
|
48
24
|
present((close) => (
|
|
49
25
|
<Payment //
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
onConfirm={(args) => onConfirm(args).finally(() => close())}
|
|
53
|
-
prepaidAmount={prepaidAmount}
|
|
54
|
-
allowedTokens={allowedTokens}
|
|
55
|
-
payableToken={payableToken}
|
|
56
|
-
needAmount={needAmount}
|
|
26
|
+
onClose={() => (close(), reject(new Error("User rejected")))}
|
|
27
|
+
onProcess={(task) => (close(), resolve(task))}
|
|
57
28
|
connector={connector}
|
|
58
|
-
|
|
59
|
-
|
|
29
|
+
token={token}
|
|
30
|
+
amount={amount}
|
|
31
|
+
recipient={recipient}
|
|
60
32
|
/>
|
|
61
33
|
));
|
|
62
34
|
});
|
|
@@ -90,15 +62,7 @@ export const openBridge = (hot: HotConnector, setup?: BridgeProps["setup"]) => {
|
|
|
90
62
|
};
|
|
91
63
|
|
|
92
64
|
export const openConnector = (hot: HotConnector) => {
|
|
93
|
-
|
|
94
|
-
present((close) => <Connector hot={hot} onClose={() => (resolve(), close())} />);
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const openConnectPrimaryWallet = (hot: HotConnector) => {
|
|
99
|
-
return new Promise<void>((resolve) => {
|
|
100
|
-
present((close) => <ConnectPrimaryWallet hot={hot} onClose={() => (close(), resolve())} />);
|
|
101
|
-
});
|
|
65
|
+
present((close) => <Connector hot={hot} onClose={close} />);
|
|
102
66
|
};
|
|
103
67
|
|
|
104
68
|
export const openProfile = (hot: HotConnector) => {
|
|
@@ -126,7 +90,3 @@ export const openWCRequest = <T,>(args: { task: () => Promise<T>; deeplink?: str
|
|
|
126
90
|
present((close) => <WCRequest deeplink={args.deeplink} name={args.name} icon={args.icon} onClose={close} task={taskPromise} />);
|
|
127
91
|
return taskPromise;
|
|
128
92
|
};
|
|
129
|
-
|
|
130
|
-
export const openToast = (message: string) => {
|
|
131
|
-
return present(() => <Toast message={message} />);
|
|
132
|
-
};
|
package/src/ui/styles.ts
CHANGED
|
@@ -195,7 +195,6 @@ export const PopupOption = styled.button`
|
|
|
195
195
|
outline: none;
|
|
196
196
|
border: none;
|
|
197
197
|
background: transparent;
|
|
198
|
-
width: 100%;
|
|
199
198
|
gap: 12px;
|
|
200
199
|
|
|
201
200
|
img {
|
|
@@ -265,7 +264,6 @@ export const PopupButton = styled.button`
|
|
|
265
264
|
|
|
266
265
|
export const PopupRoot = styled.div`
|
|
267
266
|
height: 100%;
|
|
268
|
-
width: 100%;
|
|
269
267
|
|
|
270
268
|
h1,
|
|
271
269
|
h2,
|
package/build/HotConnector.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { ChainConfig, WalletType } from "./core/chains";
|
|
2
|
-
import { HotBridge } from "./core/bridge";
|
|
3
|
-
import { OmniToken } from "./core/chains";
|
|
4
|
-
import { Intents } from "./core/Intents";
|
|
5
|
-
import { Token } from "./core/token";
|
|
6
|
-
import type CosmosWallet from "./cosmos/wallet";
|
|
7
|
-
import type NearWallet from "./near/wallet";
|
|
8
|
-
import type EvmWallet from "./evm/wallet";
|
|
9
|
-
import type SolanaWallet from "./solana/wallet";
|
|
10
|
-
import type StellarWallet from "./stellar/wallet";
|
|
11
|
-
import type TonWallet from "./ton/wallet";
|
|
12
|
-
import { OmniConnector } from "./OmniConnector";
|
|
13
|
-
import { OmniWallet } from "./OmniWallet";
|
|
14
|
-
import { Exchange } from "./exchange";
|
|
15
|
-
import { Activity } from "./activity";
|
|
16
|
-
interface HotConnectorOptions {
|
|
17
|
-
apiKey: string;
|
|
18
|
-
chains?: Record<number, ChainConfig>;
|
|
19
|
-
connectors?: ((wibe3: HotConnector) => Promise<OmniConnector>)[];
|
|
20
|
-
walletConnect?: {
|
|
21
|
-
projectId?: string;
|
|
22
|
-
metadata?: {
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
url: string;
|
|
26
|
-
icons: string[];
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export declare class HotConnector {
|
|
31
|
-
connectors: OmniConnector[];
|
|
32
|
-
balances: Record<string, Record<string, bigint>>;
|
|
33
|
-
activity: Activity;
|
|
34
|
-
hotBridge: HotBridge;
|
|
35
|
-
exchange: Exchange;
|
|
36
|
-
private events;
|
|
37
|
-
settings: {
|
|
38
|
-
webWallet: string;
|
|
39
|
-
projectId?: string;
|
|
40
|
-
metadata?: {
|
|
41
|
-
name: string;
|
|
42
|
-
description: string;
|
|
43
|
-
url: string;
|
|
44
|
-
icons: string[];
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
constructor(options?: HotConnectorOptions);
|
|
48
|
-
setOmniChainBranding(branding: {
|
|
49
|
-
name: string;
|
|
50
|
-
icon: string;
|
|
51
|
-
}): void;
|
|
52
|
-
getWalletConnector(type: WalletType): OmniConnector | null;
|
|
53
|
-
omni(token: OmniToken): Token;
|
|
54
|
-
get tokens(): Token[];
|
|
55
|
-
get priorityWallet(): StellarWallet | NearWallet | EvmWallet | SolanaWallet | TonWallet | undefined;
|
|
56
|
-
get wallets(): OmniWallet[];
|
|
57
|
-
get walletsTokens(): {
|
|
58
|
-
token: Token;
|
|
59
|
-
wallet: OmniWallet;
|
|
60
|
-
balance: bigint;
|
|
61
|
-
}[];
|
|
62
|
-
get nearRpc(): import("./near/rpc").NearRpc;
|
|
63
|
-
get near(): NearWallet | null;
|
|
64
|
-
get evm(): EvmWallet | null;
|
|
65
|
-
get solana(): SolanaWallet | null;
|
|
66
|
-
get stellar(): StellarWallet | null;
|
|
67
|
-
get ton(): TonWallet | null;
|
|
68
|
-
get cosmos(): CosmosWallet | null;
|
|
69
|
-
isCosmosWallet(wallet?: OmniWallet): wallet is CosmosWallet;
|
|
70
|
-
isEvmWallet(wallet?: OmniWallet): wallet is EvmWallet;
|
|
71
|
-
isSolanaWallet(wallet?: OmniWallet): wallet is SolanaWallet;
|
|
72
|
-
isStellarWallet(wallet?: OmniWallet): wallet is StellarWallet;
|
|
73
|
-
isTonWallet(wallet?: OmniWallet): wallet is TonWallet;
|
|
74
|
-
isNearWallet(wallet?: OmniWallet): wallet is NearWallet;
|
|
75
|
-
getChainBalances(chain: number): number;
|
|
76
|
-
balance(wallet?: OmniWallet, token?: Token): bigint;
|
|
77
|
-
omniBalance(token: OmniToken): {
|
|
78
|
-
token: Token;
|
|
79
|
-
onchain: bigint;
|
|
80
|
-
omni: bigint;
|
|
81
|
-
total: number;
|
|
82
|
-
};
|
|
83
|
-
fetchToken(token: Token, wallet: OmniWallet): Promise<bigint>;
|
|
84
|
-
fetchOmniTokens(wallet: OmniWallet): Promise<void>;
|
|
85
|
-
fetchTokens(wallet: OmniWallet): Promise<void>;
|
|
86
|
-
intentsBuilder(wallet?: OmniWallet): Intents;
|
|
87
|
-
onConnect(handler: (payload: {
|
|
88
|
-
wallet: OmniWallet;
|
|
89
|
-
connector: OmniConnector;
|
|
90
|
-
}) => void): () => void;
|
|
91
|
-
onDisconnect(handler: (payload: {
|
|
92
|
-
wallet: OmniWallet;
|
|
93
|
-
connector: OmniConnector;
|
|
94
|
-
}) => void): () => void;
|
|
95
|
-
withdraw(token: OmniToken, amount?: number, settings?: {
|
|
96
|
-
sender?: OmniWallet;
|
|
97
|
-
}): Promise<import("./exchange").BridgeReview>;
|
|
98
|
-
deposit(token: OmniToken, amount?: number): Promise<import("./exchange").BridgeReview>;
|
|
99
|
-
openBridge(): Promise<void>;
|
|
100
|
-
connect(type?: WalletType): Promise<void>;
|
|
101
|
-
disconnect(wallet: WalletType | OmniWallet): Promise<void>;
|
|
102
|
-
}
|
|
103
|
-
export {};
|