Skip to content

Commit 99c75af

Browse files
committed
fix zero value on gas estimation
1 parent 233d2a0 commit 99c75af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web3swift/Transaction/Classes/EthereumTransaction.swift

+5-2
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,13 @@ public struct EthereumTransaction: CustomStringConvertible {
322322
static func createRequest(method: JSONRPCmethod, transaction: EthereumTransaction, transactionOptions: TransactionOptions?) -> JSONRPCrequest? {
323323
let onBlock = transactionOptions?.callOnBlock?.stringValue
324324
var request = JSONRPCrequest()
325+
var tx = transaction
325326
request.method = method
326327
let from = transactionOptions?.from
327-
// guard let from = options?.from else {return nil}
328-
guard var txParams = transaction.encodeAsDictionary(from: from) else {return nil}
328+
if transactionOptions != nil, transactionOptions!.value != nil {
329+
tx.value = transactionOptions!.value!
330+
}
331+
guard var txParams = tx.encodeAsDictionary(from: from) else {return nil}
329332
if method == .estimateGas || transactionOptions?.gasLimit == nil {
330333
txParams.gas = nil
331334
}

0 commit comments

Comments
 (0)