2021-09-08 18:05:39 +00:00
|
|
|
import
|
|
|
|
web3/ethtypes
|
|
|
|
|
|
|
|
import
|
2021-09-11 12:09:52 +00:00
|
|
|
transactions, ../types/[rpc_response, transaction]
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2021-09-10 17:27:49 +00:00
|
|
|
proc sendTransaction*(tx: var TransactionData, password: string, success: var bool): string =
|
2021-09-08 18:05:39 +00:00
|
|
|
success = true
|
|
|
|
try:
|
|
|
|
let response = transactions.sendTransaction(tx, password)
|
|
|
|
result = response.result
|
|
|
|
except RpcException as e:
|
|
|
|
success = false
|
|
|
|
result = e.msg
|
|
|
|
|
2021-09-10 17:27:49 +00:00
|
|
|
proc estimateGas*(tx: var TransactionData, success: var bool): string =
|
2021-09-08 18:05:39 +00:00
|
|
|
success = true
|
|
|
|
try:
|
|
|
|
let response = transactions.estimateGas(tx)
|
|
|
|
result = response.result
|
|
|
|
except RpcException as e:
|
|
|
|
success = false
|
|
|
|
result = e.msg
|