diff --git a/dapps/react-dapp-v2/package.json b/dapps/react-dapp-v2/package.json
index 6654fbf..5cea98a 100644
--- a/dapps/react-dapp-v2/package.json
+++ b/dapps/react-dapp-v2/package.json
@@ -3,7 +3,7 @@
"version": "2.3.3",
"private": true,
"scripts": {
- "dev": "next dev",
+ "dev": "next dev -p 3000",
"build": "next build",
"start": "next start",
"lint": "next lint",
@@ -20,9 +20,9 @@
"@polkadot/util-crypto": "^10.1.2",
"@solana/web3.js": "^1.36.0",
"@walletconnect/encoding": "^1.0.1",
- "@walletconnect/sign-client": "2.9.1",
- "@walletconnect/types": "2.9.1",
- "@walletconnect/utils": "2.9.1",
+ "@walletconnect/sign-client": "2.10.0",
+ "@walletconnect/types": "2.10.0",
+ "@walletconnect/utils": "2.10.0",
"@web3modal/standalone": "2.4.3",
"axios": "^0.21.1",
"blockies-ts": "^1.0.0",
@@ -37,6 +37,7 @@
"qr-image": "^3.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
+ "react-hot-toast": "^2.4.1",
"react-scripts": "^4.0.3",
"solana-wallet": "^1.0.1",
"styled-components": "^5.2.0",
diff --git a/dapps/react-dapp-v2/src/contexts/ClientContext.tsx b/dapps/react-dapp-v2/src/contexts/ClientContext.tsx
index fc56383..f384c27 100644
--- a/dapps/react-dapp-v2/src/contexts/ClientContext.tsx
+++ b/dapps/react-dapp-v2/src/contexts/ClientContext.tsx
@@ -1,6 +1,8 @@
import Client from "@walletconnect/sign-client";
import { PairingTypes, SessionTypes } from "@walletconnect/types";
import { Web3Modal } from "@web3modal/standalone";
+import { RELAYER_EVENTS } from "@walletconnect/core";
+import toast from "react-hot-toast";
import { PublicKey } from "@solana/web3.js";
import {
@@ -155,7 +157,6 @@ export function ClientContextProvider({
"optionalNamespaces config for connect:",
optionalNamespaces
);
-
const { uri, approval } = await client.connect({
pairingTopic: pairing?.topic,
requiredNamespaces,
@@ -179,6 +180,9 @@ export function ClientContextProvider({
setPairings(client.pairing.getAll({ active: true }));
} catch (e) {
console.error(e);
+ toast.error((e as Error).message, {
+ position: "bottom-left",
+ });
// ignore rejection
} finally {
// close modal in case it was open
@@ -202,11 +206,13 @@ export function ClientContextProvider({
reason: getSdkError("USER_DISCONNECTED"),
});
} catch (error) {
- console.error("SignClient.disconnect failed:", error);
- } finally {
- // Reset app state after disconnect.
- reset();
+ toast.error((error as Error).message, {
+ position: "bottom-left",
+ });
+ return;
}
+ // Reset app state after disconnect.
+ reset();
}, [client, session]);
const _subscribeToEvents = useCallback(
@@ -323,12 +329,30 @@ export function ClientContextProvider({
useEffect(() => {
if (!client) {
createClient();
- } else if (prevRelayerValue.current !== relayerRegion) {
+ } else if (
+ prevRelayerValue.current &&
+ prevRelayerValue.current !== relayerRegion
+ ) {
client.core.relayer.restartTransport(relayerRegion);
prevRelayerValue.current = relayerRegion;
}
}, [createClient, relayerRegion, client]);
+ useEffect(() => {
+ if (!client) return;
+ client.core.relayer.on(RELAYER_EVENTS.connect, () => {
+ toast.success("Network connection is restored!", {
+ position: "bottom-left",
+ });
+ });
+
+ client.core.relayer.on(RELAYER_EVENTS.disconnect, () => {
+ toast.error("Network connection lost.", {
+ position: "bottom-left",
+ });
+ });
+ }, [client]);
+
const value = useMemo(
() => ({
pairings,
diff --git a/dapps/react-dapp-v2/src/pages/_app.tsx b/dapps/react-dapp-v2/src/pages/_app.tsx
index 2f49b9c..c6c8ce7 100644
--- a/dapps/react-dapp-v2/src/pages/_app.tsx
+++ b/dapps/react-dapp-v2/src/pages/_app.tsx
@@ -1,6 +1,7 @@
import "../styles/globals.css";
import type { AppProps } from "next/app";
import { createGlobalStyle } from "styled-components";
+import { Toaster } from "react-hot-toast";
import { ClientContextProvider } from "../contexts/ClientContext";
import { JsonRpcContextProvider } from "../contexts/JsonRpcContext";
@@ -15,6 +16,7 @@ const GlobalStyle = createGlobalStyle`
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
+
diff --git a/dapps/react-dapp-v2/yarn.lock b/dapps/react-dapp-v2/yarn.lock
index c0ddfe9..3db8ec1 100644
--- a/dapps/react-dapp-v2/yarn.lock
+++ b/dapps/react-dapp-v2/yarn.lock
@@ -3414,6 +3414,28 @@
"@typescript-eslint/types" "5.59.7"
eslint-visitor-keys "^3.3.0"
+"@walletconnect/core@2.10.0":
+ version "2.10.0"
+ resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.10.0.tgz#b659de4dfb374becd938964abd4f2150d410e617"
+ integrity sha512-Z8pdorfIMueuiBXLdnf7yloiO9JIiobuxN3j0OTal+MYc4q5/2O7d+jdD1DAXbLi1taJx3x60UXT/FPVkjIqIQ==
+ dependencies:
+ "@walletconnect/heartbeat" "1.2.1"
+ "@walletconnect/jsonrpc-provider" "1.0.13"
+ "@walletconnect/jsonrpc-types" "1.0.3"
+ "@walletconnect/jsonrpc-utils" "1.0.8"
+ "@walletconnect/jsonrpc-ws-connection" "1.0.13"
+ "@walletconnect/keyvaluestorage" "^1.0.2"
+ "@walletconnect/logger" "^2.0.1"
+ "@walletconnect/relay-api" "^1.0.9"
+ "@walletconnect/relay-auth" "^1.0.4"
+ "@walletconnect/safe-json" "^1.0.2"
+ "@walletconnect/time" "^1.0.2"
+ "@walletconnect/types" "2.10.0"
+ "@walletconnect/utils" "2.10.0"
+ events "^3.3.0"
+ lodash.isequal "4.5.0"
+ uint8arrays "^3.1.0"
+
"@walletconnect/core@2.8.6":
version "2.8.6"
resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.8.6.tgz#1db6acae36437dbe7357be7767f1faeda5d4ca6c"
@@ -3436,28 +3458,6 @@
lodash.isequal "4.5.0"
uint8arrays "^3.1.0"
-"@walletconnect/core@2.9.1":
- version "2.9.1"
- resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.9.1.tgz#1a333933750f5f933d9b7788a8dae44ce1173063"
- integrity sha512-xyWeP0eLhEEDQAVJSmqs4n/AClKUM+8os2ZFe7BTuw1tFYjeLNVDtKCHziVOSTh8wEChMsKSGKA4zerQoH8mAQ==
- dependencies:
- "@walletconnect/heartbeat" "1.2.1"
- "@walletconnect/jsonrpc-provider" "1.0.13"
- "@walletconnect/jsonrpc-types" "1.0.3"
- "@walletconnect/jsonrpc-utils" "1.0.8"
- "@walletconnect/jsonrpc-ws-connection" "1.0.13"
- "@walletconnect/keyvaluestorage" "^1.0.2"
- "@walletconnect/logger" "^2.0.1"
- "@walletconnect/relay-api" "^1.0.9"
- "@walletconnect/relay-auth" "^1.0.4"
- "@walletconnect/safe-json" "^1.0.2"
- "@walletconnect/time" "^1.0.2"
- "@walletconnect/types" "2.9.1"
- "@walletconnect/utils" "2.9.1"
- events "^3.3.0"
- lodash.isequal "4.5.0"
- uint8arrays "^3.1.0"
-
"@walletconnect/encoding@^1.0.1":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@walletconnect/encoding/-/encoding-1.0.2.tgz#cb3942ad038d6a6bf01158f66773062dd25724da"
@@ -3571,19 +3571,19 @@
dependencies:
tslib "1.14.1"
-"@walletconnect/sign-client@2.9.1":
- version "2.9.1"
- resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.9.1.tgz#e4aa9c7b15849f450fdd1b03754a7517cb5c8811"
- integrity sha512-Z7tFRrJ9btA1vU427vsjUS6cPlHQVcTWdKH90khEc2lv3dB6mU8FNO0VJsw+I2D7CW7WaMWF3nnj6Z1FfotbDg==
+"@walletconnect/sign-client@2.10.0":
+ version "2.10.0"
+ resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.10.0.tgz#0fee8f12821e37783099f0c7bd64e6efdfbd9d86"
+ integrity sha512-hbDljDS53kR/It3oXD91UkcOsT6diNnW5+Zzksm0YEfwww5dop/YfNlcdnc8+jKUhWOL/YDPNQCjzsCSNlVzbw==
dependencies:
- "@walletconnect/core" "2.9.1"
+ "@walletconnect/core" "2.10.0"
"@walletconnect/events" "^1.0.1"
"@walletconnect/heartbeat" "1.2.1"
"@walletconnect/jsonrpc-utils" "1.0.8"
"@walletconnect/logger" "^2.0.1"
"@walletconnect/time" "^1.0.2"
- "@walletconnect/types" "2.9.1"
- "@walletconnect/utils" "2.9.1"
+ "@walletconnect/types" "2.10.0"
+ "@walletconnect/utils" "2.10.0"
events "^3.3.0"
"@walletconnect/sign-client@~2.8.1":
@@ -3608,6 +3608,18 @@
dependencies:
tslib "1.14.1"
+"@walletconnect/types@2.10.0":
+ version "2.10.0"
+ resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.10.0.tgz#5d63235b49e03d609521402a4b49627dbc4ed514"
+ integrity sha512-kSTA/WZnbKdEbvbXSW16Ty6dOSzOZCHnGg6JH7q1MuraalD2HuNg00lVVu7QAZ/Rj1Gn9DAkrgP5Wd5a8Xq//Q==
+ dependencies:
+ "@walletconnect/events" "^1.0.1"
+ "@walletconnect/heartbeat" "1.2.1"
+ "@walletconnect/jsonrpc-types" "1.0.3"
+ "@walletconnect/keyvaluestorage" "^1.0.2"
+ "@walletconnect/logger" "^2.0.1"
+ events "^3.3.0"
+
"@walletconnect/types@2.8.6", "@walletconnect/types@~2.8.1":
version "2.8.6"
resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.8.6.tgz#71426144db3fa693170a95f89f5d6e594ab2d901"
@@ -3620,17 +3632,25 @@
"@walletconnect/logger" "^2.0.1"
events "^3.3.0"
-"@walletconnect/types@2.9.1":
- version "2.9.1"
- resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.9.1.tgz#cb32ff396cc8880a7395f28716d1e82f407e1372"
- integrity sha512-xbGgTPuD6xsb7YMvCESBIH55cjB86QAnnVL50a/ED42YkQzDsOdJ0VGTbrm0tG5cxUOF933rpxZQjxGdP+ovww==
+"@walletconnect/utils@2.10.0":
+ version "2.10.0"
+ resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.10.0.tgz#6918d12180d797b8bd4a19fb2ff128e394e181d6"
+ integrity sha512-9GRyEz/7CJW+G04RvrjPET5k7hOEsB9b3fF9cWDk/iDCxSWpbkU/hv/urRB36C+gvQMAZgIZYX3dHfzJWkY/2g==
dependencies:
- "@walletconnect/events" "^1.0.1"
- "@walletconnect/heartbeat" "1.2.1"
- "@walletconnect/jsonrpc-types" "1.0.3"
- "@walletconnect/keyvaluestorage" "^1.0.2"
- "@walletconnect/logger" "^2.0.1"
- events "^3.3.0"
+ "@stablelib/chacha20poly1305" "1.0.1"
+ "@stablelib/hkdf" "1.0.1"
+ "@stablelib/random" "^1.0.2"
+ "@stablelib/sha256" "1.0.1"
+ "@stablelib/x25519" "^1.0.3"
+ "@walletconnect/relay-api" "^1.0.9"
+ "@walletconnect/safe-json" "^1.0.2"
+ "@walletconnect/time" "^1.0.2"
+ "@walletconnect/types" "2.10.0"
+ "@walletconnect/window-getters" "^1.0.1"
+ "@walletconnect/window-metadata" "^1.0.1"
+ detect-browser "5.3.0"
+ query-string "7.1.3"
+ uint8arrays "^3.1.0"
"@walletconnect/utils@2.8.6":
version "2.8.6"
@@ -3652,26 +3672,6 @@
query-string "7.1.3"
uint8arrays "^3.1.0"
-"@walletconnect/utils@2.9.1":
- version "2.9.1"
- resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.9.1.tgz#92abc24b3af3ead42a3864e019dbf2f651ab2e47"
- integrity sha512-tXeQVebF5oPBvhdmuUyVSkSIBYx/egIi4czav1QrnUpwrUS1LsrFhyWBxSbhN7TXY287ULWkEf6aFpWOHdp5EA==
- dependencies:
- "@stablelib/chacha20poly1305" "1.0.1"
- "@stablelib/hkdf" "1.0.1"
- "@stablelib/random" "^1.0.2"
- "@stablelib/sha256" "1.0.1"
- "@stablelib/x25519" "^1.0.3"
- "@walletconnect/relay-api" "^1.0.9"
- "@walletconnect/safe-json" "^1.0.2"
- "@walletconnect/time" "^1.0.2"
- "@walletconnect/types" "2.9.1"
- "@walletconnect/window-getters" "^1.0.1"
- "@walletconnect/window-metadata" "^1.0.1"
- detect-browser "5.3.0"
- query-string "7.1.3"
- uint8arrays "^3.1.0"
-
"@walletconnect/window-getters@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@walletconnect/window-getters/-/window-getters-1.0.1.tgz#f36d1c72558a7f6b87ecc4451fc8bd44f63cbbdc"
@@ -7764,6 +7764,11 @@ globby@^6.1.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"
+goober@^2.1.10:
+ version "2.1.13"
+ resolved "https://registry.yarnpkg.com/goober/-/goober-2.1.13.tgz#e3c06d5578486212a76c9eba860cbc3232ff6d7c"
+ integrity sha512-jFj3BQeleOoy7t93E9rZ2de+ScC4lQICLwiAQmKMg9F6roKGaLSHoCDYKkWlSafg138jejvq/mTdvmnwDQgqoQ==
+
gopd@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
@@ -11991,6 +11996,13 @@ react-error-overlay@^6.0.9:
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb"
integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==
+react-hot-toast@^2.4.1:
+ version "2.4.1"
+ resolved "https://registry.yarnpkg.com/react-hot-toast/-/react-hot-toast-2.4.1.tgz#df04295eda8a7b12c4f968e54a61c8d36f4c0994"
+ integrity sha512-j8z+cQbWIM5LY37pR6uZR6D4LfseplqnuAO4co4u8917hBUvXlEqyP1ZzqVLcqoyUesZZv/ImreoCeHVDpE5pQ==
+ dependencies:
+ goober "^2.1.10"
+
react-is@^16.13.1, react-is@^16.7.0:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
diff --git a/wallets/react-wallet-v2/package.json b/wallets/react-wallet-v2/package.json
index b1d213e..0296ef3 100644
--- a/wallets/react-wallet-v2/package.json
+++ b/wallets/react-wallet-v2/package.json
@@ -24,8 +24,8 @@
"@solana/web3.js": "1.43.0",
"@taquito/signer": "^15.1.0",
"@taquito/taquito": "^15.1.0",
- "@walletconnect/sign-client": "2.9.1",
- "@walletconnect/utils": "2.9.1",
+ "@walletconnect/sign-client": "2.10.0",
+ "@walletconnect/utils": "2.10.0",
"bs58": "5.0.0",
"cosmos-wallet": "1.2.0",
"ethers": "5.6.6",
@@ -36,6 +36,7 @@
"react": "17.0.2",
"react-code-blocks": "0.0.9-0",
"react-dom": "17.0.2",
+ "react-hot-toast": "^2.4.1",
"react-qr-reader-es6": "2.2.1-2",
"solana-wallet": "^1.0.2",
"tronweb": "^4.4.0",
@@ -44,7 +45,7 @@
"devDependencies": {
"@types/node": "17.0.35",
"@types/react": "18.0.9",
- "@walletconnect/types": "2.9.0",
+ "@walletconnect/types": "2.10.0",
"eslint": "8.15.0",
"eslint-config-next": "12.1.6",
"eslint-config-prettier": "8.5.0",
diff --git a/wallets/react-wallet-v2/src/components/AccountCard.tsx b/wallets/react-wallet-v2/src/components/AccountCard.tsx
index f41e55f..b1f3902 100644
--- a/wallets/react-wallet-v2/src/components/AccountCard.tsx
+++ b/wallets/react-wallet-v2/src/components/AccountCard.tsx
@@ -16,7 +16,7 @@ interface Props {
chainId: string
}
-export default function AccountCard({ name, logo, rgb, address, chainId }: Props) {
+export default function AccountCard({ name, logo, rgb, address = '', chainId }: Props) {
const [copied, setCopied] = useState(false)
const { activeChainId, account } = useSnapshot(SettingsStore.state)
function onCopy() {
@@ -38,7 +38,7 @@ export default function AccountCard({ name, logo, rgb, address, chainId }: Props
{name}
- {truncate(address, 19)}
+ {address ? truncate(address, 19) : ''}
diff --git a/wallets/react-wallet-v2/src/components/AccountPicker.tsx b/wallets/react-wallet-v2/src/components/AccountPicker.tsx
index 0e3baf0..8aa3d0d 100644
--- a/wallets/react-wallet-v2/src/components/AccountPicker.tsx
+++ b/wallets/react-wallet-v2/src/components/AccountPicker.tsx
@@ -14,6 +14,7 @@ export default function AccountPicker() {
function onSelect(value: string) {
const account = Number(value)
+ console.log('account', account)
SettingsStore.setAccount(account)
SettingsStore.setEIP155Address(eip155Addresses[account])
SettingsStore.setCosmosAddress(cosmosAddresses[account])
@@ -26,7 +27,12 @@ export default function AccountPicker() {
}
return (
-