@exodus/web3-ethereum 13.3.0 → 13.5.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,8 +1,8 @@
|
|
|
1
|
+
import { SignTypedDataVersion } from '@exodus/ethereumjs/eth-sig-util';
|
|
1
2
|
import { AssetNotSupportedError, InvalidInputError, UnauthorizedError, UnsupportedMethodError, UserRejectedRequestError, } from '@exodus/web3-errors';
|
|
2
3
|
import { bufferToHex0xString, hex0xStringToBuffer, } from '@exodus/web3-ethereum-utils';
|
|
3
4
|
import { connect } from '@exodus/web3-rpc-handlers';
|
|
4
5
|
import { hexToBN } from '@exodus/web3-utils';
|
|
5
|
-
import { SignTypedDataVersion } from '@metamask/eth-sig-util';
|
|
6
6
|
import { parseAndValidateTypedData } from './parseAndValidateTypedData.js';
|
|
7
7
|
// See: https://eips.ethereum.org/EIPS/eip-2255.
|
|
8
8
|
const ETH_ACCOUNTS_PERMISSION = 'eth_accounts';
|
|
@@ -197,11 +197,17 @@ export function exposeHandlers(rpc, deps) {
|
|
|
197
197
|
async function approveAndSignTypedData(typedData) {
|
|
198
198
|
await assertTrusted();
|
|
199
199
|
await ensureUnlocked();
|
|
200
|
-
const parsedTypedData = parseAndValidateTypedData(typedData, { chainId });
|
|
201
|
-
const message = typedDataToMessage(typedData, SignTypedDataVersion.V4);
|
|
202
|
-
await approve(approveMessage, network, message);
|
|
203
200
|
const walletAccount = await getActiveWalletAccountData();
|
|
204
201
|
const asset = await getAsset(network);
|
|
202
|
+
const address = await getAddress();
|
|
203
|
+
const parsedTypedData = parseAndValidateTypedData(typedData, { chainId });
|
|
204
|
+
const message = typedDataToMessage(typedData, SignTypedDataVersion.V4);
|
|
205
|
+
const simulationResult = await asset.baseAsset.api.web3.simulateMessage({
|
|
206
|
+
address,
|
|
207
|
+
message,
|
|
208
|
+
url: new URL(getOrigin()),
|
|
209
|
+
});
|
|
210
|
+
await approve(approveMessage, network, message, walletAccount.toString(), simulationResult);
|
|
205
211
|
const signedMessageBuffer = await messageSigner.signMessage({
|
|
206
212
|
walletAccount,
|
|
207
213
|
baseAssetName: asset.baseAssetName,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageTypes, TypedDataV1, TypedMessage } from '@
|
|
1
|
+
import type { MessageTypes, TypedDataV1, TypedMessage } from '@exodus/ethereumjs/eth-sig-util';
|
|
2
2
|
export declare function convertChainIdToHex(chainId: string): string;
|
|
3
3
|
export declare function parseAndValidateTypedData(typedData: string, { chainId: activeChainId }: {
|
|
4
4
|
chainId: string;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import type { AddEthereumChainParameter, EthereumProvider } from './provider/index.js';
|
|
2
|
+
import type { MessageTypes, TypedDataV1, TypedMessage } from '@exodus/ethereumjs/eth-sig-util';
|
|
4
3
|
import type { EthAggregatedTransactionSimulationResult, EthSimulateTransactionParams, EthTransaction, EthTransactionHash, EthWalletWatchAsset } from '@exodus/web3-ethereum-utils';
|
|
5
4
|
import type { EthTransactionParams } from '@exodus/web3-ethereum-utils';
|
|
6
5
|
import type { WalletStandardCommonDeps } from '@exodus/web3-provider';
|
|
7
6
|
import type { CommonDeps } from '@exodus/web3-rpc-handlers';
|
|
8
7
|
import type { Asset, CreateSimulationServiceParams, EthereumFeeData, GetActiveWalletAccountData, GetFeeDataParams, IAnalyticsModule, IBlockchainMetadataModule, IMessageSignerModule, ITransactionSignerModule, NumberUnit } from '@exodus/web3-types';
|
|
9
|
-
import type { TypedDataV1 } from '@metamask/eth-sig-util';
|
|
10
|
-
import type { MessageTypes, TypedMessage } from '@metamask/eth-sig-util/sign-typed-data';
|
|
11
8
|
/**
|
|
12
9
|
* EVM-compatible chains.
|
|
13
10
|
*/
|
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": "13.
|
|
4
|
+
"version": "13.5.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@exodus/ethereum-api": "^8.31.0",
|
|
43
43
|
"@exodus/web3-constants": "^1.30.0",
|
|
44
|
-
"@exodus/web3-ethereum-utils": "^4.
|
|
44
|
+
"@exodus/web3-ethereum-utils": "^4.4.0",
|
|
45
45
|
"@exodus/web3-provider": "^3.15.0",
|
|
46
46
|
"@exodus/web3-rpc-handlers": "^2.25.0",
|
|
47
47
|
"@exodus/web3-utils": "^1.48.2",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"eth-rpc-errors": "^4.0.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@exodus/assets": "^11.2
|
|
53
|
-
"@exodus/ethereum-meta": "^2.4
|
|
52
|
+
"@exodus/assets": "^11.3.2",
|
|
53
|
+
"@exodus/ethereum-meta": "^2.8.4",
|
|
54
54
|
"@exodus/json-rpc": "^1.11.0",
|
|
55
55
|
"@exodus/schemasafe": "^1.0.0",
|
|
56
56
|
"@exodus/web3-management": "0.36.1",
|
|
57
|
-
"@exodus/web3-types": "1.
|
|
57
|
+
"@exodus/web3-types": "1.58.0",
|
|
58
58
|
"@exodus/web3-validation": "^1.38.0",
|
|
59
59
|
"@wallet-standard/base": "^1.0.1"
|
|
60
60
|
},
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aweb3-ethereum"
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://github.com/ExodusMovement/assets/tree/master/web3/web3-ethereum",
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "4a17ab063edca012f7ca2458c31100e6ed816e48"
|
|
67
67
|
}
|