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
@@ -8,7 +8,7 @@ export declare function useBtcWalletSelector(): {
|
|
8
8
|
autoConnect: () => Promise<void>;
|
9
9
|
logout: () => void;
|
10
10
|
account: string;
|
11
|
-
getPublicKey: () =>
|
11
|
+
getPublicKey: () => Promise<string | undefined>;
|
12
12
|
signMessage: (msg: string) => any;
|
13
13
|
getContext: () => any;
|
14
14
|
getNetwork: () => Promise<"livenet" | "testnet">;
|
package/dist/index.js
CHANGED
@@ -2792,7 +2792,8 @@ function useBtcWalletSelector() {
|
|
2792
2792
|
}, [signMessage]);
|
2793
2793
|
(0, import_react11.useEffect)(() => {
|
2794
2794
|
const fn = (account) => {
|
2795
|
-
|
2795
|
+
console.log("accountsChanged account", account);
|
2796
|
+
if (account == null ? void 0 : account.length) {
|
2796
2797
|
getPublicKey().then((res) => {
|
2797
2798
|
publicKey.current = res;
|
2798
2799
|
context.emit("updatePublicKey", res);
|
@@ -2854,9 +2855,21 @@ function useBtcWalletSelector() {
|
|
2854
2855
|
context.emit("btcLogOut");
|
2855
2856
|
},
|
2856
2857
|
account: accounts == null ? void 0 : accounts[0],
|
2857
|
-
getPublicKey: () => {
|
2858
|
-
|
2859
|
-
|
2858
|
+
getPublicKey: () => __async(this, null, function* () {
|
2859
|
+
const publicKey2 = yield getPublicKey();
|
2860
|
+
if (publicKey2)
|
2861
|
+
return publicKey2;
|
2862
|
+
if (connectModalOpen)
|
2863
|
+
return;
|
2864
|
+
try {
|
2865
|
+
yield requestDirectAccount(connectorRef.current);
|
2866
|
+
return yield getPublicKey();
|
2867
|
+
} catch (error) {
|
2868
|
+
console.error("btcLoginError", error);
|
2869
|
+
context.emit("btcLoginError");
|
2870
|
+
return;
|
2871
|
+
}
|
2872
|
+
}),
|
2860
2873
|
signMessage: (msg) => {
|
2861
2874
|
return signMessageFn.current(msg);
|
2862
2875
|
},
|
@@ -2872,10 +2885,12 @@ function useBtcWalletSelector() {
|
|
2872
2885
|
getNetwork2,
|
2873
2886
|
switchNetwork,
|
2874
2887
|
sendBitcoin2,
|
2888
|
+
connectModalOpen,
|
2875
2889
|
openConnectModal,
|
2876
|
-
requestDirectAccount,
|
2877
2890
|
context,
|
2878
|
-
|
2891
|
+
requestDirectAccount,
|
2892
|
+
disconnect,
|
2893
|
+
getPublicKey
|
2879
2894
|
]);
|
2880
2895
|
return hook;
|
2881
2896
|
}
|
@@ -4606,7 +4621,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4606
4621
|
});
|
4607
4622
|
const context = window.btcContext.getContext();
|
4608
4623
|
context.on("updatePublicKey", (btcPublicKey) => __async(this, null, function* () {
|
4609
|
-
console.log("updatePublicKey");
|
4610
4624
|
state_default.clear();
|
4611
4625
|
console.log("updatePublicKey clear");
|
4612
4626
|
try {
|
@@ -4905,7 +4919,7 @@ function getGroup(state) {
|
|
4905
4919
|
|
4906
4920
|
// src/index.ts
|
4907
4921
|
var getVersion = () => {
|
4908
|
-
return "0.5.
|
4922
|
+
return "0.5.32-beta";
|
4909
4923
|
};
|
4910
4924
|
if (typeof window !== "undefined") {
|
4911
4925
|
window.__BTC_WALLET_VERSION = getVersion();
|