Exemple #1
0
        T MakeRequest <T>(RpcMethods method, params object[] parameters)
        {
            bool ok;
            T    result = default(T);

            try
            {
                result = _rpcConnector.MakeRequest <T>(method, parameters);
                if (result == null)
                {
                    Console.WriteLine("NMC Connector is not configured");
                    ok = false;
                }
                else
                {
                    ok = true;
                }
            }
            catch (RpcException ex)
            {
                if ((ex.InnerException is System.IO.IOException) || (ex.InnerException is WebException && ((WebException)ex.InnerException).Response == null))
                {
                    Console.WriteLine("Unable to connect to Namecoin client: {0}", ex.Message);
                    if (ex.InnerException != null)
                    {
                        Console.WriteLine(" Inner: {0}", ex.InnerException.Message);
                    }
                }
                else
                {
                    WebException webEx = ex.InnerException as WebException;
                    if (webEx != null && webEx.Response is HttpWebResponse && ((HttpWebResponse)webEx.Response).StatusCode == HttpStatusCode.Unauthorized)
                    {
                        Console.WriteLine(" Not authorized to connect to wallet...");
                        TryUpdateApiCreds();
                    }
                    else
                    {
                        Console.WriteLine("An RPC Error Occurred: {0}", ex.InnerException != null ? ex.InnerException.Message : ex.Message);
                    }
                }
                ok = false;
            }

            if (ok != Available)
            {
                Available = ok;
                EventSink.InvokeNameServerAvailableChanged(this, new NameServerAvailableChangedEventArgs(Available));
            }

            return(result);
        }
Exemple #2
0
 public string AddMultiSigAddress(int nRquired, List <string> publicKeys, string account)
 {
     return(account != null
         ? _rpcConnector.MakeRequest <string>(RpcMethods.addmultisigaddress, nRquired, publicKeys, account)
         : _rpcConnector.MakeRequest <string>(RpcMethods.addmultisigaddress, nRquired, publicKeys));
 }
Exemple #3
0
 public String AddMultiSigAddress(Int32 nRquired, List <String> publicKeys, String account)
 {
     return(_rpcConnector.MakeRequest <String>(RpcMethods.addmultisigaddress, nRquired, publicKeys, account));
 }
Exemple #4
0
 public async Task <string> AddMultiSigAddressAsync(int nRquired, List <string> publicKeys, string account)
 {
     return(account != null
         ? await _rpcConnector.MakeRequest <string>(RpcMethods.addmultisigaddress, nRquired, publicKeys, account)
         : await _rpcConnector.MakeRequest <string>(RpcMethods.addmultisigaddress, nRquired, publicKeys));
 }
Exemple #5
0
 public string CreateRawTransaction(CreateRawTransactionRequest rawTransaction)
 {
     return(_rpcConnector.MakeRequest <string>(RpcMethods.createrawtransaction, rawTransaction.Inputs, rawTransaction.Outputs));
 }
 //JSON-RPC Endpoints
 public JObject getAddressSummary(GetAddressSummaryParameter parameter)
 {
     return(_rpcConnector.MakeRequest <JObject>(RpcMethods.getAddressSummary, parameter));
 }