cleanup imports after rebase, fix toJson

This commit is contained in:
Eric 2023-11-16 13:54:22 +11:00
parent 34c4fb07fe
commit c1e5d0e9c2
No known key found for this signature in database
5 changed files with 4 additions and 15 deletions

View File

@ -32,6 +32,7 @@ import ../node
import ../blocktype
import ../conf
import ../contracts
import ../manifest
import ../streams/asyncstreamwrapper
import ./coders

View File

@ -6,7 +6,6 @@ import pkg/codexdht/discv5/routing_table as rt
import ../sales
import ../purchasing
import ../utils/json
import ../units
import ../manifest
export json

View File

@ -28,7 +28,7 @@ push: {.upraises: [].}
import std/typetraits
import pkg/chronos
import pkg/chronicles
import pkg/chronicles except toJson
import pkg/datastore
import pkg/nimcrypto
import pkg/questionable

View File

@ -303,18 +303,7 @@ func `%`*[T: distinct](id: T): JsonNode =
type baseType = T.distinctBase
% baseType(id)
func toJson*(obj: object): string = $(%obj)
func toJson*(obj: ref object): string = $(%obj)
func toJson*[T: object](elements: openArray[T]): string =
let jObj = newJArray()
for elem in elements: jObj.add(%elem)
$jObj
func toJson*[T: ref object](elements: openArray[T]): string =
let jObj = newJArray()
for elem in elements: jObj.add(%elem)
$jObj
func toJson*[T](item: T): string = $(%item)
proc toJsnImpl(x: NimNode): NimNode =
case x.kind

View File

@ -3,7 +3,7 @@ import std/options
import std/strformat
import std/strutils
import std/unittest
import pkg/chronicles
import pkg/chronicles except toJson
import pkg/stew/byteutils
import pkg/stint
import pkg/codex/contracts/requests