Esempio n. 1
0
        /// <summary>
        /// Retrieves the metrics for calculating fees from the network.
        /// network.
        /// </summary>
        /// <remarks>
        /// NOTE: this method incours a charge to retrieve the file from the network.
        /// </remarks>
        /// <param name="client">Client Object</param>
        /// <param name="configure">
        /// Optional callback method providing an opportunity to modify
        /// the execution configuration for just this method call.
        /// It is executed prior to submitting the request to the network.
        /// </param>
        /// <returns>
        /// The structure representing the metrics of the Network's Fee Schedule.
        /// </returns>
        public static async Task <FeeSchedules> GetFeeScheduleAsync(this Client client, Action <IContext>?configure = null)
        {
            var file = await client.GetFileContentAsync(FEE_SCHEDULE_FILE_ADDRESS, configure);

            var set = Proto.CurrentAndNextFeeSchedule.Parser.ParseFrom(file.ToArray());

            return(new FeeSchedules(Protobuf.FromFeeSchedule(set.CurrentFeeSchedule), Protobuf.FromFeeSchedule(set.NextFeeSchedule)));
        }