From 82116d3b14ae623ef25d2853dcebb6a2cebe34e7 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 25 Jan 2022 15:07:16 +0100 Subject: [PATCH] Add eth_sendTransaction() --- ethers/providers/rpccalls/conversions.nim | 8 ++++++++ ethers/providers/rpccalls/signatures.nim | 1 + 2 files changed, 9 insertions(+) diff --git a/ethers/providers/rpccalls/conversions.nim b/ethers/providers/rpccalls/conversions.nim index 1a21ed7..493b061 100644 --- a/ethers/providers/rpccalls/conversions.nim +++ b/ethers/providers/rpccalls/conversions.nim @@ -12,6 +12,14 @@ func `%`*(bytes: seq[byte]): JsonNode = func fromJson*(json: JsonNode, name: string, result: var seq[byte]) = result = hexToSeqByte(json.getStr()) +# byte arrays + +func `%`*[N](bytes: array[N, byte]): JsonNode = + %("0x" & bytes.toHex) + +func fromJson*[N](json: JsonNode, name: string, result: var array[N, byte]) = + hexToByteArray(json.getStr(), result) + # Address func `%`*(address: Address): JsonNode = diff --git a/ethers/providers/rpccalls/signatures.nim b/ethers/providers/rpccalls/signatures.nim index 68ade27..e7eb521 100644 --- a/ethers/providers/rpccalls/signatures.nim +++ b/ethers/providers/rpccalls/signatures.nim @@ -6,3 +6,4 @@ proc eth_gasPrice(): UInt256 proc eth_getTransactionCount(address: Address, blockTag: BlockTag): UInt256 proc eth_estimateGas(transaction: Transaction): UInt256 proc eth_chainId(): UInt256 +proc eth_sendTransaction(transaction: Transaction): array[32, byte]