Skip to content
Merged
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
9 changes: 3 additions & 6 deletions cold-wallet-app/lib/components/call_detail_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ class _CallFieldView extends ConsumerWidget {
note: note,
);

case AmountField(:final label, :final planck, :final assetId, :final note):
case AmountField(:final label, :final token, :final assetId, :final note):
return DetailRow(
label: label,
value: assetId == null
? '${_formatPlanck(planck)} ${AppConstants.tokenSymbol}'
: '$planck raw units of asset #$assetId',
? '${NumberFormattingService().formatAmount(token)} ${AppConstants.tokenSymbol}'
: '$token raw units of asset #$assetId',
note: assetId == null
? note
: [
Expand Down Expand Up @@ -127,9 +127,6 @@ class _CallFieldView extends ConsumerWidget {
);
}
}

String _formatPlanck(BigInt planck) =>
NumberFormattingService().formatBalance(planck, smartDecimals: 4, maxDecimals: AppConstants.decimals);
}

/// An address plus its checkphrase, so the signer can verify it out loud rather
Expand Down
4 changes: 2 additions & 2 deletions cold-wallet-app/lib/debug/debug_payloads.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DebugPayloads {
return _withExtensions(
const balances_pallet.Txs().transferAllowDeath(
dest: _address(AppConstants.debugTestAddress),
value: BigInt.from(1500000000000), // 1.5 QUAN
value: BigInt.from(1500000000000), // 1.5 tokens
),
);
}
Expand All @@ -33,7 +33,7 @@ class DebugPayloads {
static Uint8List multisigApproveTransfer() {
final inner = const balances_pallet.Txs().transferAllowDeath(
dest: _address(AppConstants.debugTestAddress),
value: BigInt.from(4200000000000), // 4.2 QUAN
value: BigInt.from(4200000000000), // 4.2 tokens
);
return _withExtensions(
const multisig_pallet.Txs().approve(multisigAddress: _debugMultisigAccount, proposalId: 12, call: inner.encode()),
Expand Down
10 changes: 5 additions & 5 deletions cold-wallet-app/lib/screens/sign_transaction_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ class _SignTransactionScreenState extends ConsumerState<SignTransactionScreen> {
}
}

String _formatAmount(BigInt planck) =>
NumberFormattingService().formatBalance(planck, smartDecimals: 4, maxDecimals: AppConstants.decimals);

@override
Widget build(BuildContext context) {
if (_parseError != null) return _errorView(context, _parseError!);
Expand Down Expand Up @@ -200,7 +197,10 @@ class _SignTransactionScreenState extends ConsumerState<SignTransactionScreen> {
DetailRow(label: 'Runtime', value: 'spec ${ext.specVersion}, tx version ${ext.transactionVersion}'),
DetailRow(label: 'Nonce', value: '${ext.nonce}'),
DetailRow(label: 'Era', value: '${ext.era}'),
DetailRow(label: 'Tip', value: '${_formatAmount(ext.tip)} ${AppConstants.tokenSymbol}'),
DetailRow(
label: 'Tip',
value: '${NumberFormattingService().formatAmount(ext.tip)} ${AppConstants.tokenSymbol}',
),
DetailRow(label: 'Genesis hash', value: '0x${hex.encode(ext.genesisHash)}', monospace: true),
DetailRow(label: 'Block hash', value: '0x${hex.encode(ext.blockHash)}', monospace: true),
DetailRow(
Expand Down Expand Up @@ -319,7 +319,7 @@ class _SignTransactionScreenState extends ConsumerState<SignTransactionScreen> {
text: TextSpan(
children: [
TextSpan(
text: _formatAmount(summary.amount),
text: NumberFormattingService().formatAmount(summary.amount),
style: text.transactionDetailAmountPrimary?.copyWith(color: colors.textPrimary),
),
TextSpan(
Expand Down
6 changes: 3 additions & 3 deletions cold-wallet-app/test/transaction_signing_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:quantus_sdk/quantus_sdk.dart';
import 'package:quantus_cold_wallet/debug/debug_payloads.dart';

void main() {
// The 0.1 QUAN keystone transfer call with a Planck extension suffix (era 5501 =
// The 0.1 token keystone transfer call with a Planck extension suffix (era 5501 =
// period 64 phase 21, nonce 0, tip 0, spec 131, tx version 2, metadata None), so the
// cold wallet is verified against the exact byte layout the hot wallet produces.
const planckHex =
Expand Down Expand Up @@ -56,7 +56,7 @@ void main() {
expect(destination.kind, ValueKind.address);
expect(destination.value, startsWith('qz'));
final amount = parsed.call.fields.whereType<AmountField>().firstWhere((f) => f.label == 'Amount');
expect(amount.planck, BigInt.parse('100000000000')); // 0.1 QUAN at 12 decimals
expect(amount.token, BigInt.parse('100000000000')); // 0.1 token at 12 decimals
expect(parsed.call.summary?.amount, BigInt.parse('100000000000'));
expect(parsed.network, 'Planck');
expect(parsed.extensions.era.toString(), '64 blocks');
Expand Down Expand Up @@ -93,7 +93,7 @@ void main() {
.call;
expect(approved.call, 'transfer_allow_death');
expect(
approved.fields.whereType<AmountField>().firstWhere((f) => f.label == 'Amount').planck,
approved.fields.whereType<AmountField>().firstWhere((f) => f.label == 'Amount').token,
BigInt.from(4200000000000),
);
// Hero amount comes from the authorised transfer.
Expand Down
2 changes: 1 addition & 1 deletion miner-app/lib/features/miner/miner_balance_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _MinerBalanceCardState extends State<MinerBalanceCard> {
_log.i('Fetching unspent balance for $address ...');
try {
final balance = await _utxoService.getUnspentBalance(wormholeAddress: address, secretHex: secretHex);
_log.i('Unspent balance: $balance planck (${_formatter.formatBalance(balance, addSymbol: true)})');
_log.i('Unspent balance: $balance token units (${_formatter.formatBalance(balance, addSymbol: true)})');
if (!mounted) return;
setState(() {
_balance = balance;
Expand Down
8 changes: 4 additions & 4 deletions miner-app/lib/features/withdrawal/claim_rewards_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class _ClaimRewardsDialogState extends State<_ClaimRewardsDialog> {
super.dispose();
}

String _formatBalance(BigInt planck) =>
_balanceFormatter.formatBalance(planck, smartDecimals: 4, addThousandsSeparators: false);
String _formatBalance(BigInt amount) =>
_balanceFormatter.formatBalance(amount, smartDecimals: 4, addThousandsSeparators: false);

bool _validateAddress(String address) {
final trimmed = address.trim();
Expand Down Expand Up @@ -229,7 +229,7 @@ class _ClaimRewardsDialogState extends State<_ClaimRewardsDialog> {
children: [
Text('Claimable Balance', style: TextStyle(fontSize: 14, color: Colors.white.withValues(alpha: 0.7))),
Text(
'${_formatBalance(widget.balance)} QUAN',
'${_formatBalance(widget.balance)} ${AppConstants.tokenSymbol}',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
Expand Down Expand Up @@ -308,7 +308,7 @@ class _ClaimRewardsDialogState extends State<_ClaimRewardsDialog> {
],
),
const SizedBox(height: 24),
_confirmRow('Amount', '${_formatBalance(widget.balance)} QUAN'),
_confirmRow('Amount', '${_formatBalance(widget.balance)} ${AppConstants.tokenSymbol}'),
const SizedBox(height: 12),
_confirmRow('Destination', _addressController.text.trim(), mono: true),
const SizedBox(height: 12),
Expand Down
2 changes: 1 addition & 1 deletion miner-app/lib/src/services/chain_rpc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ChainRpcClient {
///
/// [address] should be an SS58-encoded address.
/// [accountIdHex] can be provided if already known (32 bytes as hex without 0x prefix).
/// Returns the free balance in planck (smallest unit), or null if the query fails.
/// Returns the free balance in token units (smallest unit), or null if the query fails.
Future<BigInt?> getAccountBalance(String address, {String? accountIdHex}) async {
try {
// Build the storage key for System::Account(address)
Expand Down
53 changes: 41 additions & 12 deletions mobile-app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,14 @@
"@homeActivityEmptyTitle": {
"description": "Empty state title in home activity section"
},
"homeActivityEmptyMessage": "Your activity will appear here once you send or receive QUAN.",
"homeActivityEmptyMessage": "Your activity will appear here once you send or receive {tokenSymbol}.",
"@homeActivityEmptyMessage": {
"description": "Empty state message in home activity section"
"description": "Empty state message in home activity section",
"placeholders": {
"tokenSymbol": {
"type": "String"
}
}
},

"accountsSheetTitle": "Accounts",
Expand Down Expand Up @@ -2249,9 +2254,14 @@
"@settingsMiningStatRedeemable": {
"description": "Redeemable rewards stat label"
},
"settingsMiningQuanEarned": "QUAN EARNED",
"@settingsMiningQuanEarned": {
"description": "QUAN earned stat label"
"settingsMiningTokenEarned": "{tokenSymbol} EARNED",
"@settingsMiningTokenEarned": {
"description": "Token earned stat label",
"placeholders": {
"tokenSymbol": {
"type": "String"
}
}
},
"settingsMiningViewTelemetry": "View Telemetry ↗",
"@settingsMiningViewTelemetry": {
Expand Down Expand Up @@ -2424,7 +2434,7 @@
"@swapGetQuote": {
"description": "Get quote button on swap screen"
},
"swapRateLabel": "1 QUAN = {amount} {symbol}",
"swapRateLabel": "1 {tokenSymbol} = {amount} {symbol}",
"@swapRateLabel": {
"description": "Exchange rate display",
"placeholders": {
Expand All @@ -2433,15 +2443,21 @@
},
"symbol": {
"type": "String"
},
"tokenSymbol": {
"type": "String"
}
}
},
"swapRateZero": "1 QUAN = 0 {symbol}",
"swapRateZero": "1 {tokenSymbol} = 0 {symbol}",
"@swapRateZero": {
"description": "Exchange rate when amount is zero",
"placeholders": {
"symbol": {
"type": "String"
},
"tokenSymbol": {
"type": "String"
}
}
},
Expand Down Expand Up @@ -2539,12 +2555,15 @@
"@swapDepositCompleteTitle": {
"description": "Title when swap is complete"
},
"swapDepositCompleteBody": "Your swap for {amount} QUAN is complete.",
"swapDepositCompleteBody": "Your swap for {amount} {tokenSymbol} is complete.",
"@swapDepositCompleteBody": {
"description": "Body when swap is complete",
"placeholders": {
"amount": {
"type": "String"
},
"tokenSymbol": {
"type": "String"
}
}
},
Expand Down Expand Up @@ -2767,13 +2786,23 @@
"@encryptedSendFeeLabel": {
"description": "Fee label for encrypted sends (wormhole volume fee)"
},
"encryptedSendAmountStep": "Use steps of 0.01 QUAN",
"encryptedSendAmountStep": "Use steps of 0.01 {tokenSymbol}",
"@encryptedSendAmountStep": {
"description": "Shown when an encrypted send amount is not a multiple of 0.01 QUAN"
"description": "Shown when an encrypted send amount is not a multiple of 0.01 token",
"placeholders": {
"tokenSymbol": {
"type": "String"
}
}
},
"encryptedSendMinimum": "Encrypted sends must move at least 0.1 QUAN",
"encryptedSendMinimum": "Encrypted sends must move at least 0.1 {tokenSymbol}",
"@encryptedSendMinimum": {
"description": "Shown when an encrypted send falls below the chain's minimum exit amount"
"description": "Shown when an encrypted send falls below the chain's minimum exit amount",
"placeholders": {
"tokenSymbol": {
"type": "String"
}
}
},
"encryptedSendProgressTitle": "Private Send",
"@encryptedSendProgressTitle": {
Expand Down
14 changes: 7 additions & 7 deletions mobile-app/lib/l10n/app_id.arb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"homeActivityErrorLoading": "Gagal memuat transaksi",
"homeActivityRetry": "Coba Lagi",
"homeActivityEmptyTitle": "Belum Ada Transaksi",
"homeActivityEmptyMessage": "Aktivitas Anda akan muncul di sini setelah Anda mengirim atau menerima QUAN.",
"homeActivityEmptyMessage": "Aktivitas Anda akan muncul di sini setelah Anda mengirim atau menerima {tokenSymbol}.",

"accountsSheetTitle": "Akun",
"accountsSheetFailedLoadAccounts": "Gagal memuat akun.",
Expand Down Expand Up @@ -517,7 +517,7 @@
"settingsMiningStatTestnetRewards": "HADIAH TESTNET",
"settingsMiningStatRedeemed": "DITUKAR",
"settingsMiningStatRedeemable": "DAPAT DITUKAR",
"settingsMiningQuanEarned": "QUAN DIHASILKAN",
"settingsMiningTokenEarned": "{tokenSymbol} DIHASILKAN",
"settingsMiningViewTelemetry": "Lihat Telemetri ↗",
"settingsMiningNoDataTitle": "Belum ada data mining",
"settingsMiningNoDataBody": "Siapkan node mining Quantus untuk mulai mendapatkan hadiah.",
Expand Down Expand Up @@ -558,8 +558,8 @@
"swapSlippageTolerance": "Toleransi Slippage",
"swapRate": "Kurs",
"swapGetQuote": "Dapatkan Penawaran",
"swapRateLabel": "1 QUAN = {amount} {symbol}",
"swapRateZero": "1 QUAN = 0 {symbol}",
"swapRateLabel": "1 {tokenSymbol} = {amount} {symbol}",
"swapRateZero": "1 {tokenSymbol} = 0 {symbol}",

"swapTokenPickerTitle": "Pilih Token",
"swapTokenPickerLoadError": "Gagal memuat token",
Expand All @@ -579,7 +579,7 @@
"swapDepositProcessingTitle": "Memproses Swap",
"swapDepositProcessingBody": "Ini mungkin memakan waktu beberapa menit...",
"swapDepositCompleteTitle": "Swap Selesai",
"swapDepositCompleteBody": "Swap Anda untuk {amount} QUAN telah selesai.",
"swapDepositCompleteBody": "Swap Anda untuk {amount} {tokenSymbol} telah selesai.",
"swapDepositTestnetBanner": "HANYA DEMO - KAMI MASIH DI TESTNET",
"swapDemoOnly": "Hanya Demo",
"swapDemoOnlyBody": "Tidak ada swap sungguhan yang dilakukan.",
Expand Down Expand Up @@ -630,8 +630,8 @@
"redeemDone": "Selesai",
"redeemSuccessBanner": "{amount} ditukar dalam {count} batch",
"encryptedSendFeeLabel": "Biaya privasi",
"encryptedSendAmountStep": "Gunakan kelipatan 0,01 QUAN",
"encryptedSendMinimum": "Pengiriman terenkripsi minimal 0,1 QUAN",
"encryptedSendAmountStep": "Gunakan kelipatan 0,01 {tokenSymbol}",
"encryptedSendMinimum": "Pengiriman terenkripsi minimal 0,1 {tokenSymbol}",
"encryptedSendProgressTitle": "Mengirim Secara Privat...",
"encryptedSendFailedTitle": "Pengiriman Gagal",
"encryptedSendCancelledTitle": "Pengiriman Dibatalkan",
Expand Down
32 changes: 16 additions & 16 deletions mobile-app/lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ abstract class AppLocalizations {
/// Empty state message in home activity section
///
/// In en, this message translates to:
/// **'Your activity will appear here once you send or receive QUAN.'**
String get homeActivityEmptyMessage;
/// **'Your activity will appear here once you send or receive {tokenSymbol}.'**
String homeActivityEmptyMessage(String tokenSymbol);

/// Title of the accounts bottom sheet
///
Expand Down Expand Up @@ -2948,11 +2948,11 @@ abstract class AppLocalizations {
/// **'REDEEMABLE'**
String get settingsMiningStatRedeemable;

/// QUAN earned stat label
/// Token earned stat label
///
/// In en, this message translates to:
/// **'QUAN EARNED'**
String get settingsMiningQuanEarned;
/// **'{tokenSymbol} EARNED'**
String settingsMiningTokenEarned(String tokenSymbol);

/// Link to mining telemetry
///
Expand Down Expand Up @@ -3173,14 +3173,14 @@ abstract class AppLocalizations {
/// Exchange rate display
///
/// In en, this message translates to:
/// **'1 QUAN = {amount} {symbol}'**
String swapRateLabel(String amount, String symbol);
/// **'1 {tokenSymbol} = {amount} {symbol}'**
String swapRateLabel(String amount, String symbol, String tokenSymbol);

/// Exchange rate when amount is zero
///
/// In en, this message translates to:
/// **'1 QUAN = 0 {symbol}'**
String swapRateZero(String symbol);
/// **'1 {tokenSymbol} = 0 {symbol}'**
String swapRateZero(String symbol, String tokenSymbol);

/// Title on token picker sheet
///
Expand Down Expand Up @@ -3281,8 +3281,8 @@ abstract class AppLocalizations {
/// Body when swap is complete
///
/// In en, this message translates to:
/// **'Your swap for {amount} QUAN is complete.'**
String swapDepositCompleteBody(String amount);
/// **'Your swap for {amount} {tokenSymbol} is complete.'**
String swapDepositCompleteBody(String amount, String tokenSymbol);

/// Testnet demo banner on deposit screen
///
Expand Down Expand Up @@ -3560,17 +3560,17 @@ abstract class AppLocalizations {
/// **'Privacy fee'**
String get encryptedSendFeeLabel;

/// Shown when an encrypted send amount is not a multiple of 0.01 QUAN
/// Shown when an encrypted send amount is not a multiple of 0.01 token
///
/// In en, this message translates to:
/// **'Use steps of 0.01 QUAN'**
String get encryptedSendAmountStep;
/// **'Use steps of 0.01 {tokenSymbol}'**
String encryptedSendAmountStep(String tokenSymbol);

/// Shown when an encrypted send falls below the chain's minimum exit amount
///
/// In en, this message translates to:
/// **'Encrypted sends must move at least 0.1 QUAN'**
String get encryptedSendMinimum;
/// **'Encrypted sends must move at least 0.1 {tokenSymbol}'**
String encryptedSendMinimum(String tokenSymbol);

/// App bar title while an encrypted send is proving/submitting
///
Expand Down
Loading
Loading