parent
f18e09769a
commit
b1775357c3
|
@ -110,7 +110,6 @@ QtObject:
|
|||
|
||||
proc estimateGas*(self: View, from_addr: string, to: string, assetAddress: string, value: string, data: string): string {.slot.} =
|
||||
result = self.delegate.estimateGas(from_addr, to, assetAddress, value, data)
|
||||
result = self.delegate.estimateGas(from_addr, to, assetAddress, value, data)
|
||||
|
||||
proc transactionSent*(self: View, txResult: string) {.signal.}
|
||||
|
||||
|
|
|
@ -224,7 +224,6 @@ QtObject:
|
|||
): string {.slot.} =
|
||||
var response: RpcResponse[JsonNode]
|
||||
# TODO make this async
|
||||
try:
|
||||
if assetAddress != ZERO_ADDRESS and not assetAddress.isEmptyOrWhitespace:
|
||||
var tx = buildTokenTransaction(
|
||||
parseAddress(from_addr),
|
||||
|
@ -240,24 +239,28 @@ QtObject:
|
|||
let transfer = Transfer(to: parseAddress(to), value: conversion.eth2Wei(parseFloat(value), token.decimals))
|
||||
let transferproc = ERC20_procS.toTable["transfer"]
|
||||
var success: bool
|
||||
try:
|
||||
let gas = transferproc.estimateGas(tx, transfer, success)
|
||||
|
||||
let res = fromHex[int](gas)
|
||||
result = $(%* { "result": res, "success": success })
|
||||
else:
|
||||
return $(%* { "result": res, "success": success })
|
||||
except Exception as e:
|
||||
error "Error estimating gas", msg = e.msg
|
||||
return $(%* { "result": "-1", "success": false, "error": { "message": e.msg } })
|
||||
|
||||
var tx = ens_utils.buildTransaction(
|
||||
parseAddress(from_addr),
|
||||
eth2Wei(parseFloat(value), 18),
|
||||
data = data
|
||||
)
|
||||
tx.to = parseAddress(to).some
|
||||
try:
|
||||
response = eth.estimateGas(%*[%tx])
|
||||
|
||||
let res = fromHex[int](response.result.getStr)
|
||||
result = $(%* { "result": %res, "success": true })
|
||||
except Exception as e:
|
||||
error "Error estimating gas", msg = e.msg
|
||||
result = $(%* { "result": "-1", "success": false, "error": { "message": e.msg } })
|
||||
return $(%* { "result": "-1", "success": false })
|
||||
|
||||
|
||||
proc transferEth*(
|
||||
self: Service,
|
||||
|
|
Loading…
Reference in New Issue