@exodus/web3-ethereum 12.22.6 → 13.0.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.
@@ -1,15 +1,6 @@
1
1
  import { getNonce as apiGetNonce, getServer } from '@exodus/ethereum-api';
2
- import { InvalidInputError } from '@exodus/web3-errors';
3
- import { signMessage, signTypedData, hex0xStringToBuffer, bufferToHex0xString, } from '@exodus/web3-ethereum-utils';
4
- import { SignTypedDataVersion } from '@metamask/eth-sig-util';
5
- async function getDefaultPurposeForLedger(asset) {
6
- const purposes = await asset.api.getSupportedPurposes({
7
- compatibilityMode: 'ledger',
8
- });
9
- return purposes[0];
10
- }
11
2
  const createEVMDepsFactory = ({ analytics, blockchainMetadata, }) => {
12
- return ({ addEthereumChain, assetName, chainId: _chainId, origin, getAsset, getAddress: _getAddress, getSupportedChainIds, getPrivateKey, getFeeData: getFeeConfig, getCustomFeeRate, getActiveWalletAccount, simulateEthereumTransactions, getActiveWalletAccountData, transactionSigner, messageSigner: _messageSigner, getLedgerDevice, onEthWalletWatchAssetRequest: _onEthWalletWatchAssetRequest, }) => {
3
+ return ({ addEthereumChain, assetName, chainId: _chainId, origin, getAsset, getAddress: _getAddress, getSupportedChainIds, getFeeData: getFeeConfig, getCustomFeeRate, getActiveWalletAccount, simulateEthereumTransactions, getActiveWalletAccountData, transactionSigner, messageSigner, onEthWalletWatchAssetRequest: _onEthWalletWatchAssetRequest, }) => {
13
4
  const asset = getAsset(assetName);
14
5
  const server = getServer(asset);
15
6
  const forwardRequest = async ({ method, params }) => {
@@ -104,52 +95,6 @@ const createEVMDepsFactory = ({ analytics, blockchainMetadata, }) => {
104
95
  });
105
96
  return true;
106
97
  };
107
- const messageSigner = _messageSigner
108
- ? _messageSigner
109
- : {
110
- signMessage: async ({ baseAssetName, walletAccount, message, }) => {
111
- const { rawMessage, EIP712Message } = message;
112
- if (rawMessage && EIP712Message) {
113
- throw new InvalidInputError("Can't set both rawMessage and EIP712Message");
114
- }
115
- if (walletAccount.source === 'exodus') {
116
- if (!getPrivateKey) {
117
- throw new Error('`getPrivateKey` should be provided to sign with Exodus accounts.');
118
- }
119
- const { privateKey } = await getPrivateKey(assetName);
120
- if (rawMessage) {
121
- return hex0xStringToBuffer(signMessage(bufferToHex0xString(rawMessage), privateKey));
122
- }
123
- if (EIP712Message) {
124
- const typedDataVersion = Array.isArray(EIP712Message)
125
- ? SignTypedDataVersion.V1
126
- : SignTypedDataVersion.V4;
127
- return hex0xStringToBuffer(signTypedData(EIP712Message, privateKey, typedDataVersion));
128
- }
129
- }
130
- else if (getLedgerDevice) {
131
- const device = await getLedgerDevice();
132
- const purpose = await getDefaultPurposeForLedger(asset);
133
- const { derivationPath } = await getAsset(assetName).baseAsset.api.getKeyIdentifier({
134
- compatibilityMode: 'ledger',
135
- purpose,
136
- accountIndex: 0,
137
- chainIndex: 0,
138
- addressIndex: 0,
139
- });
140
- const signedMessage = await device.signMessage({
141
- assetName: baseAssetName,
142
- derivationPath,
143
- message: {
144
- rawMessage,
145
- EIP712Message,
146
- },
147
- });
148
- return Buffer.from(signedMessage);
149
- }
150
- throw new InvalidInputError();
151
- },
152
- };
153
98
  return {
154
99
  addEthereumChain,
155
100
  chainId: _chainId || 'undefined',
package/lib/types.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { EthAggregatedTransactionSimulationResult, EthSimulateTransactionPa
4
4
  import type { EthTransactionParams } from '@exodus/web3-ethereum-utils';
5
5
  import type { WalletStandardCommonDeps } from '@exodus/web3-provider';
6
6
  import type { CommonDeps } from '@exodus/web3-rpc-handlers';
7
- import type { Asset, CreateSimulationServiceParams, EthereumFeeData, GetActiveWalletAccountData, GetFeeDataParams, GetLedgerDevice, IAnalyticsModule, IBlockchainMetadataModule, IMessageSignerModule, ITransactionSignerModule, NumberUnit } from '@exodus/web3-types';
7
+ import type { Asset, CreateSimulationServiceParams, EthereumFeeData, GetActiveWalletAccountData, GetFeeDataParams, IAnalyticsModule, IBlockchainMetadataModule, IMessageSignerModule, ITransactionSignerModule, NumberUnit } from '@exodus/web3-types';
8
8
  import type { TypedDataV1 } from '@metamask/eth-sig-util';
9
9
  import type { MessageTypes, TypedMessage } from '@metamask/eth-sig-util/sign-typed-data';
10
10
  /**
@@ -36,14 +36,10 @@ export interface CreateEvmDepsParams {
36
36
  getFeeData: ({ assetName }: GetFeeDataParams) => Promise<EthereumFeeData>;
37
37
  getCustomFeeRate?: () => Promise<NumberUnit>;
38
38
  getSupportedChainIds?: () => Promise<string[]>;
39
- getPrivateKey?: (assetName: string) => Promise<{
40
- privateKey: Buffer;
41
- }>;
42
39
  simulateEthereumTransactions: SimulateTransactionsFn;
43
40
  getActiveWalletAccountData: GetActiveWalletAccountData;
44
41
  transactionSigner: EVMTransactionSignerModule;
45
- messageSigner?: EVMMessageSigner;
46
- getLedgerDevice?: GetLedgerDevice;
42
+ messageSigner: EVMMessageSigner;
47
43
  onEthWalletWatchAssetRequest?: (param: EthWalletWatchAsset) => Promise<boolean>;
48
44
  }
49
45
  export declare type EVMFactory = (params: CreateEvmDepsParams) => EVMDeps;
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": "12.22.6",
4
+ "version": "13.0.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "module": "lib/index.js",
@@ -34,10 +34,10 @@
34
34
  "dependencies": {
35
35
  "@exodus/ethereum-api": "^8.1.5",
36
36
  "@exodus/web3-constants": "^1.30.0",
37
- "@exodus/web3-ethereum-utils": "^3.36.3",
37
+ "@exodus/web3-ethereum-utils": "^3.36.5",
38
38
  "@exodus/web3-provider": "^3.15.0",
39
39
  "@exodus/web3-rpc-handlers": "^2.25.0",
40
- "@exodus/web3-utils": "^1.48.1",
40
+ "@exodus/web3-utils": "^1.48.2",
41
41
  "bn.js": "^5.2.0",
42
42
  "eth-rpc-errors": "^4.0.3"
43
43
  },
@@ -50,5 +50,5 @@
50
50
  "@exodus/web3-validation": "^1.38.0",
51
51
  "@wallet-standard/base": "^1.0.1"
52
52
  },
53
- "gitHead": "a6abe8f6f3e30bfa0bd317c315760965446ab066"
53
+ "gitHead": "555e9064541b78607367d4098ec70fb74403d4a2"
54
54
  }