@exodus/ethereum-lib 4.2.1 → 4.2.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
4
4
|
"description": "Ethereum Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"ms": "^2.1.1",
|
|
45
45
|
"reselect": "~3.0.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "932d009fbd44833d111c7b73142f62e671623ab3"
|
|
48
48
|
}
|
package/src/fee-data/cronos.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FeeData } from '@exodus/asset-lib'
|
|
2
2
|
import { asset } from '@exodus/cronos-meta'
|
|
3
3
|
|
|
4
|
+
// https://cronoscan.com/chart/gasprice
|
|
4
5
|
export default new FeeData({
|
|
5
6
|
config: {
|
|
6
|
-
gasPrice: '
|
|
7
|
-
max: '
|
|
8
|
-
min: '
|
|
9
|
-
fuelThreshold: '
|
|
7
|
+
gasPrice: '11250 Gwei',
|
|
8
|
+
max: '250000 Gwei',
|
|
9
|
+
min: '10000 Gwei',
|
|
10
|
+
fuelThreshold: '10000 Gwei',
|
|
10
11
|
gasPriceEconomicalRate: 0.8,
|
|
11
12
|
gasPriceMinimumRate: 0.6,
|
|
12
13
|
enableFeeDelegation: false,
|
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
/* @flow */
|
|
2
1
|
import { Transaction, FeeMarketEIP1559Transaction } from '@exodus/ethereumjs-tx'
|
|
3
|
-
import Common from '@exodus/ethereumjs-common'
|
|
2
|
+
import Common, { Hardfork } from '@exodus/ethereumjs-common'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
import { CUSTOM_CHAINS } from '../constants'
|
|
7
|
-
|
|
8
|
-
export default function createEthereumJsTx(unsignedTx: UnsignedTransaction) {
|
|
4
|
+
export default function createEthereumJsTx(unsignedTx) {
|
|
9
5
|
const {
|
|
10
|
-
txData: {
|
|
6
|
+
txData: { chainId, ...txData },
|
|
11
7
|
txMeta: { eip1559Enabled },
|
|
12
8
|
} = unsignedTx
|
|
9
|
+
const { gasPrice, tipGasPrice } = txData
|
|
13
10
|
|
|
14
|
-
let tx
|
|
15
11
|
/*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
So we must prevent building accidentally an EIP1559 tx on bsc if tipGasPrice is set
|
|
20
|
-
`eip` will be set with s corresponding feature flag in the wallet
|
|
12
|
+
EIP1559 is not supported by all ethereum-like assets.
|
|
13
|
+
e.g BSC does not support EIP1559 at the moment, prevent building an EIP1559 transaction
|
|
14
|
+
if `tipGasPrice` or `maxPriorityFeePerGas` is set.
|
|
21
15
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const isEip1559Tx = !!(unsignedTx.txData.tipGasPrice || unsignedTx.txData.maxPriorityFeePerGas)
|
|
17
|
+
if (eip1559Enabled && isEip1559Tx) {
|
|
18
|
+
return FeeMarketEIP1559Transaction.fromTxData(
|
|
24
19
|
{
|
|
25
20
|
maxFeePerGas: gasPrice,
|
|
26
|
-
maxPriorityFeePerGas,
|
|
27
|
-
|
|
21
|
+
maxPriorityFeePerGas: tipGasPrice,
|
|
22
|
+
// `maxPriorityFeePerGas`, `maxFeePerGas` set in `txData` below take precedence over ^.
|
|
28
23
|
...txData,
|
|
29
24
|
},
|
|
30
25
|
{
|
|
31
|
-
common:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
common: Common.custom(
|
|
27
|
+
{
|
|
28
|
+
chainId,
|
|
29
|
+
},
|
|
30
|
+
{ hardfork: Hardfork.London }
|
|
31
|
+
),
|
|
37
32
|
}
|
|
38
33
|
)
|
|
39
34
|
} else {
|
|
40
35
|
// Legacy tx
|
|
41
|
-
|
|
42
|
-
{ gasPrice, ...txData },
|
|
43
|
-
{ common: Common.custom({ chainId: chain }) }
|
|
44
|
-
)
|
|
36
|
+
return Transaction.fromTxData(txData, { common: Common.custom({ chainId }) })
|
|
45
37
|
}
|
|
46
|
-
return tx
|
|
47
38
|
}
|