@@ -293,7 +293,7 @@ extension web3.Eth {
293
293
}
294
294
295
295
public func estimateGas( _ transaction: EthereumTransaction , options: Web3Options ? , onBlock: String = " latest " ) -> Result < BigUInt , Web3Error > {
296
- let mergedOptions = Web3Options . merge ( Web3Options . defaultOptions ( ) , with: options)
296
+ let mergedOptions = Web3Options . merge ( self . options , with: options)
297
297
guard let request = EthereumTransaction . createRequest ( method: JSONRPCmethod . estimateGas, transaction: transaction, onBlock: onBlock, options: mergedOptions) else {
298
298
return Result . failure ( Web3Error . inputError ( " Transaction serialization failed " ) )
299
299
}
@@ -430,5 +430,21 @@ extension web3.Eth {
430
430
return Result ( block)
431
431
}
432
432
}
433
+ public func sendETH( to: EthereumAddress , amount: BigUInt , extraData: Data = Data ( ) , options: Web3Options ? = nil ) -> TransactionIntermediate ? {
434
+ let contract = self . web3. contract ( Web3 . Utils. coldWalletABI, at: to, abiVersion: 2 )
435
+ guard var mergedOptions = Web3Options . merge ( self . options, with: options) else { return nil }
436
+ mergedOptions. value = amount
437
+ let intermediate = contract? . method ( " fallback " , extraData: extraData, options: mergedOptions)
438
+ return intermediate
439
+ }
440
+
441
+ public func sendETH( to: EthereumAddress , amount: String , units: Web3 . Utils . Units = . eth, extraData: Data = Data ( ) , options: Web3Options ? = nil ) -> TransactionIntermediate ? {
442
+ let contract = self . web3. contract ( Web3 . Utils. coldWalletABI, at: to, abiVersion: 2 )
443
+ guard var mergedOptions = Web3Options . merge ( self . options, with: options) else { return nil }
444
+ guard let value = Web3 . Utils. parseToBigUInt ( amount, units: . eth) else { return nil }
445
+ mergedOptions. value = value
446
+ let intermediate = contract? . method ( " fallback " , extraData: extraData, options: mergedOptions)
447
+ return intermediate
448
+ }
433
449
434
450
}
0 commit comments