From 8b65943e7d1db919b34fbb815d89c8b60a56b56c Mon Sep 17 00:00:00 2001 From: shum Date: Wed, 21 Oct 2026 22:53:41 +0000 Subject: [PATCH] store: build the names env's chain client --- .../src/StoreService/Names/Env.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/simplex-store-service/src/StoreService/Names/Env.hs b/apps/simplex-store-service/src/StoreService/Names/Env.hs index 325ff4538c..4743669d47 100644 --- a/apps/simplex-store-service/src/StoreService/Names/Env.hs +++ b/apps/simplex-store-service/src/StoreService/Names/Env.hs @@ -2,10 +2,11 @@ module StoreService.Names.Env (NamesEnv (..), newNamesEnv) where -import Simplex.Chat.Controller (ChatController) +import Simplex.Chat.Controller (ChatController (..)) import Simplex.Messaging.Agent.Protocol (UserId) import Simplex.Messaging.Agent.Store.Common (DBStore) -import StoreService.Config (NamesConfig) +import StoreService.Config (NamesConfig (..)) +import StoreService.Names.Chain (ChainClient, newChainClient) import StoreService.Names.Phases (Phases, newPhases) import StoreService.Names.Turns (Turns, newTurns) @@ -15,11 +16,13 @@ data NamesEnv = NamesEnv neConfig :: NamesConfig, neStore :: DBStore, nePhases :: Phases, - neTurns :: Turns + neTurns :: Turns, + neChain :: ChainClient } newNamesEnv :: ChatController -> UserId -> NamesConfig -> DBStore -> IO NamesEnv -newNamesEnv neChat neUserId neConfig neStore = do +newNamesEnv neChat@ChatController {random} neUserId neConfig@NamesConfig {nChain} neStore = do nePhases <- newPhases neTurns <- newTurns - pure NamesEnv {neChat, neUserId, neConfig, neStore, nePhases, neTurns} + neChain <- newChainClient random nChain + pure NamesEnv {neChat, neUserId, neConfig, neStore, nePhases, neTurns, neChain}