protected void HighLevelCall()
        {
            var response = HighLevelClient.Search <Project>(s => s);

            response.Should().NotBeNull();
            var serverError = response.ServerError;

            serverError.Should().NotBeNull();
            serverError.Status.Should().Be(response.ApiCall.HttpStatusCode);
            serverError.Error.Should().NotBeNull();
            serverError.Error.Headers.Should().NotBeNull();
            AssertResponseError("high level client", serverError.Error);
        }
        public async void Execute()
        {
            // sending data is a high level operation. construct high level client and input the node client
            // (node client can be constructed with a custom URI if needed - default is https://chrysalis-nodes.iota.org)
            var client = new HighLevelClient(new NodeRestClient());

            // send data with indexation key (can be searched for e.g. with the IOTA explorer)
            var response = await client.SendDataAsync(new SendDataRequest("Tangle .Net",
                                                                          "Data to send. Can be anything string encoded. E.g. JSON or Base64"));


            // the response contains the id of the message | needed to later retrieve the message again
            Console.WriteLine(response.MessageId);
        }
        public async void Execute()
        {
            // sending data is a high level operation. construct high level client and input the node client
            // (node client can be constructed with a custom URI if needed - default is https://chrysalis-nodes.iota.org)
            var client = new HighLevelClient(new NodeRestClient());

            // the transfer request can be build in multiple ways
            // in any case it needs the seed to get the funds from
            // the receiver can either be input as a bech32 or ed25519 address
            // the bech32 type is the one displayed in Firefly
            // IMPORTANT: Due to dust protection, the network only allows transactions with a value of 1 Mi or more!
            var request = new SendTransferRequest(Ed25519Seed.FromMnemonic("some mnemonic"),
                                                  "iota1qqh6pxkg4huzv506623l6lrt4daraktak6rvxwsvtewakj89vy7mj4enzsp", 1000000);

            //send request
            var response = await client.SendTransferAsync(request);

            // the response contains the id of the message | needed to later retrieve the message again
            Console.WriteLine(response.MessageId);
        }
Example #4
0
        private static async Task HighLevelOperations(NodeRestClient client)
        {
            var highLevelClient = new HighLevelClient(client);

            Console.WriteLine("Sending Transfer -----------------------");
            var seed = Ed25519Seed.FromMnemonic("");
            var sendTransferResponse = await highLevelClient.SendTransferAsync(new SendTransferRequest(seed, "iota1qqh6pxkg4huzv506623l6lrt4daraktak6rvxwsvtewakj89vy7mj4enzsp", 1000000, "Tangle .Net", "Test"));

            Console.WriteLine(JsonConvert.SerializeObject(sendTransferResponse, Formatting.Indented));
            Console.WriteLine("---------------------------------------");

            Console.WriteLine("Sending High Level Data -----------------------");
            var sendDataResponse = await highLevelClient.SendDataAsync(new SendDataRequest("Tangle .Net", "High Level Data"));

            Console.WriteLine(JsonConvert.SerializeObject(sendDataResponse, Formatting.Indented));
            Console.WriteLine("---------------------------------------");

            Console.WriteLine("Retrieving High Level Data -----------------------");
            var retrieveDataResponse = await highLevelClient.RetrieveDataAsync(new MessageRequest(sendDataResponse.MessageId));

            Console.WriteLine(JsonConvert.SerializeObject(retrieveDataResponse, Formatting.Indented));
            Console.WriteLine("---------------------------------------");
        }