From cfa6b4fc249e85e8dc07b6f1818390e0bdb78447 Mon Sep 17 00:00:00 2001 From: fuwa Date: Thu, 27 Jun 2019 12:09:05 +0000 Subject: [PATCH] add port to config --- cyberwow/lib/config/cyberwow.dart | 1 + cyberwow/lib/config/prototype.dart | 2 ++ cyberwow/lib/controller/rpc.dart | 11 +++-------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cyberwow/lib/config/cyberwow.dart b/cyberwow/lib/config/cyberwow.dart index 27e0522..5033334 100644 --- a/cyberwow/lib/config/cyberwow.dart +++ b/cyberwow/lib/config/cyberwow.dart @@ -31,5 +31,6 @@ const config = CryptoConfig 70, Colors.green, Colors.black, + 34568, ['--prune-blockchain'], ); diff --git a/cyberwow/lib/config/prototype.dart b/cyberwow/lib/config/prototype.dart index af6fb34..3c4eaac 100644 --- a/cyberwow/lib/config/prototype.dart +++ b/cyberwow/lib/config/prototype.dart @@ -28,6 +28,7 @@ class CryptoConfig { final int splashDelay; final Color textColor; final Color backgroundColor; + final int port; final List extraArgs; const CryptoConfig ( @@ -37,6 +38,7 @@ class CryptoConfig { this.splashDelay, this.textColor, this.backgroundColor, + this.port, this.extraArgs, ); } diff --git a/cyberwow/lib/controller/rpc.dart b/cyberwow/lib/controller/rpc.dart index 9741945..53b79e2 100644 --- a/cyberwow/lib/controller/rpc.dart +++ b/cyberwow/lib/controller/rpc.dart @@ -25,15 +25,10 @@ import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:flutter/foundation.dart'; -Future rpc(String method) async { - var url = ''; - if (kReleaseMode) { - url = 'http://127.0.0.1:34568/json_rpc'; - } else { - url = 'http://192.168.10.101:34568/json_rpc'; - } +import '../config.dart'; - url = 'http://127.0.0.1:34568/json_rpc'; +Future rpc(String method) async { + final url = 'http://127.0.0.1:${config.port}/json_rpc'; final body = json.encode (