From 5916c359c5ffc5000581a60b9e249667591f6b89 Mon Sep 17 00:00:00 2001 From: shawn Date: Mon, 28 Jun 2021 17:43:30 +0800 Subject: [PATCH] fix stakingDetailPage data parsing --- CHANGELOG.md | 5 +++++ lib/pages/staking/actions/stakingDetailPage.dart | 15 +++++++++------ lib/polkawallet_plugin_kusama.dart | 2 +- pubspec.yaml | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4007983ac..35815ab88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [0.2.3] - 20210628. + +* bump polkawallet_sdk: 0.2.3. +* fix stakingDetailPage data parsing. + ## [0.2.2] - 20210623. * bump polkawallet_sdk & ui: 0.2.2. diff --git a/lib/pages/staking/actions/stakingDetailPage.dart b/lib/pages/staking/actions/stakingDetailPage.dart index 1ba661435..10dc9f92e 100644 --- a/lib/pages/staking/actions/stakingDetailPage.dart +++ b/lib/pages/staking/actions/stakingDetailPage.dart @@ -25,7 +25,7 @@ class StakingDetailPage extends StatelessWidget { List info = [ TxDetailInfoItem(label: dicStaking['action'], content: Text(detail.call)), ]; - List params = jsonDecode(detail.params); + List params = detail.params.isEmpty ? [] : jsonDecode(detail.params); if (params != null) { info.addAll(params.map((i) { String value = i['value'].toString(); @@ -38,11 +38,14 @@ class StakingDetailPage extends StatelessWidget { break; case "AccountId": value = value.contains('0x') ? value : '0x$value'; - final address = plugin.store.accounts - .pubKeyAddressMap[plugin.sdk.api.connectedNode.ss58] - [value] ?? - value; - value = Fmt.address(address); + final ss58 = plugin.sdk.api.connectedNode?.ss58; + final pubKeyAddressMap = plugin.store.accounts.pubKeyAddressMap; + final address = ss58 != null && + pubKeyAddressMap != null && + pubKeyAddressMap[ss58] != null + ? pubKeyAddressMap[ss58][value] + : value; + value = Fmt.address(address ?? value); break; case "RewardDestination": if (i['value']['Account'] != null) { diff --git a/lib/polkawallet_plugin_kusama.dart b/lib/polkawallet_plugin_kusama.dart index 4b62b26d9..3d81be9b6 100644 --- a/lib/polkawallet_plugin_kusama.dart +++ b/lib/polkawallet_plugin_kusama.dart @@ -70,7 +70,7 @@ class PluginKusama extends PolkawalletPlugin { 'packages/polkawallet_plugin_kusama/assets/images/public/$name.png'), iconDisabled: Image.asset( 'packages/polkawallet_plugin_kusama/assets/images/public/${name}_gray.png'), - jsCodeVersion: 20701, + jsCodeVersion: 21001, isTestNet: false, ), recoveryEnabled = name == network_name_kusama, diff --git a/pubspec.yaml b/pubspec.yaml index d715c6a96..5403ce1a2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: polkawallet_plugin_kusama description: The kusama/polkadot network flutter plugin for polkawallet app. -version: 0.2.2 +version: 0.2.3 homepage: environment: