@hot-labs/kit 1.4.21 → 1.4.24
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/HotConnector.d.ts +3 -1
- package/build/HotConnector.js +7 -2
- package/build/HotConnector.js.map +1 -1
- package/build/core/token.js +1 -1
- package/build/core/token.js.map +1 -1
- package/build/cosmos/connector.js +1 -1
- package/build/cosmos/connector.js.map +1 -1
- package/build/cosmos/wallet.d.ts +1 -1
- package/build/cosmos/wallet.js +3 -1
- package/build/cosmos/wallet.js.map +1 -1
- package/build/hot-wallet/google.js +2 -0
- package/build/hot-wallet/google.js.map +1 -1
- package/build/near/standalone.js +0 -1
- package/build/near/standalone.js.map +1 -1
- package/build/solana/WalletStandard.d.ts +2 -1
- package/build/solana/WalletStandard.js +9 -4
- package/build/solana/WalletStandard.js.map +1 -1
- package/build/solana/connector.js +1 -1
- package/build/solana/connector.js.map +1 -1
- package/build/ui/profile/Profile.d.ts +2 -1
- package/build/ui/profile/Profile.js +3 -1
- package/build/ui/profile/Profile.js.map +1 -1
- package/build/ui/router.js +3 -2
- package/build/ui/router.js.map +1 -1
- package/examples-node/token.ts +24 -0
- package/examples-node/transfer.ts +1 -1
- package/examples-node/withdraw.ts +1 -1
- package/package.json +1 -1
- package/skill.md +2 -1211
- package/src/HotConnector.ts +8 -2
- package/src/core/token.ts +1 -1
- package/src/cosmos/connector.ts +1 -1
- package/src/cosmos/wallet.ts +4 -1
- package/src/hot-wallet/google.ts +1 -0
- package/src/near/standalone.ts +0 -2
- package/src/solana/WalletStandard.ts +8 -3
- package/src/solana/connector.ts +1 -2
- package/src/ui/profile/Profile.tsx +10 -2
- package/src/ui/router.tsx +3 -2
- package/CHANGELOG.md +0 -3
package/src/HotConnector.ts
CHANGED
|
@@ -22,6 +22,7 @@ import type EvmWallet from "./evm/wallet";
|
|
|
22
22
|
import type SolanaWallet from "./solana/wallet";
|
|
23
23
|
import type StellarWallet from "./stellar/wallet";
|
|
24
24
|
import type TonWallet from "./ton/wallet";
|
|
25
|
+
import type TronWallet from "./tron/wallet";
|
|
25
26
|
|
|
26
27
|
import { openBridge, openConnector, openProfile, openWalletPicker } from "./ui/router";
|
|
27
28
|
import { ConnectorType, OmniConnector } from "./core/OmniConnector";
|
|
@@ -140,6 +141,7 @@ export class HotConnector {
|
|
|
140
141
|
if (this.solana) return this.solana;
|
|
141
142
|
if (this.ton) return this.ton;
|
|
142
143
|
if (this.stellar) return this.stellar;
|
|
144
|
+
if (this.tron) return this.tron;
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
get wallets(): OmniWallet[] {
|
|
@@ -179,6 +181,10 @@ export class HotConnector {
|
|
|
179
181
|
return this.wallets.find((w) => w.type === WalletType.STELLAR) as StellarWallet | null;
|
|
180
182
|
}
|
|
181
183
|
|
|
184
|
+
get tron(): TronWallet | null {
|
|
185
|
+
return this.wallets.find((w) => w.type === WalletType.Tron) as TronWallet | null;
|
|
186
|
+
}
|
|
187
|
+
|
|
182
188
|
get ton(): TonWallet | null {
|
|
183
189
|
return this.wallets.find((w) => w.type === WalletType.TON) as TonWallet | null;
|
|
184
190
|
}
|
|
@@ -342,10 +348,10 @@ export class HotConnector {
|
|
|
342
348
|
}
|
|
343
349
|
|
|
344
350
|
async connect(type?: WalletType) {
|
|
345
|
-
if (!type) return openConnector(this);
|
|
351
|
+
if (!type) return await openConnector(this);
|
|
346
352
|
const connector = this.connectors.find((t) => t.type === ConnectorType.WALLET && t.walletTypes.includes(type));
|
|
347
353
|
if (!connector) throw new Error("Connector not found");
|
|
348
|
-
return openWalletPicker(connector);
|
|
354
|
+
return await openWalletPicker(connector);
|
|
349
355
|
}
|
|
350
356
|
|
|
351
357
|
async disconnect(wallet: WalletType | OmniWallet) {
|
package/src/core/token.ts
CHANGED
|
@@ -68,7 +68,7 @@ export class Token {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
get originalChainIcon() {
|
|
71
|
-
if (this.originalChain === Network.Juno) return "https://
|
|
71
|
+
if (this.originalChain === Network.Juno) return "https://cryptologos.cc/logos/cosmos-atom-logo.svg";
|
|
72
72
|
return `https://storage.herewallet.app/ft/${this.originalChain}:native.png`;
|
|
73
73
|
}
|
|
74
74
|
|
package/src/cosmos/connector.ts
CHANGED
|
@@ -100,7 +100,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
get icon() {
|
|
103
|
-
return chains.getByKey(this.chainId)?.logo || "
|
|
103
|
+
return chains.getByKey(this.chainId)?.logo || "";
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
get name() {
|
package/src/cosmos/wallet.ts
CHANGED
|
@@ -23,13 +23,16 @@ interface ProtocolWallet {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export default class CosmosWallet extends OmniWallet {
|
|
26
|
-
readonly icon = "https://legacy.cosmos.network/presskit/cosmos-brandmark-dynamic-dark.svg";
|
|
27
26
|
readonly type = WalletType.COSMOS;
|
|
28
27
|
|
|
29
28
|
constructor(readonly wallet: ProtocolWallet) {
|
|
30
29
|
super();
|
|
31
30
|
}
|
|
32
31
|
|
|
32
|
+
get icon() {
|
|
33
|
+
return chains.getByKey(this.wallet.chainId)?.logo || "";
|
|
34
|
+
}
|
|
35
|
+
|
|
33
36
|
get address() {
|
|
34
37
|
return this.wallet.account.address;
|
|
35
38
|
}
|
package/src/hot-wallet/google.ts
CHANGED
|
@@ -32,6 +32,7 @@ class GoogleConnector extends OmniConnector<OmniWallet> {
|
|
|
32
32
|
this.webWallet = options?.webWallet ?? "https://app.hot-labs.org";
|
|
33
33
|
makeObservable(this, { connectWallet: action });
|
|
34
34
|
this.getStorage().then((accounts: any) => {
|
|
35
|
+
if (!Array.isArray(accounts)) return;
|
|
35
36
|
accounts.forEach((account: any) => this.connectWallet(account));
|
|
36
37
|
});
|
|
37
38
|
}
|
package/src/near/standalone.ts
CHANGED
|
@@ -21,8 +21,6 @@ export const createNearWallet = async (privateKeyBuf: Buffer, address?: string)
|
|
|
21
21
|
const addr = address || hex.encode(publicKeyBuffer);
|
|
22
22
|
const publicKey = `ed25519:${base58.encode(publicKeyBuffer)}`;
|
|
23
23
|
|
|
24
|
-
console.log({ publicKey });
|
|
25
|
-
|
|
26
24
|
return new NearWallet(addr, publicKey, {
|
|
27
25
|
manifest: {} as unknown as WalletManifest,
|
|
28
26
|
signAndSendTransaction: async (params: SignAndSendTransactionParams) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { base58 } from "@scure/base";
|
|
1
2
|
import type { Connection, Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
2
3
|
import type { Wallet } from "@wallet-standard/base";
|
|
3
4
|
|
|
@@ -9,12 +10,15 @@ export interface ISolanaProtocolWallet {
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
class SolanaProtocolWallet implements ISolanaProtocolWallet {
|
|
12
|
-
|
|
13
|
+
readonly address: string;
|
|
14
|
+
constructor(readonly wallet: Wallet, readonly publicKey: Uint8Array) {
|
|
15
|
+
this.address = base58.encode(publicKey);
|
|
16
|
+
}
|
|
13
17
|
|
|
14
18
|
static async connect(wallet: Wallet, { silent = false }: { silent?: boolean } = {}): Promise<ISolanaProtocolWallet> {
|
|
15
|
-
const a = new SolanaProtocolWallet(wallet,
|
|
19
|
+
const a = new SolanaProtocolWallet(wallet, new Uint8Array(32));
|
|
16
20
|
const account = await a.getAccount({ silent });
|
|
17
|
-
return new SolanaProtocolWallet(wallet, account.
|
|
21
|
+
return new SolanaProtocolWallet(wallet, new Uint8Array(account.publicKey));
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
async getAccount({ silent = false }: { silent?: boolean } = {}) {
|
|
@@ -28,6 +32,7 @@ class SolanaProtocolWallet implements ISolanaProtocolWallet {
|
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
if (!accounts.length) throw new Error("No account found");
|
|
35
|
+
if (!accounts[0].publicKey) throw new Error("No account found");
|
|
31
36
|
return accounts[0];
|
|
32
37
|
}
|
|
33
38
|
|
package/src/solana/connector.ts
CHANGED
|
@@ -98,6 +98,7 @@ class SolanaConnector extends OmniConnector<SolanaWallet, { wallet: Wallet }> {
|
|
|
98
98
|
return this.setWallet(
|
|
99
99
|
new SolanaWallet({
|
|
100
100
|
address: account,
|
|
101
|
+
disconnect: () => this.disconnectWalletConnect(),
|
|
101
102
|
sendTransaction: async (tx: Transaction | VersionedTransaction, connection: Connection, options?: any) => {
|
|
102
103
|
const transaction = Buffer.from(tx.serialize()).toString("base64");
|
|
103
104
|
const { signature } = await this.requestWalletConnect<{ signature: string }>({
|
|
@@ -114,8 +115,6 @@ class SolanaConnector extends OmniConnector<SolanaWallet, { wallet: Wallet }> {
|
|
|
114
115
|
});
|
|
115
116
|
return base58.decode(signature);
|
|
116
117
|
},
|
|
117
|
-
|
|
118
|
-
disconnect: () => this.disconnectWalletConnect(),
|
|
119
118
|
})
|
|
120
119
|
);
|
|
121
120
|
}
|
|
@@ -8,6 +8,7 @@ import ExchangeIcon from "../icons/exchange";
|
|
|
8
8
|
import { ImageView } from "../uikit/image";
|
|
9
9
|
import { Loader } from "../uikit/loader";
|
|
10
10
|
|
|
11
|
+
import { OmniWallet } from "../../core/OmniWallet";
|
|
11
12
|
import { ConnectorType } from "../../core/OmniConnector";
|
|
12
13
|
import { formatter } from "../../core/utils";
|
|
13
14
|
import { OmniToken } from "../../core/chains";
|
|
@@ -19,7 +20,7 @@ import { TokenCard, TokenIcon } from "../bridge/TokenCard";
|
|
|
19
20
|
import { PopupOption } from "../styles";
|
|
20
21
|
import Popup from "../Popup";
|
|
21
22
|
|
|
22
|
-
export const Profile = observer(({ hot, onClose }: { hot: HotConnector; onClose: () => void }) => {
|
|
23
|
+
export const Profile = observer(({ hot, onClose }: { hot: HotConnector; onClose: (wallet?: OmniWallet) => void }) => {
|
|
23
24
|
let totalBalance = 0;
|
|
24
25
|
|
|
25
26
|
const tokensList = hot.walletsTokens
|
|
@@ -68,7 +69,14 @@ export const Profile = observer(({ hot, onClose }: { hot: HotConnector; onClose:
|
|
|
68
69
|
)}
|
|
69
70
|
|
|
70
71
|
{hot.wallets.length < hot.connectors.length && (
|
|
71
|
-
<WalletCard
|
|
72
|
+
<WalletCard
|
|
73
|
+
style={{ paddingRight: 12 }}
|
|
74
|
+
onClick={() =>
|
|
75
|
+
openConnector(hot)
|
|
76
|
+
.then((wallet) => onClose(wallet))
|
|
77
|
+
.catch(() => onClose())
|
|
78
|
+
}
|
|
79
|
+
>
|
|
72
80
|
<PlusIcon />
|
|
73
81
|
Add wallet
|
|
74
82
|
</WalletCard>
|
package/src/ui/router.tsx
CHANGED
|
@@ -92,15 +92,16 @@ export const openBridge = (hot: HotConnector, setup?: BridgeProps["setup"]) => {
|
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
export const openConnector = (hot: HotConnector) => {
|
|
95
|
+
export const openConnector = async (hot: HotConnector) => {
|
|
96
96
|
return new Promise<OmniWallet>((resolve, reject) => {
|
|
97
97
|
present((close) => (
|
|
98
98
|
<Connector
|
|
99
99
|
hot={hot}
|
|
100
100
|
onClose={(wallet) => {
|
|
101
|
-
|
|
101
|
+
console.log("onClose", wallet);
|
|
102
102
|
if (wallet) resolve(wallet);
|
|
103
103
|
else reject(new Error("User rejected"));
|
|
104
|
+
close();
|
|
104
105
|
}}
|
|
105
106
|
/>
|
|
106
107
|
));
|
package/CHANGELOG.md
DELETED