Ejemplo n.º 1
0
        /// <summary>
        /// Creates PlasmaComm object.
        /// </summary>
        /// <param name="ethClient">Ethereum jsonRpc client implementation</param>
        /// <param name="gameCenterContract">game center contract address</param>
        /// <param name="watcherClient">watcher client</param>
        /// <param name="childChainClient">child chain client</param>
        /// <param name="rootChainAddress">root chain address</param>
        /// <param name="_rootChainVersion">root chain version</param>
        public PlasmaComm(Nethereum.JsonRpc.Client.IClient ethClient,
                          string gameCenterContract,
                          PlasmaCore.RPC.IClient watcherClient,
                          PlasmaCore.RPC.IClient childChainClient,
                          string rootChainAddress,
                          RootChainVersion _rootChainVersion)
        {
            web3   = new Web3(ethClient);
            bcComm = new BCComm(ethClient, gameCenterContract);

            plasmaApiService = new PlasmaAPIService(watcherClient, childChainClient);
            rootChainVersion = _rootChainVersion;

            if (rootChainAddress == null)
            {
                var statusData = plasmaApiService.GetStatus().Result;
                rootChainAddress = statusData.ContractAddr;
            }

            if (rootChainAddress != null)
            {
                rootChainContract = new RootChainContract(web3, rootChainAddress, rootChainVersion);
            }

            transactionEncoder = TransactionEncoderFactory.Create(rootChainVersion, rootChainAddress);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates BCComm object.
        /// </summary>
        /// <param name="client">JsonRpc client implementation</param>
        /// <param name="gameCenterContract">game center contract address</param>
        public BCComm(Nethereum.JsonRpc.Client.IClient client, string gameCenterContract)
        {
            web = new Web3(client);

            if (gameCenterContract == null)
            {
                ErrorCallbackProvider.ReportError("Game center contract cannot be null!");
            }

            gameCenter = (GameCenterContract)GetContract(typeof(GameCenterContract), gameCenterContract);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates Plasma client options object with root chain access
 /// </summary>
 /// <param name="rpcClient">JsonRpc client implementation</param>
 /// <param name="rootChainAddress">root chain contract address</param>
 /// <param name="rootChainVersion">root chain version</param>
 /// <param name="watcherClient">Plasma watcher client</param>
 /// <param name="childChainClient">Plasma child chain client (optional)</param>
 public PlasmaClientOptions(
     Nethereum.JsonRpc.Client.IClient rpcClient,
     string rootChainAddress,
     string rootChainVersion,
     PlasmaCore.RPC.IClient watcherClient,
     PlasmaCore.RPC.IClient childChainClient = null) :
     base(rpcClient)
 {
     RootChainAddress = rootChainAddress;
     RootChainVersion = RootChainABI.FromString(rootChainVersion);
     WatcherClient    = watcherClient;
     ChildChainClient = childChainClient;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates Plasma client options object (without root chain access)
 /// </summary>
 /// <param name="rpcClient">JsonRpc client implementation</param>
 /// <param name="watcherClient">Plasma watcher client</param>
 /// <param name="childChainClient">Plasma child chain client (optional)</param>
 public PlasmaClientOptions(Nethereum.JsonRpc.Client.IClient rpcClient, PlasmaCore.RPC.IClient watcherClient, PlasmaCore.RPC.IClient childChainClient = null)
     : base(rpcClient)
 {
     WatcherClient    = watcherClient;
     ChildChainClient = childChainClient;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates Ethereum client options object.
 /// </summary>
 /// <param name="rpcClient">JsonRpc client implementation</param>
 public EthereumClientOptions(Nethereum.JsonRpc.Client.IClient rpcClient) :
     base(rpcClient)
 {
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="rpcClient"></param>
 protected BCClientOptions(Nethereum.JsonRpc.Client.IClient rpcClient)
 {
     RpcClient = rpcClient;
 }