Ejemplo n.º 1
0
        public void ObjectHierarchy()
        {
            string nodeConfigOutputKey = "nodeRegistry";

            ClientConfiguration clientConfig = _client.Configuration;

            NodeRegistryConfiguration nodeRegistryConfig = clientConfig.NodeRegistry;

            nodeRegistryConfig.NeedsUpdate       = false;
            nodeRegistryConfig.RegistryId        = "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb";
            nodeRegistryConfig.Contract          = "0xdd80249a0631cf0f1593c7a9c9f9b8545e6c88ab";
            nodeRegistryConfig.WhiteListContract = "0xdd80249a0631cf0f1593c7a9c9f9b8545e6c88ab";

            string jsonConfiguration1 = clientConfig.ToJson();

            JsonDocument jsonObject1    = JsonDocument.Parse(jsonConfiguration1);
            var          propertiesName = jsonObject1.RootElement.EnumerateObject().Select(prop => prop.Name);

            Assert.That(propertiesName.Contains(nodeConfigOutputKey));

            NodeConfiguration nodeListConfig = new NodeConfiguration(nodeRegistryConfig)
            {
                Props   = 0x0,
                Url     = "scheme://userinfo@host:port/path?query#fragment",
                Address = "0x0"
            };

            string       jsonConfiguration2 = clientConfig.ToJson();
            JsonDocument jsonObject2        = JsonDocument.Parse(jsonConfiguration2);

            Assert.DoesNotThrow(() => jsonObject2
                                .RootElement
                                .GetProperty(nodeConfigOutputKey));
        }
Ejemplo n.º 2
0
        protected override void CreateConfig()
        {
            ClientConfiguration clientConfig = Client.Configuration;

            NodeRegistryConfiguration currentChainConfiguration = clientConfig.NodeRegistry;

            currentChainConfiguration.NeedsUpdate = false;
            currentChainConfiguration.Contract    = "0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f";
            currentChainConfiguration.RegistryId  = "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb";

            clientConfig.RequestCount   = 1;
            clientConfig.AutoUpdateList = false;
            clientConfig.Proof          = Proof.None;
            clientConfig.MaxAttempts    = 10;
            clientConfig.SignatureCount = 0;
            clientConfig.Experimental   = true;
        }
Ejemplo n.º 3
0
        public void DispatchRequestInvalidConfig()
        {
            ClientConfiguration config = _client.Configuration;

            NodeRegistryConfiguration chainConfig = config.NodeRegistry;

            chainConfig.NeedsUpdate       = false;
            chainConfig.RegistryId        = "0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb";
            chainConfig.Contract          = "0xdd80249a0631cf0f1593c7a9c9f9b8545e6c88ab";
            chainConfig.WhiteListContract = "0xdd80249a0631cf0f1593c7a9c9f9b8545e6c88ab";
            chainConfig.WhiteList         = new[]
            {
                "0x0123456789012345678901234567890123456789",
                "0x1234567890123456789012345678901234567890"
            };

            Assert.ThrowsAsync <ArgumentException>(() => _client.Eth1.GetGasPrice());
        }