예제 #1
0
        public async Task CanPerformNoRippleCheckWithRequest()
        {
            NoRippleCheckRequest request = new NoRippleCheckRequest(account);

            request.Role = RoleType.Gateway;
            NoRippleCheck noRippleCheck = await client.NoRippleCheck(request);

            Assert.IsNotNull(noRippleCheck);
        }
예제 #2
0
        public void CanCreateNoRippleCheckRequest()
        {
            NoRippleCheckRequest request = new NoRippleCheckRequest(account);

            request.Role = RoleType.User;

            string  json    = JsonConvert.SerializeObject(request);
            JObject jObject = JObject.Parse(json);
            JToken  role    = jObject["role"];

            Assert.AreEqual("user", role.Value <string>());
        }
예제 #3
0
        public Task <NoRippleCheck> NoRippleCheck(NoRippleCheckRequest request)
        {
            var command = JsonConvert.SerializeObject(request, serializerSettings);
            TaskCompletionSource <NoRippleCheck> task = new TaskCompletionSource <NoRippleCheck>();

            TaskInfo taskInfo = new TaskInfo();

            taskInfo.TaskId = request.Id;
            taskInfo.TaskCompletionResult = task;
            taskInfo.Type = typeof(NoRippleCheck);

            tasks.TryAdd(request.Id, taskInfo);

            client.SendMessage(command);
            return(task.Task);
        }
예제 #4
0
        /// <summary>
        /// The noripple_check command provides a quick way to check the status of the Default Ripple field for an account and the No Ripple flag of its trust lines, compared with the recommended settings.
        /// </summary>
        public async Task <NoRippleCheckResponse> NoRippleCheck(NoRippleCheckRequest request, CancellationToken cancellationToken = default)
        {
            jsonBuffer.Clear();
            jsonWriter.Reset();
            jsonWriter.WriteStartObject();
            var requestId = WriteHeader(jsonWriter, "noripple_check");

            LedgerSpecification.Write(jsonWriter, request.Ledger);
            jsonWriter.WriteString("account", request.Account.ToString());
            jsonWriter.WriteString("role", request.Role);
            jsonWriter.WriteBoolean("transactions", request.Transactions);
            if (request.Limit.HasValue)
            {
                jsonWriter.WriteNumber("limit", request.Limit.Value);
            }
            WriteFooter(jsonWriter);
            jsonWriter.WriteEndObject();
            jsonWriter.Flush();
            var response = await SendReceiveAsync(requestId, jsonBuffer.WrittenMemory, cancellationToken);

            return(new NoRippleCheckResponse(response));
        }
예제 #5
0
        public Task <NoRippleCheck> NoRippleCheck(string account)
        {
            NoRippleCheckRequest request = new NoRippleCheckRequest(account);

            return(NoRippleCheck(request));
        }