Skip to content

Commit 9f3fb48

Browse files
Merge pull request #222 from ABMatrix/master
correct gasLimit
2 parents a45f86b + eab0871 commit 9f3fb48

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Sources/web3swift/Transaction/EthereumTransaction.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ public extension EthereumTransaction {
332332
switch gL {
333333
case .manual(let value):
334334
tx.gasLimit = value
335+
case .limited(let value):
336+
tx.gasLimit = value
335337
default:
336338
tx.gasLimit = BigUInt(UInt64(21000))
337339
}

Sources/web3swift/Web3/Web3+Options.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ public struct TransactionOptions {
125125
var options = TransactionOptions()
126126
if let gas = json["gas"] as? String, let gasBiguint = BigUInt(gas.stripHexPrefix().lowercased(), radix: 16) {
127127
options.gasLimit = .limited(gasBiguint)
128-
} else {
129-
options.gasLimit = .automatic
130-
}
131-
if let gasLimit = json["gasLimit"] as? String, let gasgasLimitBiguint = BigUInt(gasLimit.stripHexPrefix().lowercased(), radix: 16) {
128+
} else if let gasLimit = json["gasLimit"] as? String, let gasgasLimitBiguint = BigUInt(gasLimit.stripHexPrefix().lowercased(), radix: 16) {
132129
options.gasLimit = .limited(gasgasLimitBiguint)
133130
} else {
134131
options.gasLimit = .automatic

0 commit comments

Comments
 (0)