public bool HasEnoughFundsForCycle(bool firstCycle, string originWalletName = null)
        {
            Money   walletBalance  = this.Services.WalletService.GetBalance(originWalletName);
            FeeRate networkFeeRate = this.Services.FeeService.GetFeeRateAsync().GetAwaiter().GetResult();

            return(TumblerClientRuntime.HasEnoughFundsForCycle(firstCycle, walletBalance, networkFeeRate, TumblerParameters.Denomination, TumblerParameters.Fee));
        }
Exemplo n.º 2
0
 public PaymentStateMachine(
     TumblerClientRuntime runtime)
 {
     if (runtime == null)
     {
         throw new ArgumentNullException("runtime");
     }
     Runtime = runtime;
 }
Exemplo n.º 3
0
 public StateMachinesExecutor(
     TumblerClientRuntime runtime)
 {
     if (runtime == null)
     {
         throw new ArgumentNullException("runtime");
     }
     Runtime         = runtime;
     _ParametersHash = Runtime.TumblerParameters.GetHash();
 }
Exemplo n.º 4
0
        public static async Task <TumblerClientRuntime> FromConfigurationAsync(TumblerClientConfigurationBase configuration, ClientInteraction interaction)
        {
            TumblerClientRuntime runtime = new TumblerClientRuntime();

            try
            {
                await runtime.ConfigureAsync(configuration, interaction).ConfigureAwait(false);
            }
            catch
            {
                runtime.Dispose();
                throw;
            }
            return(runtime);
        }
Exemplo n.º 5
0
        public static async Task <TumblerClientRuntime> FromConfigurationAsync(TumblerClientConfiguration configuration, ClientInteraction interaction)
        {
            TumblerClientRuntime runtime = new TumblerClientRuntime();

            try
            {
                await runtime.ConfigureAsync(configuration, interaction).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                var message = ex.Message;
                runtime.Dispose();
                throw;
            }
            return(runtime);
        }
Exemplo n.º 6
0
        public static async Task <TumblerClientRuntime> FromConfigurationAsync(TumblerClientConfigurationBase configuration, ClientInteraction interaction = null, bool connectionTest = false)
        {
            TumblerClientRuntime runtime = new TumblerClientRuntime();

            try
            {
                await runtime.ConfigureAsync(configuration, interaction, connectionTest).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception during runtime configuration: " + e);
                runtime?.Dispose();
                throw;
            }
            return(runtime);
        }
Exemplo n.º 7
0
 public PaymentStateMachine(
     TumblerClientRuntime runtime,
     State state) : this(runtime)
 {
     if (state == null)
     {
         return;
     }
     if (state.NegotiationClientState != null)
     {
         StartCycle = state.NegotiationClientState.CycleStart;
         ClientChannelNegotiation = new ClientChannelNegotiation(runtime.TumblerParameters, state.NegotiationClientState);
     }
     if (state.PromiseClientState != null)
     {
         PromiseClientSession = new PromiseClientSession(runtime.TumblerParameters.CreatePromiseParamaters(), state.PromiseClientState);
     }
     if (state.SolverClientState != null)
     {
         SolverClientSession = new SolverClientSession(runtime.TumblerParameters.CreateSolverParamaters(), state.SolverClientState);
     }
     InvalidPhaseCount = state.InvalidPhaseCount;
 }
Exemplo n.º 8
0
 public PaymentStateMachine(
     TumblerClientRuntime runtime)
 {
     Runtime = runtime ?? throw new ArgumentNullException(nameof(runtime));
 }