btc-wallet 0.5.31-beta → 0.5.32-beta
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/dist/core/btcWalletSelectorContext.d.ts +1 -1
- package/dist/index.js +22 -8
- package/dist/index.js.map +3 -3
- package/dist/utils/initWalletButton.d.ts +2 -2
- package/esm/index.js +22 -8
- package/esm/index.js.map +3 -3
- package/package.json +1 -1
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { Wallet } from '@near-wallet-selector/core';
|
2
2
|
import { type ENV } from '../config';
|
3
3
|
interface OriginalWallet {
|
4
|
-
account: string |
|
5
|
-
getPublicKey: () => Promise<string>;
|
4
|
+
account: string | undefined;
|
5
|
+
getPublicKey: () => Promise<string | undefined>;
|
6
6
|
}
|
7
7
|
export declare function setupWalletButton(env: ENV, wallet: Wallet, originalWallet: OriginalWallet): void;
|
8
8
|
export declare function removeWalletButton(): void;
|
package/esm/index.js
CHANGED
@@ -2723,7 +2723,8 @@ function useBtcWalletSelector() {
|
|
2723
2723
|
}, [signMessage]);
|
2724
2724
|
useEffect6(() => {
|
2725
2725
|
const fn = (account) => {
|
2726
|
-
|
2726
|
+
console.log("accountsChanged account", account);
|
2727
|
+
if (account == null ? void 0 : account.length) {
|
2727
2728
|
getPublicKey().then((res) => {
|
2728
2729
|
publicKey.current = res;
|
2729
2730
|
context.emit("updatePublicKey", res);
|
@@ -2785,9 +2786,21 @@ function useBtcWalletSelector() {
|
|
2785
2786
|
context.emit("btcLogOut");
|
2786
2787
|
},
|
2787
2788
|
account: accounts == null ? void 0 : accounts[0],
|
2788
|
-
getPublicKey: () => {
|
2789
|
-
|
2790
|
-
|
2789
|
+
getPublicKey: () => __async(this, null, function* () {
|
2790
|
+
const publicKey2 = yield getPublicKey();
|
2791
|
+
if (publicKey2)
|
2792
|
+
return publicKey2;
|
2793
|
+
if (connectModalOpen)
|
2794
|
+
return;
|
2795
|
+
try {
|
2796
|
+
yield requestDirectAccount(connectorRef.current);
|
2797
|
+
return yield getPublicKey();
|
2798
|
+
} catch (error) {
|
2799
|
+
console.error("btcLoginError", error);
|
2800
|
+
context.emit("btcLoginError");
|
2801
|
+
return;
|
2802
|
+
}
|
2803
|
+
}),
|
2791
2804
|
signMessage: (msg) => {
|
2792
2805
|
return signMessageFn.current(msg);
|
2793
2806
|
},
|
@@ -2803,10 +2816,12 @@ function useBtcWalletSelector() {
|
|
2803
2816
|
getNetwork2,
|
2804
2817
|
switchNetwork,
|
2805
2818
|
sendBitcoin2,
|
2819
|
+
connectModalOpen,
|
2806
2820
|
openConnectModal,
|
2807
|
-
requestDirectAccount,
|
2808
2821
|
context,
|
2809
|
-
|
2822
|
+
requestDirectAccount,
|
2823
|
+
disconnect,
|
2824
|
+
getPublicKey
|
2810
2825
|
]);
|
2811
2826
|
return hook;
|
2812
2827
|
}
|
@@ -4537,7 +4552,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4537
4552
|
});
|
4538
4553
|
const context = window.btcContext.getContext();
|
4539
4554
|
context.on("updatePublicKey", (btcPublicKey) => __async(this, null, function* () {
|
4540
|
-
console.log("updatePublicKey");
|
4541
4555
|
state_default.clear();
|
4542
4556
|
console.log("updatePublicKey clear");
|
4543
4557
|
try {
|
@@ -4838,7 +4852,7 @@ function getGroup(state) {
|
|
4838
4852
|
|
4839
4853
|
// src/index.ts
|
4840
4854
|
var getVersion = () => {
|
4841
|
-
return "0.5.
|
4855
|
+
return "0.5.32-beta";
|
4842
4856
|
};
|
4843
4857
|
if (typeof window !== "undefined") {
|
4844
4858
|
window.__BTC_WALLET_VERSION = getVersion();
|