12
12
13
13
export addresses, keys, transactions
14
14
15
- proc signTransaction* (tx: Transaction, privateKey: PrivateKey, eip155 = true ): Transaction =
15
+ proc signTransaction* (
16
+ tx: Transaction, privateKey: PrivateKey, eip155 = true
17
+ ): Transaction =
16
18
result = tx
17
19
result .signature = result .sign(privateKey, eip155)
18
20
@@ -30,27 +32,19 @@ func validateChainId*(tx: Transaction, chainId: ChainId): bool =
30
32
chainId == tx.chainId
31
33
32
34
func maxPriorityFeePerGasNorm* (tx: Transaction): GasInt =
33
- if tx.txType < TxEip1559:
34
- tx.gasPrice
35
- else :
36
- tx.maxPriorityFeePerGas
35
+ if tx.txType < TxEip1559: tx.gasPrice else : tx.maxPriorityFeePerGas
37
36
38
37
func maxFeePerGasNorm* (tx: Transaction): GasInt =
39
- if tx.txType < TxEip1559:
40
- tx.gasPrice
41
- else :
42
- tx.maxFeePerGas
38
+ if tx.txType < TxEip1559: tx.gasPrice else : tx.maxFeePerGas
43
39
44
40
func effectiveGasPrice* (tx: Transaction, baseFeePerGas: GasInt): GasInt =
45
41
if tx.txType < TxEip1559:
46
42
tx.gasPrice
47
43
else :
48
- baseFeePerGas +
49
- min(tx.maxPriorityFeePerGas, tx.maxFeePerGas - baseFeePerGas)
44
+ baseFeePerGas + min(tx.maxPriorityFeePerGas, tx.maxFeePerGas - baseFeePerGas)
50
45
51
- func effectiveGasTip* (tx: Transaction; baseFeePerGas: Opt[UInt256]): GasInt =
52
- let
53
- baseFeePerGas = baseFeePerGas.get(0 .u256).truncate(GasInt)
46
+ func effectiveGasTip* (tx: Transaction, baseFeePerGas: Opt[UInt256]): GasInt =
47
+ let baseFeePerGas = baseFeePerGas.get(0 .u256).truncate(GasInt)
54
48
55
49
min(tx.maxPriorityFeePerGasNorm(), tx.maxFeePerGasNorm() - baseFeePerGas)
56
50
0 commit comments