Example #1
0
        /// <summary>
        /// Creates a <see cref="TransactionApi"/> type object from a Json representation.
        /// </summary>
        ///
        /// <param name="json">The Json representation of the object.</param>
        ///
        /// <returns>Returns an instance of the <see cref="TransactionApi"/> type.</returns>
        ///
        public TransactionApi FromJson(NetworkApi networkApi, string json)
        {
            var tx = new TransactionApi(networkApi);

            tx = JsonConvert.DeserializeObject <TransactionApi>(json);
            return(tx);
        }
Example #2
0
        /// <summary>
        /// Instantiates a new instance of the <see cref="PeerApi"/> class.
        /// </summary>
        /// <param name="ip">The peer ip address.</param>
        /// <param name="port">The peer port.</param>
        public PeerApi(NetworkApi networkApi, string ip, int port)
        {
            _networkApi = networkApi;
            var protocol = "http://";

            if (port % 1000 == 443)
            {
                protocol = "https://";
            }

            Init(ip, port);

            _httpClient = new HttpClient()
            {
                BaseAddress = new UriBuilder(protocol, this._ip, this._port).Uri
            };

            if (_networkApi.NetworkSettings != null)
            {
                _httpClient.DefaultRequestHeaders.Add("nethash", _networkApi.NetworkSettings.NetHash);
                _httpClient.DefaultRequestHeaders.Add("version", _networkApi.NetworkSettings.Version);
                _httpClient.DefaultRequestHeaders.Add("port", _networkApi.NetworkSettings.Port.ToString());
            }
        }
Example #3
0
 /// <summary>
 /// Instantiates a new instance of the <see cref="TransactionApi"/> type.
 /// </summary>
 ///
 public TransactionApi(NetworkApi networkApi, LoggingApi logger)
 {
     _networkApi = networkApi;
 }
Example #4
0
 /// <summary>
 /// Instantiates a new instance of the <see cref="TransactionApi"/> type.
 /// </summary>
 ///
 public TransactionApi(NetworkApi networkApi)
 {
     _networkApi = networkApi;
 }