chain network name display fixed #147
@@ -28,16 +28,16 @@ func (d *Driver) Name() string {
|
||||
}
|
||||
|
||||
func (d *Driver) FormatAddress(address string) (string, error) {
|
||||
d.logger.Debug("format address", zap.String("address", address))
|
||||
d.logger.Debug("Format address", zap.String("address", address))
|
||||
normalized, err := normalizeAddress(address)
|
||||
if err != nil {
|
||||
d.logger.Warn("format address failed", zap.String("address", address), zap.Error(err))
|
||||
d.logger.Warn("Format address failed", zap.String("address", address), zap.Error(err))
|
||||
}
|
||||
return normalized, err
|
||||
}
|
||||
|
||||
func (d *Driver) NormalizeAddress(address string) (string, error) {
|
||||
d.logger.Debug("normalize address", zap.String("address", address))
|
||||
d.logger.Debug("Normalize address", zap.String("address", address))
|
||||
normalized, err := normalizeAddress(address)
|
||||
if err != nil {
|
||||
d.logger.Warn("normalize address failed", zap.String("address", address), zap.Error(err))
|
||||
@@ -49,16 +49,12 @@ func (d *Driver) Balance(ctx context.Context, deps driver.Deps, network shared.N
|
||||
if wallet == nil {
|
||||
return nil, merrors.InvalidArgument("wallet is required")
|
||||
}
|
||||
d.logger.Debug("balance request",
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("network", network.Name),
|
||||
)
|
||||
d.logger.Debug("Balance request", zap.String("wallet_ref", wallet.WalletRef), zap.String("network", network.Name))
|
||||
rpcAddr, err := rpcAddress(wallet.DepositAddress)
|
||||
if err != nil {
|
||||
d.logger.Warn("balance address conversion failed",
|
||||
d.logger.Warn("Balance address conversion failed", zap.Error(err),
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("address", wallet.DepositAddress),
|
||||
zap.Error(err),
|
||||
)
|
||||
return nil, err
|
||||
}
|
||||
@@ -66,10 +62,9 @@ func (d *Driver) Balance(ctx context.Context, deps driver.Deps, network shared.N
|
||||
driverDeps.Logger = d.logger
|
||||
result, err := evm.Balance(ctx, driverDeps, network, wallet, rpcAddr)
|
||||
if err != nil {
|
||||
d.logger.Warn("balance failed",
|
||||
d.logger.Warn("Balance failed", zap.Error(err),
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("network", network.Name),
|
||||
zap.Error(err),
|
||||
)
|
||||
} else if result != nil {
|
||||
d.logger.Debug("balance result",
|
||||
@@ -86,26 +81,24 @@ func (d *Driver) EstimateFee(ctx context.Context, deps driver.Deps, network shar
|
||||
if wallet == nil {
|
||||
return nil, merrors.InvalidArgument("wallet is required")
|
||||
}
|
||||
d.logger.Debug("estimate fee request",
|
||||
d.logger.Debug("Estimate fee request",
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("network", network.Name),
|
||||
zap.String("destination", destination),
|
||||
)
|
||||
rpcFrom, err := rpcAddress(wallet.DepositAddress)
|
||||
if err != nil {
|
||||
d.logger.Warn("estimate fee address conversion failed",
|
||||
d.logger.Warn("Estimate fee address conversion failed", zap.Error(err),
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("address", wallet.DepositAddress),
|
||||
zap.Error(err),
|
||||
)
|
||||
return nil, err
|
||||
}
|
||||
rpcTo, err := rpcAddress(destination)
|
||||
if err != nil {
|
||||
d.logger.Warn("estimate fee destination conversion failed",
|
||||
d.logger.Warn("Estimate fee destination conversion failed", zap.Error(err),
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("destination", destination),
|
||||
zap.Error(err),
|
||||
)
|
||||
return nil, err
|
||||
}
|
||||
@@ -113,13 +106,12 @@ func (d *Driver) EstimateFee(ctx context.Context, deps driver.Deps, network shar
|
||||
driverDeps.Logger = d.logger
|
||||
result, err := evm.EstimateFee(ctx, driverDeps, network, wallet, rpcFrom, rpcTo, amount)
|
||||
if err != nil {
|
||||
d.logger.Warn("estimate fee failed",
|
||||
d.logger.Warn("Estimate fee failed", zap.Error(err),
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("network", network.Name),
|
||||
zap.Error(err),
|
||||
)
|
||||
} else if result != nil {
|
||||
d.logger.Debug("estimate fee result",
|
||||
d.logger.Debug("Estimate fee result",
|
||||
zap.String("wallet_ref", wallet.WalletRef),
|
||||
zap.String("network", network.Name),
|
||||
zap.String("amount", result.Amount),
|
||||
@@ -133,26 +125,24 @@ func (d *Driver) SubmitTransfer(ctx context.Context, deps driver.Deps, network s
|
||||
if source == nil {
|
||||
return "", merrors.InvalidArgument("source wallet is required")
|
||||
}
|
||||
d.logger.Debug("submit transfer request",
|
||||
d.logger.Debug("Submit transfer request",
|
||||
zap.String("transfer_ref", transfer.TransferRef),
|
||||
zap.String("network", network.Name),
|
||||
zap.String("destination", destination),
|
||||
)
|
||||
rpcFrom, err := rpcAddress(source.DepositAddress)
|
||||
if err != nil {
|
||||
d.logger.Warn("submit transfer address conversion failed",
|
||||
d.logger.Warn("Submit transfer address conversion failed", zap.Error(err),
|
||||
zap.String("wallet_ref", source.WalletRef),
|
||||
zap.String("address", source.DepositAddress),
|
||||
zap.Error(err),
|
||||
)
|
||||
return "", err
|
||||
}
|
||||
rpcTo, err := rpcAddress(destination)
|
||||
if err != nil {
|
||||
d.logger.Warn("submit transfer destination conversion failed",
|
||||
d.logger.Warn("Submit transfer destination conversion failed", zap.Error(err),
|
||||
zap.String("transfer_ref", transfer.TransferRef),
|
||||
zap.String("destination", destination),
|
||||
zap.Error(err),
|
||||
)
|
||||
return "", err
|
||||
}
|
||||
@@ -160,13 +150,12 @@ func (d *Driver) SubmitTransfer(ctx context.Context, deps driver.Deps, network s
|
||||
driverDeps.Logger = d.logger
|
||||
txHash, err := evm.SubmitTransfer(ctx, driverDeps, network, transfer, source, rpcFrom, rpcTo)
|
||||
if err != nil {
|
||||
d.logger.Warn("submit transfer failed",
|
||||
d.logger.Warn("submit transfer failed", zap.Error(err),
|
||||
zap.String("transfer_ref", transfer.TransferRef),
|
||||
zap.String("network", network.Name),
|
||||
zap.Error(err),
|
||||
)
|
||||
} else {
|
||||
d.logger.Debug("submit transfer result",
|
||||
d.logger.Debug("Submit transfer result",
|
||||
zap.String("transfer_ref", transfer.TransferRef),
|
||||
zap.String("network", network.Name),
|
||||
zap.String("tx_hash", txHash),
|
||||
@@ -176,7 +165,7 @@ func (d *Driver) SubmitTransfer(ctx context.Context, deps driver.Deps, network s
|
||||
}
|
||||
|
||||
func (d *Driver) AwaitConfirmation(ctx context.Context, deps driver.Deps, network shared.Network, txHash string) (*types.Receipt, error) {
|
||||
d.logger.Debug("await confirmation",
|
||||
d.logger.Debug("Awaiting confirmation",
|
||||
zap.String("tx_hash", txHash),
|
||||
zap.String("network", network.Name),
|
||||
)
|
||||
@@ -184,13 +173,12 @@ func (d *Driver) AwaitConfirmation(ctx context.Context, deps driver.Deps, networ
|
||||
driverDeps.Logger = d.logger
|
||||
receipt, err := evm.AwaitConfirmation(ctx, driverDeps, network, txHash)
|
||||
if err != nil {
|
||||
d.logger.Warn("await confirmation failed",
|
||||
d.logger.Warn("Awaiting of confirmation failed", zap.Error(err),
|
||||
zap.String("tx_hash", txHash),
|
||||
zap.String("network", network.Name),
|
||||
zap.Error(err),
|
||||
)
|
||||
} else if receipt != nil {
|
||||
d.logger.Debug("await confirmation result",
|
||||
d.logger.Debug("Await confirmation result",
|
||||
zap.String("tx_hash", txHash),
|
||||
zap.String("network", network.Name),
|
||||
zap.Uint64("block_number", receipt.BlockNumber.Uint64()),
|
||||
|
||||
@@ -180,9 +180,6 @@ func (l *loggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, erro
|
||||
}
|
||||
if resp.StatusCode >= 400 {
|
||||
l.logger.Warn("RPC response error", respFields...)
|
||||
} else {
|
||||
// Log response content so downstream parse failures can be inspected without debug logs.
|
||||
l.logger.Warn("RPC response", respFields...)
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
|
||||
@@ -79,7 +79,7 @@ func toWallet(w *chainv1.ManagedWallet) wallet {
|
||||
token := ""
|
||||
contract := ""
|
||||
if asset != nil {
|
||||
chain = asset.GetChain().String()
|
||||
chain = chainNetworkValue(asset.GetChain())
|
||||
token = asset.GetTokenSymbol()
|
||||
contract = asset.GetContractAddress()
|
||||
}
|
||||
@@ -141,3 +141,15 @@ func tsToString(ts *timestamppb.Timestamp) string {
|
||||
}
|
||||
return ts.AsTime().UTC().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
func chainNetworkValue(chain chainv1.ChainNetwork) string {
|
||||
name := chain.String()
|
||||
if !strings.HasPrefix(name, "CHAIN_NETWORK_") {
|
||||
return "unspecified"
|
||||
}
|
||||
trimmed := strings.TrimPrefix(name, "CHAIN_NETWORK_")
|
||||
if trimmed == "" {
|
||||
return "unspecified"
|
||||
}
|
||||
return strings.ToLower(trimmed)
|
||||
}
|
||||
|
||||
@@ -83,7 +83,9 @@ String fxSideToValue(FxSide side) {
|
||||
}
|
||||
|
||||
ChainNetwork chainNetworkFromValue(String? value) {
|
||||
switch (value) {
|
||||
final raw = value ?? '';
|
||||
final normalized = _normalizeChainNetwork(raw);
|
||||
switch (normalized) {
|
||||
case 'ethereum_mainnet':
|
||||
return ChainNetwork.ethereumMainnet;
|
||||
case 'arbitrum_one':
|
||||
@@ -95,7 +97,7 @@ ChainNetwork chainNetworkFromValue(String? value) {
|
||||
case 'unspecified':
|
||||
return ChainNetwork.unspecified;
|
||||
default:
|
||||
throw ArgumentError('Unknown ChainNetwork value: $value');
|
||||
throw ArgumentError('Unknown ChainNetwork value: $raw');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +116,19 @@ String chainNetworkToValue(ChainNetwork chain) {
|
||||
}
|
||||
}
|
||||
|
||||
String _normalizeChainNetwork(String value) {
|
||||
final trimmed = value.trim();
|
||||
if (trimmed.isEmpty) {
|
||||
return 'unspecified';
|
||||
}
|
||||
final lower = trimmed.toLowerCase();
|
||||
const prefix = 'chain_network_';
|
||||
if (lower.startsWith(prefix)) {
|
||||
return lower.substring(prefix.length);
|
||||
}
|
||||
return lower;
|
||||
}
|
||||
|
||||
InsufficientNetPolicy insufficientNetPolicyFromValue(String? value) {
|
||||
switch (value) {
|
||||
case 'block_posting':
|
||||
|
||||
20
frontend/pshared/lib/data/mapper/wallet/asset.dart
Normal file
20
frontend/pshared/lib/data/mapper/wallet/asset.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:pshared/data/dto/wallet/asset.dart';
|
||||
import 'package:pshared/data/mapper/payment/enums.dart';
|
||||
import 'package:pshared/models/wallet/wallet.dart';
|
||||
|
||||
|
||||
extension WalletAssetDTOMapper on WalletAssetDTO {
|
||||
WalletAsset toDomain() => WalletAsset(
|
||||
chain: chainNetworkFromValue(chain),
|
||||
tokenSymbol: tokenSymbol,
|
||||
contractAddress: contractAddress,
|
||||
);
|
||||
}
|
||||
|
||||
extension WalletAssetMapper on WalletAsset {
|
||||
WalletAssetDTO toDTO() => WalletAssetDTO(
|
||||
chain: chainNetworkToValue(chain),
|
||||
tokenSymbol: tokenSymbol,
|
||||
contractAddress: contractAddress,
|
||||
);
|
||||
}
|
||||
@@ -1,21 +1,17 @@
|
||||
import 'package:pshared/data/dto/wallet/balance.dart';
|
||||
import 'package:pshared/data/dto/wallet/wallet.dart';
|
||||
import 'package:pshared/data/mapper/wallet/asset.dart';
|
||||
import 'package:pshared/data/mapper/wallet/balance.dart';
|
||||
import 'package:pshared/data/mapper/wallet/money.dart';
|
||||
import 'package:pshared/models/describable.dart';
|
||||
import 'package:pshared/models/wallet/wallet.dart';
|
||||
|
||||
|
||||
extension WalletDTOMapper on WalletDTO {
|
||||
WalletModel toDomain({WalletBalanceDTO? balance}) => WalletModel(
|
||||
walletRef: walletRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
asset: WalletAsset(
|
||||
chain: asset.chain,
|
||||
tokenSymbol: asset.tokenSymbol,
|
||||
contractAddress: asset.contractAddress,
|
||||
),
|
||||
asset: asset.toDomain(),
|
||||
depositAddress: depositAddress,
|
||||
status: status,
|
||||
metadata: metadata,
|
||||
@@ -24,7 +20,7 @@ extension WalletDTOMapper on WalletDTO {
|
||||
balance: balance?.toDomain(),
|
||||
availableMoney: balance?.available?.toDomain(),
|
||||
describable: newDescribable(
|
||||
name: name.isNotEmpty ? name : (metadata?['name'] ?? 'Crypto Wallet'),
|
||||
name: name.isNotEmpty ? name : (metadata?['name']?.toString() ?? ''),
|
||||
description: (description != null && description!.isNotEmpty)
|
||||
? description
|
||||
: metadata?['description'],
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import 'package:pshared/models/describable.dart';
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
import 'package:pshared/models/wallet/balance.dart';
|
||||
import 'package:pshared/models/wallet/money.dart';
|
||||
import 'package:pshared/models/describable.dart';
|
||||
|
||||
|
||||
class WalletAsset {
|
||||
final String chain;
|
||||
final ChainNetwork chain;
|
||||
final String tokenSymbol;
|
||||
final String contractAddress;
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:pshared/models/currency.dart';
|
||||
import 'package:pshared/models/wallet/wallet.dart' as domain;
|
||||
|
||||
import 'package:pshared/models/currency.dart';
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
|
||||
|
||||
extension WalletUiMapper on domain.WalletModel {
|
||||
Wallet toUi() {
|
||||
final amountStr = availableMoney?.amount ?? balance?.available?.amount ?? '0';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:pshared/models/currency.dart';
|
||||
import 'package:pshared/models/describable.dart';
|
||||
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
|
||||
class Wallet implements Describable {
|
||||
final String id;
|
||||
@@ -10,7 +10,7 @@ class Wallet implements Describable {
|
||||
final bool isHidden;
|
||||
final DateTime calculatedAt;
|
||||
final String? depositAddress;
|
||||
final String? network;
|
||||
final ChainNetwork? network;
|
||||
final String? tokenSymbol;
|
||||
final String? contractAddress;
|
||||
final Describable describable;
|
||||
@@ -42,7 +42,7 @@ class Wallet implements Describable {
|
||||
String? walletUserID,
|
||||
bool? isHidden,
|
||||
String? depositAddress,
|
||||
String? network,
|
||||
ChainNetwork? network,
|
||||
String? tokenSymbol,
|
||||
String? contractAddress,
|
||||
Describable? describable,
|
||||
|
||||
@@ -2,9 +2,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/providers/two_factor.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class ResendCodeButton extends StatelessWidget {
|
||||
const ResendCodeButton({super.key});
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
import 'package:pshared/models/recipient/status.dart';
|
||||
import 'package:pshared/models/recipient/type.dart';
|
||||
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
import 'package:pweb/pages/address_book/form/method_tile.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/button.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/email_field.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/header.dart';
|
||||
import 'package:pweb/pages/address_book/form/widgets/name_field.dart';
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
import 'package:pshared/utils/l10n/chain.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
class BalanceHeader extends StatelessWidget {
|
||||
final String? walletNetwork;
|
||||
final ChainNetwork? walletNetwork;
|
||||
final String? tokenSymbol;
|
||||
|
||||
const BalanceHeader({
|
||||
@@ -15,14 +19,33 @@ class BalanceHeader extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
final symbol = tokenSymbol?.trim();
|
||||
final networkLabel = (walletNetwork == null || walletNetwork == ChainNetwork.unspecified)
|
||||
? null
|
||||
: walletNetwork!.localizedName(context);
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
'Crypto Wallet',
|
||||
style: textTheme.titleMedium?.copyWith(
|
||||
color: colorScheme.onSurface,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
loc.paymentTypeCryptoWallet,
|
||||
style: textTheme.titleMedium?.copyWith(
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
if (networkLabel != null)
|
||||
Text(
|
||||
networkLabel,
|
||||
style: textTheme.bodySmall?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (symbol != null && symbol.isNotEmpty) ...[
|
||||
|
||||
@@ -2,9 +2,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/utils/payment/label.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class PaymentMethodTypeSelector extends StatelessWidget {
|
||||
final PaymentType? value;
|
||||
|
||||
@@ -2,9 +2,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/russian_bank.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/utils/text_field_styles.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class RussianBankForm extends StatefulWidget {
|
||||
final void Function(RussianBankAccountPaymentMethod) onChanged;
|
||||
|
||||
@@ -2,9 +2,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/methods/wallet.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/utils/text_field_styles.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class WalletForm extends StatefulWidget {
|
||||
final void Function(WalletPaymentMethod) onChanged;
|
||||
|
||||
@@ -7,12 +7,10 @@ class SectionTitle extends StatelessWidget {
|
||||
const SectionTitle(this.title, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) => Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pshared/utils/currency.dart';
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/pages/dashboard/buttons/balance/amount.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class WalletCard extends StatelessWidget {
|
||||
final Wallet wallet;
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:provider/provider.dart';
|
||||
import 'package:pweb/app/router/payout_routes.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
import 'package:pweb/widgets/sidebar/destinations.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class WalletEditHeader extends StatelessWidget {
|
||||
const WalletEditHeader({super.key});
|
||||
@@ -12,6 +14,7 @@ class WalletEditHeader extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<WalletsProvider>();
|
||||
final wallet = provider.selectedWallet;
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
if (wallet == null) {
|
||||
return const SizedBox.shrink();
|
||||
@@ -29,7 +32,7 @@ class WalletEditHeader extends StatelessWidget {
|
||||
spacing: 4,
|
||||
children: [
|
||||
Text(
|
||||
'Crypto Wallet',
|
||||
loc.paymentTypeCryptoWallet,
|
||||
style: theme.textTheme.headlineMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/pages/payout_page/wallet/card.dart';
|
||||
import 'package:pweb/providers/wallets.dart';
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
|
||||
|
||||
import 'package:pweb/models/edit_state.dart';
|
||||
import 'package:pweb/utils/error/snackbar.dart';
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
import 'package:pweb/pages/settings/widgets/base.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
const _kSearchThreshold = 12;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
import 'package:pshared/utils/currency.dart';
|
||||
import 'package:pshared/utils/l10n/chain.dart';
|
||||
|
||||
import 'package:pweb/models/wallet.dart';
|
||||
import 'package:pweb/pages/wallet_top_up/details.dart';
|
||||
@@ -25,7 +27,10 @@ class WalletTopUpContent extends StatelessWidget {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
final address = _resolveAddress(wallet);
|
||||
final network = wallet.network?.trim();
|
||||
final network = wallet.network;
|
||||
final networkLabel = (network == null || network == ChainNetwork.unspecified)
|
||||
? null
|
||||
: network.localizedName(context);
|
||||
final assetLabel = wallet.tokenSymbol ?? currencyCodeToSymbol(wallet.currency);
|
||||
|
||||
return Align(
|
||||
@@ -51,7 +56,7 @@ class WalletTopUpContent extends StatelessWidget {
|
||||
SizedBox(height: dimensions.paddingLarge),
|
||||
WalletTopUpMeta(
|
||||
assetLabel: assetLabel,
|
||||
network: network,
|
||||
network: networkLabel,
|
||||
walletId: wallet.walletUserID,
|
||||
),
|
||||
SizedBox(height: dimensions.paddingXLarge),
|
||||
|
||||
@@ -20,7 +20,7 @@ class WalletTopUpHeader extends StatelessWidget {
|
||||
final symbol = tokenSymbol?.trim();
|
||||
|
||||
final subtitle = [
|
||||
'Crypto Wallet',
|
||||
loc.paymentTypeCryptoWallet,
|
||||
if (symbol != null && symbol.isNotEmpty) symbol,
|
||||
].join(' · ');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user