@sundaeswap/wallet-lite 0.0.27 → 0.0.28
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/cjs/classes/WalletObserver.class.js +33 -24
- package/dist/cjs/classes/WalletObserver.class.js.map +1 -1
- package/dist/esm/classes/WalletObserver.class.js +7 -1
- package/dist/esm/classes/WalletObserver.class.js.map +1 -1
- package/dist/types/classes/WalletObserver.class.d.ts +1 -1
- package/dist/types/classes/WalletObserver.class.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/classes/WalletObserver.class.ts +15 -4
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { TransactionUnspentOutput } from "@cardano-sdk/core/dist/cjs/Serialization/index.js";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
APIErrorCode,
|
|
4
|
+
type ApiError,
|
|
5
|
+
type Cip30WalletApi,
|
|
6
|
+
type GetCollateral,
|
|
5
7
|
} from "@cardano-sdk/dapp-connector";
|
|
6
8
|
import { AssetAmount, type IAssetAmountMetadata } from "@sundaeswap/asset";
|
|
7
9
|
import merge from "lodash/merge.js";
|
|
@@ -238,7 +240,8 @@ export class WalletObserver<
|
|
|
238
240
|
const selectedWallet =
|
|
239
241
|
activeWallet || (this._activeWallet as TSupportedWalletExtensions);
|
|
240
242
|
|
|
241
|
-
|
|
243
|
+
let shouldContinue = true;
|
|
244
|
+
while (!this.api && shouldContinue) {
|
|
242
245
|
if (attempts === 10) {
|
|
243
246
|
throw new Error(
|
|
244
247
|
"Could not reconnect to the selected wallet. Please check your extension."
|
|
@@ -255,6 +258,14 @@ export class WalletObserver<
|
|
|
255
258
|
this.api = api;
|
|
256
259
|
this.network = await api.getNetworkId();
|
|
257
260
|
} catch (e) {
|
|
261
|
+
if (
|
|
262
|
+
(e as Error)?.message === "user canceled connection" ||
|
|
263
|
+
(e as ApiError)?.code === APIErrorCode.Refused
|
|
264
|
+
) {
|
|
265
|
+
shouldContinue = false;
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
268
|
+
|
|
258
269
|
await new Promise((res) => setTimeout(res, 200));
|
|
259
270
|
attempts++;
|
|
260
271
|
}
|