Skip to content

Commit

Permalink
Merge pull request #222 from ABMatrix/master
Browse files Browse the repository at this point in the history
correct gasLimit
  • Loading branch information
TonioMacaronio authored Oct 19, 2019
2 parents a45f86b + eab0871 commit 9f3fb48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Sources/web3swift/Transaction/EthereumTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ public extension EthereumTransaction {
switch gL {
case .manual(let value):
tx.gasLimit = value
case .limited(let value):
tx.gasLimit = value
default:
tx.gasLimit = BigUInt(UInt64(21000))
}
Expand Down
5 changes: 1 addition & 4 deletions Sources/web3swift/Web3/Web3+Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@ public struct TransactionOptions {
var options = TransactionOptions()
if let gas = json["gas"] as? String, let gasBiguint = BigUInt(gas.stripHexPrefix().lowercased(), radix: 16) {
options.gasLimit = .limited(gasBiguint)
} else {
options.gasLimit = .automatic
}
if let gasLimit = json["gasLimit"] as? String, let gasgasLimitBiguint = BigUInt(gasLimit.stripHexPrefix().lowercased(), radix: 16) {
} else if let gasLimit = json["gasLimit"] as? String, let gasgasLimitBiguint = BigUInt(gasLimit.stripHexPrefix().lowercased(), radix: 16) {
options.gasLimit = .limited(gasgasLimitBiguint)
} else {
options.gasLimit = .automatic
Expand Down

0 comments on commit 9f3fb48

Please sign in to comment.