diff --git a/CHANGELOG.md b/CHANGELOG.md index dc3b88c6..f9a17af5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,4 +34,11 @@ - Add Edgeware network support. - Update ChainX plugin. - Update Laminar plugin to TC3. +- Fix known Bugs. + +# 2.0.5-beta +- Update Acala swap & loan UI. +- Remove Kusama council module. +- Update Edgeware Update. +- Update ChainX plugin. - Fix known Bugs. \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index debf71c8..fd735789 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -493,7 +493,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -526,7 +526,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = WQ5H736A22; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/app.dart b/lib/app.dart index fe158e6d..5e2a8457 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -272,6 +272,8 @@ class _WalletAppState extends State { // todo: remove this after crowd loan final karStarted = await WalletApi.getKarCrowdLoanStarted(); if (karStarted != null && karStarted['result']) { + storage.write(kar_crowd_loan_api_key, + '${karStarted['endpoint']}|${karStarted['subscribe']}'); Navigator.of(context).pushNamed(AdPage.route); return; } diff --git a/lib/common/consts.dart b/lib/common/consts.dart index 0e189a3d..319f3a44 100644 --- a/lib/common/consts.dart +++ b/lib/common/consts.dart @@ -15,8 +15,9 @@ const prefixList = [ /// app versions enum BuildTargets { apk, playStore, dev } -const String app_beta_version = 'v2.0.5-beta.1'; -const int app_beta_version_code = 2051; +const String app_beta_version = 'v2.0.5-beta.3'; +const int app_beta_version_code = 2053; const show_guide_status_key = 'show_guide_status'; const show_banner_status_key = 'show_banner_status'; +const kar_crowd_loan_api_key = 'kar_crowd_loan_api'; diff --git a/lib/pages/public/AdBanner.dart b/lib/pages/public/AdBanner.dart index dddc603d..60fba344 100644 --- a/lib/pages/public/AdBanner.dart +++ b/lib/pages/public/AdBanner.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:app/common/consts.dart'; -import 'package:app/main.dart'; import 'package:app/pages/public/karCrowdLoanPage.dart'; import 'package:app/service/walletApi.dart'; import 'package:app/utils/i18n/index.dart'; @@ -61,10 +60,7 @@ class _AdBannerState extends State { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { - // todo: only available in dev now - if (widget.service.buildTarget == BuildTargets.dev) { - _getCrowdLoanStarted(); - } + _getCrowdLoanStarted(); }); } diff --git a/lib/pages/public/adPage.dart b/lib/pages/public/adPage.dart index 76497dad..bb3bb920 100644 --- a/lib/pages/public/adPage.dart +++ b/lib/pages/public/adPage.dart @@ -13,7 +13,7 @@ class AdPage extends StatefulWidget { } class _AdPageState extends State { - int _timerCount = 6; + int _timerCount = 10; void _updateTimer() { if (_timerCount > 0) { diff --git a/lib/pages/public/karCrowdLoanFormPage.dart b/lib/pages/public/karCrowdLoanFormPage.dart index 22948e2c..fd967e04 100644 --- a/lib/pages/public/karCrowdLoanFormPage.dart +++ b/lib/pages/public/karCrowdLoanFormPage.dart @@ -1,3 +1,4 @@ +import 'package:app/common/consts.dart'; import 'package:app/pages/public/karCrowdLoanPage.dart'; import 'package:app/service/index.dart'; import 'package:app/service/walletApi.dart'; @@ -63,10 +64,9 @@ class _KarCrowdLoanFormPageState extends State { final amt = double.parse(v); - // todo: update decimals while online - final decimals = 12; - // final decimals = widget.service.plugin.networkState.tokenDecimals[0]; - final valid = amt < Fmt.bigIntToDouble(balanceInt, decimals); + final decimals = + (widget.service.plugin.networkState.tokenDecimals ?? [12])[0]; + final valid = amt < Fmt.bigIntToDouble(balanceInt, decimals) && amt >= 1; setState(() { _amountValid = valid; _amount = amt; @@ -92,7 +92,8 @@ class _KarCrowdLoanFormPageState extends State { }); return; } - final res = await WalletApi.verifyKarReferralCode(v); + final karApis = widget.service.store.storage.read(kar_crowd_loan_api_key); + final res = await WalletApi.verifyKarReferralCode(v, karApis.split('|')[0]); print(res); final valid2 = res != null && res['result']; setState(() { @@ -109,16 +110,22 @@ class _KarCrowdLoanFormPageState extends State { setState(() { _submitting = true; }); + final karApi = widget.service.store.storage.read(kar_crowd_loan_api_key); + final karApis = karApi.split('|'); final KarCrowdLoanPageParams params = ModalRoute.of(context).settings.arguments; - // todo: update decimals while online - final decimals = 12; - // final decimals = widget.service.plugin.networkState.tokenDecimals[0]; + final decimals = + (widget.service.plugin.networkState.tokenDecimals ?? [12])[0]; final amountInt = Fmt.tokenInt(_amount.toString(), decimals); final signed = widget.service.store.storage .read('$kar_statement_store_key${account.pubKey}'); final signingRes = await widget.service.account.postKarCrowdLoan( - account.address, amountInt, params.email, _referral, signed); + account.address, + amountInt, + params.email, + _referral, + signed, + karApis[0]); if (signingRes != null && (signingRes['result'] ?? false)) { final dic = I18n.of(context).getDic(i18n_full_dic_app, 'public'); final res = (await Navigator.of(context).pushNamed(TxConfirmPage.route, @@ -135,8 +142,7 @@ class _KarCrowdLoanFormPageState extends State { ))) as Map; if (res != null) { if (params.email.isNotEmpty && _emailAccept) { - // todo: update subscribe id in production - WalletApi.postKarSubscribe(params.email); + WalletApi.postKarSubscribe(params.email, karApis[1]); } await showCupertinoDialog( context: context, @@ -200,9 +206,8 @@ class _KarCrowdLoanFormPageState extends State { Widget build(_) { return Observer(builder: (BuildContext context) { final dic = I18n.of(context).getDic(i18n_full_dic_app, 'public'); - // todo: update decimals while online - final decimals = 12; - // final decimals = widget.service.plugin.networkState.tokenDecimals[0]; + final decimals = + (widget.service.plugin.networkState.tokenDecimals ?? [12])[0]; final cardColor = Theme.of(context).cardColor; final karColor = Colors.red; diff --git a/lib/pages/public/karCrowdLoanPage.dart b/lib/pages/public/karCrowdLoanPage.dart index 7df99721..2f9fa43c 100644 --- a/lib/pages/public/karCrowdLoanPage.dart +++ b/lib/pages/public/karCrowdLoanPage.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:app/common/consts.dart'; import 'package:app/pages/public/karCrowdLoanFormPage.dart'; import 'package:app/pages/public/adPage.dart'; import 'package:app/service/index.dart'; @@ -80,7 +81,9 @@ class _KarCrowdLoanPageState extends State { } Future _getCrowdLoanHistory() async { - final res = await WalletApi.getKarCrowdLoanHistory(_account.address); + final karApis = widget.service.store.storage.read(kar_crowd_loan_api_key); + final res = await WalletApi.getKarCrowdLoanHistory( + _account.address, karApis.split('|')[0]); print(res); if (res != null && mounted) { setState(() { @@ -102,8 +105,8 @@ class _KarCrowdLoanPageState extends State { } Future _getKarStatement() async { - final res = await WalletApi.getKarCrowdLoanStatement(); - print(res); + final karApis = widget.service.store.storage.read(kar_crowd_loan_api_key); + final res = await WalletApi.getKarCrowdLoanStatement(karApis.split('|')[0]); if (res != null && mounted) { setState(() { _statement = res; @@ -656,7 +659,7 @@ class CrowdLoanPageLayout extends StatelessWidget { ), Container( height: 56, - margin: EdgeInsets.only(top: 24, left: 8), + margin: EdgeInsets.only(top: 32, left: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/service/apiAccount.dart b/lib/service/apiAccount.dart index 727b531b..9b2df720 100644 --- a/lib/service/apiAccount.dart +++ b/lib/service/apiAccount.dart @@ -175,9 +175,9 @@ class ApiAccount { } Future postKarCrowdLoan(String address, BigInt amount, String email, - String referral, String signature) async { + String referral, String signature, String endpoint) async { final submitted = await WalletApi.postKarCrowdLoan( - address, amount, email, referral, signature); + address, amount, email, referral, signature, endpoint); print(submitted); if (submitted != null && (submitted['result'] ?? false)) { apiRoot.store.account.setBannerVisible(false); diff --git a/lib/service/walletApi.dart b/lib/service/walletApi.dart index 82767222..ab21eaf2 100644 --- a/lib/service/walletApi.dart +++ b/lib/service/walletApi.dart @@ -5,9 +5,6 @@ import 'package:http/http.dart'; class WalletApi { static const String _endpoint = 'https://api.polkawallet.io'; - // todo: change the _karEndpoint while online - // static const String _karEndpoint = 'https://api.aca-staging.network/'; - static const String _karEndpoint = 'https://crowdloan-api.laminar.codes'; static const String _jsCodeStorageKey = 'js_service_'; static const String _jsCodeStorageVersionKey = 'js_service_version_'; @@ -131,9 +128,9 @@ class WalletApi { } } - static Future getKarCrowdLoanStatement() async { + static Future getKarCrowdLoanStatement(String endpoint) async { try { - final res = await get('$_karEndpoint/statement'); + final res = await get('https://$endpoint/statement'); if (res == null) { return null; } else { @@ -145,9 +142,10 @@ class WalletApi { } } - static Future getKarCrowdLoanHistory(String address) async { + static Future getKarCrowdLoanHistory( + String address, String endpoint) async { try { - final res = await get('$_karEndpoint/contributions/$address'); + final res = await get('https://$endpoint/contributions/$address'); if (res == null) { return null; } else { @@ -160,9 +158,9 @@ class WalletApi { } } - static Future verifyKarReferralCode(String code) async { + static Future verifyKarReferralCode(String code, String endpoint) async { try { - final res = await get('$_karEndpoint/referral/$code'); + final res = await get('https://$endpoint/referral/$code'); if (res == null) { return null; } else { @@ -175,7 +173,7 @@ class WalletApi { } static Future postKarCrowdLoan(String address, BigInt amount, - String email, String referral, String signature) async { + String email, String referral, String signature, String endpoint) async { final headers = {"Content-type": "application/json", "Accept": "*/*"}; final body = { "address": address, @@ -189,7 +187,7 @@ class WalletApi { body.addAll({"referral": referral}); } try { - final res = await post('$_karEndpoint/verify', + final res = await post('https://$endpoint/verify', headers: headers, body: jsonEncode(body)); if (res == null) { return null; @@ -202,7 +200,7 @@ class WalletApi { } } - static Future postKarSubscribe(String email) async { + static Future postKarSubscribe(String email, String subscribeId) async { final headers = {"Content-type": "application/json", "Accept": "*/*"}; final body = { "fields": [ @@ -211,7 +209,7 @@ class WalletApi { }; try { final res = await post( - 'https://api.hsforms.com/submissions/v3/integration/submit/7522932/fc605148-482f-4302-a8d2-cece3251f7fc', + 'https://api.hsforms.com/submissions/v3/integration/submit/7522932/$subscribeId', headers: headers, body: jsonEncode(body)); if (res == null) { diff --git a/pubspec.lock b/pubspec.lock index e56c4598..f2f68bd3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -747,31 +747,64 @@ packages: polkawallet_plugin_acala: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_acala" - relative: true - source: path + path: "." + ref: "28aff6c52cbc4fbdf22120f191b073ffd1faf3a9" + resolved-ref: "28aff6c52cbc4fbdf22120f191b073ffd1faf3a9" + url: "https://github.com/AcalaNetwork/polkawallet_plugin_acala.git" + source: git version: "0.1.6" - polkawallet_plugin_kusama: + polkawallet_plugin_chainx: + dependency: "direct main" + description: + path: "." + ref: "0692cbb02da9cfd59eae2856e6e2819c072d4cd3" + resolved-ref: "0692cbb02da9cfd59eae2856e6e2819c072d4cd3" + url: "https://github.com/true-eye/polkawallet_plugin_chainx.git" + source: git + version: "0.0.1" + polkawallet_plugin_edgeware: dependency: "direct main" description: - path: "../../coding/polkawallet/polkawallet_plugin_kusama" - relative: true - source: path + path: "." + ref: "4e0d7dffee5222c493f70a310ce5f9b5b24f4d90" + resolved-ref: "4e0d7dffee5222c493f70a310ce5f9b5b24f4d90" + url: "https://github.com/remzrn/polkawallet_plugin_edgeware.git" + source: git version: "0.1.6" + polkawallet_plugin_kusama: + dependency: "direct main" + description: + path: "." + ref: "8add53266eb2bc65aa94b378f0daeb456e39eee7" + resolved-ref: "8add53266eb2bc65aa94b378f0daeb456e39eee7" + url: "https://github.com/polkawallet-io/polkawallet_plugin_kusama.git" + source: git + version: "0.1.7" + polkawallet_plugin_laminar: + dependency: "direct main" + description: + path: "." + ref: "73b623a259fa6c31c0999625ebbfa7cdb84a6dcd" + resolved-ref: "73b623a259fa6c31c0999625ebbfa7cdb84a6dcd" + url: "https://github.com/polkawallet-io/polkawallet_plugin_laminar.git" + source: git + version: "0.1.5" polkawallet_sdk: dependency: "direct overridden" description: - path: "../../coding/polkawallet/sdk" - relative: true - source: path + name: polkawallet_sdk + url: "https://pub.dartlang.org" + source: hosted version: "0.1.7" polkawallet_ui: dependency: "direct overridden" description: - path: "../../coding/polkawallet/ui" - relative: true - source: path - version: "0.1.5" + path: "." + ref: b68da4b7d56dec37ddc34844b204fd095a00f7df + resolved-ref: b68da4b7d56dec37ddc34844b204fd095a00f7df + url: "https://github.com/polkawallet-io/ui.git" + source: git + version: "0.1.7" pool: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1c86607a..e8bd29cd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,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: 2.0.5+2051 +version: 2.0.5+2053 environment: sdk: ">=2.10.0 <3.0.0" @@ -35,33 +35,33 @@ dependencies: polkawallet_plugin_kusama: git: url: https://github.com/polkawallet-io/polkawallet_plugin_kusama.git - ref: 5bd378a753df123014ed3dddd68ec644c23c6543 + ref: 8add53266eb2bc65aa94b378f0daeb456e39eee7 polkawallet_plugin_acala: git: url: https://github.com/AcalaNetwork/polkawallet_plugin_acala.git - ref: fd16946d18c84078e96c64e3dbc1b93061dc6802 + ref: 28aff6c52cbc4fbdf22120f191b073ffd1faf3a9 polkawallet_plugin_laminar: git: url: https://github.com/polkawallet-io/polkawallet_plugin_laminar.git - ref: 3011d23be5c005e088ddd7ce6c58d82ef31dca36 + ref: 73b623a259fa6c31c0999625ebbfa7cdb84a6dcd polkawallet_plugin_chainx: git: url: https://github.com/true-eye/polkawallet_plugin_chainx.git - ref: 225f62ae68adfef0d50bdb4d2eb6a34e4f518269 + ref: 0692cbb02da9cfd59eae2856e6e2819c072d4cd3 polkawallet_plugin_edgeware: git: url: https://github.com/remzrn/polkawallet_plugin_edgeware.git - ref: e05ce06f0a459ae0879a7adf56295d5e25eba8be + ref: 4e0d7dffee5222c493f70a310ce5f9b5b24f4d90 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 dependency_overrides: - polkawallet_plugin_kusama: - path: ../../coding/polkawallet/polkawallet_plugin_kusama - polkawallet_plugin_acala: - path: ../../coding/polkawallet/polkawallet_plugin_acala +# polkawallet_plugin_kusama: +# path: ../../coding/polkawallet/polkawallet_plugin_kusama +# polkawallet_plugin_acala: +# path: ../../coding/polkawallet/polkawallet_plugin_acala # polkawallet_plugin_laminar: # path: ../../coding/polkawallet/polkawallet_plugin_laminar # polkawallet_plugin_chainx: @@ -69,13 +69,13 @@ dependency_overrides: # polkawallet_plugin_edgeware: # path: ../../coding/polkawallet/polkawallet_plugin_edgeware polkawallet_ui: -# git: -# url: https://github.com/polkawallet-io/ui.git -# ref: 797d2184fb18335895b95069f94b880b539d23f6 - path: ../../coding/polkawallet/ui -# polkawallet_sdk: ^0.1.6 - polkawallet_sdk: - path: ../../coding/polkawallet/sdk + git: + url: https://github.com/polkawallet-io/ui.git + ref: b68da4b7d56dec37ddc34844b204fd095a00f7df +# path: ../../coding/polkawallet/ui + polkawallet_sdk: ^0.1.7 +# polkawallet_sdk: +# path: ../../coding/polkawallet/sdk dev_dependencies: flutter_test: