Skip to content

Commit

Permalink
Merge pull request #455 from polkawallet-io/develop
Browse files Browse the repository at this point in the history
release 3711
  • Loading branch information
RomeroYang authored Dec 13, 2024
2 parents 61bbdf3 + c1a1e5b commit 1a1a827
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 56 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# [3.7.1-beta]
20241211
1. bridge update.

# [3.7.0-beta]
20241105
1. acala/karura plugin update.
Expand Down
2 changes: 1 addition & 1 deletion lib/common/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
3 changes: 1 addition & 2 deletions lib/pages/account/import/importAccountAction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
59 changes: 38 additions & 21 deletions lib/pages/assets/asset/locksDetailPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,38 @@ class LocksDetailPageState extends State<LocksDetailPage> {
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;
});
}
}

void _onUnlock(List<String> ids) async {
void _onUnlock(List<List<String>> 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<String> 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(',')}]]'));
Expand Down Expand Up @@ -176,11 +185,11 @@ class LocksDetailPageState extends State<LocksDetailPage> {
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": ""}));
}
Expand Down Expand Up @@ -226,18 +235,23 @@ class LocksDetailPageState extends State<LocksDetailPage> {
children: locks.map((e) {
final amt = BigInt.parse(e.amount.toString());
Widget Democracchild;
final List<String> unLockIds = [];
final List<List<String>> 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 =
Expand All @@ -249,7 +263,10 @@ class LocksDetailPageState extends State<LocksDetailPage> {
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;
}
Expand Down Expand Up @@ -344,7 +361,7 @@ class LocksDetailPageState extends State<LocksDetailPage> {
claimableAmount, decimals, symbol));
} else if (Democracchild != null) {
return buildItem(
title: 'Democracy',
title: 'Referenda',
child: Democracchild,
hasClaim: maxUnlockAmount - maxLockAmount > 0,
onRedeem: () => _onUnlock(unLockIds));
Expand Down
4 changes: 1 addition & 3 deletions lib/pages/profile/account/exportAccountPage.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/service/apiAccount.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
28 changes: 2 additions & 26 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -1100,10 +1076,10 @@ packages:
dependency: "direct main"
description:
name: polkawallet_sdk
sha256: "69d1b782cc0a7d3f8c184970f758940aa9ad455f429b34ea7442e423170ea54d"
sha256: "260d923ec6bebd38632492446b1d83e97bda08aa28e10fbff8f6b1f1473d7c26"
url: "https://pub.dev"
source: hosted
version: "0.6.3"
version: "0.6.4"
polkawallet_ui:
dependency: "direct main"
description:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.1+3711

environment:
sdk: ">=2.10.0 <3.0.0"
Expand Down Expand Up @@ -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.4
# polkawallet_ui:
# path: ../../coding/polkawallet/ui
# polkawallet_sdk:
Expand Down

0 comments on commit 1a1a827

Please sign in to comment.