From 82c39afabfc9b7a6d50a951abb2c0e0ff1cb2432 Mon Sep 17 00:00:00 2001 From: mucahit Date: Thu, 24 Nov 2022 12:12:16 +0000 Subject: [PATCH 1/2] fix(disconnect): `reject` with correct error type --- src/PeraWalletConnect.ts | 10 +++++++++- src/util/PeraWalletConnectError.ts | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/PeraWalletConnect.ts b/src/PeraWalletConnect.ts index 7bc07a9..a8f1a9c 100644 --- a/src/PeraWalletConnect.ts +++ b/src/PeraWalletConnect.ts @@ -716,7 +716,15 @@ class PeraWalletConnect { resetWalletDetailsFromStorage(); - reject(event.data.message.error); + reject( + new PeraWalletConnectError( + { + type: "SESSION_DISCONNECTED", + detail: event.data.message.error + }, + event.data.message.error + ) + ); } if (event.data.message.type === "SIGN_TXN_CALLBACK_ERROR") { diff --git a/src/util/PeraWalletConnectError.ts b/src/util/PeraWalletConnectError.ts index 571a29f..402abe3 100644 --- a/src/util/PeraWalletConnectError.ts +++ b/src/util/PeraWalletConnectError.ts @@ -1,7 +1,7 @@ interface PeraWalletConnectErrorData { type: | "SIGN_TRANSACTIONS" - | "SESSION_DISCONNECT" + | "SESSION_DISCONNECTED" | "SESSION_UPDATE" | "SESSION_CONNECT" | "SESSION_RECONNECT" From 324cef62951c1ea50d2046d90b612fa0e56c3c0b Mon Sep 17 00:00:00 2001 From: mucahit Date: Thu, 24 Nov 2022 13:01:40 +0000 Subject: [PATCH 2/2] Bump-up minor version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5398162..b57945c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@perawallet/connect", - "version": "1.0.4", + "version": "1.0.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@perawallet/connect", - "version": "1.0.4", + "version": "1.0.5", "license": "ISC", "dependencies": { "@json-rpc-tools/utils": "^1.7.6", diff --git a/package.json b/package.json index f9af1f5..04456b7 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.0.4", + "version": "1.0.5", "name": "@perawallet/connect", "description": "JavaScript SDK for integrating Pera Wallet to web applications.", "main": "dist/index.js",