@aptos-labs/wallet-adapter-core 2.3.1 → 2.3.2
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
- package/src/WalletCore.ts +5 -2
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
160
160
|
@emit emits "connect" event
|
|
161
161
|
@throws WalletConnectionError
|
|
162
162
|
*/
|
|
163
|
-
connect(walletName: WalletName): Promise<void>;
|
|
163
|
+
connect(walletName: WalletName): Promise<void | string>;
|
|
164
164
|
/**
|
|
165
165
|
Disconnect the exisitng wallet. On success, we clear the
|
|
166
166
|
current account, current network and LocalStorage data.
|
package/dist/index.js
CHANGED
|
@@ -344,7 +344,9 @@ var WalletCore = class extends import_eventemitter3.default {
|
|
|
344
344
|
return;
|
|
345
345
|
if (this._connected) {
|
|
346
346
|
if (((_b = this.wallet) == null ? void 0 : _b.name) === walletName)
|
|
347
|
-
|
|
347
|
+
throw new WalletConnectionError(
|
|
348
|
+
`${walletName} wallet is already connected`
|
|
349
|
+
).message;
|
|
348
350
|
await this.disconnect();
|
|
349
351
|
}
|
|
350
352
|
if (isRedirectable()) {
|
package/dist/index.mjs
CHANGED
|
@@ -303,7 +303,9 @@ var WalletCore = class extends EventEmitter {
|
|
|
303
303
|
return;
|
|
304
304
|
if (this._connected) {
|
|
305
305
|
if (((_b = this.wallet) == null ? void 0 : _b.name) === walletName)
|
|
306
|
-
|
|
306
|
+
throw new WalletConnectionError(
|
|
307
|
+
`${walletName} wallet is already connected`
|
|
308
|
+
).message;
|
|
307
309
|
await this.disconnect();
|
|
308
310
|
}
|
|
309
311
|
if (isRedirectable()) {
|
package/package.json
CHANGED
package/src/WalletCore.ts
CHANGED
|
@@ -181,7 +181,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
181
181
|
@emit emits "connect" event
|
|
182
182
|
@throws WalletConnectionError
|
|
183
183
|
*/
|
|
184
|
-
async connect(walletName: WalletName): Promise<void> {
|
|
184
|
+
async connect(walletName: WalletName): Promise<void | string> {
|
|
185
185
|
try {
|
|
186
186
|
const selectedWallet = this._wallets?.find(
|
|
187
187
|
(wallet: Wallet) => wallet.name === walletName
|
|
@@ -191,7 +191,10 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
191
191
|
|
|
192
192
|
if (this._connected) {
|
|
193
193
|
// if the selected wallet is already connected, we don't need to connect again
|
|
194
|
-
if (this.wallet?.name === walletName)
|
|
194
|
+
if (this.wallet?.name === walletName)
|
|
195
|
+
throw new WalletConnectionError(
|
|
196
|
+
`${walletName} wallet is already connected`
|
|
197
|
+
).message;
|
|
195
198
|
|
|
196
199
|
await this.disconnect();
|
|
197
200
|
}
|