public void Start()
        {
            HoardConfig = new HoardConfigLoader(hoardConfig).GetHoardServiceOptions();

            var clientURL = ((EthereumClientConfig)HoardConfig.BCClient).ClientUrl;
            var ethClient = new EthereumClientOptions(new UnityRpcClientAsync(new Uri(clientURL)));
            var options   = new HoardServiceOptions(HoardConfig, ethClient);

            HoardService.Instance.Initialize(options)
            .ContinueGUISynch(AfterInit);
        }
Exemplo n.º 2
0
        public void InitializeFromConfig(string configPath = null)
        {
            HoardServiceConfig config = HoardServiceConfig.Load(configPath);

            BCClientOptions clientOpts = null;

            if (config.BCClient is EthereumClientConfig)
            {
                var ethConfig = config.BCClient as EthereumClientConfig;
                clientOpts = new EthereumClientOptions(
                    new Nethereum.JsonRpc.Client.RpcClient(new Uri(ethConfig.ClientUrl))
                    );
            }
            else
            {
                var plasmaConfig = config.BCClient as PlasmaClientConfig;

                PlasmaCore.RPC.RpcClient watcherClient    = new PlasmaCore.RPC.RpcClient(new Uri(plasmaConfig.WatcherUrl));
                PlasmaCore.RPC.RpcClient childChainClient = null;
                if (plasmaConfig.ChildChainUrl != null && plasmaConfig.ChildChainUrl != string.Empty)
                {
                    childChainClient = new PlasmaCore.RPC.RpcClient(new Uri(plasmaConfig.ChildChainUrl));
                }

                clientOpts = new PlasmaClientOptions(
                    new Nethereum.JsonRpc.Client.RpcClient(new Uri(plasmaConfig.ClientUrl)),
                    plasmaConfig.RootChainAddress,
                    plasmaConfig.RootChainVersion,
                    watcherClient,
                    childChainClient
                    );
            }

            HoardServiceOptions options = new HoardServiceOptions(config, clientOpts);

            HoardService = HoardService.Instance;

            try
            {
                HoardService.Initialize(options);
            }
            catch (Exception)
            {
                Assert.True(false);
            }

            //authenticate user
            UserIDs.Add(CreateUser().Result);
        }