Skip to content

Commit 074f82e

Browse files
CharlVSnaezith
andauthored
[0.8.3+0] RC: add arbitrum coin type and private key export (#2512)
* add arbitrum coin type (#166) * Private Key Export (#183) * kdf show_priv_key api * display private keys * private keys QR code dialog * private keys list title * private key dialog width * private key share instead of copy * Revert "private key share instead of copy" This reverts commit a623444ea75e4d074419bcc9689585ca819beceb. * private key clipboard warning * DEX Swap form gets filled with URL parameters (#162) * router fix uri query parameters were lost at parse * router add dexroute parameters * router dex state notifyListeners for new fields * router dex process order_type param * router dex clean params without notifying * router dex maker process ticker and amount params * router dex fix typo * dex TakerSetSellCoin event add setOnlyIfNotSet * router dex maker consumes only their own params * router dex allow order_type being maker by default * router dex taker process from/to currencies * dex repository waitOrderbookAvailability function * router dex form wait for orderbooks before process * router dex taker process from_amount * router dex code cleanup * mobile/widget layout taker form dropdown position * maker form parse error check * hide trading bot setting * default to wallet route parser if wallet only * wallet only logout confirmation description * improve transaction table error message Use the message suggested by @smk762 rather than printing the raw exception message * fix disappearing icons on fiat coin selection dropdown --------- Co-authored-by: Tolga Ay <[email protected]> Co-authored-by: naezith <[email protected]>
2 parents c779c1d + cada902 commit 074f82e

File tree

34 files changed

+578
-108
lines changed

34 files changed

+578
-108
lines changed

assets/translations/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"swapFeeDetailsNone": "None",
194194
"swapFeeDetailsPaidFromReceivedVolume": "Paid from received volume",
195195
"logoutPopupTitle": "Confirm log out?",
196+
"logoutPopupDescriptionWalletOnly": "Are you sure you want to logout?",
196197
"logoutPopupDescription": "Are you sure you want to logout? Your opened orders will no longer be available to match with other users and any trades in progress may not be completed",
197198
"transactionDetailsTitle": "Transaction completed",
198199
"customSeedWarningText": "Custom seed phrases are generally less secure and easier to crack than a generated BIP39 compliant seed phrase. To confirm you understand and are aware of the risk, type \"I\u00A0Understand\" in the box below.",
@@ -463,6 +464,8 @@
463464
"manageAnalytics": "Manage analytics",
464465
"logs": "Logs",
465466
"resetActivatedCoinsTitle": "Reset Activated Coins",
467+
"privateKeys": "Private Keys",
468+
"copyWarning": "Your clipboard isn't a safe place for your private key! Copying the seed phrase or private keys can make them vulnerable to clipboard hacks. Please handle with caution and only copy if absolutely necessary.",
466469
"seedConfirmTitle": "Let's double check your seed phrase",
467470
"seedConfirmDescription": "Your seed phrase is the only way to access Your funds. That's why we want to ensure you saved it safely. Please input your seed phrase into text filed below.",
468471
"standardWallet": "Standard wallet",
@@ -513,6 +516,7 @@
513516
"refreshList": "Refresh {} NFT list",
514517
"unableRetrieveNftData": "Waiting for {} NFT data sync",
515518
"tryCheckInternetConnection": "Try checking your internet connection",
519+
"connectionToServersFailing": "Connection to {} servers are failing. Please join the Komodo Platform Discord server for support and more information",
516520
"resetWalletTitle": "Reset Wallet",
517521
"resetWalletContent": "Do you want to reset activated coins of {} wallet?\n\nResetting the activated coins will revert your wallet to its initial state. You will need to re-enable the coins to include them in your wallet's balance and trade them.",
518522
"resetCompleteTitle": "Reset Complete",

lib/app_config/app_config.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Map<String, int> priorityCoinsAbbrMap = {
4545
'DASH': 11,
4646
'MATIC': 10,
4747
'FTM': 10,
48+
'ARB': 10,
4849
'AVAX': 10,
4950
'HT': 10,
5051
'MOVR': 10,

lib/bloc/dex_repository.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:rational/rational.dart';
2+
import 'package:web_dex/app_config/app_config.dart';
23
import 'package:web_dex/mm2/mm2_api/mm2_api.dart';
34
import 'package:web_dex/mm2/mm2_api/rpc/base.dart';
45
import 'package:web_dex/mm2/mm2_api/rpc/best_orders/best_orders.dart';
@@ -139,4 +140,28 @@ class DexRepository {
139140

140141
return Swap.fromJson(response['result']);
141142
}
143+
144+
Future<void> waitOrderbookAvailability({
145+
int retries = 10,
146+
int interval = 300,
147+
}) async {
148+
BestOrders orders;
149+
150+
for (int attempt = 0; attempt < retries; attempt++) {
151+
orders = await getBestOrders(
152+
BestOrdersRequest(
153+
coin: defaultDexCoin,
154+
type: BestOrdersRequestType.number,
155+
number: 1,
156+
action: 'sell',
157+
),
158+
);
159+
160+
if (orders.result?.isNotEmpty ?? false) {
161+
return;
162+
}
163+
164+
await Future.delayed(Duration(milliseconds: interval));
165+
}
166+
}
142167
}

lib/bloc/fiat/base_fiat_provider.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Currency {
2929
(t == CoinType.avx20 && symbol == 'AVAX') ||
3030
(t == CoinType.etc && symbol == 'ETC') ||
3131
(t == CoinType.ftm20 && symbol == 'FTM') ||
32+
(t == CoinType.arb20 && symbol == 'ARB') ||
3233
(t == CoinType.hrc20 && symbol == 'ONE') ||
3334
(t == CoinType.plg20 && symbol == 'MATIC') ||
3435
(t == CoinType.mvr20 && symbol == 'MOVR')) return symbol;
@@ -155,6 +156,8 @@ abstract class BaseFiatProvider {
155156
return 'ETC';
156157
case CoinType.ftm20:
157158
return 'FTM';
159+
case CoinType.arb20:
160+
return 'ARB';
158161
case CoinType.hrc20:
159162
return 'HARMONY';
160163
case CoinType.plg20:
@@ -261,6 +264,8 @@ abstract class BaseFiatProvider {
261264
return CoinType.etc;
262265
case "FTM":
263266
return CoinType.ftm20;
267+
case "ARB":
268+
return CoinType.arb20;
264269
case "HARMONY":
265270
return CoinType.hrc20;
266271
case "MATIC":

lib/bloc/taker_form/taker_bloc.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,18 @@ class TakerBloc extends Bloc<TakerEvent, TakerState> {
240240
TakerSetDefaults event,
241241
Emitter<TakerState> emit,
242242
) async {
243-
if (state.sellCoin == null) await _setDefaultSellCoin();
244-
}
245-
246-
Future<void> _setDefaultSellCoin() async {
247-
final Coin? defaultCoin = _coinsRepo.getCoin(defaultDexCoin);
248-
add(TakerSetSellCoin(defaultCoin));
243+
if (state.sellCoin == null) {
244+
final Coin? defaultCoin = _coinsRepo.getCoin(defaultDexCoin);
245+
add(TakerSetSellCoin(defaultCoin, setOnlyIfNotSet: true));
246+
}
249247
}
250248

251249
Future<void> _onSetSellCoin(
252250
TakerSetSellCoin event,
253251
Emitter<TakerState> emit,
254252
) async {
253+
if (event.setOnlyIfNotSet && state.sellCoin != null) return;
254+
255255
emit(state.copyWith(
256256
sellCoin: () => event.coin,
257257
showCoinSelector: () => false,

lib/bloc/taker_form/taker_event.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ class TakerCoinSelectorClick extends TakerEvent {}
2525
class TakerOrderSelectorClick extends TakerEvent {}
2626

2727
class TakerSetSellCoin extends TakerEvent {
28-
TakerSetSellCoin(this.coin, {this.autoSelectOrderAbbr});
28+
TakerSetSellCoin(this.coin,
29+
{this.autoSelectOrderAbbr, this.setOnlyIfNotSet = false});
2930

3031
final Coin? coin;
3132
final String? autoSelectOrderAbbr;
33+
final bool setOnlyIfNotSet;
3234
}
3335

3436
class TakerSelectOrder extends TakerEvent {

lib/blocs/maker_form_bloc.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,11 @@ class MakerFormBloc implements BlocBase {
526526
if (amountStr.isEmpty) {
527527
amount = null;
528528
} else {
529-
amount = Rational.parse(amountStr);
529+
try {
530+
amount = Rational.parse(amountStr);
531+
} catch (_) {
532+
amount = null;
533+
}
530534
}
531535

532536
isMaxActive = false;
@@ -544,7 +548,11 @@ class MakerFormBloc implements BlocBase {
544548
if (amountStr.isEmpty) {
545549
amount = null;
546550
} else {
547-
amount = Rational.parse(amountStr);
551+
try {
552+
amount = Rational.parse(amountStr);
553+
} catch (_) {
554+
amount = null;
555+
}
548556
}
549557

550558
if (amount == buyAmount) return;

0 commit comments

Comments
 (0)