From 4f0af4815b1fc20a4094f3ff187449de095b1036 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Mon, 8 Aug 2022 18:06:42 +0800 Subject: [PATCH 01/19] fix bug --- lib/pages/assets/index.dart | 3 +- lib/pages/ecosystem/converToPage.dart | 137 +++++++++------- .../ecosystem/crosschainTransferPage.dart | 154 ++++++++---------- pubspec.lock | 10 +- pubspec.yaml | 6 +- 5 files changed, 157 insertions(+), 153 deletions(-) diff --git a/lib/pages/assets/index.dart b/lib/pages/assets/index.dart index 68b10997..e5151db7 100644 --- a/lib/pages/assets/index.dart +++ b/lib/pages/assets/index.dart @@ -10,7 +10,6 @@ import 'package:app/pages/networkSelectPage.dart'; import 'package:app/pages/public/AdBanner.dart'; import 'package:app/service/index.dart'; import 'package:app/utils/InstrumentWidget.dart'; -import 'package:app/utils/Utils.dart'; import 'package:app/utils/i18n/index.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -210,6 +209,7 @@ class _AssetsState extends State { children: [ Container( margin: EdgeInsets.only(right: 8), + height: 32, width: 32, child: widget.plugins[networkIndex].basic.icon), Text( @@ -261,6 +261,7 @@ class _AssetsState extends State { title: Text(dic['uos.title']), content: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: confirmMsg), actions: [ PolkawalletActionSheetAction( diff --git a/lib/pages/ecosystem/converToPage.dart b/lib/pages/ecosystem/converToPage.dart index e9e00fe6..1e20be86 100644 --- a/lib/pages/ecosystem/converToPage.dart +++ b/lib/pages/ecosystem/converToPage.dart @@ -189,6 +189,9 @@ class _ConverToPageState extends State { final fromNetwork = data["fromNetwork"]; final feeData = await widget.service.plugin.sdk.webView?.evalJavascript( 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); + + print( + 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); if (feeData != null) { fee = feeData['partialFee'].toString(); } @@ -227,7 +230,6 @@ class _ConverToPageState extends State { @override Widget build(BuildContext context) { final dic = I18n.of(context)?.getDic(i18n_full_dic_app, 'public'); - final dicAcala = I18n.of(context).getDic(i18n_full_dic_karura, 'acala'); final data = ModalRoute.of(context).settings.arguments as Map; final TokenBalanceData balance = data["balance"]; final fromNetwork = data["fromNetwork"]; @@ -244,15 +246,21 @@ class _ConverToPageState extends State { final tokenXcmInfo = (tokensConfig['xcmInfo'] ?? {})[fromNetwork] ?? {}; - final destExistDeposit = Fmt.balanceInt( - plugin.store.assets.tokenBalanceMap[balance.tokenNameId].minBalance); final destFee = Fmt.balanceInt((tokenXcmInfo[balance.symbol] ?? {})['receiveFee']); - - final nativeToken = widget.service.plugin.networkState.tokenSymbol[0]; - final nativeTokenDecimals = widget - .service.plugin.networkState.tokenDecimals[ - widget.service.plugin.networkState.tokenSymbol.indexOf(nativeToken)]; + final destExistDeposit = Fmt.balanceInt( + (tokenXcmInfo[balance.symbol] ?? {})['existentialDeposit']); + + final max = (BigInt.parse(balance.amount) - + destExistDeposit - + Fmt.tokenInt( + (Fmt.balanceDouble(_fee, balance.decimals) * 1.2).toString(), + balance.decimals)) + .toString(); + final min = (Fmt.balanceInt(plugin + .store.assets.tokenBalanceMap[balance.tokenNameId].minBalance) + + destFee) + .toString(); final feeTokenSymbol = ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? {})['nativeToken']; @@ -271,7 +279,7 @@ class _ConverToPageState extends State { ), body: SafeArea( child: Padding( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: Column( children: [ Expanded( @@ -285,9 +293,9 @@ class _ConverToPageState extends State { ), Container( width: double.infinity, - padding: - EdgeInsets.symmetric(horizontal: 8, vertical: 16), - decoration: BoxDecoration( + padding: const EdgeInsets.symmetric( + horizontal: 8, vertical: 16), + decoration: const BoxDecoration( color: Color(0x0FFFFFFF), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(4), @@ -306,13 +314,26 @@ class _ConverToPageState extends State { titleTag: "${dic['ecosystem.bringTo']} ${widget.service.plugin.basic.name}", inputCtrl: _amountCtrl, - // onSetMax: (Fmt.balanceInt(balance.amount) ?? BigInt.zero) > - // BigInt.zero - // ? (max) => _onSetMax(max, balance.decimals) - // : null, + onSetMax: (Fmt.balanceInt(balance.amount) ?? BigInt.zero) > + BigInt.zero + ? (maxValue) { + _amountCtrl.text = Fmt.priceFloorBigInt( + BigInt.parse(max), balance.decimals, + lengthMax: 10); + } + : null, onInputChange: (v) { var error = _validateAmount( v, Fmt.balanceInt(balance.amount), balance.decimals); + if (Fmt.tokenInt(v, balance.decimals) < + BigInt.parse(min)) { + error = + '${dic['bridge.min']} ${Fmt.priceFloorBigInt(BigInt.parse(min), balance.decimals, lengthMax: 6)}'; + } else if (Fmt.tokenInt(v, balance.decimals) > + BigInt.parse(max)) { + error = + '${dic['bridge.max']} ${Fmt.priceFloorBigInt(BigInt.parse(max), balance.decimals, lengthMax: 6)}'; + } if (error == null) { _getTxFee(_amountCtrl.text); } @@ -335,10 +356,10 @@ class _ConverToPageState extends State { ), ErrorMessage( _error1, - margin: EdgeInsets.only(bottom: 24), + margin: const EdgeInsets.only(bottom: 24), ), Padding( - padding: EdgeInsets.only(bottom: 24), + padding: const EdgeInsets.only(bottom: 24), child: PluginAddressFormItem( label: dic['ecosystem.destinationAccount'], account: widget.service.keyring.current, @@ -347,66 +368,66 @@ class _ConverToPageState extends State { visible: _isLoading, child: Container( width: double.infinity, - child: PluginLoadingWidget(), + child: const PluginLoadingWidget(), )), - Row( - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(right: 40), - child: Text(dicAcala['cross.exist'], - style: labelStyle)), - ), - Expanded( - flex: 0, - child: Text( - '${Fmt.priceCeilBigInt(destExistDeposit, balance.decimals, lengthMax: 6)} ${balance.symbol}', - style: infoValueStyle)), - ], - ), - Padding( - padding: EdgeInsets.only(top: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.only(right: 4), - child: - Text(dicAcala['cross.fee'], style: labelStyle), - ), - ), - Text( - '${Fmt.priceCeilBigInt(destFee, balance.decimals, lengthMax: 6)} ${balance.symbol}', - style: infoValueStyle, - ) - ], - ), - ), + // Row( + // children: [ + // Expanded( + // child: Container( + // padding: EdgeInsets.only(right: 40), + // child: Text(dicAcala['cross.exist'], + // style: labelStyle)), + // ), + // Expanded( + // flex: 0, + // child: Text( + // '${Fmt.priceCeilBigInt(destExistDeposit, balance.decimals, lengthMax: 6)} ${balance.symbol}', + // style: infoValueStyle)), + // ], + // ), Visibility( visible: _fee != null, child: Padding( - padding: EdgeInsets.only(top: 8), + padding: const EdgeInsets.only(top: 8), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Expanded( child: Padding( - padding: EdgeInsets.only(right: 4), - child: Text(dicAcala['transfer.fee'], + padding: const EdgeInsets.only(right: 4), + child: Text(dic['hub.origin.transfer.fee'], style: labelStyle), ), ), Text( - '${Fmt.priceCeilBigInt(Fmt.balanceInt(_fee), nativeTokenDecimals, lengthMax: 6)} $feeTokenSymbol', + '${Fmt.priceCeilBigInt(Fmt.balanceInt(_fee), balance.decimals, lengthMax: 6)} $feeTokenSymbol', style: infoValueStyle), ], ), )), + Padding( + padding: const EdgeInsets.only(top: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 4), + child: Text(dic['hub.destination.transfer.fee'], + style: labelStyle), + ), + ), + Text( + '${Fmt.priceCeilBigInt(destFee, balance.decimals, lengthMax: 6)} ${balance.symbol}', + style: infoValueStyle, + ) + ], + ), + ), ], ))), Padding( - padding: EdgeInsets.only(top: 37, bottom: 38), + padding: const EdgeInsets.only(top: 37, bottom: 38), child: PluginButton( title: dic['auction.submit'], onPressed: () async { diff --git a/lib/pages/ecosystem/crosschainTransferPage.dart b/lib/pages/ecosystem/crosschainTransferPage.dart index 4e3a97a7..ca16530f 100644 --- a/lib/pages/ecosystem/crosschainTransferPage.dart +++ b/lib/pages/ecosystem/crosschainTransferPage.dart @@ -219,10 +219,13 @@ class _CrossChainTransferPageState extends State { }); final data = ModalRoute.of(context).settings.arguments as Map; final fromNetwork = data["fromNetwork"]; + final TokenBalanceData balance = data["balance"]; final sender = TxSenderData(widget.service.keyring.current.address, widget.service.keyring.current.pubKey); - final xcmParams = await _getXcmParams('100000000', feeEstimate: true); + final xcmParams = await _getXcmParams( + Fmt.tokenInt(_amountCtrl.text.trim(), balance.decimals).toString(), + feeEstimate: true); if (xcmParams == null) return '0'; final txInfo = TxInfoData(xcmParams['module'], xcmParams['call'], sender); @@ -235,6 +238,8 @@ class _CrossChainTransferPageState extends State { } else { final feeData = await widget.service.plugin.sdk.webView?.evalJavascript( 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); + print( + 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); if (feeData != null) { fee = feeData['partialFee'].toString(); } @@ -320,7 +325,8 @@ class _CrossChainTransferPageState extends State { final destChainName = _chainTo; - final isFromKar = fromNetwork == plugin_name_karura; + final isFromKar = fromNetwork == plugin_name_karura || + fromNetwork == plugin_name_acala; final tokenXcmInfo = (tokensConfig['xcmInfo'] ?? {})[isFromKar ? destChainName : fromNetwork] ?? @@ -351,11 +357,27 @@ class _CrossChainTransferPageState extends State { ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? {})['nativeToken']; - final nativeToken = widget.service.plugin.networkState.tokenSymbol[0]; final nativeTokenDecimals = widget.service.plugin.networkState.tokenDecimals[widget .service.plugin.networkState.tokenSymbol - .indexOf(nativeToken)]; + .indexOf(feeTokenSymbol)]; + + final fromEd = isFromKar + ? BigInt.zero + : Fmt.balanceInt(tokensConfig['xcmInfo'][fromNetwork] + [balance.symbol]['existentialDeposit']); + + final max = (BigInt.parse(balance.amount) - + fromEd - + Fmt.tokenInt( + (Fmt.balanceDouble( + feeTokenSymbol == balance.symbol ? _fee : '0', + balance.decimals) * + 1.2) + .toString(), + balance.decimals)) + .toString(); + final min = (destExistDeposit + destFee).toString(); return SafeArea( child: Padding( padding: EdgeInsets.all(16), @@ -412,11 +434,29 @@ class _CrossChainTransferPageState extends State { titleTag: "${balance.symbol} ${I18n.of(context)?.getDic(i18n_full_dic_app, 'assets')['amount']}", inputCtrl: _amountCtrl, + onSetMax: (Fmt.balanceInt(balance.amount) ?? + BigInt.zero) > + BigInt.zero + ? (maxValue) { + _amountCtrl.text = Fmt.priceFloorBigInt( + BigInt.parse(max), balance.decimals, + lengthMax: 10); + } + : null, onInputChange: (v) { var error = _validateAmount( v, Fmt.balanceInt(balance.amount), balance.decimals); + if (Fmt.tokenInt(v, balance.decimals) < + BigInt.parse(min)) { + error = + '${dic['bridge.min']} ${Fmt.priceFloorBigInt(BigInt.parse(min), balance.decimals, lengthMax: 6)}'; + } else if (Fmt.tokenInt(v, balance.decimals) > + BigInt.parse(max)) { + error = + '${dic['bridge.max']} ${Fmt.priceFloorBigInt(BigInt.parse(max), balance.decimals, lengthMax: 6)}'; + } setState(() { _error1 = error; }); @@ -446,90 +486,6 @@ class _CrossChainTransferPageState extends State { width: double.infinity, child: PluginLoadingWidget(), )), - Row( - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(right: 40), - child: Text(dicAcala['cross.exist'], - style: labelStyle)), - ), - Expanded( - flex: 0, - child: Text( - '${Fmt.priceCeilBigInt(destExistDeposit, balance.decimals, lengthMax: 6)} ${balance.symbol}', - style: infoValueStyle)), - ], - ), - Padding( - padding: EdgeInsets.only(top: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.only(right: 4), - child: Text(dicAcala['cross.fee'], - style: labelStyle), - ), - ), - Text( - '${Fmt.priceCeilBigInt(destFee, balance.decimals, lengthMax: 6)} ${balance.symbol}', - style: infoValueStyle, - ) - ], - ), - ), - Visibility( - visible: isFromKar && sendFee.length > 0, - child: Padding( - padding: EdgeInsets.only(top: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.only(right: 4), - child: Text('XCM fee', - style: labelStyle), - ), - ), - Text( - '${Fmt.priceFloorBigInt(sendFeeAmount, balance.decimals ?? 12, lengthMax: 6)} ${balance.symbol}', - style: infoValueStyle), - ], - ), - ), - ), - Visibility( - visible: isFromKar, - child: Padding( - padding: EdgeInsets.only(top: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(right: 60), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text(dicAcala['transfer.exist'], - style: labelStyle), - Text( - dicAcala['cross.exist.msg'], - style: subTitleStyle), - ], - )), - ), - Text( - '${Fmt.priceCeilBigInt(existDeposit, balance.decimals, lengthMax: 6)} ${balance.symbol}', - style: infoValueStyle), - ], - ), - ), - ), Visibility( visible: _fee != null, child: Padding( @@ -541,7 +497,7 @@ class _CrossChainTransferPageState extends State { child: Padding( padding: EdgeInsets.only(right: 4), child: Text( - dicAcala['transfer.fee'], + dic['hub.origin.transfer.fee'], style: labelStyle), ), ), @@ -551,6 +507,26 @@ class _CrossChainTransferPageState extends State { ], ), )), + Padding( + padding: EdgeInsets.only(top: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.only(right: 4), + child: Text( + dic['hub.destination.transfer.fee'], + style: labelStyle), + ), + ), + Text( + '${Fmt.priceCeilBigInt(destFee, balance.decimals, lengthMax: 6)} ${balance.symbol}', + style: infoValueStyle, + ) + ], + ), + ), ]), )), Padding( diff --git a/pubspec.lock b/pubspec.lock index eb208f7b..5eef7b7e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -553,11 +553,13 @@ packages: source: hosted version: "2.0.6" flutter_qr_scan: - dependency: transitive + dependency: "direct overridden" description: - name: flutter_qr_scan - url: "https://pub.dartlang.org" - source: hosted + path: "." + ref: "90fdd52b98e954c301b68f605c0c6c0fd21cef61" + resolved-ref: "90fdd52b98e954c301b68f605c0c6c0fd21cef61" + url: "https://github.com/polkawallet-io/flutter_qr_reader.git" + source: git version: "1.0.7" flutter_screenutil: dependency: "direct main" diff --git a/pubspec.yaml b/pubspec.yaml index a8652050..27ee5594 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.3.4+3343 +version: 3.3.4+3344 environment: sdk: ">=2.10.0 <3.0.0" @@ -128,6 +128,10 @@ dependency_overrides: flutter_html: ^2.2.1 flutter_slidable: ^1.2.0 platform: ^3.1.0 + flutter_qr_scan: + git: + url: https://github.com/polkawallet-io/flutter_qr_reader.git + ref: 90fdd52b98e954c301b68f605c0c6c0fd21cef61 dev_dependencies: From 269c0277002c0325da2e665b254726eeeb2de0ea Mon Sep 17 00:00:00 2001 From: gxhx Date: Tue, 9 Aug 2022 10:31:44 +0800 Subject: [PATCH 02/19] fix bug #349 #342 --- lib/app.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/app.dart b/lib/app.dart index 6f8cf3dd..c2beebe0 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -72,6 +72,7 @@ import 'package:polkawallet_sdk/api/types/networkParams.dart'; import 'package:polkawallet_sdk/api/types/walletConnect/pairingData.dart'; import 'package:polkawallet_sdk/api/types/walletConnect/payloadData.dart'; import 'package:polkawallet_sdk/plugin/index.dart'; +import 'package:polkawallet_sdk/service/localServer.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/app.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; @@ -907,6 +908,7 @@ class _WalletAppState extends State with WidgetsBindingObserver { break; case AppLifecycleState.resumed: _dropsService(); + LocalServer.getInstance().startLocalServer(); break; case AppLifecycleState.paused: _dropsServiceCancel(); From 598da171a70c09642c8868fba9ef0300b07592d7 Mon Sep 17 00:00:00 2001 From: gxhx Date: Tue, 9 Aug 2022 15:06:23 +0800 Subject: [PATCH 03/19] bridge ui update --- lib/pages/bridge/bridgePage.dart | 41 ++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/lib/pages/bridge/bridgePage.dart b/lib/pages/bridge/bridgePage.dart index f42fe6e6..5a6f65fd 100644 --- a/lib/pages/bridge/bridgePage.dart +++ b/lib/pages/bridge/bridgePage.dart @@ -17,16 +17,16 @@ import 'package:polkawallet_sdk/api/types/bridge/bridgeTokenBalance.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/storage/types/keyPairData.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; +import 'package:polkawallet_ui/components/addressIcon.dart'; import 'package:polkawallet_ui/components/tokenIcon.dart'; -import 'package:polkawallet_ui/components/v3/addressIcon.dart'; +import 'package:polkawallet_ui/components/v3/addressIcon.dart' as v3; import 'package:polkawallet_ui/components/v3/addressTextFormField.dart'; import 'package:polkawallet_ui/components/v3/dialog.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginAccountInfoAction.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTextFormField.dart'; -import 'package:polkawallet_ui/pages/v3/accountListPage.dart'; +import 'package:polkawallet_ui/pages/v3/plugin/pluginAccountListPage.dart'; import 'package:polkawallet_ui/pages/v3/xcmTxConfirmPage.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; @@ -479,7 +479,7 @@ class _BridgePageState extends State { color: Colors.white)), dicAss['address']: Row( children: [ - AddressIcon(_accountTo.address, svg: _accountTo.icon), + v3.AddressIcon(_accountTo.address, svg: _accountTo.icon), Expanded( child: Container( margin: const EdgeInsets.fromLTRB(8, 16, 0, 16), @@ -507,9 +507,10 @@ class _BridgePageState extends State { void _changeSenderAccount() async { final res = await Navigator.of(context).pushNamed( - AccountListPage.route, - arguments: AccountListPageParams( - list: widget.service.keyring.allAccounts.toList()), + PluginAccountListPage.route, + arguments: PluginAccountListPageParams( + list: widget.service.keyring.allAccounts.toList(), + current: widget.service.keyring.current), ); final sender = res as KeyPairData; if (sender != null && @@ -558,9 +559,29 @@ class _BridgePageState extends State { title: Text(dic["hub.bridge"] ?? "Bridge"), centerTitle: true, actions: [ - PluginAccountInfoAction( - widget.service.keyring, - onSelected: (index) => _changeSenderAccount(), + Center( + child: Container( + width: 30, + height: 30, + margin: const EdgeInsets.only(right: 16), + decoration: BoxDecoration( + color: const Color(0x24FFFFFF), + borderRadius: BorderRadius.circular(8)), + child: IconButton( + onPressed: () => _changeSenderAccount(), + padding: EdgeInsets.zero, + iconSize: 30, + // bgColor: const Color(0x24FFFFFF), + icon: AddressIcon( + widget.service.keyring.current.address, + svg: widget.service.keyring.current.icon, + size: 22, + tapToCopy: false, + borderColor: const Color(0xFF242528), + borderWidth: 2, + ), + ), + ), ) ], ), From ba8c321bb35836f1f5c332b4d1a4dc8b57482380 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 9 Aug 2022 16:49:34 +0800 Subject: [PATCH 04/19] fix bug --- lib/pages/assets/index.dart | 33 ++++++++++------- lib/pages/ecosystem/converToPage.dart | 13 ++++--- .../ecosystem/crosschainTransferPage.dart | 36 ++++++++----------- lib/pages/ecosystem/tokenStakingPage.dart | 2 +- lib/utils/i18n/en/account.dart | 1 + lib/utils/i18n/zh/account.dart | 1 + pubspec.lock | 36 ++++++++++--------- pubspec.yaml | 2 +- 8 files changed, 64 insertions(+), 60 deletions(-) diff --git a/lib/pages/assets/index.dart b/lib/pages/assets/index.dart index e5151db7..aa95f844 100644 --- a/lib/pages/assets/index.dart +++ b/lib/pages/assets/index.dart @@ -167,8 +167,8 @@ class _AssetsState extends State { Text(dic['uos.parse']), Container( margin: EdgeInsets.only(top: 16.h), - child: CupertinoActivityIndicator( - color: const Color(0xFF3C3C44)), + child: const CupertinoActivityIndicator( + color: Color(0xFF3C3C44)), ) ], ), @@ -194,52 +194,59 @@ class _AssetsState extends State { networkIndex < 0 ? Container() : Container( - margin: EdgeInsets.only(top: 8, bottom: 8), + margin: const EdgeInsets.only(top: 8, bottom: 8), child: Text(dic['uos.network']), ), networkIndex < 0 ? Container() : Container( - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), decoration: BoxDecoration( border: Border.all( color: Theme.of(context).dividerColor, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(8))), + borderRadius: + const BorderRadius.all(Radius.circular(8))), child: Row( children: [ Container( - margin: EdgeInsets.only(right: 8), + margin: const EdgeInsets.only(right: 8), height: 32, width: 32, child: widget.plugins[networkIndex].basic.icon), Text( widget.plugins[networkIndex].basic.name.toUpperCase(), - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context) + .textTheme + .headline4 + ?.copyWith(color: Colors.black), ) ], ), ), Container( - margin: EdgeInsets.only(top: 12, bottom: 8), + margin: const EdgeInsets.only(top: 12, bottom: 8), child: Text(dic['uos.signer']), ), Container( - padding: EdgeInsets.all(8), - margin: EdgeInsets.only(bottom: 16), + padding: const EdgeInsets.all(8), + margin: const EdgeInsets.only(bottom: 16), decoration: BoxDecoration( border: Border.all( color: Theme.of(context).dividerColor, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(8))), + borderRadius: const BorderRadius.all(Radius.circular(8))), child: Row( children: [ Container( - margin: EdgeInsets.only(right: 8), + margin: const EdgeInsets.only(right: 8), width: 32, child: AddressIcon(sender.address, svg: sender.icon), ), Text( Fmt.address(sender.address), - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context) + .textTheme + .headline4 + ?.copyWith(color: Colors.black), ), ], ), diff --git a/lib/pages/ecosystem/converToPage.dart b/lib/pages/ecosystem/converToPage.dart index 1e20be86..f86050fa 100644 --- a/lib/pages/ecosystem/converToPage.dart +++ b/lib/pages/ecosystem/converToPage.dart @@ -314,8 +314,7 @@ class _ConverToPageState extends State { titleTag: "${dic['ecosystem.bringTo']} ${widget.service.plugin.basic.name}", inputCtrl: _amountCtrl, - onSetMax: (Fmt.balanceInt(balance.amount) ?? BigInt.zero) > - BigInt.zero + onSetMax: BigInt.parse(max) > BigInt.zero ? (maxValue) { _amountCtrl.text = Fmt.priceFloorBigInt( BigInt.parse(max), balance.decimals, @@ -325,14 +324,14 @@ class _ConverToPageState extends State { onInputChange: (v) { var error = _validateAmount( v, Fmt.balanceInt(balance.amount), balance.decimals); - if (Fmt.tokenInt(v, balance.decimals) < + if (Fmt.tokenInt(v, balance.decimals) > + BigInt.parse(max)) { + error = + '${dic['bridge.max']} ${Fmt.priceFloorBigInt(BigInt.parse(max) < BigInt.zero ? BigInt.zero : BigInt.parse(max), balance.decimals, lengthMax: 6)}'; + } else if (Fmt.tokenInt(v, balance.decimals) < BigInt.parse(min)) { error = '${dic['bridge.min']} ${Fmt.priceFloorBigInt(BigInt.parse(min), balance.decimals, lengthMax: 6)}'; - } else if (Fmt.tokenInt(v, balance.decimals) > - BigInt.parse(max)) { - error = - '${dic['bridge.max']} ${Fmt.priceFloorBigInt(BigInt.parse(max), balance.decimals, lengthMax: 6)}'; } if (error == null) { _getTxFee(_amountCtrl.text); diff --git a/lib/pages/ecosystem/crosschainTransferPage.dart b/lib/pages/ecosystem/crosschainTransferPage.dart index ca16530f..72add395 100644 --- a/lib/pages/ecosystem/crosschainTransferPage.dart +++ b/lib/pages/ecosystem/crosschainTransferPage.dart @@ -33,10 +33,10 @@ import 'package:polkawallet_ui/utils/index.dart'; import 'package:polkawallet_ui/components/tokenIcon.dart'; class CrossChainTransferPage extends StatefulWidget { - CrossChainTransferPage(this.service, {Key key}) : super(key: key); + const CrossChainTransferPage(this.service, {Key key}) : super(key: key); final AppService service; - static final String route = '/ecosystem/crosschainTransfer'; + static const String route = '/ecosystem/crosschainTransfer'; @override State createState() => _CrossChainTransferPageState(); @@ -347,20 +347,16 @@ class _CrossChainTransferPageState extends State { : Fmt.balanceInt((tokenXcmInfo[balance.symbol] ?? {})['fee']) : Fmt.balanceInt( (tokenXcmInfo[balance.symbol] ?? {})['receiveFee']); - final sendFee = - List.of((tokenXcmInfo[balance.symbol] ?? {})['sendFee'] ?? []); - - final sendFeeAmount = - sendFee.length > 0 ? Fmt.balanceInt(sendFee[1]) : BigInt.zero; final feeTokenSymbol = ((tokensConfig['xcmChains'] ?? {})[fromNetwork] ?? {})['nativeToken']; - final nativeTokenDecimals = - widget.service.plugin.networkState.tokenDecimals[widget - .service.plugin.networkState.tokenSymbol - .indexOf(feeTokenSymbol)]; + final feeTokenIndex = widget.service.plugin.balances.tokens + .indexWhere((e) => e.symbol == feeTokenSymbol); + final nativeTokenDecimals = feeTokenIndex >= 0 + ? widget.service.plugin.balances.tokens[feeTokenIndex].decimals + : 12; final fromEd = isFromKar ? BigInt.zero @@ -391,9 +387,9 @@ class _CrossChainTransferPageState extends State { ChainSelected(dic['ecosystem.from'], fromNetwork), isFromKar ? PluginTagCard( - margin: EdgeInsets.only(top: 24), + margin: const EdgeInsets.only(top: 24), titleTag: dic['ecosystem.to'], - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 8, vertical: 16), child: GestureDetector( onTap: () { @@ -434,9 +430,7 @@ class _CrossChainTransferPageState extends State { titleTag: "${balance.symbol} ${I18n.of(context)?.getDic(i18n_full_dic_app, 'assets')['amount']}", inputCtrl: _amountCtrl, - onSetMax: (Fmt.balanceInt(balance.amount) ?? - BigInt.zero) > - BigInt.zero + onSetMax: BigInt.parse(max) > BigInt.zero ? (maxValue) { _amountCtrl.text = Fmt.priceFloorBigInt( BigInt.parse(max), balance.decimals, @@ -448,14 +442,14 @@ class _CrossChainTransferPageState extends State { v, Fmt.balanceInt(balance.amount), balance.decimals); - if (Fmt.tokenInt(v, balance.decimals) < + if (Fmt.tokenInt(v, balance.decimals) > + BigInt.parse(max)) { + error = + '${dic['bridge.max']} ${Fmt.priceFloorBigInt(BigInt.parse(max) < BigInt.zero ? BigInt.zero : BigInt.parse(max), balance.decimals, lengthMax: 6)}'; + } else if (Fmt.tokenInt(v, balance.decimals) < BigInt.parse(min)) { error = '${dic['bridge.min']} ${Fmt.priceFloorBigInt(BigInt.parse(min), balance.decimals, lengthMax: 6)}'; - } else if (Fmt.tokenInt(v, balance.decimals) > - BigInt.parse(max)) { - error = - '${dic['bridge.max']} ${Fmt.priceFloorBigInt(BigInt.parse(max), balance.decimals, lengthMax: 6)}'; } setState(() { _error1 = error; diff --git a/lib/pages/ecosystem/tokenStakingPage.dart b/lib/pages/ecosystem/tokenStakingPage.dart index 64ee2fa7..0ebd977c 100644 --- a/lib/pages/ecosystem/tokenStakingPage.dart +++ b/lib/pages/ecosystem/tokenStakingPage.dart @@ -277,7 +277,7 @@ class _TokenItemViewState extends State { Padding( padding: EdgeInsets.only(right: 3), child: Text( - "${Fmt.priceFloorBigIntFormatter(Fmt.balanceInt(widget.balance.amount), widget.balance.decimals)} ${widget.balance.symbol}", + "${Fmt.priceFloorBigIntFormatter(Fmt.balanceInt(widget.balance.amount), widget.balance.decimals, lengthMax: 6)} ${widget.balance.symbol}", style: style)), Visibility( visible: widget.balance.isCacheChange, diff --git a/lib/utils/i18n/en/account.dart b/lib/utils/i18n/en/account.dart index 542e0ef7..b5c60281 100644 --- a/lib/utils/i18n/en/account.dart +++ b/lib/utils/i18n/en/account.dart @@ -53,6 +53,7 @@ const Map enAccount = { 'unlock.bio': 'Authenticate to unlock', 'unlock.bio.enable': 'Enable fingerprint/faceID', 'uos.title': 'Offline Signature', + 'uos.acc.invalid': 'Account invalid', 'uos.network': 'Tx signing request from', 'uos.continue': 'Continue?', 'uos.continue.switch': 'Switch account to continue?', diff --git a/lib/utils/i18n/zh/account.dart b/lib/utils/i18n/zh/account.dart index 531caf28..60ef2dc9 100644 --- a/lib/utils/i18n/zh/account.dart +++ b/lib/utils/i18n/zh/account.dart @@ -46,6 +46,7 @@ const Map zhAccount = { 'unlock.bio': '验证以解锁', 'unlock.bio.enable': '启用指纹/面容识别', 'uos.title': '离线签名', + 'uos.acc.invalid': '账户不可用', 'uos.network': '签名请求来自', 'uos.continue': '确认继续?', 'uos.continue.switch': '切换账户并继续签名?', diff --git a/pubspec.lock b/pubspec.lock index 5eef7b7e..9effb852 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -212,7 +212,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" code_builder: dependency: transitive description: @@ -373,7 +373,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: @@ -588,7 +588,7 @@ packages: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.3" flutter_swiper: dependency: transitive description: @@ -957,14 +957,14 @@ packages: name: path_drawing url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" path_provider: dependency: transitive description: @@ -1069,7 +1069,7 @@ packages: path: "../../coding/polkawallet/polkawallet_plugin_acala" relative: true source: path - version: "0.4.8" + version: "0.4.9" polkawallet_plugin_bifrost: dependency: "direct main" description: @@ -1112,7 +1112,7 @@ packages: path: "../../coding/polkawallet/polkawallet_plugin_karura" relative: true source: path - version: "0.4.8" + version: "0.4.9" polkawallet_plugin_kusama: dependency: "direct main" description: @@ -1132,24 +1132,26 @@ packages: polkawallet_plugin_statemine: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_statemine" - relative: true - source: path - version: "0.4.6" + path: "." + ref: "8ae288145247607b3fc67deca7d7f64016d8bf56" + resolved-ref: "8ae288145247607b3fc67deca7d7f64016d8bf56" + url: "https://github.com/polkawallet-io/polkawallet_plugin_statemine.git" + source: git + version: "0.4.9" polkawallet_sdk: dependency: "direct main" description: - path: "../../coding/polkawallet/sdk" - relative: true - source: path - version: "0.4.8" + name: polkawallet_sdk + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.9" polkawallet_ui: dependency: "direct main" description: path: "../../coding/polkawallet/ui" relative: true source: path - version: "0.4.8" + version: "0.4.9" pool: dependency: transitive description: @@ -1448,7 +1450,7 @@ packages: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 27ee5594..104335be 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -122,7 +122,7 @@ dependency_overrides: git: url: https://github.com/google/charts path: charts_flutter - flutter_svg: ^1.0.3 + flutter_svg: ^1.1.3 webview_flutter: ^3.0.4 cached_network_image: ^3.2.0 flutter_html: ^2.2.1 From c73653f13c4e3b491b4ddda502b6ad9c2e7f6f0b Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Wed, 10 Aug 2022 10:48:01 +0800 Subject: [PATCH 05/19] fix bug --- lib/pages/browser/browserApi.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pages/browser/browserApi.dart b/lib/pages/browser/browserApi.dart index c1d9b5a1..6f2d12a6 100644 --- a/lib/pages/browser/browserApi.dart +++ b/lib/pages/browser/browserApi.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:app/service/index.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_ui/pages/dAppWrapperPage.dart'; @@ -68,10 +66,12 @@ class BrowserApi { var dappLatest = getDappLatestStore(service); List datas = []; dappLatest.forEach((key, value) { - var data = service.store.settings.dapps - .firstWhere((element) => element["name"] == key); - data["time"] = DateTime.parse(value); - datas.add(data); + try { + var data = service.store.settings.dapps + .firstWhere((element) => element["name"] == key); + data["time"] = DateTime.parse(value); + datas.add(data); + } catch (_) {} }); datas.sort((left, right) => right["time"].compareTo(left["time"])); return datas; From 61c20454913fc988a773a754907ede9618eb5e93 Mon Sep 17 00:00:00 2001 From: gxhx Date: Wed, 10 Aug 2022 11:17:58 +0800 Subject: [PATCH 06/19] ui update --- lib/pages/bridge/bridgeChainSelector.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/pages/bridge/bridgeChainSelector.dart b/lib/pages/bridge/bridgeChainSelector.dart index 0790de7e..38af4216 100644 --- a/lib/pages/bridge/bridgeChainSelector.dart +++ b/lib/pages/bridge/bridgeChainSelector.dart @@ -596,6 +596,14 @@ class ChainSelectorList extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: const Color(0x24FFFFFF)), + foregroundDecoration: i == selected + ? BoxDecoration( + color: const Color(0xFFFF7849).withOpacity(0.09), + borderRadius: BorderRadius.circular(4), + border: Border.all( + color: const Color(0xFFFF7849), + )) + : null, child: ListTile( selected: i == selected, title: CurrencyWithIcon( From 0a6c38aec67867726e33fe1a83c86b15e1c94cfd Mon Sep 17 00:00:00 2001 From: shawn Date: Fri, 12 Aug 2022 17:01:37 +0800 Subject: [PATCH 07/19] remove xcm transfer & add address risk check for Polkadot transfer --- assets/images/icons/warning.png | Bin 0 -> 2464 bytes ios/Podfile.lock | 2 +- lib/app.dart | 2 - lib/common/consts.dart | 41 -- lib/pages/assets/transfer/transferPage.dart | 702 ++++---------------- lib/pages/public/acalaBridgePage.dart | 20 - lib/service/walletApi.dart | 15 + lib/utils/i18n/en/account.dart | 7 +- lib/utils/i18n/zh/account.dart | 4 +- 9 files changed, 155 insertions(+), 638 deletions(-) create mode 100644 assets/images/icons/warning.png delete mode 100644 lib/pages/public/acalaBridgePage.dart diff --git a/assets/images/icons/warning.png b/assets/images/icons/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..c37193ca6567f524f203a565662ffa83caf8c477 GIT binary patch literal 2464 zcmV;R319Y!P)Px;T1iAfRA@uhn_Y+{M-|6^Rn>j__WhX6X4r|@tRyHZW}bqA5m8)-5dskroP>O6 zMBRXpRx@DpO^f)xY)e{ zN~!+u(;VW)Ag0vIfZ^9JDPBCIIoeXJUcJ%xY(-c;BOI*?OGhLJWN}dr0)(jo&^LZz zL38+wCYsZ9Rt!N^V_Le8c^n9?=BQk5Va36mgU`By0Acz7^o&1RHLMUISxBj6$O1#b zDH=d2bXdvAT*hpcu{vj&ZP|kWVQK*6v)?nmTnNZqh?5W%Mu>!H0+j8tz&J~Xlu#!m zVM2K=p>tJs5FktifZX_ev3uDY7_izZKp`SjMY2v2XRiWtH;U`m-QX`+oA^X z7PD~zWYby?CJI2G`pc&c-tQ%fz{aSoOhy&uzKU?)?mMn}6lb4?u#PrOW=)ILIOS|5 zn}#b)0f6I%)z}cP6>t*M&dL~7#mPMI3@Fct-C7&C6Vd-bxjKPvawutYB`I%D-W4VW zz##RHg|yx+V!|?#RS|gTsfL#93z=t}qb*cBFommXNf9 zVg|+CpuW*J-UM*d3Ha0(yMKD+H}Jw!V6zQ;L_LX>pAe}vY}g=nZCW!4pRQzld2+kL z*Z^#Vy2nj_%hSXpu1uh+psxdY3JCkw-TW>1+*bz4@WXZm}0SnO{%~w+B^;N!2xT3_y;J>3LG8S z)g6eugD%vGq9#cr;ZT%LYF8KwfC1|J88&f**b>T9U(I0DeV}gN=J!8-b?2qv-dXCDB*bkQwuWB@z{ath&LGO1DaLDIS__*3KJOLo6!g^>Z+ zk^0t^@;%=huiR%4c@)&fd4DSs`vCxPh`I;G%c!7^O&i3QwW+){)`4k%0OZuiuySsL z`i3gjUWw*;;EG)Xo_zt3zws>E+(MR}MTPZAxWY&PY@>cVj%cK1M0W!oaf>K!+B4eQ zKL8-|JDhwEVU2=r3>=siU-Ap)NP6PX0Boavs}@nyF$5L->?1dV{J{4=RRBOx>VB;K zJ*H5j-EJ~7+uE-y>^<0ZYx=SN`_|9+t2V}@WilV_$uX4t47hwx z(37|P8Na2AIrTfZ$;^UpvuYGm4D1D*%1J zzu}DTQ@@jy!E{%B?H&X5$&qG%k__l}{0iuMz#p5_21YkWk^c3Z_FA|;HjV&o8($3b1UFXN}efP5r>!>AJ^Y7MeF zRo5b}?kS^f1K^^{uBX0V>;y06+`Dh%rw4%F6&}N>X9%R0%VJcgJT^yTJBdMpl#u0N7L6Rk^n3K^U(MFNuxbkFW&8E6RNUMpkx5AKJzf!-=B% z??L2AtQtyD&H)%uc70NVcOv#ucK1I#7)BN!=l%XnFr=cq0l;Qux0lq&@>H*ojO(W3j!X(*&0onB-IW#9ZB;XqntdcSvnPPWUhd* zF+sbE3qFK%rw8(RlSJa60RW5ApGVw3$^1EC-3`2)o&&&AKyx|D^Z6ZL$Y2+84Srhf zKwY3`ggi(n&m)1aOKaupz>Waev_h(HNAdk>*?$0W!1kd#zLQJ#{-oI1$^h>IS04+J z)tGivM%#}7FHC&(pBkcjzStt_1~9J^G@7Wmv%!GgBG}9B8i~7w4eEXr-`w-n?}ZzD zVV34cv~{zeUGCK!<-5RE&Cl2KSzE%Ux1zWc)YW7B1X+^QLF zI|LPy0vDnPokp0j05$>%aoP}QgAiWIApy!bNhBpfMq z@`|(dGTeMl# z;PBcx#d58C-}#ne-q$-`s%;6c2XQ#=07gOvmi*L5G_o>UJYWwDKZTj?P e^K9=l^#23#xs`B^n-8)80000 with WidgetsBindingObserver { WalletConnectSignPage.route: (_) => WalletConnectSignPage(_service, _service.account.getPassword), GuidePage.route: (_) => GuidePage(), - AcalaBridgePage.route: (_) => AcalaBridgePage(), StakingKSMGuide.route: (_) => StakingKSMGuide(_service), StakingDOTGuide.route: (_) => StakingDOTGuide(_service), diff --git a/lib/common/consts.dart b/lib/common/consts.dart index 38e8fa12..d39dec59 100644 --- a/lib/common/consts.dart +++ b/lib/common/consts.dart @@ -61,47 +61,6 @@ const plugin_from_community = [ chain_name_robonomics ]; -const xcm_base_weight = 1000000000; -const xcm_dest_weight_ksm = 3 * xcm_base_weight; -const xcm_dest_weight_bifrost = 5000000000; - -const xcm_send_fees = { - relay_chain_name_ksm: { - 'fee': '106666660', - 'existentialDeposit': '333333333', - }, - para_chain_name_statemine: { - 'fee': '4000000000', - 'existentialDeposit': '33333333', - }, - para_chain_name_karura: { - 'fee': '64000000', - 'existentialDeposit': '100000000', - }, - para_chain_name_acala: { - 'fee': '4285630', - 'existentialDeposit': '100000000', - }, -}; - -const xcm_support_dest_chains = { - relay_chain_name_ksm: [ - relay_chain_name_ksm, - para_chain_name_statemine, - para_chain_name_karura, - ], - // todo: KSM from statemine to kusasma has bug - // para_chain_name_statemine: [ - // para_chain_name_statemine, - // relay_chain_name_ksm, - // ], - // todo: transfer KAR to bifrost is not open yet - // para_chain_name_karura: [ - // para_chain_name_karura, - // para_chain_name_bifrost, - // ], -}; - const bridge_account = { 'mandala': '5G9VH1qNxbPE39SW9SWmDDhePxt1zxLScJ7ync57MFhJSh1v', 'acala': '13YMK2eYoAvStnzReuxBjMrAvPXmmdsURwZvc62PrdXimbNy' diff --git a/lib/pages/assets/transfer/transferPage.dart b/lib/pages/assets/transfer/transferPage.dart index 683c8147..55efaa14 100644 --- a/lib/pages/assets/transfer/transferPage.dart +++ b/lib/pages/assets/transfer/transferPage.dart @@ -1,7 +1,8 @@ -import 'package:app/common/components/cupertinoAlertDialogWithCheckbox.dart'; -import 'package:app/common/components/jumpToLink.dart'; +import 'dart:convert'; + import 'package:app/common/consts.dart'; import 'package:app/service/index.dart'; +import 'package:app/service/walletApi.dart'; import 'package:app/utils/i18n/index.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -9,9 +10,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:polkawallet_plugin_chainx/common/components/UI.dart'; import 'package:polkawallet_sdk/api/types/txInfoData.dart'; -import 'package:polkawallet_sdk/plugin/index.dart'; import 'package:polkawallet_sdk/storage/types/keyPairData.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/addressFormItem.dart'; @@ -25,45 +24,37 @@ import 'package:polkawallet_ui/components/v3/txButton.dart'; import 'package:polkawallet_ui/pages/scanPage.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; -import 'package:polkawallet_ui/utils/index.dart' as polkawallet_ui; +import 'package:polkawallet_ui/utils/index.dart'; class TransferPageParams { TransferPageParams({ this.address, - this.chainTo, }); final String address; - final String chainTo; } -const relay_chain_name_polkadot = 'polkadot'; - class TransferPage extends StatefulWidget { - const TransferPage(this.service); + const TransferPage(this.service, {Key key}) : super(key: key); - static final String route = '/assets/transfer'; + static const String route = '/assets/transfer'; final AppService service; @override - _TransferPageState createState() => _TransferPageState(); + TransferPageState createState() => TransferPageState(); } -class _TransferPageState extends State { +class TransferPageState extends State { final _formKey = GlobalKey(); - final TextEditingController _amountCtrl = new TextEditingController(); + final TextEditingController _amountCtrl = TextEditingController(); - PolkawalletPlugin _chainTo; KeyPairData _accountTo; - List _accountOptions = []; bool _keepAlive = true; String _accountToError; + String _accountWarn; TxFeeEstimateResult _fee; - List _xcmEnabledChains; - - bool _submitting = false; Future _checkBlackList(KeyPairData acc) async { final addresses = await widget.service.plugin.sdk.api.account @@ -78,34 +69,51 @@ class _TransferPageState extends State { return null; } - Future _checkAccountTo(KeyPairData acc) async { + Future _validateAccountTo(KeyPairData acc) async { final blackListCheck = await _checkBlackList(acc); if (blackListCheck != null) return blackListCheck; - if (widget.service.keyring.allAccounts - .indexWhere((e) => e.pubKey == acc.pubKey) >= - 0) { - return null; + return null; + } + + Future _checkAccountWaring(KeyPairData acc) async { + final dic = I18n.of(context).getDic(i18n_full_dic_app, 'account'); + final dicUI = I18n.of(context).getDic(i18n_full_dic_app, 'account'); + + String warn; + + /// check account risk for Polkadot address + if (widget.service.plugin.basic.name == relay_chain_name_dot) { + final risk = await WalletApi.getAddressRisk(acc.address); + if (risk != null && risk['data'] != null) { + final data = jsonDecode(risk['data']); + if (data['risk_level'] > 1) { + warn = data['tag_type_verbose'] == 'Exchange' + ? dic['bad.risk.cex'] + : ['bad.risk']; + } + } } - final addressCheckValid = await widget.service.plugin.sdk.webView - .evalJavascript('(account.checkAddressFormat != undefined ? {}:null)', - wrapPromise: false); - if (addressCheckValid != null) { - final res = await widget.service.plugin.sdk.api.account - .checkAddressFormat(acc.address, _chainTo.basic.ss58); - if (res != null && !res) { - return I18n.of(context) - .getDic(i18n_full_dic_ui, 'account')['ss58.mismatch']; + /// check account format + if (warn == null && + widget.service.keyring.allAccounts + .indexWhere((e) => e.pubKey == acc.pubKey) < + -1) { + final addressCheckValid = await widget.service.plugin.sdk.webView + .evalJavascript('(account.checkAddressFormat != undefined ? {}:null)', + wrapPromise: false); + if (addressCheckValid != null) { + final res = await widget.service.plugin.sdk.api.account + .checkAddressFormat(acc.address, widget.service.plugin.basic.ss58); + if (res != null && !res) { + warn = dicUI['ss58.mismatch']; + } } } - return null; - } - Future _validateAccountTo(KeyPairData acc) async { - final error = await _checkAccountTo(acc); setState(() { - _accountToError = error; + _accountWarn = warn; }); } @@ -117,183 +125,14 @@ class _TransferPageState extends State { _updateAccountTo(to.address.address, name: to.address.name); } - bool _isToParaChain() { - return _chainTo.basic.name != relay_chain_name_ksm && - _chainTo.basic.name != relay_chain_name_dot && - _chainTo.basic.name != para_chain_name_statemine && - _chainTo.basic.name != para_chain_name_statemint; - } - - TxConfirmParams _getDotAcalaBridgeTxParams() { - final dic = I18n.of(context).getDic(i18n_full_dic_app, 'assets'); - final symbol = (widget.service.plugin.networkState.tokenSymbol ?? [''])[0]; - final decimals = - (widget.service.plugin.networkState.tokenDecimals ?? [12])[0]; - - return TxConfirmParams( - txTitle: '${dic['transfer']} $symbol (${dic['cross.chain']})', - module: 'balances', - call: 'transfer', - txDisplay: { - dic['to.chain']: _chainTo.basic.name, - }, - txDisplayBold: { - dic['amount']: Text( - _amountCtrl.text.trim() + ' $symbol', - style: Theme.of(context).textTheme.headline1, - ), - dic['to']: Row( - children: [ - AddressIcon(_accountTo.address, svg: _accountTo.icon), - Expanded( - child: Container( - margin: EdgeInsets.fromLTRB(8, 16, 0, 16), - child: Text( - Fmt.address(_accountTo.address, pad: 8), - style: Theme.of(context).textTheme.headline4, - ), - ), - ), - ], - ), - }, - params: [ - bridge_account[_chainTo.basic.name], - Fmt.tokenInt(_amountCtrl.text.trim(), decimals).toString(), - ], - ); - } - Future _getTxParams() async { - if (_accountToError == null && - _formKey.currentState.validate() && - !_submitting) { + if (_accountToError == null && _formKey.currentState.validate()) { final dic = I18n.of(context).getDic(i18n_full_dic_app, 'assets'); final symbol = (widget.service.plugin.networkState.tokenSymbol ?? [''])[0]; final decimals = (widget.service.plugin.networkState.tokenDecimals ?? [12])[0]; - /// send XCM tx if cross chain - if (_chainTo.basic.name != widget.service.plugin.basic.name) { - final isToParaChain = _isToParaChain(); - - final isToParent = _chainTo.basic.name == relay_chain_name_ksm || - _chainTo.basic.name == relay_chain_name_dot; - - final txModule = isToParent ? 'polkadotXcm' : 'xcmPallet'; - final txCall = - isToParaChain ? 'reserveTransferAssets' : 'limitedTeleportAssets'; - - final amount = - Fmt.tokenInt(_amountCtrl.text.trim(), decimals).toString(); - - String destPubKey = _accountTo.pubKey; - // we need to decode address for the pubKey here - if (destPubKey == null || destPubKey.isEmpty) { - setState(() { - _submitting = true; - }); - final pk = await widget.service.plugin.sdk.api.account - .decodeAddress([_accountTo.address]); - setState(() { - _submitting = false; - }); - if (pk == null) return null; - - destPubKey = pk.keys.toList()[0]; - } - - List paramsX; - if (isToParaChain) { - /// this is KSM/DOT transfer RelayChain <-> Acala/Karura - /// paramsX: [dest, beneficiary, assets, dest_weight] - final dest = { - 'X1': {'Parachain': _chainTo.basic.parachainId} - }; - final beneficiary = { - 'X1': { - 'AccountId32': {'id': destPubKey, 'network': 'Any'} - } - }; - final assets = [ - { - 'ConcreteFungible': {'amount': amount} - } - ]; - paramsX = [ - {'V0': dest}, - {'V0': beneficiary}, - {'V0': assets}, - 0 - ]; - } else { - /// this is KSM/DOT transfer RelayChain <-> ParaChain - /// paramsX: [dest, beneficiary, assets, fee_asset_item, dest_weight] - final dest = isToParent - ? {'interior': 'Here', 'parents': 1} - : { - 'interior': { - 'X1': {'Parachain': _chainTo.basic.parachainId} - }, - 'parents': 0 - }; - final beneficiary = { - 'interior': { - 'X1': { - 'AccountId32': {'id': destPubKey, 'network': 'Any'} - } - }, - 'parents': 0 - }; - final assets = [ - { - 'fun': {'Fungible': amount}, - 'id': { - 'Concrete': {'interior': 'Here', 'parents': isToParent ? 1 : 0} - }, - } - ]; - paramsX = [ - {'V1': dest}, - {'V1': beneficiary}, - {'V1': assets}, - 0, - 'Unlimited' - ]; - } - return TxConfirmParams( - txTitle: '${dic['transfer']} $symbol (${dic['cross.chain']})', - module: txModule, - call: txCall, - txDisplay: { - dic['to.chain']: _chainTo.basic.name, - }, - txDisplayBold: { - dic['amount']: Text( - _amountCtrl.text.trim() + ' $symbol', - style: Theme.of(context).textTheme.headline1, - ), - dic['to']: Row( - children: [ - AddressIcon(_accountTo.address, svg: _accountTo.icon), - Expanded( - child: Container( - margin: EdgeInsets.fromLTRB(8, 16, 0, 16), - child: Text( - Fmt.address(_accountTo.address, pad: 8), - style: Theme.of(context).textTheme.headline4, - ), - ), - ), - ], - ), - }, - params: paramsX, - ); - } - - /// else send normal transfer // params: [to, amount] final params = [ _accountTo.address, @@ -309,7 +148,7 @@ class _TransferPageState extends State { AddressIcon(_accountTo.address, svg: _accountTo.icon), Expanded( child: Container( - margin: EdgeInsets.fromLTRB(8, 16, 0, 16), + margin: const EdgeInsets.fromLTRB(8, 16, 0, 16), child: Text( Fmt.address(_accountTo.address, pad: 8), style: Theme.of(context).textTheme.headline4, @@ -319,7 +158,7 @@ class _TransferPageState extends State { ], ), dic['amount']: Text( - _amountCtrl.text.trim() + ' $symbol', + '${_amountCtrl.text.trim()} $symbol', style: Theme.of(context).textTheme.headline1, ), }, @@ -404,8 +243,13 @@ class _TransferPageState extends State { final res = await Future.wait([ widget.service.plugin.sdk.api.account.getAddressIcons([acc.address]), - _checkAccountTo(acc), + _validateAccountTo(acc), ]); + + if (res[1] == null) { + _checkAccountWaring(acc); + } + if (res != null && res[0] != null) { final accWithIcon = KeyPairData(); accWithIcon.address = address; @@ -423,109 +267,6 @@ class _TransferPageState extends State { } } - /// only support: - /// Kusama -> Karura - /// Kusama -> Statemine - /// Statemine -> Kusama - /// - /// DOT from polkadot to acala with acala bridge - void _onSelectChain() { - final dic = I18n.of(context).getDic(i18n_full_dic_app, 'assets'); - - final allPlugins = widget.service.allPlugins.toList(); - allPlugins.retainWhere((e) { - return [widget.service.plugin.basic.name, ..._xcmEnabledChains] - .indexOf(e.basic.name) > - -1; - }); - - showCupertinoModalPopup( - context: context, - builder: (_) => PolkawalletActionSheet( - title: Text(dic['cross.para.select']), - actions: allPlugins.map((e) { - return PolkawalletActionSheetAction( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(right: 8), - width: 32, - height: 32, - child: ClipRRect( - borderRadius: BorderRadius.circular(32), - child: e.basic.icon, - ), - ), - Text( - e.basic.name.toUpperCase(), - ) - ], - ), - onPressed: () async { - if (e.basic.name != _chainTo.basic.name) { - // set ss58 of _chainTo so we can get according address - // from AddressInputField - widget.service.keyring.setSS58(e.basic.ss58); - final options = widget.service.keyring.allWithContacts.toList(); - widget.service.keyring - .setSS58(widget.service.plugin.basic.ss58); - setState(() { - _chainTo = e; - _accountOptions = options; - - if (e.basic.name != widget.service.plugin.basic.name) { - _accountTo = widget.service.keyring.current; - } - }); - - _validateAccountTo(_accountTo); - - if (_amountCtrl.text.trim().toString().length > 0) { - // update estimated tx fee if switch ToChain - _getTxFee( - isXCM: e.basic.name != relay_chain_name_ksm, - reload: true); - } - } - Navigator.of(context).pop(); - }, - ); - }).toList(), - cancelButton: PolkawalletActionSheetAction( - child: Text( - I18n.of(context).getDic(i18n_full_dic_ui, 'common')['cancel']), - onPressed: () { - Navigator.pop(context); - }, - ), - ), - ); - } - - Future _showAcalaBridgeAlert() async { - await showCupertinoDialog( - context: context, - builder: (_) { - final dic = I18n.of(context).getDic(i18n_full_dic_app, 'assets'); - return PolkawalletAlertDialog( - title: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(dic['dot.bridge']), - JumpToLink( - 'https://wiki.acala.network/acala/get-started/acalas-dot-bridge', - text: '', - ) - ], - ), - content: CupertinoAlertDialogContentWithCheckbox( - content: Text(dic['dot.bridge.info']), - ), - ); - }); - } - void _onSwitchCheckAlive(bool res, BigInt notTransferable) { final dic = I18n.of(context).getDic(i18n_full_dic_app, 'assets'); @@ -591,8 +332,6 @@ class _TransferPageState extends State { WidgetsBinding.instance.addPostFrameCallback((_) async { _getTxFee(); - _chainTo = widget.service.plugin; - final TransferPageParams args = ModalRoute.of(context).settings.arguments; if (args?.address != null) { _updateAccountTo(args.address); @@ -601,24 +340,6 @@ class _TransferPageState extends State { _accountTo = widget.service.keyring.current; }); } - - // final xcmEnabledChains = await widget.service.store.settings - // .getXcmEnabledChains(widget.service.plugin.basic.name); - // setState(() { - // _accountOptions = widget.service.keyring.allWithContacts.toList(); - // _xcmEnabledChains = xcmEnabledChains; - // - // if (args?.chainTo != null) { - // final chainToIndex = xcmEnabledChains.indexOf(args.chainTo); - // if (chainToIndex > -1) { - // _chainTo = widget.service.allPlugins - // .firstWhere((e) => e.basic.name == args.chainTo); - // _accountTo = widget.service.keyring.current; - // return; - // } - // } - // _chainTo = widget.service.plugin; - // }); }); } @@ -650,12 +371,6 @@ class _TransferPageState extends State { (widget.service.plugin.balances.native?.lockedBalance ?? 0) .toString()); - final canCrossChain = - _xcmEnabledChains != null && _xcmEnabledChains.length > 0; - - final destChainName = _chainTo?.basic?.name ?? 'karura'; - final isCrossChain = widget.service.plugin.basic.name != destChainName; - final existDeposit = Fmt.balanceInt( ((widget.service.plugin.networkConst['balances'] ?? {})['existentialDeposit'] ?? @@ -663,15 +378,6 @@ class _TransferPageState extends State { .toString()); final existAmount = _getExistAmount(notTransferable, existDeposit); - final destExistDeposit = isCrossChain - ? Fmt.balanceInt(xcm_send_fees[destChainName]['existentialDeposit']) - : BigInt.zero; - final destFee = isCrossChain - ? Fmt.balanceInt(xcm_send_fees[destChainName]['fee']) - : BigInt.zero; - - final colorGrey = Theme.of(context).unselectedWidgetColor; - final labelStyle = Theme.of(context) .textTheme .headline4 @@ -680,23 +386,23 @@ class _TransferPageState extends State { height: 1, fontWeight: FontWeight.w300, fontSize: 12, - color: polkawallet_ui.UI.isDarkTheme(context) + color: UI.isDarkTheme(context) ? Colors.white - : Color(0xBF565554)); + : const Color(0xBF565554)); final infoValueStyle = Theme.of(context) .textTheme .headline5 .copyWith(fontWeight: FontWeight.w600); return Scaffold( appBar: AppBar( - systemOverlayStyle: polkawallet_ui.UI.isDarkTheme(context) + systemOverlayStyle: UI.isDarkTheme(context) ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark, title: Text('${dic['transfer']} $symbol'), centerTitle: true, actions: [ v3.IconButton( - margin: EdgeInsets.only(right: 8), + margin: const EdgeInsets.only(right: 8), icon: SvgPicture.asset( 'assets/images/scan.svg', color: Theme.of(context).cardColor, @@ -705,13 +411,13 @@ class _TransferPageState extends State { onPressed: _onScan, isBlueBg: true) ], - leading: BackBtn()), + leading: const BackBtn()), body: SafeArea( child: Column( children: [ Expanded( child: SingleChildScrollView( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), padding: EdgeInsets.only(bottom: 16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -723,7 +429,7 @@ class _TransferPageState extends State { children: [ Text(dic['from'], style: labelStyle), Padding( - padding: EdgeInsets.only(top: 3), + padding: const EdgeInsets.only(top: 3), child: AddressFormItem( widget.service.keyring.current)), Container(height: 8.h), @@ -735,14 +441,18 @@ class _TransferPageState extends State { children: [ AddressTextFormField( widget.service.plugin.sdk.api, - _accountOptions, + widget.service.keyring.allWithContacts + .toList(), labelText: dic['cross.to'], labelStyle: labelStyle, hintText: dic['address'], initialValue: _accountTo, onChanged: (KeyPairData acc) async { final accValid = - await _checkAccountTo(acc); + await _validateAccountTo(acc); + if (accValid == null) { + _checkAccountWaring(acc); + } setState(() { _accountTo = acc; _accountToError = accValid; @@ -755,15 +465,19 @@ class _TransferPageState extends State { Visibility( visible: _accountToError != null, child: Container( - margin: EdgeInsets.only(top: 4), - child: Text(_accountToError ?? "", - style: Theme.of(context) - .textTheme - .caption - .copyWith( - color: - Theme.of(context) - .errorColor)), + margin: + const EdgeInsets.only(top: 4), + child: ToAddressWarning( + _accountToError), + )), + Visibility( + visible: _accountWarn != null && + _accountToError == null, + child: Container( + margin: + const EdgeInsets.only(top: 4), + child: ToAddressWarning( + _accountWarn), )), Container(height: 10.h), v3.TextInputWidget( @@ -793,9 +507,8 @@ class _TransferPageState extends State { UI.decimalInputFormatter(decimals) ], controller: _amountCtrl, - keyboardType: - TextInputType.numberWithOptions( - decimal: true), + keyboardType: const TextInputType + .numberWithOptions(decimal: true), validator: (v) { final error = Fmt.validatePrice(v, context); @@ -829,202 +542,12 @@ class _TransferPageState extends State { Padding( padding: EdgeInsets.only( top: 20.h, bottom: 7.h)), - Visibility( - visible: canCrossChain, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 4), - child: Text( - dic['to.chain'], - style: labelStyle, - ), - ), - GestureDetector( - child: RoundedCard( - padding: EdgeInsets.symmetric( - vertical: 9.h, - horizontal: 16.w), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only( - right: 8), - width: 32, - height: 32, - child: ClipRRect( - borderRadius: - BorderRadius - .circular(32), - child: _chainTo - ?.basic?.icon, - ), - ), - Text( - destChainName - .toUpperCase(), - style: - Theme.of(context) - .textTheme - .headline4) - ], - ), - Row( - children: [ - Visibility( - visible: isCrossChain, - child: Container( - padding: EdgeInsets - .fromLTRB(15.w, - 0, 15.w, 4), - height: 24, - margin: - EdgeInsets.only( - right: 8), - decoration: - BoxDecoration( - color: Colors - .transparent, - image: DecorationImage( - image: AssetImage( - "assets/images/icon_bg_2.png"), - fit: BoxFit - .contain), - ), - alignment: Alignment - .center, - child: Text( - dic['cross.chain'], - style: TextStyle( - color: Theme.of( - context) - .cardColor, - fontSize: polkawallet_ui - .UI - .getTextSize( - 12, - context), - fontFamily: polkawallet_ui - .UI - .getFontFamily( - 'TitilliumWeb', - context), - fontWeight: - FontWeight - .w600, - ), - ), - )), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: colorGrey, - ) - ], - ) - ], - ), - ), - onTap: _onSelectChain, - ), - ], - )) ])), RoundedCard( margin: EdgeInsets.fromLTRB(16.w, 20.h, 16.w, 0), - padding: EdgeInsets.symmetric(vertical: 6), + padding: const EdgeInsets.symmetric(vertical: 6), child: Column( children: [ - Visibility( - visible: isCrossChain, - child: Column(children: [ - Container( - padding: EdgeInsets.symmetric( - horizontal: 16.w), - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Expanded( - child: Container( - padding: - EdgeInsets.only(right: 40), - child: Column( - mainAxisSize: - MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text(dic['cross.exist'], - style: labelStyle - ?.copyWith( - fontWeight: - FontWeight - .w400)), - Padding( - padding: - EdgeInsets.only( - top: 2), - child: Text( - dic['amount.exist.msg'], - style: subTitleStyle - ?.copyWith( - height: 1.3), - )), - ], - )), - ), - Expanded( - flex: 0, - child: Text( - '${Fmt.priceCeilBigInt(destExistDeposit, decimals, lengthMax: 6)} $symbol', - style: infoValueStyle)), - ], - ), - ), - Padding( - padding: - EdgeInsets.symmetric(vertical: 6), - child: Divider(height: 1)) - ])), - Visibility( - visible: isCrossChain, - child: Column(children: [ - Container( - padding: EdgeInsets.symmetric( - horizontal: 16.w), - child: Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - Expanded( - child: Padding( - padding: - EdgeInsets.only(right: 4), - child: Text(dic['cross.fee'], - style: labelStyle?.copyWith( - fontWeight: - FontWeight.w400)), - ), - ), - Text( - '${Fmt.priceCeilBigInt(destFee, decimals, lengthMax: 6)} $symbol', - style: infoValueStyle), - ], - ), - ), - Padding( - padding: - EdgeInsets.symmetric(vertical: 6), - child: Divider(height: 1)) - ])), Column(children: [ Container( padding: @@ -1034,8 +557,8 @@ class _TransferPageState extends State { children: [ Expanded( child: Container( - padding: - EdgeInsets.only(right: 60), + padding: const EdgeInsets.only( + right: 60), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: @@ -1048,8 +571,9 @@ class _TransferPageState extends State { FontWeight .w400)), Padding( - padding: EdgeInsets.only( - top: 2), + padding: + const EdgeInsets.only( + top: 2), child: Text( dic['amount.exist.msg'], style: subTitleStyle @@ -1064,7 +588,7 @@ class _TransferPageState extends State { style: infoValueStyle), ], )), - Padding( + const Padding( padding: EdgeInsets.symmetric(vertical: 6), child: Divider(height: 1)) ]), @@ -1080,8 +604,8 @@ class _TransferPageState extends State { children: [ Expanded( child: Padding( - padding: - EdgeInsets.only(right: 4), + padding: const EdgeInsets.only( + right: 4), child: Text(dic['amount.fee'], style: labelStyle?.copyWith( fontWeight: @@ -1094,7 +618,7 @@ class _TransferPageState extends State { ], ), ), - Padding( + const Padding( padding: EdgeInsets.symmetric(vertical: 6), child: Divider(height: 1)) @@ -1106,7 +630,8 @@ class _TransferPageState extends State { children: [ Expanded( child: Container( - padding: EdgeInsets.only(right: 60), + padding: + const EdgeInsets.only(right: 60), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: @@ -1118,7 +643,8 @@ class _TransferPageState extends State { FontWeight.w400)), Padding( padding: - EdgeInsets.only(top: 2), + const EdgeInsets.only( + top: 2), child: Text( dic['transfer.alive.msg'], style: subTitleStyle @@ -1145,7 +671,7 @@ class _TransferPageState extends State { ), ), Container( - padding: EdgeInsets.all(16), + padding: const EdgeInsets.all(16), child: TxButton( text: connected ? dic['make'] : 'connecting...', getTxParams: connected ? _getTxParams : () => null, @@ -1164,3 +690,35 @@ class _TransferPageState extends State { ); } } + +class ToAddressWarning extends StatelessWidget { + const ToAddressWarning(this.message, {Key key}) : super(key: key); + final String message; + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(top: 8), + decoration: BoxDecoration( + color: const Color(0x18FF7847), + border: Border.all(color: const Color(0xFFFF7847)), + borderRadius: const BorderRadius.all(Radius.circular(4))), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8), + child: Image.asset('assets/images/icons/warning.png', width: 32), + ), + Flexible( + child: Text( + message, + style: Theme.of(context).textTheme.headline5.copyWith( + fontSize: UI.getTextSize(13, context), + fontWeight: FontWeight.bold, + height: 1.1), + )) + ], + ), + ); + } +} diff --git a/lib/pages/public/acalaBridgePage.dart b/lib/pages/public/acalaBridgePage.dart deleted file mode 100644 index bdb2b25d..00000000 --- a/lib/pages/public/acalaBridgePage.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:app/common/consts.dart'; -import 'package:app/pages/assets/transfer/transferPage.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class AcalaBridgePage extends StatelessWidget { - static const route = '/bridge/aca'; - - @override - Widget build(BuildContext context) { - WidgetsBinding.instance.addPostFrameCallback((_) { - Navigator.of(context).popAndPushNamed(TransferPage.route, - arguments: TransferPageParams(chainTo: para_chain_name_acala)); - }); - return Scaffold( - backgroundColor: Colors.transparent, - body: Container(width: 1, height: 1), - ); - } -} diff --git a/lib/service/walletApi.dart b/lib/service/walletApi.dart index e3d1dae5..be6af6a7 100644 --- a/lib/service/walletApi.dart +++ b/lib/service/walletApi.dart @@ -302,4 +302,19 @@ class WalletApi { return null; } } + + static Future getAddressRisk(String address) async { + try { + Response res = await get( + getUrl(_endpoint, '/height-time-avg/risk?address=$address')); + if (res == null) { + return null; + } else { + return jsonDecode(utf8.decode(res.bodyBytes)) as Map; + } + } catch (err) { + print(err); + return null; + } + } } diff --git a/lib/utils/i18n/en/account.dart b/lib/utils/i18n/en/account.dart index b5c60281..1a032b72 100644 --- a/lib/utils/i18n/en/account.dart +++ b/lib/utils/i18n/en/account.dart @@ -81,7 +81,12 @@ const Map enAccount = { 'plugin.note': 'Maintained by ', 'plugin.team': ' team.', 'plugin.disable': 'This plugin is outdated and needs fix from maintainer.', - 'bad.scam': 'Scam address', + 'bad.scam': + 'This is a less-than-honest address with high risk. Please change another address', + 'bad.risk.cex': + 'This is a CEX address with high risk. Make sure you still want to transfer your assets.', + 'bad.risk': + 'This address with high risk. Please check the recipient\'s identity carefully.', 'bad.warn': 'WARNING!!!', 'bad.warn.info': 'is a public account which is derived by Mnemonic 【null】, please delete it and create a new one.', diff --git a/lib/utils/i18n/zh/account.dart b/lib/utils/i18n/zh/account.dart index 60ef2dc9..4f7537aa 100644 --- a/lib/utils/i18n/zh/account.dart +++ b/lib/utils/i18n/zh/account.dart @@ -72,7 +72,9 @@ const Map zhAccount = { 'plugin.note': '功能插件由 ', 'plugin.team': ' 团队维护。', 'plugin.disable': '该插件与当前 App 版本不兼容,请等待插件修复。', - 'bad.scam': '诈骗地址', + 'bad.scam': '该地址为非诚信地址,无法进行转账。', + 'bad.risk.cex': '该地址为交易所地址,请注意转账风险。', + 'bad.risk': '该地址为风险地址,请仔细核对收款人身份。', 'bad.warn': '警告!!!', 'bad.warn.info': '是一个助记词为【null】的公共账户,请将其删除并创建新的账户使用.', 'biometric.msg': "由于该账户超过7日未使用过指纹/面容ID,需要输入密码进行解锁。", From af3f67e1ba612c5d6cccd6214c21c8437966a2f3 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Fri, 12 Aug 2022 18:45:39 +0800 Subject: [PATCH 08/19] fix bug --- lib/pages/ecosystem/converToPage.dart | 3 ++ .../ecosystem/crosschainTransferPage.dart | 3 ++ pubspec.lock | 32 +++++++++++-------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/pages/ecosystem/converToPage.dart b/lib/pages/ecosystem/converToPage.dart index f86050fa..11fb7ed5 100644 --- a/lib/pages/ecosystem/converToPage.dart +++ b/lib/pages/ecosystem/converToPage.dart @@ -319,6 +319,9 @@ class _ConverToPageState extends State { _amountCtrl.text = Fmt.priceFloorBigInt( BigInt.parse(max), balance.decimals, lengthMax: 10); + setState(() { + _error1 = null; + }); } : null, onInputChange: (v) { diff --git a/lib/pages/ecosystem/crosschainTransferPage.dart b/lib/pages/ecosystem/crosschainTransferPage.dart index 72add395..ecf4a10c 100644 --- a/lib/pages/ecosystem/crosschainTransferPage.dart +++ b/lib/pages/ecosystem/crosschainTransferPage.dart @@ -435,6 +435,9 @@ class _CrossChainTransferPageState extends State { _amountCtrl.text = Fmt.priceFloorBigInt( BigInt.parse(max), balance.decimals, lengthMax: 10); + setState(() { + _error1 = null; + }); } : null, onInputChange: (v) { diff --git a/pubspec.lock b/pubspec.lock index 9effb852..77a52004 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1066,9 +1066,11 @@ packages: polkawallet_plugin_acala: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_acala" - relative: true - source: path + path: "." + ref: a609b218b4b93743c77016841d8ffc8e29ba8898 + resolved-ref: a609b218b4b93743c77016841d8ffc8e29ba8898 + url: "https://github.com/AcalaNetwork/polkawallet_plugin_acala.git" + source: git version: "0.4.9" polkawallet_plugin_bifrost: dependency: "direct main" @@ -1109,17 +1111,21 @@ packages: polkawallet_plugin_karura: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_karura" - relative: true - source: path + path: "." + ref: "9c8bf1aba91caa69d1fd8cdd5dbfd28cf20962bf" + resolved-ref: "9c8bf1aba91caa69d1fd8cdd5dbfd28cf20962bf" + url: "https://github.com/AcalaNetwork/polkawallet_plugin_karura.git" + source: git version: "0.4.9" polkawallet_plugin_kusama: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_kusama" - relative: true - source: path - version: "0.4.8" + path: "." + ref: c80eca534d3041ab1f2ff1674febbf63fb6c1e24 + resolved-ref: c80eca534d3041ab1f2ff1674febbf63fb6c1e24 + url: "https://github.com/polkawallet-io/polkawallet_plugin_kusama.git" + source: git + version: "0.4.9" polkawallet_plugin_robonomics: dependency: "direct main" description: @@ -1148,9 +1154,9 @@ packages: polkawallet_ui: dependency: "direct main" description: - path: "../../coding/polkawallet/ui" - relative: true - source: path + name: polkawallet_ui + url: "https://pub.dartlang.org" + source: hosted version: "0.4.9" pool: dependency: transitive From e98747381a8cc5cc6b9f542ca13a0a5bd8d58b31 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 16 Aug 2022 16:25:54 +0800 Subject: [PATCH 09/19] update priceTrendChart --- ios/Podfile.lock | 2 +- lib/pages/assets/asset/assetPage.dart | 58 ++++++--- lib/pages/assets/asset/priceTrendChart.dart | 118 +++++++++++++------ lib/pages/assets/asset/priceTrendDialog.dart | 68 ++++++----- 4 files changed, 153 insertions(+), 93 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 94f40c54..10d17b9d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -305,4 +305,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 54d14ef5a14a0b3c64cc6d6bfeff28f02dcce905 -COCOAPODS: 1.11.2 +COCOAPODS: 1.11.3 diff --git a/lib/pages/assets/asset/assetPage.dart b/lib/pages/assets/asset/assetPage.dart index a5b2e30d..28937654 100644 --- a/lib/pages/assets/asset/assetPage.dart +++ b/lib/pages/assets/asset/assetPage.dart @@ -681,27 +681,47 @@ class BalanceCard extends StatelessWidget { flex: 1, ), Expanded( + flex: 0, child: marketPriceList != null && marketPriceList.length > 1 - ? Container( - width: MediaQuery.of(context).size.width / 3, - alignment: Alignment.centerRight, - child: GestureDetector( - onTap: () { - showCupertinoDialog( - context: context, - builder: (BuildContext context) { - return PriceTrendDialog( - getTimeSeriesAmounts(marketPriceList, 30), - symbol, - Fmt.priceCurrencySymbol(priceCurrency)); - }, - ); - }, - child: RewardsChart.withData( - getTimeSeriesAmounts(marketPriceList, 7), - MediaQuery.of(context).size.width / 4))) + ? Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + padding: const EdgeInsets.only(bottom: 7), + alignment: Alignment.centerLeft, + width: MediaQuery.of(context).size.width / 4, + child: Text( + '${I18n.of(context).getDic(i18n_full_dic_app, 'assets')['v3.priceTrend']}${Fmt.priceCurrencySymbol(priceCurrency)} :', + style: TextStyle( + color: titleColor, + fontSize: UI.getTextSize(12, context), + fontWeight: FontWeight.w400, + fontFamily: + UI.getFontFamily('SF_Pro', context), + ))), + Container( + width: MediaQuery.of(context).size.width / 3, + alignment: Alignment.centerRight, + child: GestureDetector( + onTap: () { + showCupertinoDialog( + context: context, + builder: (BuildContext context) { + return PriceTrendDialog( + getTimeSeriesAmounts( + marketPriceList, 30), + symbol, + Fmt.priceCurrencySymbol( + priceCurrency)); + }, + ); + }, + child: RewardsChart.withData( + getTimeSeriesAmounts(marketPriceList, 7), + MediaQuery.of(context).size.width / 4))) + ], + ) : Container(width: MediaQuery.of(context).size.width / 3), - flex: 0, ) ], ), diff --git a/lib/pages/assets/asset/priceTrendChart.dart b/lib/pages/assets/asset/priceTrendChart.dart index 989f1be5..a3b2dfe9 100644 --- a/lib/pages/assets/asset/priceTrendChart.dart +++ b/lib/pages/assets/asset/priceTrendChart.dart @@ -70,11 +70,22 @@ class PriceTrendChart extends StatelessWidget { @override Widget build(BuildContext context) { + final _maxY = maxY * (1 + 0.15); + final _minY = minY * (1 - 0.15); final verticalInterval = 10 / ((seriesList.length > 7 ? (seriesList.length / 2 - 1) : (seriesList.length - 1)) + 0.01); + + final horizontalInterval = + (_maxY - _minY) / (orientation == Orientation.portrait ? 3.1 : 5.1); + + final shared = []; + for (int i = ((_maxY - _minY) ~/ horizontalInterval); i >= 0; i--) { + shared.add( + (_maxY - _minY) / ((_maxY - _minY) / horizontalInterval) * i + _minY); + } return Container( width: width, height: width / sizeRatio, @@ -82,14 +93,19 @@ class PriceTrendChart extends StatelessWidget { child: Stack( alignment: AlignmentDirectional.bottomCenter, children: [ - LineChart( - mainData(context, verticalInterval), - swapAnimationDuration: Duration(milliseconds: 0), // Optional - swapAnimationCurve: Curves.linear, - ), + Container( + width: double.infinity, + margin: const EdgeInsets.only(left: 64), + child: LineChart( + mainData(context, verticalInterval, horizontalInterval, _maxY, + _minY), + swapAnimationDuration: + const Duration(milliseconds: 0), // Optional + swapAnimationCurve: Curves.linear, + )), Container( width: double.infinity, - margin: EdgeInsets.only(left: 64, bottom: 26), + margin: const EdgeInsets.only(left: 64, bottom: 26), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: List.filled( @@ -102,16 +118,39 @@ class PriceTrendChart extends StatelessWidget { : Colors.black.withAlpha(25), )), ), + ), + Container( + margin: const EdgeInsets.only(bottom: 31, left: 20), + width: double.infinity, + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...shared.map((e) { + return Text( + "${Fmt.priceFloorFormatter(e, lengthMax: 2)}$priceCurrencySymbol", + style: Theme.of(context) + .textTheme + .headline5 + ?.copyWith( + fontSize: UI.getTextSize(10, context), + fontWeight: FontWeight.w600, + color: Theme.of(context) + .textTheme + .headline5 + ?.color + ?.withAlpha( + (255.0 / _maxY * e).toInt()))); + }) + ]), ) ], )); } - LineChartData mainData(BuildContext context, double verticalInterval) { - final _maxY = maxY * (1 + 0.15); - final _minY = minY * (1 - 0.15); - final horizontalInterval = - (_maxY - _minY) / (orientation == Orientation.portrait ? 3.1 : 5.1); + LineChartData mainData(BuildContext context, double verticalInterval, + double horizontalInterval, double _maxY, double _minY) { return LineChartData( gridData: FlGridData( show: true, @@ -138,7 +177,7 @@ class PriceTrendChart extends StatelessWidget { show: true, getDotPainter: (p0, p1, p2, p3) { return FlDotCirclePainter( - radius: 6, + radius: 8, color: chartLineColors()[0], strokeColor: Colors.transparent); }, @@ -146,9 +185,11 @@ class PriceTrendChart extends StatelessWidget { .toList(); }, touchTooltipData: LineTouchTooltipData( - tooltipBgColor: Color(0xFFFFFFFF).withAlpha(173), - tooltipPadding: EdgeInsets.symmetric(horizontal: 8, vertical: 3), - tooltipMargin: orientation == Orientation.portrait ? -34 : -50, + tooltipBgColor: Color(0xFF4F4D4D).withAlpha(102), + tooltipPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 7), + tooltipMargin: 10, + fitInsideHorizontally: true, + fitInsideVertically: true, getTooltipItems: (datas) { return datas.map((e) { var time = DateTime.fromMillisecondsSinceEpoch((e.x / @@ -168,7 +209,7 @@ class PriceTrendChart extends StatelessWidget { .textTheme .headline5 ?.copyWith( - color: Colors.black.withAlpha(191), + color: Colors.white, fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w600)), TextSpan( @@ -178,7 +219,7 @@ class PriceTrendChart extends StatelessWidget { .textTheme .headline5 ?.copyWith( - color: Colors.black.withAlpha(191), + color: Colors.white, fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.w600)), ]); @@ -210,26 +251,27 @@ class PriceTrendChart extends StatelessWidget { ), topTitles: SideTitles(showTitles: false), rightTitles: SideTitles(showTitles: false), - leftTitles: SideTitles( - showTitles: true, - interval: horizontalInterval, - getTextStyles: (context, index) => Theme.of(context) - .textTheme - .headline5 - ?.copyWith( - fontSize: UI.getTextSize(10, context), - fontWeight: FontWeight.w600, - color: Theme.of(context) - .textTheme - .headline5 - ?.color - ?.withAlpha((255.0 / _maxY * index).toInt())), - getTitles: (value) { - return "${Fmt.priceFloorFormatter(value, lengthMax: 2)}$priceCurrencySymbol"; - }, - reservedSize: 55, - margin: 10, - ), + leftTitles: SideTitles(showTitles: false), + // leftTitles: SideTitles( + // showTitles: true, + // interval: horizontalInterval, + // getTextStyles: (context, index) => Theme.of(context) + // .textTheme + // .headline5 + // ?.copyWith( + // fontSize: UI.getTextSize(10, context), + // fontWeight: FontWeight.w600, + // color: Theme.of(context) + // .textTheme + // .headline5 + // ?.color + // ?.withAlpha((255.0 / _maxY * index).toInt())), + // getTitles: (value) { + // return "${Fmt.priceFloorFormatter(value, lengthMax: 2)}$priceCurrencySymbol"; + // }, + // reservedSize: 55, + // margin: 10, + // ), ), borderData: FlBorderData( show: true, @@ -254,7 +296,7 @@ class PriceTrendChart extends StatelessWidget { barWidth: 1, isStrokeCapRound: true, dotData: FlDotData( - show: false, + show: true, ), belowBarData: BarAreaData( show: true, diff --git a/lib/pages/assets/asset/priceTrendDialog.dart b/lib/pages/assets/asset/priceTrendDialog.dart index bf604067..2c38d978 100644 --- a/lib/pages/assets/asset/priceTrendDialog.dart +++ b/lib/pages/assets/asset/priceTrendDialog.dart @@ -77,8 +77,22 @@ class _PriceTrendDialogState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(children: [ + GestureDetector( + onTap: () { + OrientationPlugin.forceOrientation( + DeviceOrientation.portraitUp); + SystemChrome.setPreferredOrientations( + [DeviceOrientation.portraitUp]); + Navigator.of(context).pop(); + }, + child: Icon( + Icons.clear, + size: 18, + color: Theme.of(context).textTheme.headline4.color, + ), + ), Padding( - padding: EdgeInsets.only(right: 7), + padding: EdgeInsets.only(left: 9), child: Text( '${widget.symbol.toUpperCase()} ${I18n.of(context).getDic(i18n_full_dic_app, 'assets')['v3.priceTrend']}(${widget.priceCurrencySymbol})', style: Theme.of(context) @@ -86,41 +100,25 @@ class _PriceTrendDialogState extends State { .headline4 ?.copyWith(fontWeight: FontWeight.w600), )), - Visibility( - visible: orientation == Orientation.portrait, - child: GestureDetector( - onTap: () { - var _orientation = DeviceOrientation.portraitUp; - if (orientation == Orientation.portrait) { - _orientation = - DeviceOrientation.landscapeRight; - } - OrientationPlugin.forceOrientation( - _orientation); - }, - child: SvgPicture.asset( - "assets/images/zoom.svg", - width: 16, - color: UI.isDarkTheme(context) - ? Color(0xFFFFC952) - : Color(0xFF768FE1), - ), - )), ]), - GestureDetector( - onTap: () { - OrientationPlugin.forceOrientation( - DeviceOrientation.portraitUp); - SystemChrome.setPreferredOrientations( - [DeviceOrientation.portraitUp]); - Navigator.of(context).pop(); - }, - child: Icon( - Icons.clear, - size: 19, - color: Theme.of(context).textTheme.headline4.color, - ), - ) + Visibility( + visible: orientation == Orientation.portrait, + child: GestureDetector( + onTap: () { + var _orientation = DeviceOrientation.portraitUp; + if (orientation == Orientation.portrait) { + _orientation = DeviceOrientation.landscapeRight; + } + OrientationPlugin.forceOrientation(_orientation); + }, + child: SvgPicture.asset( + "assets/images/zoom.svg", + width: 18, + color: UI.isDarkTheme(context) + ? Color(0xFFFFC952) + : Color(0xFF768FE1), + ), + )), ], )), Divider(height: 1, color: Color(0xFF979797).withAlpha(61)), From ae551863cb4c6d1dc810e28c27e4df2dc6f343b0 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 16 Aug 2022 16:36:55 +0800 Subject: [PATCH 10/19] ui update --- lib/pages/assets/asset/assetPage.dart | 2 +- lib/utils/i18n/en/profile.dart | 2 +- lib/utils/i18n/zh/profile.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pages/assets/asset/assetPage.dart b/lib/pages/assets/asset/assetPage.dart index 28937654..3f79d190 100644 --- a/lib/pages/assets/asset/assetPage.dart +++ b/lib/pages/assets/asset/assetPage.dart @@ -691,7 +691,7 @@ class BalanceCard extends StatelessWidget { alignment: Alignment.centerLeft, width: MediaQuery.of(context).size.width / 4, child: Text( - '${I18n.of(context).getDic(i18n_full_dic_app, 'assets')['v3.priceTrend']}${Fmt.priceCurrencySymbol(priceCurrency)} :', + '${I18n.of(context).getDic(i18n_full_dic_app, 'assets')['v3.priceTrend']} ${Fmt.priceCurrencySymbol(priceCurrency)} :', style: TextStyle( color: titleColor, fontSize: UI.getTextSize(12, context), diff --git a/lib/utils/i18n/en/profile.dart b/lib/utils/i18n/en/profile.dart index a962c593..a54641bc 100644 --- a/lib/utils/i18n/en/profile.dart +++ b/lib/utils/i18n/en/profile.dart @@ -28,7 +28,7 @@ const Map enProfile = { 'setting.lang.auto': 'Auto Detect', 'setting.network': 'Select Wallet', 'setting.network.node': 'Select Wallet Node', - 'setting.currency': 'Price Symbol', + 'setting.currency': 'Currency', 'setting.currency.tip': 'only affects the main Assets page', 'setting.balance.hide': 'Hide Balance', 'community': 'Join Community', diff --git a/lib/utils/i18n/zh/profile.dart b/lib/utils/i18n/zh/profile.dart index f6b3b7d3..77159bb0 100644 --- a/lib/utils/i18n/zh/profile.dart +++ b/lib/utils/i18n/zh/profile.dart @@ -28,7 +28,7 @@ const Map zhProfile = { 'setting.lang.auto': '自动检测', 'setting.network': '选择钱包', 'setting.network.node': '选择网络节点', - 'setting.currency': '价格单位', + 'setting.currency': '货币', 'setting.currency.tip': '仅影响资产主页', 'setting.balance.hide': '隐藏余额', 'community': '加入社区', From cb86219c7fda8b326e34d784978bcb2586d1d30c Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Wed, 17 Aug 2022 11:11:32 +0800 Subject: [PATCH 11/19] v 3.3.5-beta.2 --- CHANGELOG.md | 11 +++++++ ios/Runner.xcodeproj/project.pbxproj | 12 ++++---- lib/store/settings.dart | 6 ++-- pubspec.lock | 46 ++++++++++++---------------- pubspec.yaml | 30 +++++++++--------- 5 files changed, 54 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 804b8ca8..229ae3e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# [3.3.5-beta] - 20220817 +1. Multiple fiat display #125 +2. 发送交易失败错误信息解析修复 #341 +3. Astar 跨链 #353 +4. polkadot-js update 8.x -> 9.x #361 +5. Swap预估收到显示优化 #359 +6. Bridge-点击头像直接进入select account页面(且UI默认选中当前账号) #347 +7. Optimize the LP assets page #242 +8. Price trend chart UI adjust #366 +9. homa taiga apy 展示调整 + # [3.3.4-beta] - 20220804 1. Replace history api #267 2. Optimize Vault display #180 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 039abd5c..2e083d86 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -367,7 +367,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3343; + CURRENT_PROJECT_VERSION = 3352; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -386,7 +386,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.3.4; + MARKETING_VERSION = 3.3.5; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -515,7 +515,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3343; + CURRENT_PROJECT_VERSION = 3352; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -534,7 +534,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.3.4; + MARKETING_VERSION = 3.3.5; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -556,7 +556,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3343; + CURRENT_PROJECT_VERSION = 3352; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -575,7 +575,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.3.4; + MARKETING_VERSION = 3.3.5; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/lib/store/settings.dart b/lib/store/settings.dart index 8cd5c989..1bde3a6b 100644 --- a/lib/store/settings.dart +++ b/lib/store/settings.dart @@ -75,9 +75,9 @@ abstract class _SettingsStore with Store { List dapps = []; Map tokenStakingConfig = { - "onStart": {"KSM": true, "DOT": false}, - "KSM": ["kusama", "bifrost", "calamari"], - "LKSM": ["parallel heiko", "calamari", "turing"], + "onStart": {"KSM": true, "DOT": true}, + "KSM": ["kusama", "calamari"], + "LKSM": ["parallel heiko", "calamari"], "DOT": ["polkadot"], "LDOT": ["parallel"] }; diff --git a/pubspec.lock b/pubspec.lock index 77a52004..f0708082 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1066,11 +1066,9 @@ packages: polkawallet_plugin_acala: dependency: "direct main" description: - path: "." - ref: a609b218b4b93743c77016841d8ffc8e29ba8898 - resolved-ref: a609b218b4b93743c77016841d8ffc8e29ba8898 - url: "https://github.com/AcalaNetwork/polkawallet_plugin_acala.git" - source: git + path: "../../coding/polkawallet/polkawallet_plugin_acala" + relative: true + source: path version: "0.4.9" polkawallet_plugin_bifrost: dependency: "direct main" @@ -1111,20 +1109,16 @@ packages: polkawallet_plugin_karura: dependency: "direct main" description: - path: "." - ref: "9c8bf1aba91caa69d1fd8cdd5dbfd28cf20962bf" - resolved-ref: "9c8bf1aba91caa69d1fd8cdd5dbfd28cf20962bf" - url: "https://github.com/AcalaNetwork/polkawallet_plugin_karura.git" - source: git + path: "../../coding/polkawallet/polkawallet_plugin_karura" + relative: true + source: path version: "0.4.9" polkawallet_plugin_kusama: dependency: "direct main" description: - path: "." - ref: c80eca534d3041ab1f2ff1674febbf63fb6c1e24 - resolved-ref: c80eca534d3041ab1f2ff1674febbf63fb6c1e24 - url: "https://github.com/polkawallet-io/polkawallet_plugin_kusama.git" - source: git + path: "../../coding/polkawallet/polkawallet_plugin_kusama" + relative: true + source: path version: "0.4.9" polkawallet_plugin_robonomics: dependency: "direct main" @@ -1138,25 +1132,23 @@ packages: polkawallet_plugin_statemine: dependency: "direct main" description: - path: "." - ref: "8ae288145247607b3fc67deca7d7f64016d8bf56" - resolved-ref: "8ae288145247607b3fc67deca7d7f64016d8bf56" - url: "https://github.com/polkawallet-io/polkawallet_plugin_statemine.git" - source: git - version: "0.4.9" + path: "../../coding/polkawallet/polkawallet_plugin_statemine" + relative: true + source: path + version: "0.4.6" polkawallet_sdk: dependency: "direct main" description: - name: polkawallet_sdk - url: "https://pub.dartlang.org" - source: hosted + path: "../../coding/polkawallet/sdk" + relative: true + source: path version: "0.4.9" polkawallet_ui: dependency: "direct main" description: - name: polkawallet_ui - url: "https://pub.dartlang.org" - source: hosted + path: "../../coding/polkawallet/ui" + relative: true + source: path version: "0.4.9" pool: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index 104335be..4b0d8f84 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.3.4+3344 +version: 3.3.5+3352 environment: sdk: ">=2.10.0 <3.0.0" @@ -100,20 +100,20 @@ dependencies: sticky_headers: ^0.2.0 dependency_overrides: -# polkawallet_plugin_kusama: -# path: ../../coding/polkawallet/polkawallet_plugin_kusama -# polkawallet_plugin_acala: -# path: ../../coding/polkawallet/polkawallet_plugin_acala -# polkawallet_plugin_karura: -# path: ../../coding/polkawallet/polkawallet_plugin_karura -# polkawallet_plugin_statemine: -# path: ../../coding/polkawallet/polkawallet_plugin_statemine - polkawallet_ui: ^0.4.9 - polkawallet_sdk: ^0.4.9 -# polkawallet_ui: -# path: ../../coding/polkawallet/ui -# polkawallet_sdk: -# path: ../../coding/polkawallet/sdk + polkawallet_plugin_kusama: + path: ../../coding/polkawallet/polkawallet_plugin_kusama + polkawallet_plugin_acala: + path: ../../coding/polkawallet/polkawallet_plugin_acala + polkawallet_plugin_karura: + path: ../../coding/polkawallet/polkawallet_plugin_karura + polkawallet_plugin_statemine: + path: ../../coding/polkawallet/polkawallet_plugin_statemine +# polkawallet_ui: ^0.4.9 +# polkawallet_sdk: ^0.4.9 + polkawallet_ui: + path: ../../coding/polkawallet/ui + polkawallet_sdk: + path: ../../coding/polkawallet/sdk transformer_page_view: git: url: https://github.com/polkawallet-io/transformer_page_view.git From c7528b8d673c00e74826bac418bd47a4e6bcc4ed Mon Sep 17 00:00:00 2001 From: shawn Date: Fri, 19 Aug 2022 19:18:51 +0800 Subject: [PATCH 12/19] use txHex for sending xcm tx --- lib/pages/ecosystem/converToPage.dart | 9 ++++---- .../ecosystem/crosschainTransferPage.dart | 19 ++++++++++------- lib/pages/ecosystem/tokenStakingPage.dart | 21 +++++++++++++++---- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/lib/pages/ecosystem/converToPage.dart b/lib/pages/ecosystem/converToPage.dart index 11fb7ed5..bc200757 100644 --- a/lib/pages/ecosystem/converToPage.dart +++ b/lib/pages/ecosystem/converToPage.dart @@ -126,6 +126,7 @@ class _ConverToPageState extends State { ), }, params: xcmParams['params'], + txHex: xcmParams['txHex'], chainFrom: fromNetwork, chainFromIcon: fromIcon.contains('.svg') ? SvgPicture.network(fromIcon) @@ -183,15 +184,13 @@ class _ConverToPageState extends State { Fmt.tokenInt(_amountCtrl.text.trim(), balance.decimals).toString()); if (xcmParams == null) return '0'; - final txInfo = TxInfoData(xcmParams['module'], xcmParams['call'], sender); + final txInfo = TxInfoData(xcmParams['module'], xcmParams['call'], sender, + txHex: xcmParams['txHex']); String fee = '0'; final fromNetwork = data["fromNetwork"]; final feeData = await widget.service.plugin.sdk.webView?.evalJavascript( - 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); - - print( - 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); + 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, [])'); if (feeData != null) { fee = feeData['partialFee'].toString(); } diff --git a/lib/pages/ecosystem/crosschainTransferPage.dart b/lib/pages/ecosystem/crosschainTransferPage.dart index ecf4a10c..fdf93ab8 100644 --- a/lib/pages/ecosystem/crosschainTransferPage.dart +++ b/lib/pages/ecosystem/crosschainTransferPage.dart @@ -17,6 +17,7 @@ import 'package:polkawallet_sdk/api/types/txInfoData.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/currencyWithIcon.dart'; +import 'package:polkawallet_ui/components/tokenIcon.dart'; import 'package:polkawallet_ui/components/v3/addressIcon.dart'; import 'package:polkawallet_ui/components/v3/bottomSheetContainer.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; @@ -30,7 +31,6 @@ import 'package:polkawallet_ui/pages/v3/xcmTxConfirmPage.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/index.dart'; -import 'package:polkawallet_ui/components/tokenIcon.dart'; class CrossChainTransferPage extends StatefulWidget { const CrossChainTransferPage(this.service, {Key key}) : super(key: key); @@ -174,6 +174,7 @@ class _CrossChainTransferPageState extends State { ), }, params: xcmParams['params'], + txHex: xcmParams['txHex'], chainFrom: fromNetwork, chainFromIcon: fromIcon.contains('.svg') ? SvgPicture.network(fromIcon) @@ -224,11 +225,15 @@ class _CrossChainTransferPageState extends State { final sender = TxSenderData(widget.service.keyring.current.address, widget.service.keyring.current.pubKey); final xcmParams = await _getXcmParams( - Fmt.tokenInt(_amountCtrl.text.trim(), balance.decimals).toString(), + Fmt.tokenInt( + _amountCtrl.text.trim().isEmpty ? '0' : _amountCtrl.text.trim(), + balance.decimals) + .toString(), feeEstimate: true); if (xcmParams == null) return '0'; - final txInfo = TxInfoData(xcmParams['module'], xcmParams['call'], sender); + final txInfo = TxInfoData(xcmParams['module'], xcmParams['call'], sender, + txHex: xcmParams['txHex']); String fee = '0'; if (fromNetwork == plugin_name_karura || fromNetwork == plugin_name_acala) { @@ -237,9 +242,7 @@ class _CrossChainTransferPageState extends State { fee = feeData.partialFee.toString(); } else { final feeData = await widget.service.plugin.sdk.webView?.evalJavascript( - 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); - print( - 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, ${jsonEncode(xcmParams['params'])})'); + 'keyring.txFeeEstimate(xcm.getApi("$fromNetwork"), ${jsonEncode(txInfo)}, [])'); if (feeData != null) { fee = feeData['partialFee'].toString(); } @@ -367,7 +370,9 @@ class _CrossChainTransferPageState extends State { fromEd - Fmt.tokenInt( (Fmt.balanceDouble( - feeTokenSymbol == balance.symbol ? _fee : '0', + feeTokenSymbol == balance.symbol + ? _fee ?? '0' + : '0', balance.decimals) * 1.2) .toString(), diff --git a/lib/pages/ecosystem/tokenStakingPage.dart b/lib/pages/ecosystem/tokenStakingPage.dart index 0ebd977c..58990baa 100644 --- a/lib/pages/ecosystem/tokenStakingPage.dart +++ b/lib/pages/ecosystem/tokenStakingPage.dart @@ -13,14 +13,14 @@ import 'package:polkawallet_plugin_karura/polkawallet_plugin_karura.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/connectionChecker.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginPopLoadingWidget.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginAccountInfoAction.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginOutlinedButtonSmall.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginPageTitleTaps.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginPopLoadingWidget.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/index.dart'; -import 'package:polkawallet_ui/components/v3/plugin/pluginAccountInfoAction.dart'; class TokenStaking extends StatefulWidget { TokenStaking(this.service, {Key key}) : super(key: key); @@ -117,8 +117,21 @@ class _TokenStakingState extends State { body: SafeArea( child: Column( children: [ - ConnectionChecker(widget.service.plugin, - onConnected: _getBalance), + ConnectionChecker( + widget.service.plugin, + onConnected: _getBalance, + checker: () { + final tokenWithBalances = (widget.service.plugin as dynamic) + .store + ?.assets + ?.tokenBalanceMap + ?.keys + ?.length ?? + 0; + return widget.service.plugin.sdk.api.connectedNode != null && + tokenWithBalances > 0; + }, + ), Container( margin: EdgeInsets.fromLTRB(16, 16, 0, 16), child: PluginPageTitleTaps( From 24735e686e4b67e9c03c2891e2bde1b28ff92157 Mon Sep 17 00:00:00 2001 From: shawn Date: Mon, 22 Aug 2022 15:09:57 +0800 Subject: [PATCH 13/19] bridgePage config parsing update --- lib/pages/bridge/bridgePage.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pages/bridge/bridgePage.dart b/lib/pages/bridge/bridgePage.dart index 5a6f65fd..b330c9dc 100644 --- a/lib/pages/bridge/bridgePage.dart +++ b/lib/pages/bridge/bridgePage.dart @@ -144,6 +144,7 @@ class _BridgePageState extends State { final chainInfo = await widget.service.plugin.sdk.api.bridge.getChainsInfo(); final routes = await widget.service.plugin.sdk.api.bridge.getRoutes(); + chainFromAll.retainWhere((e) => routes.indexWhere((r) => r.from == e) > -1); for (BridgeRouteData element in routes) { final Set from = _chainToMap[element.from] ?? {}; @@ -172,9 +173,9 @@ class _BridgePageState extends State { final token = args?.token; final address = args?.address; _chainFrom = from ?? - (chainFromAll.contains(widget.service.plugin.basic.name) + (_chainFromAll.contains(widget.service.plugin.basic.name) ? widget.service.plugin.basic.name - : chainFromAll.first); + : _chainFromAll.first); _chainTo = to ?? (_chainToMap[_chainFrom].contains('acala') ? 'acala' From 5d69011cb3c4d706e0bc4868ead8fd7c366adcfa Mon Sep 17 00:00:00 2001 From: gxhx Date: Wed, 24 Aug 2022 19:26:58 +0800 Subject: [PATCH 14/19] ui update --- lib/pages/bridge/bridgeChainSelector.dart | 147 +++++++++++++++++----- lib/pages/bridge/bridgePage.dart | 1 + lib/utils/i18n/en/public.dart | 1 + lib/utils/i18n/zh/public.dart | 1 + 4 files changed, 117 insertions(+), 33 deletions(-) diff --git a/lib/pages/bridge/bridgeChainSelector.dart b/lib/pages/bridge/bridgeChainSelector.dart index 38af4216..451dfda0 100644 --- a/lib/pages/bridge/bridgeChainSelector.dart +++ b/lib/pages/bridge/bridgeChainSelector.dart @@ -7,6 +7,7 @@ import 'package:polkawallet_sdk/api/types/bridge/bridgeChainData.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/currencyWithIcon.dart'; import 'package:polkawallet_ui/components/tokenIcon.dart'; +import 'package:polkawallet_ui/utils/index.dart'; import 'package:skeleton_loader/skeleton_loader.dart'; import 'package:rive/rive.dart'; @@ -570,7 +571,7 @@ class BridgePopupRoute extends PopupRoute { } } -class ChainSelectorList extends StatelessWidget { +class ChainSelectorList extends StatefulWidget { const ChainSelectorList( {this.options, this.crossChainIcons, @@ -585,42 +586,122 @@ class ChainSelectorList extends StatelessWidget { final Map chainsInfo; final String selected; final Function(String) onSelect; + @override + State createState() => _ChainSelectorListState(); +} + +class _ChainSelectorListState extends State { + final TextEditingController searchCtl = TextEditingController(); + final FocusNode focusNode = FocusNode(); + List searchList = []; + + @override + void initState() { + super.initState(); + searchList = widget.options; + } @override Widget build(BuildContext context) { - return ListView( - children: options.map((i) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 14), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: const Color(0x24FFFFFF)), - foregroundDecoration: i == selected - ? BoxDecoration( - color: const Color(0xFFFF7849).withOpacity(0.09), + final dic = I18n.of(context).getDic(i18n_full_dic_app, 'public'); + return Column(children: [ + Container( + padding: const EdgeInsets.only(left: 16, right: 16, bottom: 10), + alignment: Alignment.center, + height: 40, + child: Stack( + children: [ + Align( + child: Container( + decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), - border: Border.all( - color: const Color(0xFFFF7849), - )) - : null, - child: ListTile( - selected: i == selected, - title: CurrencyWithIcon( - chainsInfo[i].display, - TokenIcon(i, crossChainIcons), - textStyle: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.w600, - fontSize: 16, - fontFamily: 'Titillium Web SemiBold'), + color: const Color(0xFF424447)), ), - onTap: () { - onSelect(i); - }, - )), - ); - }).toList(), - ); + ), + Align( + alignment: Alignment.center, + child: TextField( + focusNode: focusNode, + controller: searchCtl, + onChanged: (value) { + var list = widget.options + .where((element) => element + .toUpperCase() + .contains(searchCtl.text.toUpperCase())) + .toList(); + if (searchCtl.text.isEmpty) { + list = widget.options; + } + setState(() { + searchList = list; + }); + }, + style: const TextStyle(color: Colors.white, fontSize: 14), + cursorColor: Colors.white, + textInputAction: TextInputAction.search, + maxLines: 1, + enableSuggestions: false, + autocorrect: false, + decoration: InputDecoration( + isCollapsed: true, + contentPadding: const EdgeInsets.only(left: 8, right: 30), + hintText: dic['bridge.search.chain'], + hintStyle: TextStyle( + fontFamily: 'Titillium Web Light', + fontWeight: FontWeight.w300, + fontSize: UI.getTextSize(14, context), + color: Colors.white.withOpacity(0.5)), + border: InputBorder.none, + ), + ), + ), + const Align( + alignment: Alignment.centerRight, + child: Padding( + padding: EdgeInsets.only(right: 5), + child: Icon( + Icons.search, + size: 24, + color: Color(0xFF979797), + )), + ) + ], + )), + Expanded( + child: ListView( + children: searchList.map((i) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 14), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: const Color(0x24FFFFFF)), + foregroundDecoration: i == widget.selected + ? BoxDecoration( + color: const Color(0xFFFF7849).withOpacity(0.09), + borderRadius: BorderRadius.circular(4), + border: Border.all( + color: const Color(0xFFFF7849), + )) + : null, + child: ListTile( + selected: i == widget.selected, + title: CurrencyWithIcon( + widget.chainsInfo[i].display, + TokenIcon(i, widget.crossChainIcons), + textStyle: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w600, + fontSize: 16, + fontFamily: 'Titillium Web SemiBold'), + ), + onTap: () { + widget.onSelect(i); + }, + )), + ); + }).toList(), + )) + ]); } } diff --git a/lib/pages/bridge/bridgePage.dart b/lib/pages/bridge/bridgePage.dart index b330c9dc..949b2378 100644 --- a/lib/pages/bridge/bridgePage.dart +++ b/lib/pages/bridge/bridgePage.dart @@ -722,6 +722,7 @@ class _BridgePageState extends State { ), ), PluginInputBalance( + canSearch: false, margin: EdgeInsets.only( bottom: _amountError == null ? 24 : 2), titleTag: dic['hub.amount'], diff --git a/lib/utils/i18n/en/public.dart b/lib/utils/i18n/en/public.dart index eb0ec461..ed8d5728 100644 --- a/lib/utils/i18n/en/public.dart +++ b/lib/utils/i18n/en/public.dart @@ -138,4 +138,5 @@ const Map enPublic = { 'bridge.address.warn': 'Editing cross-chain destination address is not recommended.\nAdvanced users only.', 'bridge.connecting.warn': 'Connection timeout. \ntry again later.', + 'bridge.search.chain': 'Search Chain', }; diff --git a/lib/utils/i18n/zh/public.dart b/lib/utils/i18n/zh/public.dart index cce2a2e4..f20aef9b 100644 --- a/lib/utils/i18n/zh/public.dart +++ b/lib/utils/i18n/zh/public.dart @@ -125,4 +125,5 @@ const Map zhPublic = { 'bridge.address': '收款地址', 'bridge.address.warn': '不建议修改跨链转账的收款地址。\n该功能仅限高级用户使用。', 'bridge.connecting.warn': '网络连接超时,\n请稍后重试', + 'bridge.search.chain': '搜索链', }; From 6c62004bc28e0cf1d4ef7878c5d72e14afdfc1ec Mon Sep 17 00:00:00 2001 From: gxhx Date: Thu, 25 Aug 2022 17:44:36 +0800 Subject: [PATCH 15/19] fix #136 --- android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e54602d7..887fb09a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -59,7 +59,7 @@ android { manifestPlaceholders = [ JPUSH_PKGNAME : applicationId, - JPUSH_APPKEY : System.getenv("JPUSH_APPKEY"), + JPUSH_APPKEY : System.getenv("JPUSH_APPKEY")?:"", JPUSH_CHANNEL : "developer-default" ] From ce541cc29d80c99e21444991f48105b477729cb3 Mon Sep 17 00:00:00 2001 From: shawn Date: Wed, 31 Aug 2022 17:32:53 +0800 Subject: [PATCH 16/19] fix jsCodeUpdate & reload --- lib/app.dart | 18 +++++++----------- lib/pages/homePage.dart | 4 ++-- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index a5a9dcc8..eea7a843 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -545,8 +545,7 @@ class _WalletAppState extends State with WidgetsBindingObserver { } Future _checkJSCodeUpdate( - BuildContext context, PolkawalletPlugin plugin, - {bool needReload = true}) async { + BuildContext context, PolkawalletPlugin plugin) async { _checkBadAddressAndWarn(context); // check js code update final jsVersions = await WalletApi.fetchPolkadotJSVersion(); @@ -566,7 +565,7 @@ class _WalletAppState extends State with WidgetsBindingObserver { if (needUpdate) { final res = await AppUI.updateJSCode(context, _store.storage, network, version); - if (needReload && res) { + if (res) { _changeNetwork(plugin); } } @@ -658,8 +657,7 @@ class _WalletAppState extends State with WidgetsBindingObserver { if (snapshot.hasData && _service != null) { if (WalletApp.isInitial == 1) { WalletApp.isInitial++; - _checkJSCodeUpdate(context, _service.plugin, - needReload: false); + _checkJSCodeUpdate(context, _service.plugin); WalletApp.checkUpdate(context); _queryPluginsConfig(); } @@ -859,12 +857,10 @@ class _WalletAppState extends State with WidgetsBindingObserver { void _setupPluginsNetworkSwitch() { widget.plugins.forEach((e) { - if (e.appUtils.switchNetwork == null) { - e.appUtils.switchNetwork = - (String network, {PageRouteParams pageRoute}) async { - _switchNetwork(network, pageRoute: pageRoute); - }; - } + e.appUtils.switchNetwork ??= + (String network, {PageRouteParams pageRoute, int accountType}) async { + _switchNetwork(network, pageRoute: pageRoute); + }; }); } diff --git a/lib/pages/homePage.dart b/lib/pages/homePage.dart index 3cc5e124..36f76322 100644 --- a/lib/pages/homePage.dart +++ b/lib/pages/homePage.dart @@ -34,8 +34,8 @@ class HomePage extends StatefulWidget { final AppService service; final NetworkParams connectedNode; - final Future Function(BuildContext, PolkawalletPlugin, - {bool needReload}) checkJSCodeUpdate; + final Future Function(BuildContext, PolkawalletPlugin) + checkJSCodeUpdate; final Future Function(String, {NetworkParams node, PageRouteParams pageRoute}) switchNetwork; From 8367d26edecf1653d6a197a4fa7a928f973d5408 Mon Sep 17 00:00:00 2001 From: shawn Date: Fri, 2 Sep 2022 20:28:02 +0800 Subject: [PATCH 17/19] bump gradle & firebase sdk versions --- android/build.gradle | 18 ++++---- ios/Podfile.lock | 2 +- ios/Runner.xcodeproj/project.pbxproj | 2 + ios/firebase_app_id_file.json | 7 +++ lib/app.dart | 2 +- lib/firebase_options.dart | 69 ++++++++++++++++++++++++++++ lib/main-dev.dart | 8 +++- lib/main-google.dart | 6 ++- lib/main.dart | 6 ++- pubspec.lock | 25 ++++------ pubspec.yaml | 4 +- 11 files changed, 116 insertions(+), 33 deletions(-) create mode 100644 ios/firebase_app_id_file.json create mode 100644 lib/firebase_options.dart diff --git a/android/build.gradle b/android/build.gradle index 1dedc638..7cd3fae8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,19 +1,19 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.10' repositories { google() - jcenter() mavenCentral() // hms - maven { url 'https://developer.huawei.com/repo/'} +// maven { url 'https://developer.huawei.com/repo/'} // fcm - maven { url "https://maven.google.com" } +// maven { url "https://maven.google.com" } + maven { url "https://storage.googleapis.com/download.flutter.io" } } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:7.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.google.gms:google-services:4.3.8' + classpath 'com.google.gms:google-services:4.3.13' // classpath 'com.huawei.agconnect:agcp:1.4.1.300' } } @@ -22,11 +22,11 @@ allprojects { repositories { google() mavenCentral() - jcenter() // hms - maven { url 'https://developer.huawei.com/repo/'} +// maven { url 'https://developer.huawei.com/repo/'} // fcm - maven { url "https://maven.google.com" } +// maven { url "https://maven.google.com" } + maven { url "https://storage.googleapis.com/download.flutter.io" } } } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 10d17b9d..94f40c54 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -305,4 +305,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 54d14ef5a14a0b3c64cc6d6bfeff28f02dcce905 -COCOAPODS: 1.11.3 +COCOAPODS: 1.11.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 2e083d86..0f2435f8 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 9E4D234E2858EBC700DD86B0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + ED134C0D91BB7828B5F4BF52 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -88,6 +89,7 @@ 97C146EF1CF9000F007C117D /* Products */, 1FD2E3A1CEA090246F2BAEC6 /* Pods */, 58532947E51871803BF4B379 /* Frameworks */, + ED134C0D91BB7828B5F4BF52 /* GoogleService-Info.plist */, ); sourceTree = ""; }; diff --git a/ios/firebase_app_id_file.json b/ios/firebase_app_id_file.json new file mode 100644 index 00000000..8d5f1ba2 --- /dev/null +++ b/ios/firebase_app_id_file.json @@ -0,0 +1,7 @@ +{ + "file_generated_by": "FlutterFire CLI", + "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", + "GOOGLE_APP_ID": "1:605933240116:ios:0f8e161fdee4c9a210af61", + "FIREBASE_PROJECT_ID": "polkawallet-751a3", + "GCM_SENDER_ID": "605933240116" +} \ No newline at end of file diff --git a/lib/app.dart b/lib/app.dart index eea7a843..c3699b19 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -122,7 +122,7 @@ class WalletApp extends StatefulWidget { } class _WalletAppState extends State with WidgetsBindingObserver { - final _analytics = FirebaseAnalytics(); + final _analytics = FirebaseAnalytics.instance; Keyring _keyring; diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 00000000..4d79f9e6 --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,69 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyBmhxZkKnzyIS2WHso3msrhD4fGYewb3Hg', + appId: '1:605933240116:android:dea11497bdfd901310af61', + messagingSenderId: '605933240116', + projectId: 'polkawallet-751a3', + storageBucket: 'polkawallet-751a3.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyB3Sq1q_MEp-va16J5iMV_WifEdkpc84cM', + appId: '1:605933240116:ios:0f8e161fdee4c9a210af61', + messagingSenderId: '605933240116', + projectId: 'polkawallet-751a3', + storageBucket: 'polkawallet-751a3.appspot.com', + iosClientId: '605933240116-pov3hrblag37fls3tvr8k3mmqoct249v.apps.googleusercontent.com', + iosBundleId: 'io.polkawallet.polkawallet', + ); +} diff --git a/lib/main-dev.dart b/lib/main-dev.dart index 800297c5..f77ba30e 100644 --- a/lib/main-dev.dart +++ b/lib/main-dev.dart @@ -9,12 +9,14 @@ import 'package:get_storage/get_storage.dart'; import 'package:polkawallet_plugin_acala/polkawallet_plugin_acala.dart'; import 'package:polkawallet_plugin_bifrost/polkawallet_plugin_bifrost.dart'; import 'package:polkawallet_plugin_chainx/polkawallet_plugin_chainx.dart'; +import 'package:polkawallet_plugin_dbc/polkawallet_plugin_dbc.dart'; import 'package:polkawallet_plugin_edgeware/polkawallet_plugin_edgeware.dart'; import 'package:polkawallet_plugin_karura/polkawallet_plugin_karura.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_robonomics/polkawallet_plugin_robonomics.dart'; import 'package:polkawallet_plugin_statemine/polkawallet_plugin_statemine.dart'; -import 'package:polkawallet_plugin_dbc/polkawallet_plugin_dbc.dart'; + +import 'firebase_options.dart'; void main() async { // FlutterBugly.postCatchedException(() async { @@ -23,7 +25,9 @@ void main() async { DeviceOrientation.portraitUp, ]); await GetStorage.init(get_storage_container); - await Firebase.initializeApp(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); final plugins = [ PluginKusama(name: 'polkadot'), diff --git a/lib/main-google.dart b/lib/main-google.dart index ddbc286a..104fe4ca 100644 --- a/lib/main-google.dart +++ b/lib/main-google.dart @@ -15,6 +15,8 @@ import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_robonomics/polkawallet_plugin_robonomics.dart'; import 'package:polkawallet_plugin_statemine/polkawallet_plugin_statemine.dart'; +import 'firebase_options.dart'; + void main() async { // FlutterBugly.postCatchedException(() async { WidgetsFlutterBinding.ensureInitialized(); @@ -22,7 +24,9 @@ void main() async { DeviceOrientation.portraitUp, ]); await GetStorage.init(get_storage_container); - await Firebase.initializeApp(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); final plugins = [ PluginKusama(name: 'polkadot'), diff --git a/lib/main.dart b/lib/main.dart index f7257f09..78aeaf61 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -15,6 +15,8 @@ import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_robonomics/polkawallet_plugin_robonomics.dart'; import 'package:polkawallet_plugin_statemine/polkawallet_plugin_statemine.dart'; +import 'firebase_options.dart'; + void main() async { // FlutterBugly.postCatchedException(() async { WidgetsFlutterBinding.ensureInitialized(); @@ -22,7 +24,9 @@ void main() async { DeviceOrientation.portraitUp, ]); await GetStorage.init(get_storage_container); - await Firebase.initializeApp(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); final plugins = [ PluginKusama(name: 'polkadot'), diff --git a/pubspec.lock b/pubspec.lock index f0708082..2bfc2976 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -388,55 +388,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.1.2" - firebase: - dependency: transitive - description: - name: firebase - url: "https://pub.dartlang.org" - source: hosted - version: "9.0.3" firebase_analytics: dependency: "direct main" description: name: firebase_analytics url: "https://pub.dartlang.org" source: hosted - version: "8.3.0" + version: "9.3.3" firebase_analytics_platform_interface: dependency: transitive description: name: firebase_analytics_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "3.3.3" firebase_analytics_web: dependency: transitive description: name: firebase_analytics_web url: "https://pub.dartlang.org" source: hosted - version: "0.3.0+1" + version: "0.4.2+3" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "1.5.0" + version: "1.21.1" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "4.5.1" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.7.2" fixnum: dependency: transitive description: @@ -852,7 +845,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: @@ -1135,7 +1128,7 @@ packages: path: "../../coding/polkawallet/polkawallet_plugin_statemine" relative: true source: path - version: "0.4.6" + version: "0.4.9" polkawallet_sdk: dependency: "direct main" description: @@ -1455,7 +1448,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" timing: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4b0d8f84..917c9941 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,8 +33,8 @@ dependencies: # device_info: ^2.0.1 package_info: ^2.0.2 uni_links: ^0.5.1 - firebase_core: 1.5.0 - firebase_analytics: 8.3.0 + firebase_core: ^1.21.1 + firebase_analytics: ^9.3.3 flutter_screenutil: ^5.0.0+2 # firebase_messaging: 10.0.5 polkawallet_ui: ^0.4.8 From 0ef39d934d0f5ab10c2316753c3a68047439b7dd Mon Sep 17 00:00:00 2001 From: shawn Date: Mon, 26 Sep 2022 18:45:32 +0800 Subject: [PATCH 18/19] release 3.3.6 --- ios/Podfile | 4 +- ios/Podfile.lock | 190 ++++++++++++++------------- ios/Runner.xcodeproj/project.pbxproj | 12 +- pubspec.lock | 50 ++++--- pubspec.yaml | 40 +++--- 5 files changed, 158 insertions(+), 138 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index 979f2f6a..971e2438 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '10.0' +platform :ios, '11.0' # add the Firebase pod for Google Analytics # pod 'Firebase/Analytics' @@ -36,7 +36,7 @@ target 'Runner' do pod 'Firebase/Core' pod 'Firebase/Analytics' - pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.5.0' + pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.4.0' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 94f40c54..3bcfe184 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -6,60 +6,63 @@ PODS: - ReachabilitySwift - device_info (0.0.1): - Flutter - - Firebase/Analytics (8.5.0): + - Firebase/Analytics (9.4.0): - Firebase/Core - - Firebase/Core (8.5.0): + - Firebase/Core (9.4.0): - Firebase/CoreOnly - - FirebaseAnalytics (~> 8.5.0) - - Firebase/CoreOnly (8.5.0): - - FirebaseCore (= 8.5.0) - - firebase_analytics (8.3.0): - - Firebase/Analytics (= 8.5.0) + - FirebaseAnalytics (~> 9.4.0) + - Firebase/CoreOnly (9.4.0): + - FirebaseCore (= 9.4.0) + - firebase_analytics (9.3.3): + - Firebase/Analytics (= 9.4.0) - firebase_core - Flutter - - firebase_core (1.5.0): - - Firebase/CoreOnly (= 8.5.0) + - firebase_core (1.21.1): + - Firebase/CoreOnly (= 9.4.0) - Flutter - - FirebaseAnalytics (8.5.0): - - FirebaseAnalytics/AdIdSupport (= 8.5.0) - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) - - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - - GoogleUtilities/MethodSwizzler (~> 7.4) - - GoogleUtilities/Network (~> 7.4) - - "GoogleUtilities/NSData+zlib (~> 7.4)" - - nanopb (~> 2.30908.0) - - FirebaseAnalytics/AdIdSupport (8.5.0): - - FirebaseCore (~> 8.0) - - FirebaseInstallations (~> 8.0) - - GoogleAppMeasurement (= 8.5.0) - - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - - GoogleUtilities/MethodSwizzler (~> 7.4) - - GoogleUtilities/Network (~> 7.4) - - "GoogleUtilities/NSData+zlib (~> 7.4)" - - nanopb (~> 2.30908.0) - - FirebaseCore (8.5.0): - - FirebaseCoreDiagnostics (~> 8.0) - - GoogleUtilities/Environment (~> 7.4) - - GoogleUtilities/Logger (~> 7.4) - - FirebaseCoreDiagnostics (8.11.0): - - GoogleDataTransport (~> 9.1) + - FirebaseAnalytics (9.4.0): + - FirebaseAnalytics/AdIdSupport (= 9.4.0) + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.7) + - GoogleUtilities/MethodSwizzler (~> 7.7) + - GoogleUtilities/Network (~> 7.7) + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseAnalytics/AdIdSupport (9.4.0): + - FirebaseCore (~> 9.0) + - FirebaseInstallations (~> 9.0) + - GoogleAppMeasurement (= 9.4.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.7) + - GoogleUtilities/MethodSwizzler (~> 7.7) + - GoogleUtilities/Network (~> 7.7) + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseCore (9.4.0): + - FirebaseCoreDiagnostics (~> 9.0) + - FirebaseCoreInternal (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/Logger (~> 7.7) - - nanopb (~> 2.30908.0) - - FirebaseFirestore (8.5.0): - - FirebaseFirestore/AutodetectLeveldb (= 8.5.0) - - FirebaseFirestore/AutodetectLeveldb (8.5.0): + - FirebaseCoreDiagnostics (9.6.0): + - GoogleDataTransport (< 10.0.0, >= 9.1.4) + - GoogleUtilities/Environment (~> 7.7) + - GoogleUtilities/Logger (~> 7.7) + - nanopb (< 2.30910.0, >= 2.30908.0) + - FirebaseCoreInternal (9.6.0): + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - FirebaseFirestore (9.4.0): + - FirebaseFirestore/AutodetectLeveldb (= 9.4.0) + - FirebaseFirestore/AutodetectLeveldb (9.4.0): - FirebaseFirestore/Base - FirebaseFirestore/WithLeveldb - - FirebaseFirestore/Base (8.5.0) - - FirebaseFirestore/WithLeveldb (8.5.0): + - FirebaseFirestore/Base (9.4.0) + - FirebaseFirestore/WithLeveldb (9.4.0): - FirebaseFirestore/Base - - FirebaseInstallations (8.11.0): - - FirebaseCore (~> 8.0) + - FirebaseInstallations (9.6.0): + - FirebaseCore (~> 9.0) - GoogleUtilities/Environment (~> 7.7) - GoogleUtilities/UserDefaults (~> 7.7) - - PromisesObjC (< 3.0, >= 1.2) + - PromisesObjC (~> 2.1) - Flutter (1.0.0) - flutter_aes_ecb_pkcs5 (0.0.1): - Flutter @@ -75,41 +78,48 @@ PODS: - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - - GoogleAppMeasurement (8.5.0): - - GoogleAppMeasurement/AdIdSupport (= 8.5.0) - - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - - GoogleUtilities/MethodSwizzler (~> 7.4) - - GoogleUtilities/Network (~> 7.4) - - "GoogleUtilities/NSData+zlib (~> 7.4)" - - nanopb (~> 2.30908.0) - - GoogleAppMeasurement/AdIdSupport (8.5.0): - - GoogleUtilities/AppDelegateSwizzler (~> 7.4) - - GoogleUtilities/MethodSwizzler (~> 7.4) - - GoogleUtilities/Network (~> 7.4) - - "GoogleUtilities/NSData+zlib (~> 7.4)" - - nanopb (~> 2.30908.0) - - GoogleDataTransport (9.1.2): - - GoogleUtilities/Environment (~> 7.2) - - nanopb (~> 2.30908.0) + - GoogleAppMeasurement (9.4.0): + - GoogleAppMeasurement/AdIdSupport (= 9.4.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.7) + - GoogleUtilities/MethodSwizzler (~> 7.7) + - GoogleUtilities/Network (~> 7.7) + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (9.4.0): + - GoogleAppMeasurement/WithoutAdIdSupport (= 9.4.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.7) + - GoogleUtilities/MethodSwizzler (~> 7.7) + - GoogleUtilities/Network (~> 7.7) + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (9.4.0): + - GoogleUtilities/AppDelegateSwizzler (~> 7.7) + - GoogleUtilities/MethodSwizzler (~> 7.7) + - GoogleUtilities/Network (~> 7.7) + - "GoogleUtilities/NSData+zlib (~> 7.7)" + - nanopb (< 2.30910.0, >= 2.30908.0) + - GoogleDataTransport (9.2.0): + - GoogleUtilities/Environment (~> 7.7) + - nanopb (< 2.30910.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/AppDelegateSwizzler (7.7.0): + - GoogleUtilities/AppDelegateSwizzler (7.8.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (7.7.0): + - GoogleUtilities/Environment (7.8.0): - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.7.0): + - GoogleUtilities/Logger (7.8.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (7.7.0): + - GoogleUtilities/MethodSwizzler (7.8.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (7.7.0): + - GoogleUtilities/Network (7.8.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (7.7.0)" - - GoogleUtilities/Reachability (7.7.0): + - "GoogleUtilities/NSData+zlib (7.8.0)" + - GoogleUtilities/Reachability (7.8.0): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (7.7.0): + - GoogleUtilities/UserDefaults (7.8.0): - GoogleUtilities/Logger - image_picker (0.0.1): - Flutter @@ -120,11 +130,11 @@ PODS: - Flutter - JCore (= 2.6.2) - JPush (= 3.6.1) - - nanopb (2.30908.0): - - nanopb/decode (= 2.30908.0) - - nanopb/encode (= 2.30908.0) - - nanopb/decode (2.30908.0) - - nanopb/encode (2.30908.0) + - nanopb (2.30909.0): + - nanopb/decode (= 2.30909.0) + - nanopb/encode (= 2.30909.0) + - nanopb/decode (2.30909.0) + - nanopb/encode (2.30909.0) - OrderedSet (5.0.0) - orientation (0.0.1): - Flutter @@ -134,7 +144,7 @@ PODS: - Flutter - "permission_handler (5.1.0+2)": - Flutter - - PromisesObjC (2.0.0) + - PromisesObjC (2.1.1) - ReachabilitySwift (5.0.0) - share_plus (0.0.1): - Flutter @@ -164,7 +174,7 @@ DEPENDENCIES: - Firebase/Core - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - - FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.5.0`) + - FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `9.4.0`) - Flutter (from `Flutter`) - flutter_aes_ecb_pkcs5 (from `.symlinks/plugins/flutter_aes_ecb_pkcs5/ios`) - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) @@ -191,6 +201,7 @@ SPEC REPOS: - FirebaseAnalytics - FirebaseCore - FirebaseCoreDiagnostics + - FirebaseCoreInternal - FirebaseInstallations - FMDB - GoogleAppMeasurement @@ -216,7 +227,7 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/firebase_core/ios" FirebaseFirestore: :git: https://github.com/invertase/firestore-ios-sdk-frameworks.git - :tag: 8.5.0 + :tag: 9.4.0 Flutter: :path: Flutter flutter_aes_ecb_pkcs5: @@ -259,39 +270,40 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: FirebaseFirestore: :git: https://github.com/invertase/firestore-ios-sdk-frameworks.git - :tag: 8.5.0 + :tag: 9.4.0 SPEC CHECKSUMS: biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9 connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 - Firebase: ff8c73105b90e33e1dc6c8e5445d7adc2ccdc7c1 - firebase_analytics: 3b7d92b8d1a3482f557c201e5e46c2f7fa2644ff - firebase_core: 82d486a6231b636aea229bd471bceca82cbe00a6 - FirebaseAnalytics: 96325c1e0acbd2bb805c6a613028b1fe599d6a37 - FirebaseCore: 1c1ca72483b59b17050f5b4cec4fb748425a3901 - FirebaseCoreDiagnostics: 64d9709d804a6c25bd77841371c1fcfd909d5601 - FirebaseFirestore: 69e4f06a375080a56ffd390fb034467b58ddeda0 - FirebaseInstallations: 044eede8a049bce71c4541ee68d6e4364fcbe774 + Firebase: 7703fc4022824b6d6db1bf7bea58d13b8e17ec46 + firebase_analytics: 63825a37b8ebabd44189b2c04f44ecd864554ebc + firebase_core: 8e500850dd138c269d197c8dfca3ae886fa3b6f2 + FirebaseAnalytics: a1a24e72b7ba7f47045a4633f1abb545c07bd29c + FirebaseCore: 9a2b10270a854731c4d4d8a97d0aa8380ec3458d + FirebaseCoreDiagnostics: 99a495094b10a57eeb3ae8efa1665700ad0bdaa6 + FirebaseCoreInternal: bca76517fe1ed381e989f5e7d8abb0da8d85bed3 + FirebaseFirestore: 11ab4a20524e5e7a36c65f0467a45ad403532665 + FirebaseInstallations: 0a115432c4e223c5ab20b0dbbe4cbefa793a0e8e Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_aes_ecb_pkcs5: fb682a7bb13f29cfbb33f88f7e1ed2211eacf5db flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721 flutter_qr_scan: f7c8c497584bbf395efd56ffcc3a60d27ec9de82 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - GoogleAppMeasurement: 8d10c1c470fcb0e5143ed74fddd164f0a0384800 - GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940 - GoogleUtilities: e0913149f6b0625b553d70dae12b49fc62914fd1 + GoogleAppMeasurement: 5d69e04287fc2c10cc43724bfa4bf31fc12c3dff + GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f + GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7 image_picker: 50e7c7ff960e5f58faa4d1f4af84a771c671bc4a JCore: 0cb4fc5892bc97af4f27283875369ead3eaa3067 JPush: 507d66d7ea307faba1330666d48e4e92af611659 jpush_flutter: e75658a5342e3bfe22d9f3de5dfacd3ef44230c5 - nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 + nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c orientation: 6c9203efe86ce4cff379756910f18b2d745628c3 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 - PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 + PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad @@ -303,6 +315,6 @@ SPEC CHECKSUMS: wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f webview_flutter_wkwebview: b7e70ef1ddded7e69c796c7390ee74180182971f -PODFILE CHECKSUM: 54d14ef5a14a0b3c64cc6d6bfeff28f02dcce905 +PODFILE CHECKSUM: a678b720b555a4acc8c53e7320f714f147cbbf94 COCOAPODS: 1.11.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0f2435f8..10582eea 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -369,7 +369,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3352; + CURRENT_PROJECT_VERSION = 3361; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -388,7 +388,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.3.5; + MARKETING_VERSION = 3.3.6; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -517,7 +517,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3352; + CURRENT_PROJECT_VERSION = 3361; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -536,7 +536,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.3.5; + MARKETING_VERSION = 3.3.6; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -558,7 +558,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3352; + CURRENT_PROJECT_VERSION = 3361; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = armv7; @@ -577,7 +577,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 3.3.5; + MARKETING_VERSION = 3.3.6; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.polkawallet.polkawallet; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/pubspec.lock b/pubspec.lock index 2bfc2976..95ac01fe 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -490,7 +490,7 @@ packages: name: flutter_inappwebview url: "https://pub.dartlang.org" source: hosted - version: "5.3.2" + version: "5.4.3+7" flutter_launcher_icons: dependency: "direct dev" description: @@ -1059,9 +1059,11 @@ packages: polkawallet_plugin_acala: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_acala" - relative: true - source: path + path: "." + ref: "3265d09d7cebaaf9527575a7c2d0b322da968527" + resolved-ref: "3265d09d7cebaaf9527575a7c2d0b322da968527" + url: "https://github.com/AcalaNetwork/polkawallet_plugin_acala.git" + source: git version: "0.4.9" polkawallet_plugin_bifrost: dependency: "direct main" @@ -1102,16 +1104,20 @@ packages: polkawallet_plugin_karura: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_karura" - relative: true - source: path + path: "." + ref: f3537a27d8c620ba7ff7da6c9f623d5309a15e4f + resolved-ref: f3537a27d8c620ba7ff7da6c9f623d5309a15e4f + url: "https://github.com/AcalaNetwork/polkawallet_plugin_karura.git" + source: git version: "0.4.9" polkawallet_plugin_kusama: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_kusama" - relative: true - source: path + path: "." + ref: "8eb1eb01ca1085b5f2a3dce40dfc58740f564949" + resolved-ref: "8eb1eb01ca1085b5f2a3dce40dfc58740f564949" + url: "https://github.com/polkawallet-io/polkawallet_plugin_kusama.git" + source: git version: "0.4.9" polkawallet_plugin_robonomics: dependency: "direct main" @@ -1125,24 +1131,26 @@ packages: polkawallet_plugin_statemine: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_statemine" - relative: true - source: path + path: "." + ref: "8ae288145247607b3fc67deca7d7f64016d8bf56" + resolved-ref: "8ae288145247607b3fc67deca7d7f64016d8bf56" + url: "https://github.com/polkawallet-io/polkawallet_plugin_statemine.git" + source: git version: "0.4.9" polkawallet_sdk: dependency: "direct main" description: - path: "../../coding/polkawallet/sdk" - relative: true - source: path - version: "0.4.9" + name: polkawallet_sdk + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" polkawallet_ui: dependency: "direct main" description: - path: "../../coding/polkawallet/ui" - relative: true - source: path - version: "0.4.9" + name: polkawallet_ui + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" pool: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 917c9941..69f58348 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.3.5+3352 +version: 3.3.6+3361 environment: sdk: ">=2.10.0 <3.0.0" @@ -37,8 +37,8 @@ dependencies: firebase_analytics: ^9.3.3 flutter_screenutil: ^5.0.0+2 # firebase_messaging: 10.0.5 - polkawallet_ui: ^0.4.8 - polkawallet_sdk: ^0.4.8 + polkawallet_ui: ^0.5.0 + polkawallet_sdk: ^0.5.0 ethereum_addresses: ^1.0.2 update_app: git: @@ -51,15 +51,15 @@ dependencies: polkawallet_plugin_kusama: git: url: https://github.com/polkawallet-io/polkawallet_plugin_kusama.git - ref: c80eca534d3041ab1f2ff1674febbf63fb6c1e24 + ref: 8eb1eb01ca1085b5f2a3dce40dfc58740f564949 polkawallet_plugin_acala: git: url: https://github.com/AcalaNetwork/polkawallet_plugin_acala.git - ref: a609b218b4b93743c77016841d8ffc8e29ba8898 + ref: 3265d09d7cebaaf9527575a7c2d0b322da968527 polkawallet_plugin_karura: git: url: https://github.com/AcalaNetwork/polkawallet_plugin_karura.git - ref: 9c8bf1aba91caa69d1fd8cdd5dbfd28cf20962bf + ref: f3537a27d8c620ba7ff7da6c9f623d5309a15e4f polkawallet_plugin_statemine: git: url: https://github.com/polkawallet-io/polkawallet_plugin_statemine.git @@ -100,20 +100,20 @@ dependencies: sticky_headers: ^0.2.0 dependency_overrides: - polkawallet_plugin_kusama: - path: ../../coding/polkawallet/polkawallet_plugin_kusama - polkawallet_plugin_acala: - path: ../../coding/polkawallet/polkawallet_plugin_acala - polkawallet_plugin_karura: - path: ../../coding/polkawallet/polkawallet_plugin_karura - polkawallet_plugin_statemine: - path: ../../coding/polkawallet/polkawallet_plugin_statemine -# polkawallet_ui: ^0.4.9 -# polkawallet_sdk: ^0.4.9 - polkawallet_ui: - path: ../../coding/polkawallet/ui - polkawallet_sdk: - path: ../../coding/polkawallet/sdk +# polkawallet_plugin_kusama: +# path: ../../coding/polkawallet/polkawallet_plugin_kusama +# polkawallet_plugin_acala: +# path: ../../coding/polkawallet/polkawallet_plugin_acala +# polkawallet_plugin_karura: +# path: ../../coding/polkawallet/polkawallet_plugin_karura +# polkawallet_plugin_statemine: +# path: ../../coding/polkawallet/polkawallet_plugin_statemine + polkawallet_ui: ^0.5.0 + polkawallet_sdk: ^0.5.0 +# polkawallet_ui: +# path: ../../coding/polkawallet/ui +# polkawallet_sdk: +# path: ../../coding/polkawallet/sdk transformer_page_view: git: url: https://github.com/polkawallet-io/transformer_page_view.git From 9eca46ab5e79ba83cdc2cc13ad6c09aadcb34b5b Mon Sep 17 00:00:00 2001 From: shawn Date: Mon, 26 Sep 2022 18:47:34 +0800 Subject: [PATCH 19/19] update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 229ae3e2..32b236f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# [3.3.6-beta] - 20220926 +1. Fix known bugs. +2. UX enhancement. +3. bump sdk/ui v0.5.0. + # [3.3.5-beta] - 20220817 1. Multiple fiat display #125 2. 发送交易失败错误信息解析修复 #341