@wagmi/core 0.7.4 → 0.7.5
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/{chunk-FJTAQ7YO.js → chunk-MS4CUBFJ.js} +6 -6
- package/dist/connectors/coinbaseWallet.js +1 -1
- package/dist/connectors/metaMask.js +11 -6
- package/dist/connectors/mock/index.js +1 -1
- package/dist/connectors/walletConnect.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
|
@@ -1771,7 +1771,10 @@ var InjectedConnector = class extends Connector {
|
|
|
1771
1771
|
provider.on("disconnect", this.onDisconnect);
|
|
1772
1772
|
}
|
|
1773
1773
|
this.emit("message", { type: "connecting" });
|
|
1774
|
-
const
|
|
1774
|
+
const accounts = await provider.request({
|
|
1775
|
+
method: "eth_requestAccounts"
|
|
1776
|
+
});
|
|
1777
|
+
const account = getAddress(accounts[0]);
|
|
1775
1778
|
let id = await this.getChainId();
|
|
1776
1779
|
let unsupported = this.isChainUnsupported(id);
|
|
1777
1780
|
if (chainId2 && id !== chainId2) {
|
|
@@ -1805,7 +1808,7 @@ var InjectedConnector = class extends Connector {
|
|
|
1805
1808
|
if (!provider)
|
|
1806
1809
|
throw new ConnectorNotFoundError();
|
|
1807
1810
|
const accounts = await provider.request({
|
|
1808
|
-
method: "
|
|
1811
|
+
method: "eth_accounts"
|
|
1809
1812
|
});
|
|
1810
1813
|
return getAddress(accounts[0]);
|
|
1811
1814
|
}
|
|
@@ -1837,10 +1840,7 @@ var InjectedConnector = class extends Connector {
|
|
|
1837
1840
|
const provider = await this.getProvider();
|
|
1838
1841
|
if (!provider)
|
|
1839
1842
|
throw new ConnectorNotFoundError();
|
|
1840
|
-
const
|
|
1841
|
-
method: "eth_accounts"
|
|
1842
|
-
});
|
|
1843
|
-
const account = accounts[0];
|
|
1843
|
+
const account = await this.getAccount();
|
|
1844
1844
|
return !!account;
|
|
1845
1845
|
} catch {
|
|
1846
1846
|
return false;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ResourceUnavailableError,
|
|
5
5
|
UserRejectedRequestError,
|
|
6
6
|
getClient
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-MS4CUBFJ.js";
|
|
8
8
|
import "../chunk-4DNFSL2K.js";
|
|
9
9
|
import {
|
|
10
10
|
__privateAdd,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "../chunk-MQXBDTVK.js";
|
|
15
15
|
|
|
16
16
|
// src/connectors/metaMask.ts
|
|
17
|
+
import { getAddress } from "ethers/lib/utils.js";
|
|
17
18
|
var _provider, _UNSTABLE_shimOnConnectSelectAccount, _getReady, getReady_fn, _findProvider, findProvider_fn;
|
|
18
19
|
var MetaMaskConnector = class extends InjectedConnector {
|
|
19
20
|
constructor({
|
|
@@ -46,18 +47,22 @@ var MetaMaskConnector = class extends InjectedConnector {
|
|
|
46
47
|
provider.on("disconnect", this.onDisconnect);
|
|
47
48
|
}
|
|
48
49
|
this.emit("message", { type: "connecting" });
|
|
50
|
+
let account = null;
|
|
49
51
|
if (__privateGet(this, _UNSTABLE_shimOnConnectSelectAccount) && this.options?.shimDisconnect && !getClient().storage?.getItem(this.shimDisconnectKey)) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}).catch(() => []);
|
|
53
|
-
const isConnected = !!accounts[0];
|
|
52
|
+
account = await this.getAccount().catch(() => null);
|
|
53
|
+
const isConnected = !!account;
|
|
54
54
|
if (isConnected)
|
|
55
55
|
await provider.request({
|
|
56
56
|
method: "wallet_requestPermissions",
|
|
57
57
|
params: [{ eth_accounts: {} }]
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
if (!account) {
|
|
61
|
+
const accounts = await provider.request({
|
|
62
|
+
method: "eth_requestAccounts"
|
|
63
|
+
});
|
|
64
|
+
account = getAddress(accounts[0]);
|
|
65
|
+
}
|
|
61
66
|
let id = await this.getChainId();
|
|
62
67
|
let unsupported = this.isChainUnsupported(id);
|
|
63
68
|
if (chainId && id !== chainId) {
|
package/dist/index.js
CHANGED
package/dist/internal.js
CHANGED