2023-01-25 09:29:20 +00:00
|
|
|
import 'package:decimal/decimal.dart';
|
|
|
|
import 'package:stackwallet/models/models.dart';
|
|
|
|
import 'package:stackwallet/services/tokens/ethereum/ethereum_token.dart';
|
|
|
|
import 'package:stackwallet/services/transaction_notification_tracker.dart';
|
|
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|
|
|
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
|
|
|
import 'package:stackwallet/utilities/prefs.dart';
|
|
|
|
|
|
|
|
abstract class TokenServiceAPI {
|
|
|
|
TokenServiceAPI();
|
|
|
|
|
|
|
|
factory TokenServiceAPI.from(
|
2023-01-26 18:08:12 +00:00
|
|
|
Map<dynamic, dynamic> tokenData,
|
|
|
|
Future<List<String>> walletMnemonic,
|
2023-01-25 09:29:20 +00:00
|
|
|
SecureStorageInterface secureStorageInterface,
|
|
|
|
TransactionNotificationTracker tracker,
|
|
|
|
Prefs prefs,
|
|
|
|
) {
|
|
|
|
return EthereumToken(
|
2023-01-26 18:08:12 +00:00
|
|
|
tokenData: tokenData,
|
|
|
|
walletMnemonic: walletMnemonic,
|
2023-01-27 12:32:05 +00:00
|
|
|
secureStore: secureStorageInterface,
|
2023-01-26 18:08:12 +00:00
|
|
|
// tracker: tracker,
|
2023-01-25 09:29:20 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Coin get coin;
|
|
|
|
bool get isRefreshing;
|
|
|
|
bool get shouldAutoSync;
|
|
|
|
set shouldAutoSync(bool shouldAutoSync);
|
|
|
|
|
|
|
|
Future<Map<String, dynamic>> prepareSend({
|
|
|
|
required String address,
|
|
|
|
required int satoshiAmount,
|
|
|
|
Map<String, dynamic>? args,
|
|
|
|
});
|
|
|
|
|
|
|
|
Future<String> confirmSend({required Map<String, dynamic> txData});
|
|
|
|
|
|
|
|
Future<FeeObject> get fees;
|
|
|
|
Future<int> get maxFee;
|
|
|
|
|
|
|
|
Future<String> get currentReceivingAddress;
|
|
|
|
// Future<String> get currentLegacyReceivingAddress;
|
|
|
|
|
|
|
|
Future<Decimal> get availableBalance;
|
|
|
|
Future<Decimal> get totalBalance;
|
|
|
|
|
|
|
|
Future<List<String>> get allOwnAddresses;
|
|
|
|
|
|
|
|
Future<TransactionData> get transactionData;
|
|
|
|
|
|
|
|
Future<void> refresh();
|
|
|
|
|
|
|
|
// String get walletName;
|
|
|
|
// String get walletId;
|
|
|
|
|
|
|
|
bool validateAddress(String address);
|
|
|
|
|
|
|
|
Future<void> initializeNew();
|
|
|
|
Future<void> initializeExisting();
|
|
|
|
|
|
|
|
Future<int> estimateFeeFor(int satoshiAmount, int feeRate);
|
|
|
|
|
|
|
|
// used for electrumx coins
|
|
|
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData);
|
|
|
|
}
|