[contracts] Add ContractInteractions to dagger node

This commit is contained in:
Mark Spanbroek 2022-04-13 14:15:22 +02:00 committed by markspanbroek
parent 9cbf6d0b6c
commit 0738606303
3 changed files with 10 additions and 4 deletions

View File

@ -30,6 +30,7 @@ import ./blockexchange
import ./utils/fileutils
import ./erasure
import ./discovery
import ./contracts
type
DaggerServer* = ref object
@ -121,7 +122,8 @@ proc new*(T: type DaggerServer, config: DaggerConf): T =
engine = BlockExcEngine.new(localStore, wallet, network, discovery)
store = NetworkStore.new(engine, localStore)
erasure = Erasure.new(store, leoEncoderProvider, leoDecoderProvider)
daggerNode = DaggerNodeRef.new(switch, store, engine, erasure, discovery)
contracts = ContractInteractions.new()
daggerNode = DaggerNodeRef.new(switch, store, engine, erasure, discovery, contracts)
restServer = RestServerRef.new(
daggerNode.initRestApi(),
initTAddress("127.0.0.1" , config.apiPort),

View File

@ -28,6 +28,7 @@ import ./blockexchange
import ./streams
import ./erasure
import ./discovery
import ./contracts
logScope:
topics = "dagger node"
@ -42,6 +43,7 @@ type
engine*: BlockExcEngine
erasure*: Erasure
discovery*: Discovery
contracts*: ContractInteractions
proc start*(node: DaggerNodeRef) {.async.} =
await node.switch.start()
@ -235,10 +237,12 @@ proc new*(
store: BlockStore,
engine: BlockExcEngine,
erasure: Erasure,
discovery: Discovery): T =
discovery: Discovery,
contracts: ContractInteractions): T =
T(
switch: switch,
blockStore: store,
engine: engine,
erasure: erasure,
discovery: discovery)
discovery: discovery,
contracts: contracts)

View File

@ -46,7 +46,7 @@ suite "Test Node":
discovery = Discovery.new(switch.peerInfo, Port(0))
engine = BlockExcEngine.new(localStore, wallet, network, discovery)
store = NetworkStore.new(engine, localStore)
node = DaggerNodeRef.new(switch, store, engine, nil, discovery) # TODO: pass `Erasure`
node = DaggerNodeRef.new(switch, store, engine, nil, discovery, nil) # TODO: pass `Erasure`
await node.start()