@hot-labs/kit 1.1.3 → 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 -24
- package/src/OmniConnector.ts +9 -10
- package/src/OmniWallet.ts +25 -24
- package/src/core/Intents.ts +151 -224
- package/src/core/api.ts +4 -44
- package/src/core/bridge.ts +2 -3
- package/src/core/index.ts +1 -1
- package/src/{near/rpc.ts → core/nearRpc.ts} +12 -7
- 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/hot-wallet/proxy.ts +2 -2
- 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 -244
- 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 -105
- package/build/HotConnector.js +0 -303
- 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 -474
- package/build/core/Intents.js.map +0 -1
- package/build/core/api.d.ts +0 -54
- package/build/core/api.js +0 -99
- 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/telemetry.d.ts +0 -13
- package/build/core/telemetry.js +0 -27
- package/build/core/telemetry.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 -162
- 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 -139
- 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/core/telemetry.ts +0 -28
- 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
package/src/tron/wallet.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { base58, base64, hex } from "@scure/base";
|
|
2
|
-
|
|
3
|
-
import { Network, WalletType } from "../core/chains";
|
|
4
|
-
import { ReviewFee } from "../core/bridge";
|
|
5
|
-
import { Token } from "../core/token";
|
|
6
|
-
import { Commitment } from "../core";
|
|
7
|
-
|
|
8
|
-
import type { OmniConnector } from "../OmniConnector";
|
|
9
|
-
import { OmniWallet } from "../OmniWallet";
|
|
10
|
-
|
|
11
|
-
interface TronWebLike {
|
|
12
|
-
ready?: boolean;
|
|
13
|
-
defaultAddress?: { base58?: string; hex?: string };
|
|
14
|
-
address?: { toHex?: (address: string) => string };
|
|
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
|
-
contract?: () => { at: (address: string) => Promise<any> };
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
class TronWallet extends OmniWallet {
|
|
25
|
-
readonly publicKey?: string;
|
|
26
|
-
readonly type = WalletType.Tron;
|
|
27
|
-
|
|
28
|
-
constructor(readonly connector: OmniConnector, readonly address: string, readonly tronWeb: TronWebLike) {
|
|
29
|
-
super();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get icon() {
|
|
33
|
-
return this.connector.icon;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get omniAddress() {
|
|
37
|
-
// Convert TRON base58 address -> EVM-like hex (0x + 20 bytes) for signer_id.
|
|
38
|
-
const hexAddrRaw =
|
|
39
|
-
this.tronWeb.address?.toHex?.(this.address) || //
|
|
40
|
-
this.tronWeb.defaultAddress?.hex ||
|
|
41
|
-
"";
|
|
42
|
-
|
|
43
|
-
const clean = hexAddrRaw.startsWith("0x") ? hexAddrRaw.slice(2) : hexAddrRaw;
|
|
44
|
-
if (!clean) return this.address.toLowerCase();
|
|
45
|
-
|
|
46
|
-
// Tron addresses are typically: 41 + 20 bytes (hex).
|
|
47
|
-
if (clean.length >= 42 && clean.startsWith("41")) return `0x${clean.slice(2, 42)}`.toLowerCase();
|
|
48
|
-
if (clean.length === 40) return `0x${clean}`.toLowerCase();
|
|
49
|
-
return `0x${clean}`.toLowerCase();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
private async trc20Balance(contractAddress: string): Promise<bigint> {
|
|
53
|
-
if (!this.tronWeb.contract) throw new Error("TronLink not available");
|
|
54
|
-
const contract = await this.tronWeb.contract().at(contractAddress);
|
|
55
|
-
const res = await contract.balanceOf(this.address).call();
|
|
56
|
-
const value = typeof res === "string" ? res : res?._hex ?? res?.toString?.() ?? "0";
|
|
57
|
-
return BigInt(value);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async fetchBalance(chain: number, address: string): Promise<bigint> {
|
|
61
|
-
if (chain !== Network.Tron) throw "Invalid chain";
|
|
62
|
-
if (!this.tronWeb.trx) throw new Error("TronLink not available");
|
|
63
|
-
|
|
64
|
-
if (address === "native") {
|
|
65
|
-
const balance = await this.tronWeb.trx.getBalance?.(this.address);
|
|
66
|
-
return BigInt(balance || 0);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return await this.trc20Balance(address);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async fetchBalances(chain: number, whitelist: string[]): Promise<Record<string, bigint>> {
|
|
73
|
-
const native = await this.fetchBalance(chain, "native");
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
const res = await fetch(`https://api0.herewallet.app/api/v1/user/balances/${chain}/${this.address}`, { body: JSON.stringify({ whitelist, chain_id: chain }), method: "POST" });
|
|
77
|
-
if (!res.ok) throw new Error("Failed to fetch balances");
|
|
78
|
-
const { balances } = await res.json();
|
|
79
|
-
return { ...balances, native };
|
|
80
|
-
} catch {
|
|
81
|
-
const balances = await Promise.all(
|
|
82
|
-
whitelist.map(async (token) => {
|
|
83
|
-
const balance = await this.fetchBalance(chain, token);
|
|
84
|
-
return [token, balance] as const;
|
|
85
|
-
})
|
|
86
|
-
);
|
|
87
|
-
return { ...Object.fromEntries(balances), native };
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async transferFee(token: Token): Promise<ReviewFee> {
|
|
92
|
-
// Tron fees depend on bandwidth/energy; for UX we return "0" and let wallet handle it.
|
|
93
|
-
return new ReviewFee({ baseFee: 0n, gasLimit: 0n, chain: token.chain });
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async transfer(args: { token: Token; receiver: string; amount: bigint; comment?: string; gasFee?: ReviewFee }): Promise<string> {
|
|
97
|
-
if (!this.tronWeb.trx) throw new Error("TronLink not available");
|
|
98
|
-
|
|
99
|
-
if (args.token.address === "native") {
|
|
100
|
-
const result = await this.tronWeb.trx.sendTransaction?.(args.receiver, args.amount.toString());
|
|
101
|
-
return result?.txid || result?.transaction?.txID || result?.txID || result?.id || "";
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (!this.tronWeb.contract) throw new Error("TronLink not available");
|
|
105
|
-
const contract = await this.tronWeb.contract().at(args.token.address);
|
|
106
|
-
const result = await contract.transfer(args.receiver, args.amount.toString()).send();
|
|
107
|
-
return typeof result === "string" ? result : result?.txid || result?.transaction?.txID || result?.txID || "";
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
private async signMessageTIP191(message: string): Promise<Uint8Array> {
|
|
111
|
-
if (!this.tronWeb.trx?.signMessageV2 && !this.tronWeb.trx?.signMessage) throw "not impl";
|
|
112
|
-
const signatureHex = (await (this.tronWeb.trx.signMessageV2?.(message) || this.tronWeb.trx.signMessage?.(message))) as string;
|
|
113
|
-
if (!signatureHex) throw new Error("Failed to sign message");
|
|
114
|
-
|
|
115
|
-
const clean = signatureHex.startsWith("0x") ? signatureHex.slice(2) : signatureHex;
|
|
116
|
-
if (clean.length < 130) throw new Error("Invalid signature");
|
|
117
|
-
|
|
118
|
-
const rsv = clean.slice(0, 130);
|
|
119
|
-
const v = parseInt(rsv.slice(128, 130), 16);
|
|
120
|
-
const parity = v === 27 || v === 0 ? 0 : v === 28 || v === 1 ? 1 : v % 2;
|
|
121
|
-
const normalized = rsv.slice(0, 128) + (parity === 0 ? "00" : "01");
|
|
122
|
-
return hex.decode(normalized);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
async signIntents(intents: Record<string, any>[], options?: { deadline?: number; nonce?: Uint8Array }): Promise<Commitment> {
|
|
126
|
-
const nonce = new Uint8Array(options?.nonce || window.crypto.getRandomValues(new Uint8Array(32)));
|
|
127
|
-
|
|
128
|
-
const message = JSON.stringify({
|
|
129
|
-
deadline: options?.deadline ? new Date(options.deadline).toISOString() : "2100-01-01T00:00:00.000Z",
|
|
130
|
-
verifying_contract: "intents.near",
|
|
131
|
-
signer_id: this.omniAddress,
|
|
132
|
-
nonce: base64.encode(nonce),
|
|
133
|
-
intents: intents,
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// TronLink signs messages using TIP-191 ("\x19TRON Signed Message:\n").
|
|
137
|
-
const buffer = await this.signMessageTIP191(message);
|
|
138
|
-
return {
|
|
139
|
-
signature: `secp256k1:${base58.encode(buffer)}`,
|
|
140
|
-
payload: message,
|
|
141
|
-
standard: "tip191",
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export default TronWallet;
|
package/src/ui/Toast.tsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { Loader } from "./payment/Profile";
|
|
3
|
-
|
|
4
|
-
const Toast = ({ message }: { message: string }) => {
|
|
5
|
-
return (
|
|
6
|
-
<ToastRoot>
|
|
7
|
-
<div style={{ width: 44, height: 44, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 12, background: "rgba(255, 255, 255, 0.07)" }}>
|
|
8
|
-
<Loader />
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<div>
|
|
12
|
-
<p style={{ color: "#ADA5A4" }}>Executing transaction</p>
|
|
13
|
-
<p style={{ marginTop: 2 }}>{message}</p>
|
|
14
|
-
</div>
|
|
15
|
-
</ToastRoot>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default Toast;
|
|
20
|
-
|
|
21
|
-
const ToastRoot = styled.div`
|
|
22
|
-
position: fixed;
|
|
23
|
-
bottom: 48px;
|
|
24
|
-
left: 12px;
|
|
25
|
-
right: 12px;
|
|
26
|
-
background: var(--surface-common-container--low, #262729);
|
|
27
|
-
border: 1px solid var(--border-lowest, rgba(255, 255, 255, 0.07));
|
|
28
|
-
border-radius: 8px;
|
|
29
|
-
padding: 12px;
|
|
30
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
z-index: 1000000000;
|
|
35
|
-
width: fit-content;
|
|
36
|
-
padding-right: 24px;
|
|
37
|
-
gap: 12px;
|
|
38
|
-
|
|
39
|
-
p {
|
|
40
|
-
color: var(--text-primary, #fff);
|
|
41
|
-
font-size: 16px;
|
|
42
|
-
font-weight: 500;
|
|
43
|
-
margin: 0;
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import Popup from "../Popup";
|
|
3
|
-
import { PopupButton } from "../styles";
|
|
4
|
-
import { Connector } from "./ConnectWallet";
|
|
5
|
-
import { HotConnector } from "../../HotConnector";
|
|
6
|
-
import { chains, WalletType } from "../../core";
|
|
7
|
-
|
|
8
|
-
const ConnectPrimaryWallet = ({ hot, onClose }: { hot: HotConnector; onClose: () => void }) => {
|
|
9
|
-
const [openConnect, setOpenConnect] = useState(false);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Popup onClose={onClose} header={<p>Connect main wallet</p>}>
|
|
13
|
-
{openConnect ? (
|
|
14
|
-
<Connector widget={true} walletType={WalletType.OMNI} hot={hot} onClose={onClose} />
|
|
15
|
-
) : (
|
|
16
|
-
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", width: "100%", height: 300 }}>
|
|
17
|
-
<div style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 24, marginTop: 48 }}>
|
|
18
|
-
<WalletIcon />
|
|
19
|
-
<BindIcon />
|
|
20
|
-
<img src={chains.get(-4).logo} style={{ marginLeft: -4, width: 64, height: 64, borderRadius: "50%" }} />
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<p style={{ marginTop: 24, fontSize: 20, fontWeight: "bold" }}>Connect your primary wallet</p>
|
|
24
|
-
<p style={{ marginTop: 8, fontSize: 16, color: "#c6c6c6" }}>Your HEX Balance will be tied to this wallet.</p>
|
|
25
|
-
|
|
26
|
-
<PopupButton style={{ marginTop: "auto" }} onClick={() => setOpenConnect(true)}>
|
|
27
|
-
Connect wallet
|
|
28
|
-
</PopupButton>
|
|
29
|
-
</div>
|
|
30
|
-
)}
|
|
31
|
-
</Popup>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const WalletIcon = () => {
|
|
36
|
-
return (
|
|
37
|
-
<svg width="56" height="56" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
38
|
-
<path
|
|
39
|
-
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"
|
|
40
|
-
fill="#EBDEDC"
|
|
41
|
-
/>
|
|
42
|
-
<path
|
|
43
|
-
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"
|
|
44
|
-
fill="#EBDEDC"
|
|
45
|
-
/>
|
|
46
|
-
</svg>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const BindIcon = () => {
|
|
51
|
-
return (
|
|
52
|
-
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
53
|
-
<path
|
|
54
|
-
d="M10.5552 12.5981C12.2474 10.9059 14.9908 10.9059 16.6831 12.5981L17.6597 13.5737C18.0501 13.9641 18.0499 14.5972 17.6597 14.9878C17.2691 15.3778 16.636 15.3781 16.2456 14.9878L15.269 14.0122C14.3578 13.101 12.8805 13.101 11.9692 14.0122L5.3501 20.6313C4.43935 21.5426 4.43903 23.0201 5.3501 23.9312L7.30225 25.8833C8.21331 26.7944 9.69079 26.794 10.6021 25.8833L13.5786 22.9077C13.9691 22.5172 14.6022 22.5172 14.9927 22.9077C15.383 23.2983 15.3831 23.9313 14.9927 24.3218L12.0161 27.2974C10.3238 28.9892 7.5803 28.9895 5.88818 27.2974L3.93604 25.3452C2.24392 23.6531 2.24424 20.9096 3.93604 19.2173L10.5552 12.5981ZM19.2153 3.97217C20.9038 2.25827 23.6655 2.24848 25.3667 3.94971L27.3013 5.88428C28.9935 7.57655 28.9935 10.3199 27.3013 12.0122L20.6821 18.6313C18.9898 20.3231 16.2463 20.3235 14.5542 18.6313L13.5776 17.6558C13.1874 17.2655 13.1879 16.6323 13.5776 16.2417C13.9682 15.8512 14.6012 15.8512 14.9917 16.2417L15.9683 17.2173C16.8793 18.1283 18.3568 18.128 19.2681 17.2173L25.8872 10.5981C26.7984 9.68692 26.7984 8.20956 25.8872 7.29834L23.9526 5.36377C23.0366 4.44774 21.5493 4.45268 20.6401 5.37549L16.7114 9.36377C16.3238 9.75672 15.6906 9.76194 15.2974 9.37451C14.9042 8.98707 14.8995 8.35389 15.2866 7.96045L19.2153 3.97217Z"
|
|
55
|
-
fill="#EBDEDC"
|
|
56
|
-
/>
|
|
57
|
-
<path
|
|
58
|
-
d="M10.5571 12.6016C12.2494 10.9094 14.9928 10.9093 16.6851 12.6016L17.6616 13.5771C18.0517 13.9675 18.0516 14.6008 17.6616 14.9912C17.2712 15.3816 16.6381 15.3814 16.2476 14.9912L15.271 14.0156C14.3598 13.1044 12.8824 13.1045 11.9712 14.0156L5.35205 20.6348C4.44083 21.546 4.44083 23.0233 5.35205 23.9346L8.03174 26.6143C8.9261 27.5083 10.3702 27.5276 11.2876 26.6572L13.6665 24.3984C13.637 24.375 13.6079 24.3505 13.5806 24.3232C13.1901 23.9327 13.1901 23.2997 13.5806 22.9092C14.1232 22.3666 14.8184 22.1462 15.4761 22.332C16.0272 22.488 16.6206 22.997 16.6206 23.7529C16.6206 23.7809 16.618 23.8085 16.6157 23.8359C16.6413 24.1291 16.539 24.4311 16.3091 24.6494L12.6646 28.1084C10.9608 29.7249 8.27866 29.6897 6.61768 28.0293L3.93799 25.3486C2.24572 23.6564 2.24572 20.913 3.93799 19.2207L10.5571 12.6016ZM19.2183 3.97266C20.9066 2.25916 23.6684 2.24938 25.3696 3.9502L28.1753 6.75586C29.8672 8.44789 29.868 11.1914 28.1763 12.8838L21.5581 19.5039C19.8663 21.1962 17.1218 21.1964 15.4292 19.5049L13.9614 18.0371C13.5709 17.6467 13.571 17.0136 13.9614 16.623C14.3519 16.2329 14.985 16.2327 15.3755 16.623L16.8433 18.0908C17.7547 19.0015 19.2321 19.001 20.1431 18.0898L26.7622 11.4697C27.6729 10.5585 27.6721 9.08097 26.7612 8.16992L23.9556 5.36426C23.0395 4.44844 21.5522 4.45431 20.6431 5.37695L16.7134 9.36523C16.3259 9.75836 15.6927 9.76319 15.2993 9.37598C14.906 8.98837 14.902 8.35531 15.2896 7.96191L19.2183 3.97266Z"
|
|
59
|
-
fill="#EBDEDC"
|
|
60
|
-
/>
|
|
61
|
-
</svg>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export default ConnectPrimaryWallet;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
interface Step {
|
|
4
|
-
label: string;
|
|
5
|
-
completed?: boolean;
|
|
6
|
-
active?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface StepperProps {
|
|
10
|
-
steps: Step[];
|
|
11
|
-
currentStep: number;
|
|
12
|
-
style?: React.CSSProperties;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const HorizontalStepper: React.FC<StepperProps> = ({ steps, currentStep, style }) => {
|
|
16
|
-
return (
|
|
17
|
-
<div style={{ padding: "0 32px 32px", display: "flex", alignItems: "center", width: "100%", margin: "16px 0", ...style }}>
|
|
18
|
-
{steps.map((step, idx) => {
|
|
19
|
-
const isCompleted = idx < currentStep;
|
|
20
|
-
const isActive = idx === currentStep;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<React.Fragment key={idx}>
|
|
24
|
-
<div style={{ display: "flex", flexDirection: "column", alignItems: "center" }}>
|
|
25
|
-
<div
|
|
26
|
-
style={{
|
|
27
|
-
width: 16,
|
|
28
|
-
height: 16,
|
|
29
|
-
position: "relative",
|
|
30
|
-
borderRadius: "50%",
|
|
31
|
-
border: isActive || isCompleted ? "2px solid #ffffff" : "2px solid #a0a0a0",
|
|
32
|
-
background: isCompleted ? "#ffffff" : "#333",
|
|
33
|
-
display: "flex",
|
|
34
|
-
alignItems: "center",
|
|
35
|
-
justifyContent: "center",
|
|
36
|
-
transition: "all 0.2s",
|
|
37
|
-
zIndex: 1,
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
<p style={{ fontSize: 16, color: "#fff", opacity: isActive ? 1 : 0.5, position: "absolute", top: 24, width: 100 }}>{step.label}</p>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
{idx < steps.length - 1 && <div style={{ transition: "background 0.2s", flex: 1, height: 2, background: idx < currentStep ? "#ffffff" : "#333", margin: "0 6px", borderRadius: 24, minWidth: 24 }} />}
|
|
45
|
-
</React.Fragment>
|
|
46
|
-
);
|
|
47
|
-
})}
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
File without changes
|