示例#1
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(ArkNetApi arkNetApi, string ip, int port)
        {
            _arkNetApi = arkNetApi;
            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 (_arkNetApi.NetworkApi.NetworkSettings != null)
            {
                _httpClient.DefaultRequestHeaders.Add("nethash", _arkNetApi.NetworkApi.NetworkSettings.NetHash);
                _httpClient.DefaultRequestHeaders.Add("version", _arkNetApi.NetworkApi.NetworkSettings.Version);
                _httpClient.DefaultRequestHeaders.Add("port", _arkNetApi.NetworkApi.NetworkSettings.Port.ToString());
            }
        }
示例#2
0
 public NetworkApi(ArkNetApi arkNetApi)
 {
     _arkNetApi = arkNetApi;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountController"/> class.
 /// </summary>
 /// <param name="passphrase">
 /// User's Pass Phrase as a <inheritdoc cref="string"/>
 /// Mandatory.
 /// </param>
 /// <param name="secondPassPhrase">
 /// User's Second Pass Phrase as a <inheritdoc cref="string"/>
 /// Optional.
 /// </param>
 public AccountController(ArkNetApi arkNetApi, string passphrase, string secondPassPhrase = null)
 {
     _arkNetApi        = arkNetApi;
     _passPhrase       = passphrase;
     _secondPassPhrase = secondPassPhrase;
 }