btc-wallet 0.5.30-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 +24 -11
- package/dist/index.js.map +3 -3
- package/dist/utils/initWalletButton.d.ts +2 -2
- package/esm/index.js +24 -11
- 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
|
}
|
@@ -3775,7 +3790,6 @@ import * as ecc from "@bitcoinerlab/secp256k1";
|
|
3775
3790
|
bitcoin.initEccLib(ecc);
|
3776
3791
|
var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
|
3777
3792
|
var NBTC_STORAGE_DEPOSIT_AMOUNT = "3000";
|
3778
|
-
var GAS_LIMIT = "50000000000000";
|
3779
3793
|
var NEW_ACCOUNT_MIN_DEPOSIT_AMOUNT = "1000";
|
3780
3794
|
function getBtcProvider() {
|
3781
3795
|
if (typeof window === "undefined" || !window.btcContext) {
|
@@ -3999,12 +4013,12 @@ function executeBTCDepositAndAction(_0) {
|
|
3999
4013
|
const debtAction = yield checkGasTokenDebt(csna, env, false);
|
4000
4014
|
if (debtAction) {
|
4001
4015
|
newActions.push(__spreadProps(__spreadValues({}, debtAction), {
|
4002
|
-
gas:
|
4016
|
+
gas: "30000000000000"
|
4003
4017
|
}));
|
4004
4018
|
}
|
4005
4019
|
if (action) {
|
4006
4020
|
newActions.push(__spreadProps(__spreadValues({}, action), {
|
4007
|
-
gas:
|
4021
|
+
gas: "100000000000000"
|
4008
4022
|
}));
|
4009
4023
|
}
|
4010
4024
|
const storageDepositMsg = {};
|
@@ -4538,7 +4552,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4538
4552
|
});
|
4539
4553
|
const context = window.btcContext.getContext();
|
4540
4554
|
context.on("updatePublicKey", (btcPublicKey) => __async(this, null, function* () {
|
4541
|
-
console.log("updatePublicKey");
|
4542
4555
|
state_default.clear();
|
4543
4556
|
console.log("updatePublicKey clear");
|
4544
4557
|
try {
|
@@ -4839,7 +4852,7 @@ function getGroup(state) {
|
|
4839
4852
|
|
4840
4853
|
// src/index.ts
|
4841
4854
|
var getVersion = () => {
|
4842
|
-
return "0.5.
|
4855
|
+
return "0.5.32-beta";
|
4843
4856
|
};
|
4844
4857
|
if (typeof window !== "undefined") {
|
4845
4858
|
window.__BTC_WALLET_VERSION = getVersion();
|