merge clean up and update eth to use isar for tx history and addresses
Before Width: | Height: | Size: 343 KiB After Width: | Height: | Size: 343 KiB |
BIN
assets/images/forest/ethereum.png
Normal file
After Width: | Height: | Size: 343 KiB |
BIN
assets/images/fruitSorbet/ethereum.png
Normal file
After Width: | Height: | Size: 343 KiB |
BIN
assets/images/light/ethereum.png
Normal file
After Width: | Height: | Size: 343 KiB |
BIN
assets/images/oceanBreeze/ethereum.png
Normal file
After Width: | Height: | Size: 343 KiB |
BIN
assets/images/oledBlack/ethereum.png
Normal file
After Width: | Height: | Size: 343 KiB |
|
@ -123,6 +123,7 @@ enum AddressType {
|
|||
mimbleWimble,
|
||||
unknown,
|
||||
nonWallet,
|
||||
ethereum,
|
||||
}
|
||||
|
||||
// do not modify
|
||||
|
|
|
@ -3,8 +3,8 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svget/electrumx_rpc/electrumx.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
|
||||
import 'package:stackwallet/models/node_model.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/providers/global/secure_store_provider.dart';
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_balance_toggle_
|
|||
import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_refresh_button.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/wallet/wallet_balance_toggle_state_provider.dart';
|
||||
import 'package:stackwallet/services/coins/firo/firo_wallet.dart';
|
||||
import 'package:stackwallet/services/coins/manager.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
|
@ -75,19 +74,12 @@ class _TokenSummaryInfoState extends State<TokenSummaryInfo> {
|
|||
|
||||
Future<Decimal>? totalBalanceFuture;
|
||||
Future<Decimal>? availableBalanceFuture;
|
||||
if (coin == Coin.firo || coin == Coin.firoTestNet) {
|
||||
final firoWallet =
|
||||
ref.watch(managerProvider.select((value) => value.wallet))
|
||||
as FiroWallet;
|
||||
totalBalanceFuture = firoWallet.availablePublicBalance();
|
||||
availableBalanceFuture = firoWallet.availablePrivateBalance();
|
||||
} else {
|
||||
totalBalanceFuture = ref.watch(
|
||||
managerProvider.select((value) => value.totalBalance));
|
||||
|
||||
availableBalanceFuture = ref.watch(
|
||||
managerProvider.select((value) => value.availableBalance));
|
||||
}
|
||||
final manager = ref.watch(walletsChangeNotifierProvider
|
||||
.select((value) => value.getManager(walletId)));
|
||||
totalBalanceFuture = Future(() => manager.balance.getTotal());
|
||||
availableBalanceFuture =
|
||||
Future(() => manager.balance.getSpendable());
|
||||
|
||||
final locale = ref.watch(localeServiceChangeNotifierProvider
|
||||
.select((value) => value.locale));
|
||||
|
|
|
@ -1,54 +1,31 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:decimal/decimal.dart';
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/wallet_initiated_exchange_view.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/notification_views/notifications_view.dart';
|
||||
import 'package:stackwallet/pages/receive_view/receive_view.dart';
|
||||
import 'package:stackwallet/pages/send_view/send_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart';
|
||||
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_view.dart';
|
||||
import 'package:stackwallet/pages/token_view/my_tokens_view.dart';
|
||||
import 'package:stackwallet/pages/token_view/sub_widgets/token_summary.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/sub_widgets/transactions_list.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_navigation_bar.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_summary.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/all_transactions_view.dart';
|
||||
import 'package:stackwallet/providers/global/auto_swb_service_provider.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/ui/transaction_filter_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/unread_notifications_provider.dart';
|
||||
import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart';
|
||||
import 'package:stackwallet/providers/wallet/wallet_balance_toggle_state_provider.dart';
|
||||
import 'package:stackwallet/services/coins/manager.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
|
||||
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
|
||||
import 'package:stackwallet/services/event_bus/global_event_bus.dart';
|
||||
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||
import 'package:stackwallet/services/tokens/ethereum/ethereum_token.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||
import 'package:stackwallet/utilities/eth_commons.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
/// [eventBus] should only be set during testing
|
||||
class TokenView extends ConsumerStatefulWidget {
|
||||
|
@ -87,8 +64,6 @@ class _TokenViewState extends ConsumerState<TokenView> {
|
|||
late StreamSubscription<dynamic> _syncStatusSubscription;
|
||||
late StreamSubscription<dynamic> _nodeStatusSubscription;
|
||||
|
||||
final _cnLoadingService = ExchangeDataLoadingService();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
walletId = widget.walletId;
|
||||
|
@ -211,64 +186,6 @@ class _TokenViewState extends ConsumerState<TokenView> {
|
|||
}
|
||||
}
|
||||
|
||||
void _onExchangePressed(BuildContext context) async {
|
||||
unawaited(_cnLoadingService.loadAll(ref));
|
||||
|
||||
final coin = ref.read(managerProvider).coin;
|
||||
|
||||
ref.read(currentExchangeNameStateProvider.state).state =
|
||||
ChangeNowExchange.exchangeName;
|
||||
final walletId = ref.read(managerProvider).walletId;
|
||||
ref.read(prefsChangeNotifierProvider).exchangeRateType =
|
||||
ExchangeRateType.estimated;
|
||||
|
||||
ref.read(exchangeFormStateProvider).exchange = ref.read(exchangeProvider);
|
||||
ref.read(exchangeFormStateProvider).exchangeType =
|
||||
ExchangeRateType.estimated;
|
||||
|
||||
final currencies = ref
|
||||
.read(availableChangeNowCurrenciesProvider)
|
||||
.currencies
|
||||
.where((element) =>
|
||||
element.ticker.toLowerCase() == coin.ticker.toLowerCase());
|
||||
|
||||
if (currencies.isNotEmpty) {
|
||||
ref.read(exchangeFormStateProvider).setCurrencies(
|
||||
currencies.first,
|
||||
ref
|
||||
.read(availableChangeNowCurrenciesProvider)
|
||||
.currencies
|
||||
.firstWhere(
|
||||
(element) =>
|
||||
element.ticker.toLowerCase() != coin.ticker.toLowerCase(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamed(
|
||||
WalletInitiatedExchangeView.routeName,
|
||||
arguments: Tuple3(
|
||||
walletId,
|
||||
coin,
|
||||
_loadCNData,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _loadCNData() {
|
||||
// unawaited future
|
||||
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||
_cnLoadingService.loadAll(ref, coin: ref.read(managerProvider).coin);
|
||||
} else {
|
||||
Logging.instance.log("User does not want to use external calls",
|
||||
level: LogLevel.Info);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
@ -357,7 +274,7 @@ class _TokenViewState extends ConsumerState<TokenView> {
|
|||
.textDark3,
|
||||
),
|
||||
),
|
||||
BlueTextButton(
|
||||
CustomTextButton(
|
||||
text: "See all",
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
|
|
|
@ -334,6 +334,45 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (widget.coin == Coin.ethereum)
|
||||
RawMaterialButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 66,
|
||||
),
|
||||
onPressed: widget.onTokensPressed,
|
||||
splashColor:
|
||||
Theme.of(context).extension<StackColors>()!.highlight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
widget.height / 2.0,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Spacer(),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.tokens,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
"Tokens",
|
||||
style: STextStyles.buttonSmall(context),
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.enableExchange)
|
||||
RawMaterialButton(
|
||||
constraints: const BoxConstraints(
|
||||
|
@ -476,89 +515,6 @@ class _WalletNavigationBarState extends ConsumerState<WalletNavigationBar> {
|
|||
),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
),
|
||||
// TODO: Do not delete this code.
|
||||
// only temporarily disabled
|
||||
// Spacer(
|
||||
// flex: 2,
|
||||
// ),
|
||||
// GestureDetector(
|
||||
// onTap: onBuyPressed,
|
||||
// child: Container(
|
||||
// color: Colors.transparent,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.symmetric(vertical: 2.0),
|
||||
// child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: [
|
||||
// Spacer(),
|
||||
// SvgPicture.asset(
|
||||
// Assets.svg.buy,
|
||||
// width: 24,
|
||||
// height: 24,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 4,
|
||||
// ),
|
||||
// Text(
|
||||
// "Buy",
|
||||
// style: STextStyles.buttonSmall(context),
|
||||
// ),
|
||||
// Spacer(),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
RawMaterialButton(
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 66,
|
||||
),
|
||||
onPressed: onTokensPressed,
|
||||
splashColor:
|
||||
Theme.of(context).extension<StackColors>()!.highlight,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
height / 2.0,
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Spacer(),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.tokens,
|
||||
width: 24,
|
||||
height: 24,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
"Tokens",
|
||||
style: STextStyles.buttonSmall(context),
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
|||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||
import 'package:stackwallet/utilities/eth_commons.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
|
@ -262,34 +261,6 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
),
|
||||
);
|
||||
} else {
|
||||
// ref.read(currentExchangeNameStateProvider.state).state =
|
||||
// ChangeNowExchange.exchangeName;
|
||||
// final walletId = ref.read(managerProvider).walletId;
|
||||
// ref.read(prefsChangeNotifierProvider).exchangeRateType =
|
||||
// ExchangeRateType.estimated;
|
||||
//
|
||||
// final currencies = ref
|
||||
// .read(availableChangeNowCurrenciesProvider)
|
||||
// .currencies
|
||||
// .where((element) =>
|
||||
// element.ticker.toLowerCase() == coin.ticker.toLowerCase());
|
||||
//
|
||||
// if (currencies.isNotEmpty) {
|
||||
// ref
|
||||
// .read(exchangeFormStateProvider(ExchangeRateType.estimated))
|
||||
// .setCurrencies(
|
||||
// currencies.first,
|
||||
// ref
|
||||
// .read(availableChangeNowCurrenciesProvider)
|
||||
// .currencies
|
||||
// .firstWhere(
|
||||
// (element) =>
|
||||
// element.ticker.toLowerCase() !=
|
||||
// coin.ticker.toLowerCase(),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
if (mounted) {
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamed(
|
||||
|
@ -817,11 +788,17 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
.read(managerProvider)
|
||||
.currentReceivingAddress);
|
||||
|
||||
await Navigator.of(context).pushNamed(
|
||||
MyTokensView.routeName,
|
||||
arguments: Tuple4(managerProvider,
|
||||
walletId, walletAddress, tokens),
|
||||
);
|
||||
if (mounted) {
|
||||
await Navigator.of(context).pushNamed(
|
||||
MyTokensView.routeName,
|
||||
arguments: Tuple4(
|
||||
managerProvider,
|
||||
walletId,
|
||||
walletAddress,
|
||||
tokens,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1597,8 +1597,9 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
case DerivePathType.bip49:
|
||||
key = "${walletId}_${chainId}DerivationsP2SH";
|
||||
break;
|
||||
case DerivePathType.bip84:
|
||||
throw UnsupportedError("bip84 not supported by BCH");
|
||||
default:
|
||||
throw UnsupportedError(
|
||||
"${derivePathType.name} not supported by ${coin.prettyName}");
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
@ -2712,7 +2713,8 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
addressTxid[address] = <String>[];
|
||||
}
|
||||
(addressTxid[address] as List).add(txid);
|
||||
switch (addressType(address: address)) {
|
||||
final deriveType = addressType(address: address);
|
||||
switch (deriveType) {
|
||||
case DerivePathType.bip44:
|
||||
case DerivePathType.bch44:
|
||||
addressesP2PKH.add(address);
|
||||
|
@ -2720,8 +2722,9 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
case DerivePathType.bip49:
|
||||
addressesP2SH.add(address);
|
||||
break;
|
||||
case DerivePathType.bip84:
|
||||
throw UnsupportedError("bip84 not supported by BCH");
|
||||
default:
|
||||
throw UnsupportedError(
|
||||
"${deriveType.name} not supported by ${coin.prettyName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import 'package:decimal/decimal.dart';
|
||||
import 'package:stackwallet/utilities/eth_commons.dart';
|
||||
import 'package:ethereum_addresses/ethereum_addresses.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:stackwallet/models/node_model.dart';
|
||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||
import 'package:stackwallet/models/paymint/transactions_model.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||
import 'package:stackwallet/services/node_service.dart';
|
||||
import 'package:stackwallet/services/tokens/token_service.dart';
|
||||
import 'package:stackwallet/utilities/format.dart';
|
||||
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/default_nodes.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
||||
import 'package:stackwallet/models/paymint/transactions_model.dart' as models;
|
||||
import 'package:stackwallet/utilities/eth_commons.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
import 'package:stackwallet/utilities/format.dart';
|
||||
import 'package:web3dart/web3dart.dart';
|
||||
import 'package:web3dart/web3dart.dart' as transaction;
|
||||
|
||||
import 'package:stackwallet/models/node_model.dart';
|
||||
import 'package:stackwallet/utilities/default_nodes.dart';
|
||||
import 'package:stackwallet/services/node_service.dart';
|
||||
|
||||
class AbiRequestResponse {
|
||||
final String message;
|
||||
final String result;
|
||||
|
@ -195,7 +194,8 @@ class EthereumToken extends TokenServiceAPI {
|
|||
String mnemonicString = mnemonic.join(' ');
|
||||
|
||||
//Get private key for given mnemonic
|
||||
String privateKey = getPrivateKey(mnemonicString);
|
||||
// TODO: replace empty string with actual passphrase
|
||||
String privateKey = getPrivateKey(mnemonicString, "");
|
||||
_credentials = EthPrivateKey.fromHex(privateKey);
|
||||
|
||||
_contract = DeployedContract(
|
||||
|
@ -225,7 +225,8 @@ class EthereumToken extends TokenServiceAPI {
|
|||
String mnemonicString = mnemonic.join(' ');
|
||||
|
||||
//Get private key for given mnemonic
|
||||
String privateKey = getPrivateKey(mnemonicString);
|
||||
// TODO: replace empty string with actual passphrase
|
||||
String privateKey = getPrivateKey(mnemonicString, "");
|
||||
_credentials = EthPrivateKey.fromHex(privateKey);
|
||||
|
||||
_contract = DeployedContract(
|
||||
|
|
|
@ -296,7 +296,7 @@ class _PNG {
|
|||
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/litecoin.png";
|
||||
String epicCash(BuildContext context) =>
|
||||
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/epic-cash.png";
|
||||
String epicCash(BuildContext context) =>
|
||||
String ethereum(BuildContext context) =>
|
||||
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/ethereum.png";
|
||||
String bitcoincash(BuildContext context) =>
|
||||
"assets/images/${Theme.of(context).extension<StackColors>()!.themeType.name}/bitcoincash.png";
|
||||
|
@ -325,7 +325,7 @@ class _PNG {
|
|||
case Coin.epicCash:
|
||||
return epicCash(context);
|
||||
case Coin.ethereum:
|
||||
return ethereum;
|
||||
return ethereum(context);
|
||||
case Coin.firo:
|
||||
return firo(context);
|
||||
case Coin.firoTestNet:
|
||||
|
|
|
@ -18,19 +18,21 @@ abstract class Constants {
|
|||
static void exchangeForExperiencedUsers(int count) {
|
||||
enableExchange =
|
||||
Util.isDesktop || Platform.isAndroid || count > 5 || !Platform.isIOS;
|
||||
enableBuy =
|
||||
Util.isDesktop || Platform.isAndroid || count > 5 || !Platform.isIOS;
|
||||
}
|
||||
|
||||
static bool enableExchange = Util.isDesktop || !Platform.isIOS;
|
||||
static bool enableBuy =
|
||||
true; // true for development, TODO change to "Util.isDesktop || !Platform.isIOS;" as above or even just = enableExchange
|
||||
static bool enableBuy = Util.isDesktop || !Platform.isIOS;
|
||||
|
||||
//TODO: correct for monero?
|
||||
static const int _satsPerCoinEthereum = 1000000000000000000;
|
||||
static const int _satsPerCoinMonero = 1000000000000;
|
||||
static const int _satsPerCoinWownero = 100000000000;
|
||||
static const int _satsPerCoin = 100000000;
|
||||
static const int _decimalPlaces = 8;
|
||||
static const int _decimalPlacesWownero = 11;
|
||||
static const int _decimalPlacesMonero = 12;
|
||||
static const int _decimalPlacesEthereum = 18;
|
||||
|
||||
static const int notificationsMax = 0xFFFFFFFF;
|
||||
static const Duration networkAliveTimerDuration = Duration(seconds: 10);
|
||||
|
@ -57,7 +59,6 @@ abstract class Constants {
|
|||
case Coin.dogecoinTestNet:
|
||||
case Coin.firoTestNet:
|
||||
case Coin.epicCash:
|
||||
case Coin.ethereum:
|
||||
case Coin.namecoin:
|
||||
case Coin.particl:
|
||||
return _satsPerCoin;
|
||||
|
@ -67,6 +68,9 @@ abstract class Constants {
|
|||
|
||||
case Coin.monero:
|
||||
return _satsPerCoinMonero;
|
||||
|
||||
case Coin.ethereum:
|
||||
return _satsPerCoinEthereum;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +87,6 @@ abstract class Constants {
|
|||
case Coin.dogecoinTestNet:
|
||||
case Coin.firoTestNet:
|
||||
case Coin.epicCash:
|
||||
case Coin.ethereum:
|
||||
case Coin.namecoin:
|
||||
case Coin.particl:
|
||||
return _decimalPlaces;
|
||||
|
@ -93,6 +96,9 @@ abstract class Constants {
|
|||
|
||||
case Coin.monero:
|
||||
return _decimalPlacesMonero;
|
||||
|
||||
case Coin.ethereum:
|
||||
return _decimalPlacesEthereum;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,7 @@ extension CoinExt on Coin {
|
|||
case Coin.litecoin:
|
||||
case Coin.bitcoincash:
|
||||
case Coin.dogecoin:
|
||||
case Coin.ethereum:
|
||||
return true;
|
||||
|
||||
case Coin.firo:
|
||||
|
|
|
@ -5,6 +5,7 @@ enum DerivePathType {
|
|||
bch44,
|
||||
bip49,
|
||||
bip84,
|
||||
eth,
|
||||
}
|
||||
|
||||
extension DerivePathTypeExt on DerivePathType {
|
||||
|
@ -26,6 +27,9 @@ extension DerivePathTypeExt on DerivePathType {
|
|||
case Coin.particl:
|
||||
return DerivePathType.bip84;
|
||||
|
||||
case Coin.ethereum: // TODO: do we need something here?
|
||||
return DerivePathType.eth;
|
||||
|
||||
case Coin.epicCash:
|
||||
case Coin.monero:
|
||||
case Coin.wownero:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
import 'package:ethereum_addresses/ethereum_addresses.dart';
|
||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||
import 'package:bip32/bip32.dart' as bip32;
|
||||
import 'package:bip39/bip39.dart' as bip39;
|
||||
import 'package:ethereum_addresses/ethereum_addresses.dart';
|
||||
import "package:hex/hex.dart";
|
||||
import 'package:http/http.dart';
|
||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||
|
||||
class AddressTransaction {
|
||||
final String message;
|
||||
|
@ -26,6 +26,15 @@ class AddressTransaction {
|
|||
status: json['status'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "AddressTransaction: {"
|
||||
"\n\t message: $message,"
|
||||
"\n\t status: $status,"
|
||||
"\n\t result: $result,"
|
||||
"\n}";
|
||||
}
|
||||
}
|
||||
|
||||
class GasTracker {
|
||||
|
@ -52,7 +61,7 @@ class GasTracker {
|
|||
const blockExplorer = "https://blockscout.com/eth/mainnet/api";
|
||||
const abiUrl =
|
||||
"https://api.etherscan.io/api"; //TODO - Once our server has abi functionality update
|
||||
const _hdPath = "m/44'/60'/0'/0";
|
||||
const hdPathEthereum = "m/44'/60'/0'/0";
|
||||
const _gasTrackerUrl =
|
||||
"https://blockscout.com/eth/mainnet/api/v1/gas-price-oracle";
|
||||
|
||||
|
@ -106,16 +115,16 @@ Future<List<dynamic>> getWalletTokens(String address) async {
|
|||
return <dynamic>[];
|
||||
}
|
||||
|
||||
String getPrivateKey(String mnemonic) {
|
||||
String getPrivateKey(String mnemonic, String mnemonicPassphrase) {
|
||||
final isValidMnemonic = bip39.validateMnemonic(mnemonic);
|
||||
if (!isValidMnemonic) {
|
||||
throw 'Invalid mnemonic';
|
||||
}
|
||||
|
||||
final seed = bip39.mnemonicToSeed(mnemonic);
|
||||
final seed = bip39.mnemonicToSeed(mnemonic, passphrase: mnemonicPassphrase);
|
||||
final root = bip32.BIP32.fromSeed(seed);
|
||||
const index = 0;
|
||||
final addressAtIndex = root.derivePath("$_hdPath/$index");
|
||||
final addressAtIndex = root.derivePath("$hdPathEthereum/$index");
|
||||
|
||||
return HEX.encode(addressAtIndex.privateKey as List<int>);
|
||||
}
|
||||
|
|
|
@ -1434,6 +1434,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
string_to_hex:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: string_to_hex
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.2"
|
||||
string_validator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|