From c065acf868157d6ac88e4f828f3bf14edb0ac810 Mon Sep 17 00:00:00 2001 From: shawn Date: Thu, 21 Nov 2024 10:10:33 +0800 Subject: [PATCH 1/3] bump polkawallet_sdk: ^0.6.3+2 --- lib/common/consts.dart | 2 +- .../account/import/importAccountAction.dart | 3 +- .../profile/account/exportAccountPage.dart | 4 +-- lib/service/apiAccount.dart | 2 +- pubspec.lock | 31 ++----------------- pubspec.yaml | 4 +-- 6 files changed, 9 insertions(+), 37 deletions(-) diff --git a/lib/common/consts.dart b/lib/common/consts.dart index 6a5ed591..9dc8cded 100644 --- a/lib/common/consts.dart +++ b/lib/common/consts.dart @@ -66,7 +66,7 @@ const bridge_account = { 'acala': '13YMK2eYoAvStnzReuxBjMrAvPXmmdsURwZvc62PrdXimbNy' }; -const bridge_sdk_version = 36001; +const bridge_sdk_version = 37021; const show_guide_status_key = 'show_guide_status'; diff --git a/lib/pages/account/import/importAccountAction.dart b/lib/pages/account/import/importAccountAction.dart index 176cb7b1..f3ba2579 100644 --- a/lib/pages/account/import/importAccountAction.dart +++ b/lib/pages/account/import/importAccountAction.dart @@ -2,9 +2,8 @@ import 'package:app/pages/account/accountTypeSelectPage.dart'; import 'package:app/service/index.dart'; import 'package:app/utils/i18n/index.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; import 'package:polkawallet_sdk/api/apiKeyring.dart'; -import 'package:polkawallet_sdk/ethers/apiEthers.dart'; +import 'package:polkawallet_sdk/consts/settings.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/dialog.dart'; import 'package:polkawallet_ui/utils/format.dart'; diff --git a/lib/pages/profile/account/exportAccountPage.dart b/lib/pages/profile/account/exportAccountPage.dart index cdc776f0..97f818f2 100644 --- a/lib/pages/profile/account/exportAccountPage.dart +++ b/lib/pages/profile/account/exportAccountPage.dart @@ -1,16 +1,14 @@ import 'dart:convert'; -import 'dart:developer'; import 'package:app/pages/account/accountTypeSelectPage.dart'; import 'package:app/pages/profile/account/exportResultPage.dart'; import 'package:app/pages/profile/index.dart'; import 'package:app/service/index.dart'; import 'package:app/utils/i18n/index.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:polkawallet_sdk/api/apiKeyring.dart'; -import 'package:polkawallet_sdk/ethers/apiEthers.dart'; +import 'package:polkawallet_sdk/consts/settings.dart'; import 'package:polkawallet_sdk/storage/types/keyPairData.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/back.dart'; diff --git a/lib/service/apiAccount.dart b/lib/service/apiAccount.dart index 69521625..2dd4fecd 100644 --- a/lib/service/apiAccount.dart +++ b/lib/service/apiAccount.dart @@ -9,7 +9,7 @@ import 'package:biometric_storage/biometric_storage.dart'; import 'package:flutter/cupertino.dart'; import 'package:polkawallet_sdk/api/apiKeyring.dart'; import 'package:polkawallet_sdk/api/types/recoveryInfo.dart'; -import 'package:polkawallet_sdk/ethers/apiEthers.dart'; +import 'package:polkawallet_sdk/consts/settings.dart'; import 'package:polkawallet_sdk/storage/types/ethWalletData.dart'; import 'package:polkawallet_sdk/storage/types/keyPairData.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; diff --git a/pubspec.lock b/pubspec.lock index 061ea990..814cc53b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -65,14 +65,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.3" - bip32: - dependency: transitive - description: - name: bip32 - sha256: "54787cd7a111e9d37394aabbf53d1fc5e2e0e0af2cd01c459147a97c0e3f8a97" - url: "https://pub.dev" - source: hosted - version: "2.0.0" bip39: dependency: transitive description: @@ -89,14 +81,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" - bs58check: - dependency: transitive - description: - name: bs58check - sha256: c4a164d42b25c2f6bc88a8beccb9fc7d01440f3c60ba23663a20a70faf484ea9 - url: "https://pub.dev" - source: hosted - version: "1.0.2" build: dependency: transitive description: @@ -362,14 +346,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" - ethers: - dependency: transitive - description: - name: ethers - sha256: e7f06c339a04c626c6df73f6c2559a956810a2c1b7fa32a5a6e198a78cd0c9ff - url: "https://pub.dev" - source: hosted - version: "0.0.1+3" fake_async: dependency: transitive description: @@ -1099,10 +1075,9 @@ packages: polkawallet_sdk: dependency: "direct main" description: - name: polkawallet_sdk - sha256: "69d1b782cc0a7d3f8c184970f758940aa9ad455f429b34ea7442e423170ea54d" - url: "https://pub.dev" - source: hosted + path: "../../coding/polkawallet/sdk" + relative: true + source: path version: "0.6.3" polkawallet_ui: dependency: "direct main" diff --git a/pubspec.yaml b/pubspec.yaml index 2a828dc9..2f133702 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.7.0+3701 +version: 3.7.0+3702 environment: sdk: ">=2.10.0 <3.0.0" @@ -112,7 +112,7 @@ dependency_overrides: # polkawallet_plugin_evm: # path: ../../coding/polkawallet/polkawallet_plugin_evm polkawallet_ui: ^0.5.6 - polkawallet_sdk: ^0.6.3 + polkawallet_sdk: ^0.6.3+2 # polkawallet_ui: # path: ../../coding/polkawallet/ui # polkawallet_sdk: From 2b65e9348a83926bf94a82c5079944cd8c09e9b4 Mon Sep 17 00:00:00 2001 From: shawn Date: Sat, 7 Dec 2024 00:32:42 +0800 Subject: [PATCH 2/3] remove unused bridge channels --- lib/pages/assets/asset/locksDetailPage.dart | 59 +++++++++++++-------- pubspec.lock | 9 ++-- pubspec.yaml | 2 +- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/lib/pages/assets/asset/locksDetailPage.dart b/lib/pages/assets/asset/locksDetailPage.dart index ce60a045..75e7c628 100644 --- a/lib/pages/assets/asset/locksDetailPage.dart +++ b/lib/pages/assets/asset/locksDetailPage.dart @@ -43,8 +43,8 @@ class LocksDetailPageState extends State { final res = await widget.service.plugin.sdk.webView .evalJavascript('api.derive.chain.bestNumber()'); bestNumber = int.parse(res.toString()); - final List locks = await widget.service.plugin.sdk.api.gov - .getDemocracyLocks(widget.service.keyring.current.address); + final List locks = await widget.service.plugin.sdk.api.gov2 + .queryReferendaLocks(widget.service.keyring.current.address); if (mounted && locks != null) { setState(() { _locks = locks; @@ -52,20 +52,29 @@ class LocksDetailPageState extends State { } } - void _onUnlock(List ids) async { + void _onUnlock(List> ids) async { final dic = I18n.of(context).getDic(i18n_full_dic_app, 'assets'); - final txs = ids - .map((e) => 'api.tx.democracy.removeVote(${BigInt.parse(e)})') - .toList(); - txs.add( - 'api.tx.democracy.unlock("${widget.service.keyring.current.address}")'); + final List tracks = []; + final txs = ids.map((e) { + if (!tracks.contains(e[0])) { + tracks.add(e[0]); + } + return 'api.tx.convictionVoting.removeVote("${e[0]}", "${e[1]}")'; + }).toList(); + for (var trackId in tracks) { + txs.add( + 'api.tx.convictionVoting.unlock("$trackId", "${widget.service.keyring.current.address}")'); + } final res = await Navigator.of(context).pushNamed(TxConfirmPage.route, arguments: TxConfirmParams( txTitle: dic['lock.unlock'], module: 'utility', call: 'batch', txDisplay: { - "actions": ['democracy.removeVote', 'democracy.unlock'], + "actions": [ + 'convictionVoting.removeVote', + 'convictionVoting.unlock' + ], }, params: [], rawParams: '[[${txs.join(',')}]]')); @@ -176,11 +185,11 @@ class LocksDetailPageState extends State { final l = widget.service.plugin.balances.native.lockedBreakdown.toList(); l.retainWhere((e) => BigInt.parse(e.amount.toString()) > BigInt.zero); final locks = - l.where((element) => element.use.contains('ormlvest')).toList(); - locks.addAll( - l.where((element) => element.use.contains('democrac')).toList()); - l.retainWhere( - (e) => !e.use.contains('ormlvest') && !e.use.contains('democrac')); + l.where((element) => element.use.contains('pyconvot')).toList(); + // locks.addAll( + // l.where((element) => element.use.contains('democrac')).toList()); + // l.retainWhere( + // (e) => !e.use.contains('ormlvest') && !e.use.contains('democrac')); if (l.length > 0) { locks.add(BalanceBreakdownData.fromJson({"amount": 0, "use": ""})); } @@ -226,18 +235,23 @@ class LocksDetailPageState extends State { children: locks.map((e) { final amt = BigInt.parse(e.amount.toString()); Widget Democracchild; - final List unLockIds = []; + final List> unLockIds = []; double maxLockAmount = 0, maxUnlockAmount = 0; - if (e.use.contains('democrac') && _locks.length > 0) { + if (e.use.contains('pyconvot') && _locks.length > 0) { for (int index = 0; index < _locks.length; index++) { - var unlockAt = _locks[index]['unlockAt']; + var unlockAt = _locks[index]['endBlock']; + final amountString = _locks[index]['total'] + .toString() + .startsWith('0x') + ? _locks[index]['total'] + : "0x${_locks[index]['total']}"; final amount = Fmt.balanceDouble( - _locks[index]['balance'].toString(), + amountString, decimals, ); - if (unlockAt != "0") { + if (unlockAt != "1fffffffffffff") { BigInt endLeft; try { endLeft = @@ -249,7 +263,10 @@ class LocksDetailPageState extends State { BigInt.from(bestNumber); } if (endLeft.toInt() <= 0) { - unLockIds.add(_locks[index]['referendumId']); + unLockIds.add([ + _locks[index]['classId'].toString(), + _locks[index]['refId'] + ]); if (amount > maxUnlockAmount) { maxUnlockAmount = amount; } @@ -344,7 +361,7 @@ class LocksDetailPageState extends State { claimableAmount, decimals, symbol)); } else if (Democracchild != null) { return buildItem( - title: 'Democracy', + title: 'Referenda', child: Democracchild, hasClaim: maxUnlockAmount - maxLockAmount > 0, onRedeem: () => _onUnlock(unLockIds)); diff --git a/pubspec.lock b/pubspec.lock index 814cc53b..29c732eb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1075,10 +1075,11 @@ packages: polkawallet_sdk: dependency: "direct main" description: - path: "../../coding/polkawallet/sdk" - relative: true - source: path - version: "0.6.3" + name: polkawallet_sdk + sha256: "260d923ec6bebd38632492446b1d83e97bda08aa28e10fbff8f6b1f1473d7c26" + url: "https://pub.dev" + source: hosted + version: "0.6.4" polkawallet_ui: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 2f133702..6b24316f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -112,7 +112,7 @@ dependency_overrides: # polkawallet_plugin_evm: # path: ../../coding/polkawallet/polkawallet_plugin_evm polkawallet_ui: ^0.5.6 - polkawallet_sdk: ^0.6.3+2 + polkawallet_sdk: ^0.6.4 # polkawallet_ui: # path: ../../coding/polkawallet/ui # polkawallet_sdk: From c1a1e5b46ab9e9f9d40fd90217eaa2f3ba8bd623 Mon Sep 17 00:00:00 2001 From: shawn Date: Wed, 11 Dec 2024 22:29:53 +0800 Subject: [PATCH 3/3] release 3711 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81e43c06..f158364e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# [3.7.1-beta] +20241211 +1. bridge update. + # [3.7.0-beta] 20241105 1. acala/karura plugin update. diff --git a/pubspec.yaml b/pubspec.yaml index 6b24316f..da933fb1 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.7.0+3702 +version: 3.7.1+3711 environment: sdk: ">=2.10.0 <3.0.0"