@hot-labs/kit 1.0.55 → 1.0.57
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/build/activity.js +3 -3
- package/build/activity.js.map +1 -1
- package/build/core/chains.js +1 -1
- package/build/core/chains.js.map +1 -1
- package/build/evm/connector.d.ts +1 -3
- package/build/evm/connector.js +3 -11
- package/build/evm/connector.js.map +1 -1
- package/build/evm/injected.js +3 -3
- package/build/evm/injected.js.map +1 -1
- package/build/exchange.d.ts +2 -0
- package/build/exchange.js +4 -2
- package/build/exchange.js.map +1 -1
- package/build/hot-wallet/iframe.d.ts +36 -3
- package/build/hot-wallet/iframe.js +134 -27
- package/build/hot-wallet/iframe.js.map +1 -1
- package/build/hot-wallet/proxy.d.ts +8 -0
- package/build/hot-wallet/proxy.js +45 -0
- package/build/hot-wallet/proxy.js.map +1 -0
- package/build/solana/connector.js +2 -2
- package/build/solana/connector.js.map +1 -1
- package/build/solana/injected/account.js +1 -2
- package/build/solana/injected/account.js.map +1 -1
- package/build/solana/injected/index.js +16 -19
- package/build/solana/injected/index.js.map +1 -1
- package/build/stellar/connector.d.ts +10 -4
- package/build/stellar/connector.js +39 -28
- package/build/stellar/connector.js.map +1 -1
- package/build/stellar/freigher.d.ts +46 -0
- package/build/stellar/freigher.js +110 -0
- package/build/stellar/freigher.js.map +1 -0
- package/build/stellar/{injected.d.ts → hotWallet.d.ts} +1 -6
- package/build/stellar/hotWallet.js +28 -0
- package/build/stellar/hotWallet.js.map +1 -0
- package/build/ton/connector.js +6 -3
- package/build/ton/connector.js.map +1 -1
- package/build/ton/injected.js +6 -6
- package/build/ton/injected.js.map +1 -1
- package/build/ui/Popup.js +1 -1
- package/build/ui/Popup.js.map +1 -1
- package/build/ui/payment/Bridge.js +4 -2
- package/build/ui/payment/Bridge.js.map +1 -1
- package/build/ui/payment/Profile.js +1 -1
- package/build/ui/styles.js +4 -3
- package/build/ui/styles.js.map +1 -1
- package/package.json +4 -3
- package/src/activity.ts +2 -3
- package/src/core/chains.ts +1 -1
- package/src/evm/connector.ts +4 -12
- package/src/evm/injected.ts +3 -3
- package/src/exchange.ts +4 -2
- package/src/hot-wallet/iframe.ts +151 -24
- package/src/hot-wallet/proxy.ts +54 -0
- package/src/solana/connector.ts +2 -2
- package/src/solana/injected/account.ts +1 -2
- package/src/solana/injected/index.ts +15 -18
- package/src/stellar/connector.ts +42 -29
- package/src/stellar/freigher.ts +119 -0
- package/src/stellar/{injected.ts → hotWallet.ts} +8 -12
- package/src/ton/connector.ts +14 -10
- package/src/ton/injected.ts +6 -6
- package/src/ui/Popup.tsx +7 -3
- package/src/ui/payment/Bridge.tsx +5 -2
- package/src/ui/payment/Profile.tsx +1 -1
- package/src/ui/styles.ts +4 -3
- package/build/stellar/injected.js +0 -32
- package/build/stellar/injected.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transaction, VersionedTransaction, PublicKey } from "@solana/web3.js";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import HOT from "../../hot-wallet/iframe";
|
|
4
4
|
import { registerWallet } from "./register";
|
|
5
5
|
import { GhostWallet } from "./solana-wallet";
|
|
6
6
|
|
|
@@ -25,17 +25,17 @@ const hotSolana = {
|
|
|
25
25
|
publicKey: null as PublicKey | null,
|
|
26
26
|
|
|
27
27
|
async connect(options: any) {
|
|
28
|
-
const { publicKey } = await
|
|
28
|
+
const { publicKey } = await HOT.request("solana:connect", options);
|
|
29
29
|
hotSolana.publicKey = new PublicKey(publicKey);
|
|
30
30
|
return { publicKey: hotSolana.publicKey };
|
|
31
31
|
},
|
|
32
32
|
|
|
33
33
|
async disconnect() {
|
|
34
|
-
return await
|
|
34
|
+
return await HOT.request("solana:disconnect", {});
|
|
35
35
|
},
|
|
36
36
|
|
|
37
37
|
async signAllTransactions(transactions: any[]) {
|
|
38
|
-
const result = await
|
|
38
|
+
const result = await HOT.request("solana:signAllTransactions", {
|
|
39
39
|
transactions: transactions.map((t) => t.serialize().toString("base64")),
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ const hotSolana = {
|
|
|
43
43
|
},
|
|
44
44
|
|
|
45
45
|
async signTransaction(transaction: any) {
|
|
46
|
-
const result = await
|
|
46
|
+
const result = await HOT.request("solana:signAllTransactions", {
|
|
47
47
|
transactions: [transaction.serialize().toString("base64")],
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -51,7 +51,7 @@ const hotSolana = {
|
|
|
51
51
|
},
|
|
52
52
|
|
|
53
53
|
async signAndSendTransaction(transaction: any, options: any) {
|
|
54
|
-
const result = await
|
|
54
|
+
const result = await HOT.request("solana:signAndSendTransaction", {
|
|
55
55
|
transaction: transaction.serialize().toString("base64"),
|
|
56
56
|
options,
|
|
57
57
|
});
|
|
@@ -61,11 +61,10 @@ const hotSolana = {
|
|
|
61
61
|
|
|
62
62
|
async signIn(input: any) {
|
|
63
63
|
throw "Not supported";
|
|
64
|
-
return await requestHot("solana:signIn", input);
|
|
65
64
|
},
|
|
66
65
|
|
|
67
66
|
async signMessage(message: string) {
|
|
68
|
-
const result = await
|
|
67
|
+
const result = await HOT.request("solana:signMessage", { message: Buffer.from(message).toString("base64") });
|
|
69
68
|
return { signature: Buffer.from(result.signature, "base64") };
|
|
70
69
|
},
|
|
71
70
|
|
|
@@ -84,15 +83,13 @@ HOT.subscribe("solana:accountChanged", (publicKey: string | null) => {
|
|
|
84
83
|
});
|
|
85
84
|
*/
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
registerWallet(new GhostWallet(hotSolana));
|
|
86
|
+
registerWallet(new GhostWallet(hotSolana));
|
|
89
87
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
88
|
+
// New wallets no longer need to register wallet globals - and can
|
|
89
|
+
// ignore the code below. However if you have legacy apps relying on globals,
|
|
90
|
+
// this is the safest way to attach the reference to the window, guarding against errors.
|
|
91
|
+
try {
|
|
92
|
+
Object.defineProperty(window, "hotSolana", { value: hotSolana });
|
|
93
|
+
} catch (error) {
|
|
94
|
+
//
|
|
98
95
|
}
|
package/src/stellar/connector.ts
CHANGED
|
@@ -1,68 +1,81 @@
|
|
|
1
|
-
import { sep43Modules, HotWalletModule, StellarWalletsKit, WalletNetwork, ISupportedWallet } from "@creit.tech/stellar-wallets-kit";
|
|
2
1
|
import { Transaction } from "@stellar/stellar-base";
|
|
3
2
|
|
|
3
|
+
import HOT from "../hot-wallet/iframe";
|
|
4
4
|
import { WalletType } from "../core/chains";
|
|
5
5
|
import { HotConnector } from "../HotConnector";
|
|
6
6
|
import { ConnectorType, OmniConnector } from "../OmniConnector";
|
|
7
|
-
import { isInjected } from "../hot-wallet/iframe";
|
|
8
7
|
import { OmniWallet } from "../OmniWallet";
|
|
9
|
-
import StellarWallet from "./wallet";
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import { FreighterModule } from "./freigher";
|
|
10
|
+
import { HotWalletModule } from "./hotWallet";
|
|
11
|
+
import StellarWallet from "./wallet";
|
|
13
12
|
|
|
13
|
+
class StellarConnector extends OmniConnector<StellarWallet> {
|
|
14
14
|
icon = "https://storage.herewallet.app/upload/1469894e53ca248ac6adceb2194e6950a13a52d972beb378a20bce7815ba01a4.png";
|
|
15
15
|
walletTypes = [WalletType.STELLAR, WalletType.OMNI];
|
|
16
16
|
type = ConnectorType.WALLET;
|
|
17
17
|
name = "Stellar Wallet";
|
|
18
18
|
id = "stellar";
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
modules = {
|
|
21
|
+
hotWallet: new HotWalletModule(),
|
|
22
|
+
freighter: new FreighterModule(),
|
|
23
|
+
};
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const hot = wallets.find((w) => w.id === "hot-wallet");
|
|
26
|
-
this.options = wallets.filter((w) => w.id !== "hot-wallet").map((w) => ({ ...w, name: w.name, icon: w.icon, download: w.url, type: "external" as const, id: w.id }));
|
|
27
|
-
if (hot) this.options.unshift({ ...hot, name: hot.name, icon: hot.icon, download: hot.url, type: "external" as const, id: hot.id });
|
|
28
|
-
});
|
|
25
|
+
constructor(wibe3: HotConnector) {
|
|
26
|
+
super(wibe3);
|
|
29
27
|
|
|
30
|
-
this.
|
|
31
|
-
|
|
28
|
+
this.options = Object.values(this.modules).map((module) => ({
|
|
29
|
+
type: "external" as const,
|
|
30
|
+
name: module.productName,
|
|
31
|
+
icon: module.productIcon,
|
|
32
|
+
download: module.productUrl,
|
|
33
|
+
id: module.productId,
|
|
34
|
+
}));
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
36
|
+
this.getConnectedWallet().then(async ({ id, address }) => {
|
|
37
|
+
if (!id || !address) return;
|
|
38
|
+
const wallet = this.getWallet(id);
|
|
39
|
+
const isAvailable = await wallet?.isAvailable();
|
|
40
|
+
if (isAvailable && wallet) this.selectWallet(address, wallet);
|
|
37
41
|
});
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
getWallet(id: string): FreighterModule | HotWalletModule | null {
|
|
45
|
+
return Object.values(this.modules).find((module) => module.productId === id) || null;
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
async createWallet(address: string): Promise<OmniWallet> {
|
|
41
49
|
return new StellarWallet(this, { address });
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
async getConnectedWallet() {
|
|
45
|
-
if (isInjected
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
return { type: "wallet", id: "hot-wallet", address };
|
|
53
|
+
if (HOT.isInjected) {
|
|
54
|
+
const { address } = await this.modules.hotWallet.getAddress();
|
|
55
|
+
return { type: "wallet", id: this.modules.hotWallet.productId, address };
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
return await this.getStorage();
|
|
52
59
|
}
|
|
53
60
|
|
|
61
|
+
async selectWallet(address: string, wallet: HotWalletModule | FreighterModule) {
|
|
62
|
+
const signMessage = async (message: string) => wallet.signMessage(message);
|
|
63
|
+
const signTransaction = async (transaction: Transaction) => wallet.signTransaction(transaction.toXDR());
|
|
64
|
+
return this.setWallet(new StellarWallet(this, { address, signMessage, signTransaction }));
|
|
65
|
+
}
|
|
66
|
+
|
|
54
67
|
async connect(id: string) {
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
68
|
+
const wallet = this.getWallet(id);
|
|
69
|
+
if (!wallet) throw new Error("Wallet not found");
|
|
70
|
+
|
|
71
|
+
const { address } = await wallet.getAddress();
|
|
59
72
|
this.setStorage({ type: "wallet", id, address });
|
|
60
|
-
return this.
|
|
73
|
+
return this.selectWallet(address, wallet);
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
async disconnect() {
|
|
64
77
|
super.disconnect();
|
|
65
|
-
this.
|
|
78
|
+
this.removeStorage();
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { isConnected, requestAccess, getAddress, signTransaction, signAuthEntry, signMessage, getNetwork } from "@stellar/freighter-api";
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
stellar?: {
|
|
6
|
+
provider: string;
|
|
7
|
+
platform: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function parseError(e: any) {
|
|
13
|
+
return {
|
|
14
|
+
code: e?.error?.code || e?.code || -1,
|
|
15
|
+
message: e?.error?.message || e?.message || (typeof e === "string" && e) || "Unhandled error from the wallet",
|
|
16
|
+
ext: e?.error?.ext || e?.ext,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const FREIGHTER_ID = "freighter";
|
|
21
|
+
export class FreighterModule {
|
|
22
|
+
productId = FREIGHTER_ID;
|
|
23
|
+
productName = "Freighter";
|
|
24
|
+
productUrl = "https://freighter.app";
|
|
25
|
+
productIcon = "https://stellar.creit.tech/wallet-icons/freighter.png";
|
|
26
|
+
|
|
27
|
+
async runChecks() {
|
|
28
|
+
if (!(await this.isAvailable())) {
|
|
29
|
+
throw new Error("Freighter is not connected");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async isAvailable() {
|
|
34
|
+
if (window.stellar?.provider === "freighter" && window.stellar?.platform === "mobile") return false;
|
|
35
|
+
return isConnected()
|
|
36
|
+
.then(({ isConnected: isConnected2, error }) => !error && isConnected2)
|
|
37
|
+
.catch(() => false);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async getAddress(params?: { skipRequestAccess?: boolean }): Promise<{ address: string }> {
|
|
41
|
+
return this.runChecks()
|
|
42
|
+
.then(async () => {
|
|
43
|
+
if (params?.skipRequestAccess) return true;
|
|
44
|
+
return requestAccess();
|
|
45
|
+
})
|
|
46
|
+
.then(() => getAddress())
|
|
47
|
+
.then(({ address, error }) => {
|
|
48
|
+
if (error) throw error;
|
|
49
|
+
if (!address)
|
|
50
|
+
throw {
|
|
51
|
+
code: -3,
|
|
52
|
+
message: "Getting the address is not allowed, please request access first.",
|
|
53
|
+
};
|
|
54
|
+
return { address };
|
|
55
|
+
})
|
|
56
|
+
.catch((e) => {
|
|
57
|
+
throw parseError(e);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async signTransaction(xdr: string, opts?: { address?: string; networkPassphrase?: string }): Promise<{ signedTxXdr: string; signerAddress?: string }> {
|
|
61
|
+
return this.runChecks()
|
|
62
|
+
.then(async () => {
|
|
63
|
+
const { signedTxXdr, signerAddress, error } = await signTransaction(xdr, {
|
|
64
|
+
address: opts?.address,
|
|
65
|
+
networkPassphrase: opts?.networkPassphrase,
|
|
66
|
+
});
|
|
67
|
+
if (error) throw error;
|
|
68
|
+
return { signedTxXdr, signerAddress };
|
|
69
|
+
})
|
|
70
|
+
.catch((e) => {
|
|
71
|
+
throw parseError(e);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async signAuthEntry(authEntry: string, opts?: { address?: string; networkPassphrase?: string }): Promise<{ signedAuthEntry: string; signerAddress?: string }> {
|
|
76
|
+
return this.runChecks()
|
|
77
|
+
.then(async () => {
|
|
78
|
+
const { signedAuthEntry, signerAddress, error } = await signAuthEntry(authEntry, {
|
|
79
|
+
address: opts?.address,
|
|
80
|
+
networkPassphrase: opts?.networkPassphrase,
|
|
81
|
+
});
|
|
82
|
+
if (error || !signedAuthEntry) throw error;
|
|
83
|
+
return { signedAuthEntry: Buffer.from(signedAuthEntry).toString("base64"), signerAddress };
|
|
84
|
+
})
|
|
85
|
+
.catch((e) => {
|
|
86
|
+
throw parseError(e);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async signMessage(message: string, opts?: { address?: string; networkPassphrase?: string }): Promise<{ signedMessage: string; signerAddress?: string }> {
|
|
91
|
+
return this.runChecks()
|
|
92
|
+
.then(async () => {
|
|
93
|
+
const { signedMessage, signerAddress, error } = await signMessage(message, {
|
|
94
|
+
address: opts?.address,
|
|
95
|
+
networkPassphrase: opts?.networkPassphrase,
|
|
96
|
+
});
|
|
97
|
+
if (error || !signedMessage) throw error;
|
|
98
|
+
return {
|
|
99
|
+
signedMessage: typeof signedMessage === "string" ? signedMessage : Buffer.from(signedMessage).toString("base64"),
|
|
100
|
+
signerAddress,
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
.catch((e) => {
|
|
104
|
+
throw parseError(e);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async getNetwork(): Promise<{ network: string; networkPassphrase: string }> {
|
|
109
|
+
return this.runChecks()
|
|
110
|
+
.then(async () => {
|
|
111
|
+
const { network, networkPassphrase, error } = await getNetwork();
|
|
112
|
+
if (error) throw error;
|
|
113
|
+
return { network, networkPassphrase };
|
|
114
|
+
})
|
|
115
|
+
.catch((e) => {
|
|
116
|
+
throw parseError(e);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Networks } from "@stellar/stellar-sdk";
|
|
2
|
+
import HOT from "../hot-wallet/iframe";
|
|
3
3
|
|
|
4
4
|
export const HOTWALLET_ID: string = "hot-wallet";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* **IMPORTANT**: This module requires that you have a "global" and a "Buffer" polyfill in your app, if not provided then this module will break your app.
|
|
8
|
-
*/
|
|
9
|
-
export class HotWalletModule implements ModuleInterface {
|
|
10
|
-
moduleType: ModuleType = ModuleType.HOT_WALLET;
|
|
6
|
+
export class HotWalletModule {
|
|
11
7
|
productId: string = HOTWALLET_ID;
|
|
12
8
|
productName: string = "HOT Wallet";
|
|
13
9
|
productUrl: string = "https://hot-labs.org/wallet";
|
|
@@ -18,22 +14,22 @@ export class HotWalletModule implements ModuleInterface {
|
|
|
18
14
|
}
|
|
19
15
|
|
|
20
16
|
async getAddress(): Promise<{ address: string }> {
|
|
21
|
-
return await
|
|
17
|
+
return await HOT.request("stellar:getAddress", {});
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
async signTransaction(xdr: string, opts?: { address?: string }): Promise<{ signedTxXdr: string; signerAddress?: string }> {
|
|
25
|
-
return await
|
|
21
|
+
return await HOT.request("stellar:signTransaction", { xdr, accountToSign: opts?.address });
|
|
26
22
|
}
|
|
27
23
|
|
|
28
24
|
async signAuthEntry(authEntry: string, opts?: { address?: string }): Promise<{ signedAuthEntry: string; signerAddress?: string }> {
|
|
29
|
-
return await
|
|
25
|
+
return await HOT.request("stellar:signAuthEntry", { authEntry, accountToSign: opts?.address });
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
async signMessage(message: string, opts?: { address?: string }): Promise<{ signedMessage: string; signerAddress?: string }> {
|
|
33
|
-
return await
|
|
29
|
+
return await HOT.request("stellar:signMessage", { message, accountToSign: opts?.address });
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
async getNetwork(): Promise<{ network: string; networkPassphrase: string }> {
|
|
37
|
-
return { network: "mainnet", networkPassphrase:
|
|
33
|
+
return { network: "mainnet", networkPassphrase: Networks.PUBLIC };
|
|
38
34
|
}
|
|
39
35
|
}
|
package/src/ton/connector.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TonConnectUI, TonConnect } from "@tonconnect/ui";
|
|
1
|
+
import { TonConnectUI, TonConnect, Feature } from "@tonconnect/ui";
|
|
2
2
|
import { runInAction } from "mobx";
|
|
3
3
|
|
|
4
4
|
import { WalletType } from "../core/chains";
|
|
5
5
|
import { HotConnector } from "../HotConnector";
|
|
6
6
|
import { ConnectorType, OmniConnector } from "../OmniConnector";
|
|
7
|
-
import
|
|
7
|
+
import HOT from "../hot-wallet/iframe";
|
|
8
8
|
import TonWallet from "./wallet";
|
|
9
9
|
|
|
10
10
|
export interface TonConnectorOptions {
|
|
@@ -30,6 +30,8 @@ const hotWallet = {
|
|
|
30
30
|
],
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
const isSignDataFeature = (feature: Feature) => typeof feature === "object" && feature.name === "SignData" && feature.types.includes("text");
|
|
34
|
+
|
|
33
35
|
class TonConnector extends OmniConnector<TonWallet> {
|
|
34
36
|
type = ConnectorType.WALLET;
|
|
35
37
|
walletTypes = [WalletType.TON, WalletType.OMNI];
|
|
@@ -78,13 +80,15 @@ class TonConnector extends OmniConnector<TonWallet> {
|
|
|
78
80
|
tonConnect.connector.restoreConnection();
|
|
79
81
|
tonConnect.getWallets().then((wallets) => {
|
|
80
82
|
runInAction(() => {
|
|
81
|
-
this.options = wallets
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
this.options = wallets
|
|
84
|
+
.filter((t) => t.features?.some(isSignDataFeature))
|
|
85
|
+
.map((w) => ({
|
|
86
|
+
name: w.name,
|
|
87
|
+
icon: w.imageUrl,
|
|
88
|
+
id: w.appName,
|
|
89
|
+
download: w.aboutUrl,
|
|
90
|
+
type: "external" as const,
|
|
91
|
+
}));
|
|
88
92
|
});
|
|
89
93
|
});
|
|
90
94
|
|
|
@@ -94,7 +98,7 @@ class TonConnector extends OmniConnector<TonWallet> {
|
|
|
94
98
|
tcRoot.style.position = "fixed";
|
|
95
99
|
}
|
|
96
100
|
|
|
97
|
-
if (isInjected
|
|
101
|
+
if (HOT.isInjected) {
|
|
98
102
|
tonConnect.getWallets().then((wallets) => {
|
|
99
103
|
const wallet = wallets.find((w) => w.appName === "hot");
|
|
100
104
|
if (wallet) tonConnect.connector.connect(wallet, { tonProof: "wibe3" });
|
package/src/ton/injected.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import HOT from "../hot-wallet/iframe";
|
|
2
2
|
|
|
3
|
-
if (isInjected
|
|
3
|
+
if (HOT.isInjected) {
|
|
4
4
|
// @ts-expect-error: hotWallet is not defined
|
|
5
5
|
window.hotWallet = {
|
|
6
6
|
tonconnect: {
|
|
@@ -33,19 +33,19 @@ if (isInjected()) {
|
|
|
33
33
|
isWalletBrowser: true,
|
|
34
34
|
|
|
35
35
|
connect: (_: number, request: any) => {
|
|
36
|
-
return
|
|
36
|
+
return HOT.request("ton:connect", request);
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
restoreConnection: () => {
|
|
40
|
-
return
|
|
40
|
+
return HOT.request("ton:restoreConnection", {});
|
|
41
41
|
},
|
|
42
42
|
|
|
43
43
|
disconnect: () => {
|
|
44
|
-
return
|
|
44
|
+
return HOT.request("ton:disconnect", {});
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
send: async (request: any) => {
|
|
48
|
-
return
|
|
48
|
+
return HOT.request("ton:send", request);
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
listen: () => {
|
package/src/ui/Popup.tsx
CHANGED
|
@@ -65,9 +65,13 @@ const Popup = ({ widget, children, header, onClose, style, mobileFullscreen }: P
|
|
|
65
65
|
)}
|
|
66
66
|
<ModalBody style={{ overflowX: "hidden", ...style }}>{children}</ModalBody>
|
|
67
67
|
<Footer>
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
<GetWalletLink href="https://hot-labs.org" rel="noreferrer" target="_blank" style={{ marginLeft: 0, display: "flex", alignItems: "center", gap: 4 }}>
|
|
69
|
+
<p>Secured by</p>
|
|
70
|
+
<img src="https://tgapp.herewallet.app/images/hot/hot-icon.png" alt="HOT Labs" />
|
|
71
|
+
<p>HOT</p>
|
|
72
|
+
</GetWalletLink>
|
|
73
|
+
|
|
74
|
+
<GetWalletLink href="https://download.hot-labs.org/kit" rel="noreferrer" target="_blank">
|
|
71
75
|
Don't have a wallet?
|
|
72
76
|
</GetWalletLink>
|
|
73
77
|
</Footer>
|
|
@@ -165,8 +165,11 @@ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSele
|
|
|
165
165
|
|
|
166
166
|
const process = async (review: BridgeReview) => {
|
|
167
167
|
try {
|
|
168
|
-
setProcessing({ status: "processing", message
|
|
169
|
-
|
|
168
|
+
const log = (message: string) => setProcessing({ status: "processing", message, review });
|
|
169
|
+
hot.hotBridge.logger = { log, warn: console.warn };
|
|
170
|
+
log("Signing transaction");
|
|
171
|
+
|
|
172
|
+
const result = await hot.exchange.makeSwap(review, { log });
|
|
170
173
|
setProcessing({ status: "success", message: "Transaction signed", review: result });
|
|
171
174
|
if (setup?.autoClose) onClose();
|
|
172
175
|
return result;
|
|
@@ -111,7 +111,7 @@ export const Profile = observer(({ hot, onClose }: { hot: HotConnector; onClose:
|
|
|
111
111
|
</div>
|
|
112
112
|
|
|
113
113
|
<div style={{ marginLeft: "auto", padding: "8px 12px", borderRadius: 16, background: "#1a1a1a", color: "#fff" }}>
|
|
114
|
-
<p style={{ color: "#d6d6d6" }}>{withdrawal.loading ? <Loader /> : "
|
|
114
|
+
<p style={{ color: "#d6d6d6" }}>{withdrawal.loading ? <Loader /> : "Withdraw"}</p>
|
|
115
115
|
</div>
|
|
116
116
|
</PopupOption>
|
|
117
117
|
);
|
package/src/ui/styles.ts
CHANGED
|
@@ -169,17 +169,18 @@ export const Footer = styled.div`
|
|
|
169
169
|
`;
|
|
170
170
|
|
|
171
171
|
export const GetWalletLink = styled.a`
|
|
172
|
-
color:
|
|
172
|
+
color: #fff;
|
|
173
173
|
text-align: center;
|
|
174
174
|
font-size: 16px;
|
|
175
175
|
font-style: normal;
|
|
176
176
|
font-weight: 500;
|
|
177
177
|
margin-left: auto;
|
|
178
178
|
text-decoration: none;
|
|
179
|
-
transition:
|
|
179
|
+
transition: opacity 0.2s ease-in-out;
|
|
180
|
+
opacity: 0.8;
|
|
180
181
|
|
|
181
182
|
&:hover {
|
|
182
|
-
|
|
183
|
+
opacity: 1;
|
|
183
184
|
}
|
|
184
185
|
`;
|
|
185
186
|
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ModuleType, WalletNetwork } from "@creit.tech/stellar-wallets-kit";
|
|
2
|
-
import { requestHot } from "../hot-wallet/iframe";
|
|
3
|
-
export const HOTWALLET_ID = "hot-wallet";
|
|
4
|
-
/**
|
|
5
|
-
* **IMPORTANT**: This module requires that you have a "global" and a "Buffer" polyfill in your app, if not provided then this module will break your app.
|
|
6
|
-
*/
|
|
7
|
-
export class HotWalletModule {
|
|
8
|
-
moduleType = ModuleType.HOT_WALLET;
|
|
9
|
-
productId = HOTWALLET_ID;
|
|
10
|
-
productName = "HOT Wallet";
|
|
11
|
-
productUrl = "https://hot-labs.org/wallet";
|
|
12
|
-
productIcon = "https://storage.herewallet.app/logo.png";
|
|
13
|
-
async isAvailable() {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
async getAddress() {
|
|
17
|
-
return await requestHot("stellar:getAddress", {});
|
|
18
|
-
}
|
|
19
|
-
async signTransaction(xdr, opts) {
|
|
20
|
-
return await requestHot("stellar:signTransaction", { xdr, accountToSign: opts?.address });
|
|
21
|
-
}
|
|
22
|
-
async signAuthEntry(authEntry, opts) {
|
|
23
|
-
return await requestHot("stellar:signAuthEntry", { authEntry, accountToSign: opts?.address });
|
|
24
|
-
}
|
|
25
|
-
async signMessage(message, opts) {
|
|
26
|
-
return await requestHot("stellar:signMessage", { message, accountToSign: opts?.address });
|
|
27
|
-
}
|
|
28
|
-
async getNetwork() {
|
|
29
|
-
return { network: "mainnet", networkPassphrase: WalletNetwork.PUBLIC };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=injected.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injected.js","sourceRoot":"","sources":["../../src/stellar/injected.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,UAAU,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAW,YAAY,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B,UAAU,GAAe,UAAU,CAAC,UAAU,CAAC;IAC/C,SAAS,GAAW,YAAY,CAAC;IACjC,WAAW,GAAW,YAAY,CAAC;IACnC,UAAU,GAAW,6BAA6B,CAAC;IACnD,WAAW,GAAW,yCAAyC,CAAC;IAEhE,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,MAAM,UAAU,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,GAAW,EAAE,IAA2B;QAC5D,OAAO,MAAM,UAAU,CAAC,yBAAyB,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB,EAAE,IAA2B;QAChE,OAAO,MAAM,UAAU,CAAC,uBAAuB,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,IAA2B;QAC5D,OAAO,MAAM,UAAU,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;IACzE,CAAC;CACF"}
|