From 6523e70eafecc3b9728a491058818e685bd384fb Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:06:20 +1100 Subject: [PATCH] fix: `items(JsonNode)` symbol not found (#87) * chore: export subscriptions This has a knock-on effect of nim-serde not being imported into subscriptions when JsonRpcProvider.new is called from a consumer that does not export nim-serde. * import/export serde * Replace all instances of std/json with pkg/serde --- ethers/contract.nim | 2 +- ethers/nimshims/hashes.nim | 2 +- ethers/providers/jsonrpc.nim | 1 + ethers/providers/jsonrpc/subscriptions.nim | 3 +++ testmodule/hardhat.nim | 2 +- testmodule/providers/jsonrpc/testErrors.nim | 2 +- testmodule/providers/jsonrpc/testJsonRpcSubscriptions.nim | 2 +- testmodule/testContracts.nim | 2 +- testmodule/testCustomErrors.nim | 2 +- testmodule/testErc20.nim | 2 +- 10 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ethers/contract.nim b/ethers/contract.nim index db6e68e..8857522 100644 --- a/ethers/contract.nim +++ b/ethers/contract.nim @@ -1,4 +1,4 @@ -import std/json +import pkg/serde import std/macros import std/sequtils import pkg/chronicles diff --git a/ethers/nimshims/hashes.nim b/ethers/nimshims/hashes.nim index c691d9e..a75052b 100644 --- a/ethers/nimshims/hashes.nim +++ b/ethers/nimshims/hashes.nim @@ -2,7 +2,7 @@ ## `std/json.JsonNode.hash`, eg when using `JsonNode` as a `Table` key. Adds ## {.raises: [].} for proper exception tracking. Copied from the std/json module -import std/json +import pkg/serde import std/hashes {.push raises:[].} diff --git a/ethers/providers/jsonrpc.nim b/ethers/providers/jsonrpc.nim index b1e653e..a070909 100644 --- a/ethers/providers/jsonrpc.nim +++ b/ethers/providers/jsonrpc.nim @@ -17,6 +17,7 @@ export basics export provider export chronicles export errors.JsonRpcProviderError +export subscriptions {.push raises: [].} diff --git a/ethers/providers/jsonrpc/subscriptions.nim b/ethers/providers/jsonrpc/subscriptions.nim index d9ea1dd..95a7a25 100644 --- a/ethers/providers/jsonrpc/subscriptions.nim +++ b/ethers/providers/jsonrpc/subscriptions.nim @@ -3,6 +3,7 @@ import std/sequtils import std/strutils import pkg/chronos import pkg/json_rpc/rpcclient +import pkg/serde import ../../basics import ../../provider include ../../nimshims/hashes @@ -10,6 +11,8 @@ import ./rpccalls import ./conversions import ./looping +export serde + type JsonRpcSubscriptions* = ref object of RootObj client: RpcClient diff --git a/testmodule/hardhat.nim b/testmodule/hardhat.nim index 55bd79f..ba19a31 100644 --- a/testmodule/hardhat.nim +++ b/testmodule/hardhat.nim @@ -1,4 +1,4 @@ -import std/json +import pkg/serde import pkg/ethers/basics type Deployment* = object diff --git a/testmodule/providers/jsonrpc/testErrors.nim b/testmodule/providers/jsonrpc/testErrors.nim index afa9eda..fe8cbed 100644 --- a/testmodule/providers/jsonrpc/testErrors.nim +++ b/testmodule/providers/jsonrpc/testErrors.nim @@ -1,5 +1,5 @@ import std/unittest -import std/json +import pkg/serde import pkg/questionable import pkg/ethers/providers/jsonrpc/errors diff --git a/testmodule/providers/jsonrpc/testJsonRpcSubscriptions.nim b/testmodule/providers/jsonrpc/testJsonRpcSubscriptions.nim index d0e2fff..08061a6 100644 --- a/testmodule/providers/jsonrpc/testJsonRpcSubscriptions.nim +++ b/testmodule/providers/jsonrpc/testJsonRpcSubscriptions.nim @@ -1,4 +1,4 @@ -import std/json +import pkg/serde import std/os import std/sequtils import std/importutils diff --git a/testmodule/testContracts.nim b/testmodule/testContracts.nim index f7ef78e..0981f1d 100644 --- a/testmodule/testContracts.nim +++ b/testmodule/testContracts.nim @@ -1,4 +1,4 @@ -import std/json +import pkg/serde import std/os import std/options import pkg/asynctest diff --git a/testmodule/testCustomErrors.nim b/testmodule/testCustomErrors.nim index e03ed95..9038c5e 100644 --- a/testmodule/testCustomErrors.nim +++ b/testmodule/testCustomErrors.nim @@ -1,5 +1,5 @@ import std/os -import std/json +import pkg/serde import pkg/asynctest import pkg/ethers import ./hardhat diff --git a/testmodule/testErc20.nim b/testmodule/testErc20.nim index 2eea2f7..1ad1f63 100644 --- a/testmodule/testErc20.nim +++ b/testmodule/testErc20.nim @@ -1,5 +1,5 @@ import std/os -import std/json +import pkg/serde import pkg/asynctest import pkg/questionable import pkg/stint