Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions lib/components/transaction/target_tick_dropdown.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:qubic_wallet/di.dart';
import 'package:qubic_wallet/helpers/target_tick.dart';
import 'package:qubic_wallet/l10n/l10n.dart';
import 'package:qubic_wallet/stores/wallet_content_store.dart';
import 'package:qubic_wallet/styles/text_styles.dart';
import 'package:qubic_wallet/styles/themed_controls.dart';

Expand All @@ -19,16 +21,24 @@ class TargetTickDropdown extends StatelessWidget {

List<DropdownMenuItem<TargetTickTypeEnum>> _getTickList(BuildContext context) {
final l10n = l10nOf(context);
final walletContentStore = getIt<WalletContentStore>();

return TargetTickTypeEnum.values.map((targetTickType) {
final String label;
switch (targetTickType) {
case TargetTickTypeEnum.manual:
label = l10n.sendItemLabelTargetTickManual;
case TargetTickTypeEnum.automatic:
// Show the offset actually being applied, e.g. "Automatic (+10)".
label = l10n.sendItemLabelTargetTickAutomaticDefault(
walletContentStore.defaultTickOffset);
default:
label = l10n.sendItemLabelTargetTickAutomatic(targetTickType.value);
}

return DropdownMenuItem<TargetTickTypeEnum>(
value: targetTickType,
child: Text(
targetTickType == TargetTickTypeEnum.manual
? l10n.sendItemLabelTargetTickManual
: l10n.sendItemLabelTargetTickAutomatic(targetTickType.value),
style: TextStyles.inputBoxSmallStyle,
),
child: Text(label, style: TextStyles.inputBoxSmallStyle),
);
}).toList();
}
Expand Down
1 change: 1 addition & 0 deletions lib/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ abstract class Config {
// Wallet-app specific endpoints
static const dapps = "/wallet-app/dapps/dapps.json";
static dappLocale(String locale) => "/wallet-app/dapps/locales/$locale.json";
static const walletAppConfig = "/wallet-app/config.json";

// General/ecosystem endpoints (shared across Qubic ecosystem)
static const smartContracts = "/general/data/smart_contracts.json";
Expand Down
5 changes: 3 additions & 2 deletions lib/helpers/target_tick.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
enum TargetTickTypeEnum {
/// Default selection: uses the remotely configured offset. Its own [value] is
/// a placeholder — always resolve it through `WalletContentStore.offsetFor`.
automatic(0),
autoCurrentPlus5(5),
autoCurrentPlus10(10),
autoCurrentPlus20(20),
Expand All @@ -11,5 +14,3 @@ enum TargetTickTypeEnum {
// A constructor for the enum
const TargetTickTypeEnum(this.value);
}

TargetTickTypeEnum defaultTargetTickType = TargetTickTypeEnum.autoCurrentPlus5;
10 changes: 9 additions & 1 deletion lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,22 @@
"transactionItemLabelConfirmedDate": "Zeitstempel",
"transactionItemLabelDetails": "Transaktionsdetails",
"sendItemLabelTargetTick": "Ziel-Tick",
"sendItemLabelTargetTickAutomatic": "Automatisch: Aktuell + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "Aktuell + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "Automatisch (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "Manuelles Überschreiben",
"sendItemLabelDetermineTargetTick": "Ziel-Tick bestimmen",
"sendItemDialogErrorGeneralTitle": "Fehler beim Generieren der Transaktion.",
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,22 @@
"transactionItemLabelConfirmedDate": "Timestamp",
"transactionItemLabelDetails": "Transaction Details",
"sendItemLabelTargetTick": "Target Tick",
"sendItemLabelTargetTickAutomatic": "Automatically: Current + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "Current + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "Automatic (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "Manual Override",
"sendItemLabelDetermineTargetTick": "Determine Target Tick",
"sendItemDialogErrorGeneralTitle": "Error while generating transaction",
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,22 @@
"transactionItemLabelConfirmedDate": "Fecha y hora",
"transactionItemLabelDetails": "Detalles de la Transacción",
"sendItemLabelTargetTick": "Tick de Ejecución",
"sendItemLabelTargetTickAutomatic": "Automáticamente: Actual + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "Actual + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "Automático (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "Sobreescribir manualmente",
"sendItemLabelDetermineTargetTick": "Determinar el Target de Ejecución",
"sendItemDialogErrorGeneralTitle": "Error al generar la transacción",
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,22 @@
"transactionItemLabelConfirmedDate": "Horodatage",
"transactionItemLabelDetails": "Détails de la Transaction",
"sendItemLabelTargetTick": "Tick Cible",
"sendItemLabelTargetTickAutomatic": "Automatiquement: Actuel + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "Actuel + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "Automatique (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "Remplacement Manuel",
"sendItemLabelDetermineTargetTick": "Déterminer le Tick Cible",
"sendItemDialogErrorGeneralTitle": "Erreur lors de la génération de la transaction",
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,22 @@
"transactionItemLabelConfirmedDate": "Метка времени",
"transactionItemLabelDetails": "Детали транзакции",
"sendItemLabelTargetTick": "На каком тике",
"sendItemLabelTargetTickAutomatic": "Автоматически: этот тик + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "Текущий + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "Автоматически (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "Ручное управление",
"sendItemLabelDetermineTargetTick": "Определите целевой тик",
"sendItemDialogErrorGeneralTitle": "Ошибка при генерации транзакции",
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/app_tr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,22 @@
"transactionItemLabelConfirmedDate": "Zaman damgası",
"transactionItemLabelDetails": "İşlem Detayları",
"sendItemLabelTargetTick": "Hedef Tick",
"sendItemLabelTargetTickAutomatic": "Otomatik olarak: Mevcut + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "Mevcut + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "Otomatik (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "Manuel Geçersiz Kılma",
"sendItemLabelDetermineTargetTick": "Hedef Tick'i Belirle",
"sendItemDialogErrorGeneralTitle": "Transfer oluşturulurken bir hata oluştu",
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/app_vi.arb
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,22 @@
"transactionItemLabelConfirmedDate": "Dấu thời gian",
"transactionItemLabelDetails": "Chi tiết giao dịch",
"sendItemLabelTargetTick": "Tick mục tiêu",
"sendItemLabelTargetTickAutomatic": "Tự động: Hiện tại + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "Hiện tại + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "Tự động (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "Ghi đè thủ công",
"sendItemLabelDetermineTargetTick": "Xác định Tick mục tiêu",
"sendItemDialogErrorGeneralTitle": "Lỗi khi tạo giao dịch",
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,22 @@
"transactionItemLabelConfirmedDate": "时间戳",
"transactionItemLabelDetails": "交易详情",
"sendItemLabelTargetTick": "目标刻度",
"sendItemLabelTargetTickAutomatic": "自动:当前刻度 + {addingTicks}",
"sendItemLabelTargetTickAutomatic": "当前刻度 + {addingTicks}",
"@sendItemLabelTargetTickAutomatic": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickAutomaticDefault": "自动 (+{addingTicks})",
"@sendItemLabelTargetTickAutomaticDefault": {
"placeholders": {
"addingTicks": {
"type": "int"
}
}
},
"sendItemLabelTargetTickManual": "手动调整",
"sendItemLabelDetermineTargetTick": "确定目标刻度",
"sendItemDialogErrorGeneralTitle": "生成交易时出现错误",
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class _WalletAppState extends State<WalletApp> with WidgetsBindingObserver {
WidgetsBinding.instance.addPostFrameCallback((_) {
getIt<RootJailbreakFlagStore>().showSecurityWarningIfNeeded();
getIt<WalletContentStore>().loadDapps();
getIt<WalletContentStore>().loadConfig();
});
}

Expand Down
13 changes: 13 additions & 0 deletions lib/models/wallet_app_config_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class WalletAppConfigResponse {
/// Offset added to the current tick when building a transaction's target
/// tick. Null when the key is absent.
final int? defaultTickOffset;

WalletAppConfigResponse({this.defaultTickOffset});

factory WalletAppConfigResponse.fromJson(Map<String, dynamic> json) {
return WalletAppConfigResponse(
defaultTickOffset: json['default_tick_offset'],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:qubic_wallet/components/wallet_connect/approve_wc_method_screen.dart';
import 'package:qubic_wallet/di.dart';
import 'package:qubic_wallet/helpers/global_snack_bar.dart';
import 'package:qubic_wallet/helpers/target_tick.dart';
import 'package:qubic_wallet/helpers/transaction_actions_helpers.dart';
import 'package:qubic_wallet/l10n/l10n.dart';
import 'package:qubic_wallet/models/wallet_connect.dart';
Expand All @@ -15,6 +14,7 @@ import 'package:qubic_wallet/models/wallet_connect/request_sign_message_event.da
import 'package:qubic_wallet/models/wallet_connect/request_sign_message_result.dart';
import 'package:qubic_wallet/models/wallet_connect/request_sign_transaction_result.dart';
import 'package:qubic_wallet/resources/apis/live/qubic_live_api.dart';
import 'package:qubic_wallet/stores/wallet_content_store.dart';
import 'package:reown_walletkit/reown_walletkit.dart';

// Provides a unified place to handle WalletConnect modals
Expand Down Expand Up @@ -183,7 +183,7 @@ class WalletConnectModalsController {
}
return tick;
} else {
return latestTick + defaultTargetTickType.value;
return latestTick + getIt.get<WalletContentStore>().defaultTickOffset;
}
} catch (e) {
throw JsonRpcError(
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/main/wallet_contents/release_transfer_rights.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'package:qubic_wallet/smart_contracts/release_transfer_rights_info.dart';
import 'package:mobx/mobx.dart';
import 'package:qubic_wallet/stores/application_store.dart';
import 'package:qubic_wallet/stores/qubic_ecosystem_store.dart';
import 'package:qubic_wallet/stores/wallet_content_store.dart';
import 'package:qubic_wallet/styles/edge_insets.dart';
import 'package:qubic_wallet/styles/input_decorations.dart';
import 'package:qubic_wallet/styles/text_styles.dart';
Expand All @@ -48,6 +49,7 @@ class _ReleaseTransferRightsState extends State<ReleaseTransferRights> {
final _formKey = GlobalKey<FormBuilderState>();
final ApplicationStore appStore = getIt<ApplicationStore>();
final QubicEcosystemStore ecosystemStore = getIt<QubicEcosystemStore>();
final WalletContentStore _walletContentStore = getIt<WalletContentStore>();
final _liveApi = getIt<QubicLiveApi>();
final TimedController _timedController = getIt<TimedController>();
final GlobalSnackBar _globalSnackBar = getIt<GlobalSnackBar>();
Expand All @@ -58,7 +60,7 @@ class _ReleaseTransferRightsState extends State<ReleaseTransferRights> {
);

List<bool> expanded = [false];
TargetTickTypeEnum targetTickType = defaultTargetTickType;
TargetTickTypeEnum targetTickType = TargetTickTypeEnum.automatic;

// Selected contract indices
int? selectedSourceContractIndex;
Expand Down Expand Up @@ -684,7 +686,7 @@ class _ReleaseTransferRightsState extends State<ReleaseTransferRights> {
} else {
// fetch latest tick
int latestTick = (await _liveApi.getCurrentTick()).tick;
targetTick = latestTick + targetTickType.value;
targetTick = latestTick + _walletContentStore.offsetFor(targetTickType);
}

// Get contract address and procedure number from ecosystem store
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/main/wallet_contents/send.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import 'package:qubic_wallet/pages/main/wallet_contents/transfers/transactions_f
import 'package:qubic_wallet/resources/apis/live/qubic_live_api.dart';
import 'package:qubic_wallet/resources/qubic_cmd.dart';
import 'package:qubic_wallet/stores/application_store.dart';
import 'package:qubic_wallet/stores/wallet_content_store.dart';
import 'package:qubic_wallet/styles/edge_insets.dart';
import 'package:qubic_wallet/styles/input_decorations.dart';
import 'package:qubic_wallet/styles/text_styles.dart';
Expand All @@ -45,8 +46,9 @@ class _SendState extends State<Send> {
final QubicCmd qubicCmd = getIt<QubicCmd>();
final TimedController _timedController = getIt<TimedController>();
final GlobalSnackBar _globalSnackBar = getIt<GlobalSnackBar>();
final WalletContentStore _walletContentStore = getIt<WalletContentStore>();
String? transferError;
TargetTickTypeEnum targetTickType = defaultTargetTickType;
TargetTickTypeEnum targetTickType = TargetTickTypeEnum.automatic;

final NumberFormat formatter = NumberFormat.decimalPatternDigits(
locale: 'en_us',
Expand Down Expand Up @@ -404,7 +406,7 @@ class _SendState extends State<Send> {
} else {
// fetch latest tick
int latestTick = (await _liveApi.getCurrentTick()).tick;
targetTick = latestTick + targetTickType.value;
targetTick = latestTick + _walletContentStore.offsetFor(targetTickType);
}
if (!mounted) return;
SignedTransaction? result = await sendTransactionDialog(
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/main/wallet_contents/transfer_asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'package:qubic_wallet/resources/qubic_cmd.dart';
import 'package:qubic_wallet/smart_contracts/qx_info.dart';
import 'package:qubic_wallet/stores/application_store.dart';
import 'package:qubic_wallet/stores/qubic_ecosystem_store.dart';
import 'package:qubic_wallet/stores/wallet_content_store.dart';
import 'package:qubic_wallet/styles/edge_insets.dart';
import 'package:qubic_wallet/styles/input_decorations.dart';
import 'package:qubic_wallet/styles/text_styles.dart';
Expand All @@ -50,8 +51,9 @@ class _TransferAssetState extends State<TransferAsset> {
final GlobalKey<_TransferAssetState> widgetKey = GlobalKey();
final GlobalSnackBar _globalSnackBar = getIt<GlobalSnackBar>();
final QubicEcosystemStore _ecosystemStore = getIt<QubicEcosystemStore>();
final WalletContentStore _walletContentStore = getIt<WalletContentStore>();
String? transferError;
TargetTickTypeEnum targetTickType = defaultTargetTickType;
TargetTickTypeEnum targetTickType = TargetTickTypeEnum.automatic;

final NumberFormat formatter = NumberFormat.decimalPatternDigits(
locale: 'en_us',
Expand Down Expand Up @@ -494,7 +496,7 @@ class _TransferAssetState extends State<TransferAsset> {
} else {
// fetch latest tick
int latestTick = (await _liveApi.getCurrentTick()).tick;
targetTick = latestTick + targetTickType.value;
targetTick = latestTick + _walletContentStore.offsetFor(targetTickType);
}
if (!mounted) return;
var result = await sendAssetTransferTransactionDialog(
Expand Down
Loading