mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 09:57:46 +00:00
b3d579c24a
* chore: Initial setup for polygon package * feat: Add polygon node urls * feat: Add Polygon(MATIC) wallet WIP * feat: Add Polygon(MATIC) wallet WIP * feat: Add Polygon MATIC wallet [skip ci] * fix: Issue with create/restore wallet for polygon * feat: Add erc20 tokens for polygon * feat: Adding Polygon MATIC Wallet * fix: Add build command for polygon to workflow file to fix failing action * fix: Switch evm to not display additional balance * chore: Sync with remote * fix: Revert change to inject app script * feat: Add polygon erc20 tokens * feat: Increase migration version * fix: Restore from QR address validator fix * fix: Adjust wallet connect connection flow to adapt to wallet type * fix: Make wallet fetch nfts based on the current wallet type * fix: Make wallet fetch nfts based on the current wallet type * fix: Try fetching transactions with moralis * fix: Requested review changes * fix: Error creating new wallet * fix: Revert script * fix: Exclude spam NFTs from nft listing API response * Update default_erc20_tokens.dart * replace matic with matic poly * Add polygon wallet scheme to app links * style: reformat default_settings_migration.dart * minor enhancement * fix using different wallet function for setting the transaction priorities * fix: Add chain to calls * Add USDC.e to initial coins * Add other default polygon node * Use Polygon scan some UI fixes * Add polygon scan api key to secrets generation code --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
134 lines
4.1 KiB
Dart
134 lines
4.1 KiB
Dart
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
|
|
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
|
import 'package:cake_wallet/ethereum/ethereum.dart';
|
|
import 'package:cake_wallet/polygon/polygon.dart';
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
|
import 'package:cw_core/balance.dart';
|
|
import 'package:cw_core/transaction_history.dart';
|
|
import 'package:cw_core/transaction_info.dart';
|
|
import 'package:cw_core/wallet_base.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
import 'package:mobx/mobx.dart';
|
|
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
|
|
|
part 'privacy_settings_view_model.g.dart';
|
|
|
|
class PrivacySettingsViewModel = PrivacySettingsViewModelBase with _$PrivacySettingsViewModel;
|
|
|
|
abstract class PrivacySettingsViewModelBase with Store {
|
|
PrivacySettingsViewModelBase(this._settingsStore, this._wallet);
|
|
|
|
final SettingsStore _settingsStore;
|
|
final WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> _wallet;
|
|
|
|
@computed
|
|
ExchangeApiMode get exchangeStatus => _settingsStore.exchangeStatus;
|
|
|
|
@computed
|
|
bool get isAutoGenerateSubaddressesEnabled =>
|
|
_settingsStore.autoGenerateSubaddressStatus != AutoGenerateSubaddressStatus.disabled;
|
|
|
|
@action
|
|
void setAutoGenerateSubaddresses(bool value) {
|
|
_wallet.isEnabledAutoGenerateSubaddress = value;
|
|
if (value) {
|
|
_settingsStore.autoGenerateSubaddressStatus = AutoGenerateSubaddressStatus.enabled;
|
|
} else {
|
|
_settingsStore.autoGenerateSubaddressStatus = AutoGenerateSubaddressStatus.disabled;
|
|
}
|
|
}
|
|
|
|
bool get isAutoGenerateSubaddressesVisible => _wallet.type == WalletType.monero;
|
|
|
|
@computed
|
|
bool get shouldSaveRecipientAddress => _settingsStore.shouldSaveRecipientAddress;
|
|
|
|
@computed
|
|
FiatApiMode get fiatApiMode => _settingsStore.fiatApiMode;
|
|
|
|
@computed
|
|
bool get isAppSecure => _settingsStore.isAppSecure;
|
|
|
|
@computed
|
|
bool get disableBuy => _settingsStore.disableBuy;
|
|
|
|
@computed
|
|
bool get disableSell => _settingsStore.disableSell;
|
|
|
|
@computed
|
|
bool get useEtherscan => _settingsStore.useEtherscan;
|
|
|
|
@computed
|
|
bool get usePolygonScan => _settingsStore.usePolygonScan;
|
|
|
|
@computed
|
|
bool get lookupTwitter => _settingsStore.lookupsTwitter;
|
|
|
|
@computed
|
|
bool get looksUpMastodon => _settingsStore.lookupsMastodon;
|
|
|
|
@computed
|
|
bool get looksUpYatService => _settingsStore.lookupsYatService;
|
|
|
|
@computed
|
|
bool get looksUpUnstoppableDomains => _settingsStore.lookupsUnstoppableDomains;
|
|
|
|
@computed
|
|
bool get looksUpOpenAlias => _settingsStore.lookupsOpenAlias;
|
|
|
|
@computed
|
|
bool get looksUpENS => _settingsStore.lookupsENS;
|
|
|
|
bool get canUseEtherscan => _wallet.type == WalletType.ethereum;
|
|
|
|
bool get canUsePolygonScan => _wallet.type == WalletType.polygon;
|
|
|
|
@action
|
|
void setShouldSaveRecipientAddress(bool value) =>
|
|
_settingsStore.shouldSaveRecipientAddress = value;
|
|
|
|
@action
|
|
void setExchangeApiMode(ExchangeApiMode value) => _settingsStore.exchangeStatus = value;
|
|
|
|
@action
|
|
void setFiatMode(FiatApiMode fiatApiMode) => _settingsStore.fiatApiMode = fiatApiMode;
|
|
|
|
@action
|
|
void setIsAppSecure(bool value) => _settingsStore.isAppSecure = value;
|
|
|
|
@action
|
|
void setDisableBuy(bool value) => _settingsStore.disableBuy = value;
|
|
|
|
@action
|
|
void setDisableSell(bool value) => _settingsStore.disableSell = value;
|
|
|
|
@action
|
|
void setLookupsTwitter(bool value) => _settingsStore.lookupsTwitter = value;
|
|
|
|
@action
|
|
void setLookupsMastodon(bool value) => _settingsStore.lookupsMastodon = value;
|
|
|
|
@action
|
|
void setLookupsENS(bool value) => _settingsStore.lookupsENS = value;
|
|
|
|
@action
|
|
void setLookupsYatService(bool value) => _settingsStore.lookupsYatService = value;
|
|
|
|
@action
|
|
void setLookupsUnstoppableDomains(bool value) => _settingsStore.lookupsUnstoppableDomains = value;
|
|
|
|
@action
|
|
void setLookupsOpenAlias(bool value) => _settingsStore.lookupsOpenAlias = value;
|
|
|
|
@action
|
|
void setUseEtherscan(bool value) {
|
|
_settingsStore.useEtherscan = value;
|
|
ethereum!.updateEtherscanUsageState(_wallet, value);
|
|
}
|
|
|
|
@action
|
|
void setUsePolygonScan(bool value) {
|
|
_settingsStore.usePolygonScan = value;
|
|
polygon!.updatePolygonScanUsageState(_wallet, value);
|
|
}
|
|
}
|