diff --git a/lib/common/components/addressIcon.dart b/lib/common/components/addressIcon.dart index b2155c6c..4053b297 100644 --- a/lib/common/components/addressIcon.dart +++ b/lib/common/components/addressIcon.dart @@ -5,11 +5,18 @@ import 'package:polka_wallet/store/app.dart'; import 'package:polka_wallet/utils/UI.dart'; class AddressIcon extends StatelessWidget { - AddressIcon(this.address, {this.size, this.pubKey, this.tapToCopy = true}); + AddressIcon( + this.address, { + this.size, + this.pubKey, + this.tapToCopy = true, + this.addressToCopy, + }); final String address; final String pubKey; final double size; final bool tapToCopy; + final String addressToCopy; @override Widget build(BuildContext context) { @@ -36,8 +43,9 @@ class AddressIcon extends StatelessWidget { ? Image.asset('assets/images/assets/Assets_nav_0.png') : SvgPicture.string(rawSvg), ), - onTap: - tapToCopy ? () => UI.copyAndNotify(context, addressView) : null, + onTap: tapToCopy + ? () => UI.copyAndNotify(context, addressToCopy ?? addressView) + : null, ); }, ); diff --git a/lib/js_service_acala/src/service/acala.js b/lib/js_service_acala/src/service/acala.js index 78c1960e..34b207b7 100644 --- a/lib/js_service_acala/src/service/acala.js +++ b/lib/js_service_acala/src/service/acala.js @@ -136,7 +136,7 @@ async function fetchDexPoolInfo(currencyId, address) { proportion = balanceToNumber(pool[2]) / balanceToNumber(pool[1]); } const reward = - balanceToNumber(pool[3][0]) * proportion - balanceToNumber(pool[4]); + balanceToNumber(pool[3][0]) * proportion - balanceToNumber(pool[4]); return { token: currencyId, pool: pool[0], @@ -247,7 +247,7 @@ async function fetchHomaUserInfo(api, address) { const start = stakingPool.currentEra.toNumber(); const duration = stakingPool.bondingDuration.toNumber(); const claims = []; - for (let i = start; i < start + duration; i++) { + for (let i = start; i < start + duration + 2; i++) { const claimed = await api.query.stakingPool.claimedUnbond(address, i); if (claimed.gtn(0)) { claims[claims.length] = { diff --git a/lib/page-acala/earn/addLiquidityPage.dart b/lib/page-acala/earn/addLiquidityPage.dart index 9070700a..f85c6d9f 100644 --- a/lib/page-acala/earn/addLiquidityPage.dart +++ b/lib/page-acala/earn/addLiquidityPage.dart @@ -7,7 +7,6 @@ import 'package:polka_wallet/common/components/currencyWithIcon.dart'; import 'package:polka_wallet/common/components/roundedButton.dart'; import 'package:polka_wallet/common/components/roundedCard.dart'; import 'package:polka_wallet/common/consts/settings.dart'; -import 'package:polka_wallet/common/regInputFormatter.dart'; import 'package:polka_wallet/page-acala/earn/earnPage.dart'; import 'package:polka_wallet/page/account/txConfirmPage.dart'; import 'package:polka_wallet/service/substrateApi/api.dart'; diff --git a/lib/page-acala/earn/withdrawLiquidityPage.dart b/lib/page-acala/earn/withdrawLiquidityPage.dart index e432bca8..f627d8cf 100644 --- a/lib/page-acala/earn/withdrawLiquidityPage.dart +++ b/lib/page-acala/earn/withdrawLiquidityPage.dart @@ -8,7 +8,6 @@ import 'package:polka_wallet/common/components/outlinedButtonSmall.dart'; import 'package:polka_wallet/common/components/roundedButton.dart'; import 'package:polka_wallet/common/components/roundedCard.dart'; import 'package:polka_wallet/common/consts/settings.dart'; -import 'package:polka_wallet/common/regInputFormatter.dart'; import 'package:polka_wallet/page-acala/earn/earnPage.dart'; import 'package:polka_wallet/page/account/txConfirmPage.dart'; import 'package:polka_wallet/service/substrateApi/api.dart'; diff --git a/lib/page-acala/homa/homaPage.dart b/lib/page-acala/homa/homaPage.dart index 9dfd9101..9ee7e259 100644 --- a/lib/page-acala/homa/homaPage.dart +++ b/lib/page-acala/homa/homaPage.dart @@ -206,23 +206,28 @@ class _HomaPageState extends State { (pool.currentEra ?? 0)) .toInt() .toString(); - return Row( - children: [ - InfoItem( - title: I18n.of(context) - .assets['amount'], - content: - Fmt.priceFloorBigInt( - i.claimed, - decimals: decimals), - ), - InfoItem( - title: - dic['homa.user.time'], - content: - '$unlockTime Era ≈ $unlockTime ${dic['homa.redeem.day']}', - ), - ], + return Padding( + padding: + EdgeInsets.only(bottom: 8), + child: Row( + children: [ + InfoItem( + title: I18n.of(context) + .assets['amount'], + content: + Fmt.priceFloorBigInt( + i.claimed, + decimals: + decimals), + ), + InfoItem( + title: + dic['homa.user.time'], + content: + '$unlockTime Era ≈ $unlockTime ${dic['homa.redeem.day']}', + ), + ], + ), ); }).toList(), ) diff --git a/lib/page-acala/homa/mintPage.dart b/lib/page-acala/homa/mintPage.dart index e652cbb6..7d52434a 100644 --- a/lib/page-acala/homa/mintPage.dart +++ b/lib/page-acala/homa/mintPage.dart @@ -6,8 +6,8 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polka_wallet/common/components/currencyWithIcon.dart'; import 'package:polka_wallet/common/components/roundedButton.dart'; import 'package:polka_wallet/common/components/roundedCard.dart'; -import 'package:polka_wallet/common/regInputFormatter.dart'; import 'package:polka_wallet/page-acala/homa/homaHistoryPage.dart'; +import 'package:polka_wallet/page-acala/homa/homaPage.dart'; import 'package:polka_wallet/page/account/txConfirmPage.dart'; import 'package:polka_wallet/service/substrateApi/api.dart'; import 'package:polka_wallet/store/acala/types/stakingPoolInfoData.dart'; @@ -89,8 +89,8 @@ class _MintPageState extends State { res['amountReceive'] = receive; store.acala.setHomaTxs([res]); Navigator.popUntil( - txPageContext, ModalRoute.withName(MintPage.route)); - _refreshKey.currentState.show(); + txPageContext, ModalRoute.withName(HomaPage.route)); + globalHomaRefreshKey.currentState.show(); } }; Navigator.of(context).pushNamed(TxConfirmPage.route, arguments: args); diff --git a/lib/page-acala/homa/redeemPage.dart b/lib/page-acala/homa/redeemPage.dart index e465de39..31b316d8 100644 --- a/lib/page-acala/homa/redeemPage.dart +++ b/lib/page-acala/homa/redeemPage.dart @@ -8,6 +8,7 @@ import 'package:polka_wallet/common/components/roundedButton.dart'; import 'package:polka_wallet/common/components/roundedCard.dart'; import 'package:polka_wallet/common/consts/settings.dart'; import 'package:polka_wallet/page-acala/homa/homaHistoryPage.dart'; +import 'package:polka_wallet/page-acala/homa/homaPage.dart'; import 'package:polka_wallet/page/account/txConfirmPage.dart'; import 'package:polka_wallet/service/substrateApi/api.dart'; import 'package:polka_wallet/store/acala/types/stakingPoolInfoData.dart'; @@ -158,8 +159,8 @@ class _HomaRedeemPageState extends State { res['amountReceive'] = receive; store.acala.setHomaTxs([res]); Navigator.popUntil( - txPageContext, ModalRoute.withName(HomaRedeemPage.route)); - _refreshKey.currentState.show(); + txPageContext, ModalRoute.withName(HomaPage.route)); + globalHomaRefreshKey.currentState.show(); } }; Navigator.of(context).pushNamed(TxConfirmPage.route, arguments: args); diff --git a/lib/page-acala/loan/loanCreatePage.dart b/lib/page-acala/loan/loanCreatePage.dart index fe2c9739..f01d92f7 100644 --- a/lib/page-acala/loan/loanCreatePage.dart +++ b/lib/page-acala/loan/loanCreatePage.dart @@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polka_wallet/common/components/roundedButton.dart'; import 'package:polka_wallet/common/consts/settings.dart'; -import 'package:polka_wallet/common/regInputFormatter.dart'; import 'package:polka_wallet/page-acala/loan/loanAdjustPage.dart'; import 'package:polka_wallet/page-acala/loan/loanInfoPanel.dart'; import 'package:polka_wallet/page/account/txConfirmPage.dart'; diff --git a/lib/page-acala/swap/swapPage.dart b/lib/page-acala/swap/swapPage.dart index f1738cae..fb17f688 100644 --- a/lib/page-acala/swap/swapPage.dart +++ b/lib/page-acala/swap/swapPage.dart @@ -8,7 +8,6 @@ import 'package:polka_wallet/common/components/outlinedButtonSmall.dart'; import 'package:polka_wallet/common/components/roundedButton.dart'; import 'package:polka_wallet/common/components/roundedCard.dart'; import 'package:polka_wallet/common/consts/settings.dart'; -import 'package:polka_wallet/common/regInputFormatter.dart'; import 'package:polka_wallet/page-acala/swap/swapHistoryPage.dart'; import 'package:polka_wallet/page/account/txConfirmPage.dart'; import 'package:polka_wallet/page/assets/transfer/currencySelectPage.dart'; diff --git a/lib/page/networkSelectPage.dart b/lib/page/networkSelectPage.dart index 7d547ab3..5b82a091 100644 --- a/lib/page/networkSelectPage.dart +++ b/lib/page/networkSelectPage.dart @@ -172,7 +172,7 @@ class _NetworkSelectPageState extends State { : Border.all(color: Theme.of(context).cardColor), margin: EdgeInsets.only(bottom: 16), child: ListTile( - leading: AddressIcon('', pubKey: i.pubKey), + leading: AddressIcon('', pubKey: i.pubKey, addressToCopy: address), title: Text(Fmt.accountName(context, i)), subtitle: Text(Fmt.address(address ?? 'address xxxx')), onTap: _networkChanging ? null : () => _onSelect(i, address),