Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/scryinfo/cashbox
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/scryinfo/cashbox:
  add |> add demo that test wallet dylib
  upd |> update readme
  modify token query func
  upd |> update log component
  upd |> reform the component from log_util to logger, fix #40
  add token list query,database version,add wallet token func
  #39 not work
  #39 test tls server is ok
  • Loading branch information
TigerInYourDream committed Feb 5, 2021
2 parents 5835a85 + 4180c87 commit d29b919
Show file tree
Hide file tree
Showing 105 changed files with 3,977 additions and 2,172 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ demo/rbatis_demo/target
/packages/services/test/greeter/greeter_go/go.sum
/packages/services/test/greeter/greeter_go/greeter_go/greeter_go.exe
/app/libwallets_cdl.so
/packages/wallets/lib/wallets_c.dart
/packages/services/before.log
/packages/services/log.log
/bc/wallets_cdl/src/wallets_c.h

/packages/services/test/greeter/greeter_go/greeter_go/before.log
/packages/services/test/greeter/greeter_go/greeter_go/log.log
4 changes: 2 additions & 2 deletions app/lib/configv/config/handle_config.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:log_util/log_util.dart';
import 'package:logger/logger.dart';
import 'package:flutter/services.dart';
import 'package:path_provider/path_provider.dart';

Expand Down Expand Up @@ -96,7 +96,7 @@ class HandleConfig {
await file.create();
}
} catch (e) {
LogUtil.instance().e("_getDirectoryPath ", e.toString());
Logger().e("_getDirectoryPath ", e.toString());
}
return file.path;
}
Expand Down
16 changes: 8 additions & 8 deletions app/lib/model/wallet.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:typed_data';

import 'package:log_util/log_util.dart';
import 'package:logger/logger.dart';
import 'package:wallet_manager/wallet_manager.dart';

import 'chain.dart';
Expand Down Expand Up @@ -47,14 +47,14 @@ class Wallet {
Map resetPwdMap = await WalletManager.resetPwd(walletId, newPwd, oldPwd);
int status = resetPwdMap["status"];
if (status == null) {
LogUtil.instance().e("resetPwd=>", "not find status code");
Logger().e("resetPwd=>", "not find status code");
return null;
}
if (status == 200) {
return resetPwdMap;
} else {
String message = resetPwdMap["message"];
LogUtil.instance().e("isContainWallet=>", "error status is=>" + status.toString() + "||message is=>" + message.toString());
Logger().e("isContainWallet=>", "error status is=>" + status.toString() + "||message is=>" + message.toString());
}
return resetPwdMap;
}
Expand All @@ -66,14 +66,14 @@ class Wallet {
int status = walletRenameMap["status"];
String message = walletRenameMap["message"];
if (status == null) {
LogUtil.instance().e("rename=>", "not find status code");
Logger().e("rename=>", "not find status code");
return false;
}
if (status == 200) {
this.walletName = walletName; //The jni operation is complete, change the model
return walletRenameMap["isRename"];
} else {
LogUtil.instance().e("isContainWallet=>", "error status is=>" + walletRenameMap["status"].toString() + "||message is=>" + message.toString());
Logger().e("isContainWallet=>", "error status is=>" + walletRenameMap["status"].toString() + "||message is=>" + message.toString());
return false;
}
}
Expand Down Expand Up @@ -106,15 +106,15 @@ class Wallet {
int status = getNowChainMap["status"];
String message = getNowChainMap["message"];
if (status == null) {
LogUtil.instance().e("getNowChain=>", "not find status code");
Logger().e("getNowChain=>", "not find status code");
return ChainType.UNKNOWN; //0===UNKNOWN
}
if (status == 200) {
this.walletName = walletName; //The jni operation is complete, change the model
ChainType chainType = Chain.intToChainType(getNowChainMap["getNowChainType"]);
return chainType;
} else {
LogUtil.instance().e("getNowChain=>", "error status is=>" + getNowChainMap["status"].toString() + "||message is=>" + message.toString());
Logger().e("getNowChain=>", "error status is=>" + getNowChainMap["status"].toString() + "||message is=>" + message.toString());
return ChainType.UNKNOWN; //0===UNKNOWN
}
}
Expand All @@ -133,7 +133,7 @@ class Wallet {
if (status == 200) {
return isSetNowChain;
} else {
LogUtil.instance().e("setNowChainType message ===>", setNowChainMap["message"].toString());
Logger().e("setNowChainType message ===>", setNowChainMap["message"].toString());
return false;
}
}
Expand Down
88 changes: 39 additions & 49 deletions app/lib/model/wallets.dart

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions app/lib/net/etherscan_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:app/configv/config/handle_config.dart';
import 'package:app/model/chain.dart';
import 'package:app/model/tx_model/eth_transaction_model.dart';
import 'package:app/model/wallets.dart';
import 'package:log_util/log_util.dart';
import 'package:logger/logger.dart';
import 'package:app/util/utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_translate/flutter_translate.dart';
Expand Down Expand Up @@ -67,7 +67,7 @@ Future<String> loadEthBalance(String address, ChainType chainType) async {
return (BigInt.from(num.parse(res["result"])) / config.ethUnit).toStringAsFixed(4);
}
} catch (e) {
LogUtil.instance().e("loadEthBalance error ", e.toString());
Logger().e("loadEthBalance error ", e.toString());
return null;
}
return null;
Expand Down Expand Up @@ -171,7 +171,7 @@ Future<List<EthTransactionModel>> loadEthTxHistory(BuildContext context, String
}
} catch (e) {
ethTxModel.input = "";
LogUtil.instance().e("etherScanUtil error ", e.toString());
Logger().e("etherScanUtil error ", e.toString());
}
ethTxModel.timeStamp = DateTime.fromMillisecondsSinceEpoch(int.parse(res["result"][i]["timeStamp"]) * 1000).toString();
if (res["result"][i]["from"].trim().toLowerCase() == address.trim().toLowerCase()) {
Expand All @@ -191,7 +191,7 @@ Future<List<EthTransactionModel>> loadEthTxHistory(BuildContext context, String
return [];
}
} catch (e) {
LogUtil.instance().e("loadEthTxHistory===> ", e.toString());
Logger().e("loadEthTxHistory===> ", e.toString());
return [];
}
}
Expand Down Expand Up @@ -263,7 +263,7 @@ Future<List<EthTransactionModel>> loadErc20TxHistory(BuildContext context, Strin
}
return modelArray;
} catch (e) {
LogUtil.instance().e("loadErc20TxHistory===> ", e.toString());
Logger().e("loadErc20TxHistory===> ", e.toString());
return [];
}
}
Expand Down
16 changes: 8 additions & 8 deletions app/lib/net/net_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:io';
import 'package:app/configv/config/config.dart';
import 'package:app/configv/config/handle_config.dart';
import 'package:app/util/app_info_util.dart';
import 'package:log_util/log_util.dart';
import 'package:logger/logger.dart';
import 'package:dio/adapter.dart';
import 'package:dio/dio.dart';
import 'package:device_info/device_info.dart';
Expand Down Expand Up @@ -32,18 +32,18 @@ Future requestWithDeviceId(String url, {formData}) async {
}
} on PlatformException {
_deviceData = <String, dynamic>{'Error:': 'Failed to get platform version.'};
LogUtil.instance().e("requestWithDeviceId", "unknown target platform");
Logger().e("requestWithDeviceId", "unknown target platform");
return;
} catch (e) {
LogUtil.instance().e("requestWithDeviceId", "${e}");
Logger().e("requestWithDeviceId", "${e}");
return;
}
}
if (appSignInfo == null || appSignInfo.trim() == "") {
try {
appSignInfo = await AppInfoUtil.instance.getAppSignInfo();
} catch (e) {
LogUtil.instance().e("requestWithDeviceId request() error is", "${e}");
Logger().e("requestWithDeviceId request() error is", "${e}");
return;
}
}
Expand Down Expand Up @@ -105,11 +105,11 @@ Future request(String url, {formData}) async {
return response.data;
} else {
print("后端接口出现异常,请检测代码和服务器情况.........");
LogUtil.instance().e("后端接口出现异常,请检测代码和服务器情况 ", url.toString());
Logger().e("后端接口出现异常,请检测代码和服务器情况 ", url.toString());
throw Exception('后端接口出现异常,请检测代码和服务器情况.........');
}
} catch (e) {
LogUtil.instance().e("net_util request() error is", "${e}");
Logger().e("net_util request() error is", "${e}");
return print('ERROR:======>${e}');
}
}
Expand All @@ -120,10 +120,10 @@ Future download(url, savePath) async {
//Dio dio = new Dio();
//dio.options.contentType = ContentType.parse("application/x-www-form-urlencoded");
response = await Dio().download(url, savePath);
LogUtil.instance().d("net_util download() response is", "${response}");
Logger().d("net_util download() response is", "${response}");
return response;
} catch (e) {
LogUtil.instance().e("net_util download() error is", "${e}");
Logger().e("net_util download() error is", "${e}");
}
}

Expand Down
18 changes: 9 additions & 9 deletions app/lib/net/scryx_net_util.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:app/configv/config/config.dart';
import 'package:app/configv/config/handle_config.dart';
import 'package:app/model/wallets.dart';
import 'package:log_util/log_util.dart';
import 'package:logger/logger.dart';
import 'net_util.dart';

class ScryXNetUtil {
Expand All @@ -28,7 +28,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("loadEeeChainNonceTest error is ", e.toString());
Logger().e("loadEeeChainNonceTest error is ", e.toString());
return null;
}
}
Expand Down Expand Up @@ -104,7 +104,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("loadScryXStorage error is ", e.toString());
Logger().e("loadScryXStorage error is ", e.toString());
return null;
}
}
Expand All @@ -120,7 +120,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("loadScryXRuntimeVersion error is ", e.toString());
Logger().e("loadScryXRuntimeVersion error is ", e.toString());
return null;
}
}
Expand All @@ -141,7 +141,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("loadScryXBlockHash error is ", e.toString());
Logger().e("loadScryXBlockHash error is ", e.toString());
return null;
}
}
Expand All @@ -157,7 +157,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("loadChainHeader error is ", e.toString());
Logger().e("loadChainHeader error is ", e.toString());
return null;
}
}
Expand Down Expand Up @@ -258,7 +258,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("submitExtrinsic error is ", e.toString());
Logger().e("submitExtrinsic error is ", e.toString());
return null;
}
}
Expand All @@ -274,7 +274,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("getMetadata error is ", e.toString());
Logger().e("getMetadata error is ", e.toString());
return null;
}
}
Expand All @@ -290,7 +290,7 @@ class ScryXNetUtil {
resultMap = await request(netUrl, formData: paramObj);
return resultMap;
} catch (e) {
LogUtil.instance().e("loadSystemProperties error is ", e.toString());
Logger().e("loadSystemProperties error is ", e.toString());
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:app/model/wallets.dart';
import 'package:app/res/styles.dart';
import 'package:app/routers/fluro_navigator.dart';
import 'package:app/routers/routers.dart';
import 'package:log_util/log_util.dart';
import 'package:logger/logger.dart';
import 'package:app/util/qr_scan_util.dart';
import 'package:app/widgets/app_bar.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -402,7 +402,7 @@ class _CreateTestWalletPageState extends State<CreateTestWalletPage> {
void changeMnemonic() async {
var mnemonic = await Wallets.instance.createMnemonic(12);
if (mnemonic == null) {
LogUtil.instance().e("CreateWalletMnemonicPage=>", "mnemonic is null");
Logger().e("CreateWalletMnemonicPage=>", "mnemonic is null");
return;
}
setState(() {
Expand Down
4 changes: 2 additions & 2 deletions app/lib/pages/create_wallet/create_wallet_mnemonic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:app/provide/create_wallet_process_provide.dart';
import 'package:app/provide/qr_info_provide.dart';
import 'package:app/routers/application.dart';
import 'package:app/routers/fluro_navigator.dart';
import 'package:log_util/log_util.dart';
import 'package:logger/logger.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
Expand Down Expand Up @@ -37,7 +37,7 @@ class _CreateWalletMnemonicPageState extends State<CreateWalletMnemonicPage> {
_initMnemonicData() async {
var mnemonic = await Wallets.instance.createMnemonic(12);
if (mnemonic == null) {
LogUtil.instance().e("CreateWalletMnemonicPage=>", "mnemonic is null");
Logger().e("CreateWalletMnemonicPage=>", "mnemonic is null");
return;
}
setState(() {
Expand Down
40 changes: 21 additions & 19 deletions app/lib/pages/create_wallet/create_wallet_name.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:typed_data';
import 'dart:ui';

import 'package:app/provide/create_wallet_process_provide.dart';
import 'package:flutter/material.dart';
import 'package:flutter_translate/flutter_translate.dart';
import 'package:logger/logger.dart';
import 'package:provider/provider.dart';
import '../../widgets/app_bar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
Expand Down Expand Up @@ -294,26 +296,26 @@ class _CreateWalletNamePageState extends State<CreateWalletNamePage> {
Gaps.scaleHGap(5),
Container(
child: Row(
children: <Widget>[
Checkbox(
value: _eeeChainChoose,
onChanged: (newValue) {
setState(
() {
_eeeChainChoose = newValue;
},
);
children: <Widget>[
Checkbox(
value: _eeeChainChoose,
onChanged: (newValue) {
setState(
() {
_eeeChainChoose = newValue;
},
),
Text(
translate('eee_token_name'),
style: TextStyle(
color: Colors.white,
fontSize: 13,
),
),
],
)),
);
},
),
Text(
translate('eee_token_name'),
style: TextStyle(
color: Colors.white,
fontSize: 13,
),
),
],
)),
],
),
],
Expand Down

0 comments on commit d29b919

Please sign in to comment.