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

62 lines
1.7 KiB
Dart
Raw Normal View History

2023-11-23 00:21:55 +00:00
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
2023-11-20 16:37:28 +00:00
import 'package:stackwallet/models/node_model.dart';
2023-11-20 19:55:22 +00:00
import 'package:stackwallet/utilities/default_nodes.dart';
2023-11-20 16:37:28 +00:00
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 Tezos extends Bip39Currency {
Tezos(super.network) {
switch (network) {
case CryptoCurrencyNetwork.main:
coin = Coin.tezos;
default:
throw Exception("Unsupported network: $network");
}
}
2023-11-23 00:21:55 +00:00
DerivationPath get standardDerivationPath =>
DerivationPath()..value = "m/44'/1729'/0'/0'";
List<DerivationPath> get possibleDerivationPaths => [
standardDerivationPath,
DerivationPath()..value = "",
DerivationPath()..value = "m/44'/1729'/0'/0'/0'",
DerivationPath()..value = "m/44'/1729'/0'/0/0",
];
2023-11-20 16:37:28 +00:00
@override
2023-11-22 18:30:09 +00:00
String get genesisHash => throw UnimplementedError(
"Not used in tezos at the moment",
);
2023-11-20 16:37:28 +00:00
@override
2023-11-20 19:55:22 +00:00
int get minConfirms => 1;
2023-11-20 16:37:28 +00:00
@override
bool validateAddress(String address) {
2023-11-20 19:55:22 +00:00
return RegExp(r"^tz[1-9A-HJ-NP-Za-km-z]{34}$").hasMatch(address);
}
@override
NodeModel get defaultNode {
switch (network) {
case CryptoCurrencyNetwork.main:
return NodeModel(
host: "https://mainnet.api.tez.ie",
port: 443,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(Coin.tezos),
useSSL: true,
enabled: true,
coinName: Coin.tezos.name,
isFailover: true,
isDown: false,
);
default:
throw UnimplementedError();
}
2023-11-20 16:37:28 +00:00
}
}