stack_wallet/lib/wallets/crypto_currency/coins/ethereum.dart

46 lines
1.2 KiB
Dart
Raw Normal View History

2024-01-10 16:08:12 +00:00
import 'package:ethereum_addresses/ethereum_addresses.dart';
import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/wallets/crypto_currency/crypto_currency.dart';
import 'package:stackwallet/wallets/crypto_currency/intermediate/bip39_currency.dart';
class Ethereum extends Bip39Currency {
Ethereum(super.network) {
switch (network) {
case CryptoCurrencyNetwork.main:
coin = Coin.ethereum;
default:
throw Exception("Unsupported network: $network");
}
}
int get gasLimit => 21000;
@override
bool get hasTokenSupport => true;
@override
NodeModel get defaultNode => DefaultNodes.ethereum;
@override
// Not used for eth
String get genesisHash => throw UnimplementedError();
@override
int get minConfirms => 3;
@override
bool validateAddress(String address) {
return isValidEthereumAddress(address);
}
@override
bool operator ==(Object other) {
return other is Ethereum && other.network == network;
}
@override
int get hashCode => Object.hash(Ethereum, network);
2024-01-10 16:08:12 +00:00
}