diff --git a/app/content/common-errors.md b/app/content/common-errors.md
deleted file mode 100644
index 6a6b5d8..0000000
--- a/app/content/common-errors.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-description: ''
-head:
- meta:
- - name: 'keywords'
- content: ''
----
-
-# Common Errors
-
-Common errors, common solutions.
-
-
-- ["getActivePinia()" was called but there was no active Pinia.](https://github.com/vu3th/vue-dapp/issues/160){:target="_blank"}
-
diff --git a/app/content/eips.md b/app/content/eips.md
index 099bcf5..9eba6cf 100644
--- a/app/content/eips.md
+++ b/app/content/eips.md
@@ -13,8 +13,10 @@ Collect the EIPs related to DApp development, especially in frontend.
## EIP-1193
- [EIP-1193: Ethereum Provider JavaScript API](https://eips.ethereum.org/EIPS/eip-1193){:target="_blank"}
+ - [Provider Errors](https://eips.ethereum.org/EIPS/eip-1193#provider-errors){:target="_blank"}
- [Eip1193Provider - ethers v6](https://docs.ethers.org/v6/api/providers/#Eip1193Provider){:target="_blank"}
+
## EIP-6963
- [EIP-6963: Multi Injected Provider Discovery](https://eips.ethereum.org/EIPS/eip-6963){:target="_blank"}
- [eip6963.org](https://eip6963.org/){:target="_blank"}
@@ -24,4 +26,3 @@ Collect the EIPs related to DApp development, especially in frontend.
- [EIP-3326: Wallet Switch Ethereum Chain RPC Method](https://eips.ethereum.org/EIPS/eip-3326){:target="_blank"}
- [EIP-1474: Remote procedure call specification](https://eips.ethereum.org/EIPS/eip-1474){:target="_blank"}
-
diff --git a/app/content/errors.md b/app/content/errors.md
new file mode 100644
index 0000000..084fea7
--- /dev/null
+++ b/app/content/errors.md
@@ -0,0 +1,27 @@
+---
+description: ''
+head:
+ meta:
+ - name: 'keywords'
+ content: ''
+---
+
+# Errors
+
+## Provider Errors
+
+- [EIP-1193 Provider Errors](https://eips.ethereum.org/EIPS/eip-1193#provider-errors){:target="_blank"}
+
+| Status code | Name | Description |
+| ----------- | --------------------- | ------------------------------------------------------------------------ |
+| 4001 | User Rejected Request | The user rejected the request. |
+| 4100 | Unauthorized | The requested method and/or account has not been authorized by the user. |
+| 4200 | Unsupported Method | The Provider does not support the requested method. |
+| 4900 | Disconnected | The Provider is disconnected from all chains. |
+| 4901 | Chain Disconnected | The Provider is not connected to the requested chain. |
+
+
+## Developing Common Errors
+
+- ["getActivePinia()" was called but there was no active Pinia.](https://github.com/vu3th/vue-dapp/issues/160){:target="_blank"}
+
diff --git a/app/core/sidebar.ts b/app/core/sidebar.ts
index 1c807f9..b44c06f 100644
--- a/app/core/sidebar.ts
+++ b/app/core/sidebar.ts
@@ -100,11 +100,11 @@ export const sidebarMenu = [
h(
NuxtLink,
{
- to: '/common-errors',
+ to: '/errors',
},
- { default: () => 'Common Errors' },
+ { default: () => 'Errors' },
),
- key: '/common-errors',
+ key: '/errors',
},
{
label: () =>
diff --git a/app/pages/index.vue b/app/pages/index.vue
index 0aa5bf7..51e3a2c 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -1,7 +1,6 @@
@@ -105,7 +112,7 @@ const items = computed- (() => [
Disconnect
- {{ wallet.error }}
+ {{ connectError }}
{
readonly name = 'WalletConnect'
#provider?: IEthereumProvider
- #onDisconnectHandler?: (args: ProviderRpcError) => void
+ #onDisconnectHandler?: (err: ProviderRpcError) => void
#onAccountsChangedHandler?: (accounts: string[]) => void
#onChainChangedHandler?: (chainId: number) => void
@@ -25,14 +26,24 @@ export class WalletConnectConnector extends Connector {
+ provider.on('disconnect', (err: any) => {
if (!provider.connected) {
- throw new UserRejectedRequestError(args.message)
+ throw new UserRejectedRequestError(err.message)
}
})
- try {
- await provider.enable()
- } catch (err: any) {
- throw new Error(err)
- }
-
return provider
}
@@ -66,7 +71,7 @@ export class WalletConnectConnector extends Connector void) {
+ onDisconnect(handler: (err: ProviderRpcError) => void) {
if (!this.#provider) throw new ProviderNotFoundError()
if (this.#onDisconnectHandler) {
this.#removeListener('disconnect', this.#onDisconnectHandler)