btc-wallet 0.2.3 → 0.2.5
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.
@@ -9,9 +9,10 @@ interface BTCWalletParams {
|
|
9
9
|
iconUrl?: string;
|
10
10
|
deprecated?: boolean;
|
11
11
|
autoConnect?: boolean;
|
12
|
+
syncLogOut?: boolean;
|
12
13
|
isDev?: boolean;
|
13
14
|
}
|
14
|
-
export declare function setupBTCWallet({ iconUrl, deprecated, autoConnect, isDev, }?: BTCWalletParams | undefined): WalletModuleFactory<InjectedWallet>;
|
15
|
+
export declare function setupBTCWallet({ iconUrl, deprecated, autoConnect, syncLogOut, isDev, }?: BTCWalletParams | undefined): WalletModuleFactory<InjectedWallet>;
|
15
16
|
declare const _default: {
|
16
17
|
setupBTCWallet: typeof setupBTCWallet;
|
17
18
|
};
|
package/esm/index.js
CHANGED
@@ -2250,6 +2250,10 @@ function useBtcWalletSelector() {
|
|
2250
2250
|
}, [connector]);
|
2251
2251
|
return {
|
2252
2252
|
login: () => __async(this, null, function* () {
|
2253
|
+
const account = accounts && accounts.length ? accounts[0] : null;
|
2254
|
+
if (account) {
|
2255
|
+
return account;
|
2256
|
+
}
|
2253
2257
|
setUpdater(updater + 1);
|
2254
2258
|
if (openConnectModal) {
|
2255
2259
|
yield openConnectModal();
|
@@ -2270,6 +2274,7 @@ function useBtcWalletSelector() {
|
|
2270
2274
|
}),
|
2271
2275
|
logout: () => {
|
2272
2276
|
disconnect && disconnect();
|
2277
|
+
context.emit("btcLogOut");
|
2273
2278
|
},
|
2274
2279
|
account: accounts && accounts.length ? accounts[0] : null,
|
2275
2280
|
getPublicKey: () => __async(this, null, function* () {
|
@@ -2555,6 +2560,11 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
2555
2560
|
accounts: []
|
2556
2561
|
});
|
2557
2562
|
}));
|
2563
|
+
context.on("btcLogOut", (e) => __async(void 0, null, function* () {
|
2564
|
+
emitter.emit("accountsChanged", {
|
2565
|
+
accounts: []
|
2566
|
+
});
|
2567
|
+
}));
|
2558
2568
|
if ("autoConnect" in metadata && metadata.autoConnect && localStorage.getItem("near-wallet-selector:selectedWalletId") === '"btc-wallet"') {
|
2559
2569
|
yield btcContext.autoConnect();
|
2560
2570
|
}
|
@@ -2621,7 +2631,9 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
2621
2631
|
function signOut() {
|
2622
2632
|
return __async(this, null, function* () {
|
2623
2633
|
const btcContext = window.btcContext;
|
2624
|
-
|
2634
|
+
if (metadata.syncLogOut) {
|
2635
|
+
btcContext.logout();
|
2636
|
+
}
|
2625
2637
|
state.clear();
|
2626
2638
|
window.localStorage.removeItem("near-wallet-selector:selectedWalletId");
|
2627
2639
|
removeWalletButton();
|
@@ -2714,10 +2726,10 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
2714
2726
|
chain_id: "397",
|
2715
2727
|
csna: accountId,
|
2716
2728
|
near_transactions: newTransactions.map((t) => t.txHex),
|
2717
|
-
nonce,
|
2718
2729
|
gas_token: currentConfig.token,
|
2719
2730
|
gas_limit: "3000",
|
2720
|
-
use_near_pay_gas: false
|
2731
|
+
use_near_pay_gas: false,
|
2732
|
+
nonce
|
2721
2733
|
};
|
2722
2734
|
const nearAccount = yield provider.query({
|
2723
2735
|
request_type: "view_account",
|
@@ -2793,6 +2805,7 @@ function setupBTCWallet({
|
|
2793
2805
|
iconUrl = "https://assets.deltatrade.ai/assets/chain/btc.svg",
|
2794
2806
|
deprecated = false,
|
2795
2807
|
autoConnect = true,
|
2808
|
+
syncLogOut = true,
|
2796
2809
|
isDev = false
|
2797
2810
|
} = {}) {
|
2798
2811
|
const btcWallet = () => __async(this, null, function* () {
|
@@ -2807,6 +2820,7 @@ function setupBTCWallet({
|
|
2807
2820
|
deprecated,
|
2808
2821
|
available: true,
|
2809
2822
|
autoConnect,
|
2823
|
+
syncLogOut,
|
2810
2824
|
isDev
|
2811
2825
|
},
|
2812
2826
|
init: BTCWallet
|
@@ -2867,7 +2881,7 @@ function pollTransactionStatuses(network, hashes) {
|
|
2867
2881
|
|
2868
2882
|
// src/index.ts
|
2869
2883
|
var getVersion = () => {
|
2870
|
-
return "0.2.
|
2884
|
+
return "0.2.5";
|
2871
2885
|
};
|
2872
2886
|
if (typeof window !== "undefined") {
|
2873
2887
|
window.__PARTICLE_BTC_CONNECT_VERSION = getVersion();
|