Example #1
0
        public async Task <IActionResult> EnableFederationAsync(string mnemonic, string password)
        {
            ApiResponse importWalletRequest = await ApiRequester.PostRequestAsync(this.defaultEndpointsSettings.SidechainNode, "/api/FederationWallet/import-key", new { mnemonic, password });

            if (importWalletRequest.IsSuccess)
            {
                ApiResponse enableFederationRequest = await ApiRequester.PostRequestAsync(this.defaultEndpointsSettings.SidechainNode, "/api/FederationWallet/enable-federation", new { password });

                return(enableFederationRequest.IsSuccess ? (IActionResult)Ok() : BadRequest());
            }
            return(BadRequest());
        }
Example #2
0
        public async Task <IActionResult> ResyncAsync(string value)
        {
            bool isHeight = int.TryParse(value, out int height);

            if (isHeight)
            {
                ApiResponse getblockhashRequest = await ApiRequester.GetRequestAsync(this.defaultEndpointsSettings.StratisNode, $"/api/Consensus/getblockhash?height={value}");

                ApiResponse syncRequest = await ApiRequester.PostRequestAsync(this.defaultEndpointsSettings.StratisNode, "/api/Wallet/sync", new { hash = ((string)getblockhashRequest.Content) });

                return(syncRequest.IsSuccess ? (IActionResult)Ok() : BadRequest());
            }
            else
            {
                ApiResponse syncRequest = await ApiRequester.PostRequestAsync(this.defaultEndpointsSettings.StratisNode, "/api/Wallet/sync", new { hash = value });

                return(syncRequest.IsSuccess ? (IActionResult)Ok() : BadRequest());
            }
        }
Example #3
0
        public async Task <IActionResult> StopNodeAsync()
        {
            ApiResponse stopNodeRequest = await ApiRequester.PostRequestAsync(this.defaultEndpointsSettings.StratisNode, "/api/Node/stop", true);

            return(stopNodeRequest.IsSuccess ? (IActionResult)Ok() : BadRequest());
        }
        public async Task <IActionResult> ChangeLogLevelAsync(string rule, string level)
        {
            ApiResponse changeLogLevelRequest = await ApiRequester.PostRequestAsync(this.defaultEndpointsSettings.StratisNode, "/api/Node/loglevels", new { logRules = new[] { new { ruleName = rule, logLevel = level } } });

            return(changeLogLevelRequest.IsSuccess ? (IActionResult)Ok() : BadRequest());
        }