Some more modules for the stickers refactor (#112)
* refactor: add additional sticker functions * refactor: add network module
This commit is contained in:
parent
b66a0fd88a
commit
323f53af32
|
@ -27,4 +27,7 @@ proc sendTransaction*(transactionData: string, password: string): RpcResponse[Js
|
|||
|
||||
# This is the replacement of the `call` function
|
||||
proc doEthCall*(payload = %* []): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
core.callPrivateRPC("eth_call", payload)
|
||||
core.callPrivateRPC("eth_call", payload)
|
||||
|
||||
proc estimateGas*(payload = %* []): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
core.callPrivateRPC("eth_estimateGas", payload)
|
|
@ -0,0 +1,12 @@
|
|||
import json
|
||||
|
||||
import ./core, ./response_type
|
||||
|
||||
proc getNetworks*(payload: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
core.callPrivateRPC("wallet_getEthereumChains", payload)
|
||||
|
||||
proc upsertNetwork*(payload: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
core.callPrivateRPC("wallet_addEthereumChain", payload)
|
||||
|
||||
proc deleteNetwork*(payload: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
core.callPrivateRPC("wallet_deleteEthereumChain", payload)
|
|
@ -41,3 +41,16 @@ proc getPackIdFromTokenId*(address: string, data: string): RpcResponse[JsonNode]
|
|||
raise newException(RpcException, "Error getting pack id from token id: " & response.error.message)
|
||||
|
||||
return response
|
||||
|
||||
proc getPackCount*(address: string, data: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [{
|
||||
"to": address,
|
||||
"data": data
|
||||
}, "latest"]
|
||||
|
||||
let response = eth.doEthCall(payload)
|
||||
|
||||
if not response.error.isNil:
|
||||
raise newException(RpcException, "Error getting stickers balance: " & response.error.message)
|
||||
|
||||
return response
|
Loading…
Reference in New Issue