@exodus/web3-ethereum 1.2.0 → 1.3.0

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.
@@ -38,30 +38,30 @@ export class EthereumProvider extends BaseProvider {
38
38
  const prefix = this.#chainId;
39
39
  return super._callRpcMethod(`${prefix}_${method}`, params);
40
40
  }
41
- #assertConnected() {
41
+ #assertConnected = () => {
42
42
  if (!this.isConnected()) {
43
43
  throw ethErrors.provider.disconnected({
44
44
  message: 'The Provider is disconnected from all chains.',
45
45
  });
46
46
  }
47
- }
48
- #assertChainSupported(chainId) {
47
+ };
48
+ #assertChainSupported = (chainId) => {
49
49
  if (!this.#supportedChainIds.includes(chainId)) {
50
50
  throw ethErrors.provider.custom({
51
51
  message: 'The Provider does not support the requested chain.',
52
52
  code: 4902,
53
53
  });
54
54
  }
55
- }
56
- async #getChainId() {
55
+ };
56
+ #getChainId = async () => {
57
57
  const storedChainId = await this.#storage.getChainId();
58
58
  const defaultChainId = this.#supportedChainIds[0];
59
59
  return storedChainId ?? defaultChainId;
60
- }
61
- async #getAccounts() {
60
+ };
61
+ #getAccounts = async () => {
62
62
  return this._callRpcMethod('eth_accounts', []);
63
- }
64
- async #initialize() {
63
+ };
64
+ #initialize = async () => {
65
65
  const chainId = await this.#getChainId();
66
66
  this.#handleConnect(chainId);
67
67
  this.#handleChainChanged(chainId);
@@ -69,19 +69,19 @@ export class EthereumProvider extends BaseProvider {
69
69
  this.#handleAccountsChanged(accounts);
70
70
  this.#initialized = true;
71
71
  this.#initializePromise = null;
72
- }
73
- async #awaitInitialized() {
72
+ };
73
+ #awaitInitialized = async () => {
74
74
  if (this.#initializePromise) {
75
75
  await this.#initializePromise;
76
76
  }
77
- }
78
- #handleConnect(chainId) {
77
+ };
78
+ #handleConnect = (chainId) => {
79
79
  if (!this.#isConnected) {
80
80
  this.#isConnected = true;
81
81
  this.emit('connect', { chainId });
82
82
  }
83
- }
84
- #handleChainChanged(chainId) {
83
+ };
84
+ #handleChainChanged = (chainId) => {
85
85
  if (!chainId || typeof chainId !== 'string' || !chainId.startsWith('0x')) {
86
86
  return;
87
87
  }
@@ -91,8 +91,8 @@ export class EthereumProvider extends BaseProvider {
91
91
  this.emit('chainChanged', chainId);
92
92
  }
93
93
  }
94
- }
95
- #handleAccountsChanged(accounts) {
94
+ };
95
+ #handleAccountsChanged = (accounts) => {
96
96
  // `accounts` is always going to have a single account (or none) for the time being.
97
97
  if (this.#accounts[0] !== accounts[0]) {
98
98
  this.#accounts = accounts;
@@ -101,8 +101,8 @@ export class EthereumProvider extends BaseProvider {
101
101
  this.emit('accountsChanged', accounts);
102
102
  }
103
103
  }
104
- }
105
- async #requestAccounts() {
104
+ };
105
+ #requestAccounts = async () => {
106
106
  const permissions = { eth_accounts: {} };
107
107
  await this._callRpcMethod('wallet_requestPermissions', [permissions]);
108
108
  const accounts = await this._callRpcMethod('eth_accounts', []);
@@ -115,21 +115,21 @@ export class EthereumProvider extends BaseProvider {
115
115
  }
116
116
  }
117
117
  return accounts;
118
- }
119
- async #addChain(chainId) {
118
+ };
119
+ #addChain = async (chainId) => {
120
120
  // Exodus does not support the addition of custom chains.
121
121
  // If the requested chain is supported, the provider will switch to that chain.
122
122
  // This matches MetaMask's behavior.
123
123
  // See: https://github.com/MetaMask/metamask-extension/blob/d92936475a942fed060bb36f810ee6bfd901f4f4/app/scripts/lib/rpc-method-middleware/handlers/add-ethereum-chain.js#L167-L183.
124
124
  return this.#switchChain(chainId);
125
- }
126
- async #switchChain(chainId) {
125
+ };
126
+ #switchChain = async (chainId) => {
127
127
  const lowerCaseChainId = chainId.toLowerCase();
128
128
  this.#assertChainSupported(lowerCaseChainId);
129
129
  this.#handleChainChanged(lowerCaseChainId);
130
130
  await this.#storage.setChainId(lowerCaseChainId);
131
131
  return null;
132
- }
132
+ };
133
133
  isConnected() {
134
134
  return this.#isConnected;
135
135
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exodus/web3-ethereum",
3
3
  "description": "Apps connectivity library for EVM-compatible chains.",
4
- "version": "1.2.0",
4
+ "version": "1.3.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "module": "lib/index.js",
@@ -42,11 +42,11 @@
42
42
  "@exodus/json-rpc": "^1.11.0",
43
43
  "@exodus/schemasafe": "^1.0.0-rc.7",
44
44
  "@exodus/web3-types": "^1.6.0",
45
- "@exodus/web3-validation": "^1.26.0",
45
+ "@exodus/web3-validation": "^1.27.0",
46
46
  "@wallet-standard/base": "^1.0.1"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@exodus/assets": "^8.0.72"
50
50
  },
51
- "gitHead": "39137384d78bfa3e008b92e47e106a7be1df071e"
51
+ "gitHead": "91de31ee30652f2f8acc66f6e1d909fd27174a36"
52
52
  }