@exodus/web3-ethereum-utils 4.5.0 → 4.5.1
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/lib/signatures.js +9 -12
- package/lib/transactions.d.ts +5 -1
- package/lib/transactions.js +6 -6
- package/package.json +4 -3
package/lib/signatures.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getEthereumJsTxByTransactionProps } from '@exodus/ethereum-lib';
|
|
2
2
|
import { SignTypedDataVersion, personalSign, signTypedData as ethSigUtilSignTypedData, } from '@exodus/ethereumjs/eth-sig-util';
|
|
3
|
-
import
|
|
4
|
-
const custom = Common.default?.custom || Common.custom;
|
|
3
|
+
import assert from 'minimalistic-assert';
|
|
5
4
|
export function signMessage(message, privateKey) {
|
|
6
5
|
return personalSign({ privateKey, data: message });
|
|
7
6
|
}
|
|
@@ -9,15 +8,13 @@ export function signTypedData(typedData, privateKey, version = SignTypedDataVers
|
|
|
9
8
|
return ethSigUtilSignTypedData({ privateKey, data: typedData, version });
|
|
10
9
|
}
|
|
11
10
|
export function signTransaction(transactionParams, privateKey) {
|
|
12
|
-
const { chainId, ...
|
|
13
|
-
|
|
14
|
-
const transaction =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
common: custom({ chainId }),
|
|
20
|
-
});
|
|
11
|
+
const { chainId, ...transactionProps } = transactionParams;
|
|
12
|
+
assert(typeof chainId === 'number', 'signTransaction must be explicitly passed a chainId');
|
|
13
|
+
const transaction = getEthereumJsTxByTransactionProps({
|
|
14
|
+
chainId,
|
|
15
|
+
eip1559Enabled: Boolean(transactionProps.maxFeePerGas),
|
|
16
|
+
transactionProps,
|
|
17
|
+
});
|
|
21
18
|
const signedTransaction = transaction.sign(privateKey);
|
|
22
19
|
return signedTransaction.serialize();
|
|
23
20
|
}
|
package/lib/transactions.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { EthTransaction } from './types.js';
|
|
2
2
|
import type { ApprovalBalanceChange } from '@exodus/web3-types';
|
|
3
|
-
export declare function getTransactionId(
|
|
3
|
+
export declare function getTransactionId({ chainId, serializedTransaction, }: {
|
|
4
|
+
chainId: number;
|
|
5
|
+
serializedTransaction: Buffer;
|
|
6
|
+
eip1559Enabled?: boolean;
|
|
7
|
+
}): string;
|
|
4
8
|
export declare function getDisplayDetails(willApprove: ApprovalBalanceChange[]): {
|
|
5
9
|
title: string;
|
|
6
10
|
};
|
package/lib/transactions.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getEthereumJsTxByTransactionBuffer } from '@exodus/ethereum-lib';
|
|
2
2
|
import SolidityContract from '@exodus/solidity-contract';
|
|
3
|
-
export function getTransactionId(serializedTransaction,
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
:
|
|
7
|
-
|
|
3
|
+
export function getTransactionId({ chainId, serializedTransaction, }) {
|
|
4
|
+
const transaction = getEthereumJsTxByTransactionBuffer({
|
|
5
|
+
chainId,
|
|
6
|
+
transactionBuffer: serializedTransaction,
|
|
7
|
+
});
|
|
8
8
|
return `0x${transaction.hash().toString('hex')}`;
|
|
9
9
|
}
|
|
10
10
|
export function getDisplayDetails(willApprove) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/web3-ethereum-utils",
|
|
3
3
|
"description": "Web3 Ethereum utils.",
|
|
4
|
-
"version": "4.5.
|
|
4
|
+
"version": "4.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
"test": "run -T exodus-test --jest --esbuild"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@exodus/web3-types": "1.
|
|
37
|
+
"@exodus/web3-types": "1.59.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@exodus/basic-utils": "^3.0.1",
|
|
41
|
+
"@exodus/ethereum-lib": "^5.18.1",
|
|
41
42
|
"@exodus/ethereumjs": "^1.5.0",
|
|
42
43
|
"@exodus/solidity-contract": "^1.2.1",
|
|
43
44
|
"@exodus/web3-utils": "^1.50.1",
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aweb3-ethereum-utils"
|
|
49
50
|
},
|
|
50
51
|
"homepage": "https://github.com/ExodusMovement/assets/tree/master/web3/web3-ethereum-utils",
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "f6ea2714c95f2e7ec71ffecdc589726b7974511e"
|
|
52
53
|
}
|