示例#1
0
        public async Task TestSetRegistry()
        {
            string dataKey  = Guid.NewGuid().ToString();
            int    revision = 0;
            string data     = "IADUs8d9CQjUO34LmdaaNPK_STuZo24rpKVfYW3wPPM2uQ"; //Sia logo

            var key = SiaSkynetClient.GenerateKeys(_testSeed);

            RegistryEntry reg = new RegistryEntry(new RegistryKey(dataKey));

            reg.SetData(data);
            reg.Revision = revision;

            var success = await _client.SetRegistry(key.privateKey, key.publicKey, reg);

            Assert.IsTrue(success);
        }
        public async Task TestSetRegistry_With_DiscoverableBucket()
        {
            var path    = $"crqa.hns/snew.hns/newcontent/{Guid.NewGuid().ToString()}/index.json";
            var bucket  = new DiscoverableBucket(path);
            var dataKey = new RegistryKey(bucket);

            int    revision = 0;
            string data     = "IADUs8d9CQjUO34LmdaaNPK_STuZo24rpKVfYW3wPPM2uQ"; //Sia logo

            var key = SiaSkynetClient.GenerateKeys(_testSeed);

            RegistryEntry reg = new RegistryEntry(dataKey);

            reg.SetData(data);
            reg.Revision = revision;

            var success = await _client.SetRegistry(key.privateKey, key.publicKey, reg);

            Assert.IsTrue(success);

            var result = await _client.GetRegistry(key.publicKey, dataKey);

            Assert.AreEqual(data, result.GetDataAsString());
        }