@exodus/web3-ethereum 1.5.0 → 1.6.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.
@@ -12,11 +12,11 @@ export declare class EthereumProvider extends BaseProvider<EthereumProviderEvent
12
12
  constructor({ accountsObservable, storage, supportedChainIds, transport, getDefaultChainId, }: Deps);
13
13
  protected _callRpcMethod<Params, Response>(method: string, params: Params): Promise<Response>;
14
14
  isConnected(): boolean;
15
- request(args: RequestArguments): Promise<unknown>;
15
+ request: (args: RequestArguments) => Promise<unknown>;
16
16
  get chainId(): ChainId | null;
17
17
  get selectedAddress(): string | null;
18
- enable(): Promise<string[]>;
19
- send(methodOrPayload: string | JsonRpcRequest, paramsOrCallback: unknown[] | JsonRpcCallback): Promise<void | JsonRpcResult>;
20
- sendAsync(payload: JsonRpcRequest, callback: JsonRpcCallback): void;
18
+ enable: () => Promise<string[]>;
19
+ send: (methodOrPayload: string | JsonRpcRequest, paramsOrCallback: unknown[] | JsonRpcCallback) => Promise<void | JsonRpcResult>;
20
+ sendAsync: (payload: JsonRpcRequest, callback: JsonRpcCallback) => void;
21
21
  }
22
22
  export {};
@@ -63,7 +63,7 @@ export class EthereumProvider extends BaseProvider {
63
63
  #initialize = async () => {
64
64
  const chainId = await this.#getChainId();
65
65
  this.#handleConnect(chainId);
66
- this.#handleChainChanged(chainId);
66
+ this.#handleChainChanged(chainId.toLowerCase());
67
67
  const accounts = await this.#getAccounts();
68
68
  this.#handleAccountsChanged(accounts);
69
69
  this.#initialized = true;
@@ -110,7 +110,7 @@ export class EthereumProvider extends BaseProvider {
110
110
  // Get default chain Id from remote config
111
111
  const defaultChainId = await this.#getDefaultChainId();
112
112
  if (defaultChainId) {
113
- this.#handleChainChanged(defaultChainId);
113
+ this.#handleChainChanged(defaultChainId.toLowerCase());
114
114
  }
115
115
  }
116
116
  return accounts;
@@ -132,7 +132,7 @@ export class EthereumProvider extends BaseProvider {
132
132
  isConnected() {
133
133
  return this.#isConnected;
134
134
  }
135
- async request(args) {
135
+ request = async (args) => {
136
136
  await this.#awaitInitialized();
137
137
  this.#assertConnected();
138
138
  const { method, params = [] } = args;
@@ -184,7 +184,7 @@ export class EthereumProvider extends BaseProvider {
184
184
  revisedParams = params.slice(0, 2);
185
185
  }
186
186
  return this._callRpcMethod(method, revisedParams);
187
- }
187
+ };
188
188
  /*
189
189
  * Legacy API.
190
190
  */
@@ -196,12 +196,12 @@ export class EthereumProvider extends BaseProvider {
196
196
  console.warn('Exodus: "ethereum.selectedAddress" is deprecated and may be removed in the future. Please use "ethereum.request({ method: \'eth_accounts\' })" instead.');
197
197
  return this.#selectedAddress;
198
198
  }
199
- async enable() {
199
+ enable = async () => {
200
200
  console.warn('Exodus: "ethereum.enable()" is deprecated and may be removed in the future. Please use "ethereum.request({ method: \'eth_requestAccounts\' })" instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102.');
201
201
  this.#assertConnected();
202
202
  return this.#requestAccounts();
203
- }
204
- async send(methodOrPayload, paramsOrCallback) {
203
+ };
204
+ send = async (methodOrPayload, paramsOrCallback) => {
205
205
  console.warn('Exodus: "ethereum.send()" is deprecated and may be removed in the future. Please use "ethereum.request()" instead.');
206
206
  const hasMethod = typeof methodOrPayload === 'string';
207
207
  const hasParams = Array.isArray(paramsOrCallback);
@@ -215,8 +215,8 @@ export class EthereumProvider extends BaseProvider {
215
215
  const payload = methodOrPayload;
216
216
  const callback = paramsOrCallback;
217
217
  this.sendAsync(payload, callback);
218
- }
219
- sendAsync(payload, callback) {
218
+ };
219
+ sendAsync = (payload, callback) => {
220
220
  console.warn('Exodus: "ethereum.sendAsync()" is deprecated and may be removed in the future. Please use "ethereum.request()" instead.');
221
221
  const { id, jsonrpc, method, params } = payload;
222
222
  const hasCallback = callback && typeof callback === 'function';
@@ -231,5 +231,5 @@ export class EthereumProvider extends BaseProvider {
231
231
  callback(err, { id, jsonrpc, error: err });
232
232
  }
233
233
  });
234
- }
234
+ };
235
235
  }
@@ -2,7 +2,6 @@ import { retrieveSideEffects } from '@exodus/ethereum-api';
2
2
  import { SIMULATION_SUPPORTED_ASSET_NAMES } from './constant.js';
3
3
  import { createCurrency, formatAccounts, getEthereumDisplayInfo, hexToBN, isEthTransferTx, } from './utils.js';
4
4
  const computeBalanceChanges = async (asset, shouldSimulate, transaction) => {
5
- const assetName = asset.name;
6
5
  let balanceChanges = {
7
6
  willReceive: [],
8
7
  willSend: [],
@@ -21,7 +20,7 @@ const computeBalanceChanges = async (asset, shouldSimulate, transaction) => {
21
20
  else {
22
21
  try {
23
22
  const sideEffect = await retrieveSideEffects({
24
- assetName,
23
+ asset,
25
24
  shouldSimulate,
26
25
  transaction,
27
26
  });
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.5.0",
4
+ "version": "1.6.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "module": "lib/index.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@exodus/currency": "^2.1.2",
35
- "@exodus/ethereum-api": "^3.2.4",
35
+ "@exodus/ethereum-api": "^6.0.0",
36
36
  "@exodus/web3-constants": "^1.15.0",
37
37
  "@exodus/web3-ethereum-utils": "^1.8.0",
38
38
  "@exodus/web3-provider": "^2.13.0",
@@ -50,5 +50,5 @@
50
50
  "peerDependencies": {
51
51
  "@exodus/assets": "^8.0.72"
52
52
  },
53
- "gitHead": "4a0c077d0175fe3c6a35e2f9a459f8cad214e8f6"
53
+ "gitHead": "3fcce134ea23c362a54f9e4142c33b160835a7fd"
54
54
  }