@exodus/web3-ethereum-utils 0.3.0 → 1.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.
- package/lib/signatures.js +3 -4
- package/lib/types.d.ts +2 -0
- package/package.json +2 -2
package/lib/signatures.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Common from '@exodus/ethereumjs-common';
|
|
2
|
-
import {
|
|
1
|
+
import Common, { Hardfork } from '@exodus/ethereumjs-common';
|
|
2
|
+
import { FeeMarketEIP1559Transaction } from '@exodus/ethereumjs-tx';
|
|
3
3
|
import { SignTypedDataVersion, personalSign, signTypedData as ethSigUtilSignTypedData, } from '@metamask/eth-sig-util';
|
|
4
4
|
export function signMessage(message, privateKey) {
|
|
5
5
|
return personalSign({ privateKey, data: message });
|
|
@@ -8,10 +8,9 @@ export function signTypedData(typedData, privateKey, version = SignTypedDataVers
|
|
|
8
8
|
return ethSigUtilSignTypedData({ privateKey, data: typedData, version });
|
|
9
9
|
}
|
|
10
10
|
export function signTransaction(transactionParams, privateKey) {
|
|
11
|
-
// TODO: Do we need to support EIP-1559 transactions?
|
|
12
11
|
const { chainId: hexChainId, gas, ...rest } = transactionParams;
|
|
13
12
|
const chainId = Number.parseInt(hexChainId, 16);
|
|
14
|
-
const transaction =
|
|
13
|
+
const transaction = FeeMarketEIP1559Transaction.fromTxData({ ...rest, gasLimit: gas }, { common: Common.custom({ chainId }, { hardfork: Hardfork.London }) });
|
|
15
14
|
const signedTransaction = transaction.sign(privateKey);
|
|
16
15
|
const rawTransaction = `0x${signedTransaction.serialize().toString('hex')}`;
|
|
17
16
|
return rawTransaction;
|
package/lib/types.d.ts
CHANGED
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": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"@exodus/ethereumjs-tx": "^3.3.0-exodus.6",
|
|
31
31
|
"@metamask/eth-sig-util": "^4.0.1"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "1d201bfb4846428da9700d42de33426b7d3f65ea"
|
|
34
34
|
}
|