refactor: transactions and ens procs updated
- `getGasPrice` proc added - `PendingTransactionType` should be part of the desktop app, not needed here in this context, removed.
This commit is contained in:
parent
9b7f9a086d
commit
af79b4f758
|
@ -33,4 +33,7 @@ proc estimateGas*(payload = %* []): RpcResponse[JsonNode] {.raises: [Exception].
|
||||||
core.callPrivateRPC("eth_estimateGas", payload)
|
core.callPrivateRPC("eth_estimateGas", payload)
|
||||||
|
|
||||||
proc getEthAccounts*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc getEthAccounts*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
return core.callPrivateRPC("eth_accounts")
|
return core.callPrivateRPC("eth_accounts")
|
||||||
|
|
||||||
|
proc getGasPrice*(payload = %* []): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("eth_gasPrice", payload)
|
||||||
|
|
|
@ -2,13 +2,6 @@ import json, stint, chronicles, strutils
|
||||||
|
|
||||||
import ./core as core
|
import ./core as core
|
||||||
|
|
||||||
type PendingTransactionType* {.pure.} = enum
|
|
||||||
RegisterENS = "RegisterENS",
|
|
||||||
SetPubKey = "SetPubKey",
|
|
||||||
ReleaseENS = "ReleaseENS",
|
|
||||||
BuyStickerPack = "BuyStickerPack"
|
|
||||||
WalletTransfer = "WalletTransfer"
|
|
||||||
|
|
||||||
proc checkRecentHistory*(addresses: seq[string]) {.raises: [Exception].} =
|
proc checkRecentHistory*(addresses: seq[string]) {.raises: [Exception].} =
|
||||||
let payload = %* [addresses]
|
let payload = %* [addresses]
|
||||||
discard callPrivateRPC("wallet_checkRecentHistory", payload)
|
discard callPrivateRPC("wallet_checkRecentHistory", payload)
|
||||||
|
@ -19,6 +12,18 @@ proc getTransfersByAddress*(address: string, toBlock: Uint256, limitAsHexWithout
|
||||||
|
|
||||||
callPrivateRPC("wallet_getTransfersByAddress", %* [address, toBlockParsed, limitAsHexWithoutLeadingZeros, loadMore])
|
callPrivateRPC("wallet_getTransfersByAddress", %* [address, toBlockParsed, limitAsHexWithoutLeadingZeros, loadMore])
|
||||||
|
|
||||||
proc trackPendingTransaction*(hash: string, fromAddress: string, toAddress: string, trxType: PendingTransactionType, data: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc trackPendingTransaction*(hash: string, fromAddress: string, toAddress: string, trxType: string, data: string):
|
||||||
let payload = %* [{"hash": hash, "from": fromAddress, "to": toAddress, "type": $trxType, "additionalData": data, "data": "", "value": 0, "timestamp": 0, "gasPrice": 0, "gasLimit": 0}]
|
RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
let payload = %* [{
|
||||||
|
"hash": hash,
|
||||||
|
"from": fromAddress,
|
||||||
|
"to": toAddress,
|
||||||
|
"type": trxType,
|
||||||
|
"additionalData": data,
|
||||||
|
"data": "",
|
||||||
|
"value": 0,
|
||||||
|
"timestamp": 0,
|
||||||
|
"gasPrice": 0,
|
||||||
|
"gasLimit": 0
|
||||||
|
}]
|
||||||
callPrivateRPC("wallet_storePendingTransaction", payload)
|
callPrivateRPC("wallet_storePendingTransaction", payload)
|
Loading…
Reference in New Issue