Merge pull request #591 from detherminal/add-xtz

feat: add xtz
This commit is contained in:
Likho 2023-07-19 15:04:26 +02:00 committed by GitHub
commit dd971d764a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 574 additions and 5 deletions

View file

@ -1902,6 +1902,7 @@ class ThemeAssets implements IThemeAssets {
late final String wownero; late final String wownero;
late final String namecoin; late final String namecoin;
late final String particl; late final String particl;
late final String tezos;
late final String bitcoinImage; late final String bitcoinImage;
late final String bitcoincashImage; late final String bitcoincashImage;
late final String dogecoinImage; late final String dogecoinImage;
@ -1913,6 +1914,7 @@ class ThemeAssets implements IThemeAssets {
late final String wowneroImage; late final String wowneroImage;
late final String namecoinImage; late final String namecoinImage;
late final String particlImage; late final String particlImage;
late final String tezosImage;
late final String bitcoinImageSecondary; late final String bitcoinImageSecondary;
late final String bitcoincashImageSecondary; late final String bitcoincashImageSecondary;
late final String dogecoinImageSecondary; late final String dogecoinImageSecondary;
@ -1924,6 +1926,7 @@ class ThemeAssets implements IThemeAssets {
late final String wowneroImageSecondary; late final String wowneroImageSecondary;
late final String namecoinImageSecondary; late final String namecoinImageSecondary;
late final String particlImageSecondary; late final String particlImageSecondary;
late final String tezosImageSecondary;
@override @override
late final String? loadingGif; late final String? loadingGif;
@override @override
@ -1997,6 +2000,8 @@ class ThemeAssets implements IThemeAssets {
"$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin"] as String}"
..particl = ..particl =
"$applicationThemesDirectoryPath/$themeId/assets/${json["particl"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["particl"] as String}"
..tezos =
"$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin"] as String}" // TODO: change to tezos
..bitcoinImage = ..bitcoinImage =
"$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image"] as String}"
..bitcoincashImage = ..bitcoincashImage =
@ -2019,6 +2024,8 @@ class ThemeAssets implements IThemeAssets {
"$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin_image"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin_image"] as String}"
..particlImage = ..particlImage =
"$applicationThemesDirectoryPath/$themeId/assets/${json["particl_image"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["particl_image"] as String}"
..tezosImage =
"$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image"] as String}" // TODO: change to tezos
..bitcoinImageSecondary = ..bitcoinImageSecondary =
"$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image_secondary"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image_secondary"] as String}"
..bitcoincashImageSecondary = ..bitcoincashImageSecondary =
@ -2041,6 +2048,8 @@ class ThemeAssets implements IThemeAssets {
"$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin_image_secondary"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin_image_secondary"] as String}"
..particlImageSecondary = ..particlImageSecondary =
"$applicationThemesDirectoryPath/$themeId/assets/${json["particl_image_secondary"] as String}" "$applicationThemesDirectoryPath/$themeId/assets/${json["particl_image_secondary"] as String}"
..tezosImageSecondary =
"$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image_secondary"] as String}" // TODO: change to tezos
..loadingGif = json["loading_gif"] is String ..loadingGif = json["loading_gif"] is String
? "$applicationThemesDirectoryPath/$themeId/assets/${json["loading_gif"] as String}" ? "$applicationThemesDirectoryPath/$themeId/assets/${json["loading_gif"] as String}"
: null : null

View file

@ -711,6 +711,7 @@ class _NodeFormState extends ConsumerState<NodeForm> {
case Coin.namecoin: case Coin.namecoin:
case Coin.bitcoincash: case Coin.bitcoincash:
case Coin.particl: case Coin.particl:
case Coin.tezos:
case Coin.bitcoinTestNet: case Coin.bitcoinTestNet:
case Coin.litecoinTestNet: case Coin.litecoinTestNet:
case Coin.bitcoincashTestnet: case Coin.bitcoincashTestnet:

View file

@ -15,6 +15,7 @@ import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart';
import 'package:stackwallet/services/coins/monero/monero_wallet.dart'; import 'package:stackwallet/services/coins/monero/monero_wallet.dart';
import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'; import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart';
import 'package:stackwallet/services/coins/particl/particl_wallet.dart'; import 'package:stackwallet/services/coins/particl/particl_wallet.dart';
import 'package:stackwallet/services/coins/tezos/tezos_wallet.dart';
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart'; import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/amount/amount.dart';
@ -204,6 +205,15 @@ abstract class CoinServiceAPI {
cachedClient: cachedClient, cachedClient: cachedClient,
tracker: tracker); tracker: tracker);
case Coin.tezos:
return TezosWallet(
walletId: walletId,
walletName: walletName,
coin: coin,
secureStore: secureStorageInterface,
tracker: tracker,
);
case Coin.wownero: case Coin.wownero:
return WowneroWallet( return WowneroWallet(
walletId: walletId, walletId: walletId,

View file

@ -0,0 +1,410 @@
import 'dart:async';
import 'dart:convert';
import 'dart:ffi';
import 'package:http/http.dart';
import 'package:isar/isar.dart';
import 'package:stackwallet/models/balance.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/utxo.dart';
import 'package:stackwallet/models/paymint/fee_object_model.dart';
import 'package:stackwallet/services/coins/coin_service.dart';
import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/utilities/amount/amount.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
import 'package:tezart/tezart.dart';
import 'package:tuple/tuple.dart';
import '../../../db/isar/main_db.dart';
import '../../../models/node_model.dart';
import '../../../utilities/flutter_secure_storage_interface.dart';
import '../../../utilities/logger.dart';
import '../../../utilities/prefs.dart';
import '../../mixins/wallet_cache.dart';
import '../../mixins/wallet_db.dart';
import '../../transaction_notification_tracker.dart';
const int MINIMUM_CONFIRMATIONS = 1;
class TezosWallet extends CoinServiceAPI with WalletCache, WalletDB {
TezosWallet({
required String walletId,
required String walletName,
required Coin coin,
required SecureStorageInterface secureStore,
required TransactionNotificationTracker tracker,
MainDB? mockableOverride,
}) {
txTracker = tracker;
_walletId = walletId;
_walletName = walletName;
_coin = coin;
_secureStore = secureStore;
initCache(walletId, coin);
initWalletDB(mockableOverride: mockableOverride);
}
NodeModel? _xtzNode;
NodeModel getCurrentNode() {
return _xtzNode ?? NodeService(secureStorageInterface: _secureStore).getPrimaryNodeFor(coin: Coin.tezos) ?? DefaultNodes.getNodeFor(Coin.tezos);
}
Future<Keystore> getKeystore() async {
return Keystore.fromMnemonic((await mnemonicString).toString());
}
@override
String get walletId => _walletId;
late String _walletId;
@override
String get walletName => _walletName;
late String _walletName;
@override
set walletName(String name) => _walletName = name;
@override
set isFavorite(bool markFavorite) {
_isFavorite = markFavorite;
updateCachedIsFavorite(markFavorite);
}
@override
bool get isFavorite => _isFavorite ??= getCachedIsFavorite();
bool? _isFavorite;
@override
Coin get coin => _coin;
late Coin _coin;
late SecureStorageInterface _secureStore;
late final TransactionNotificationTracker txTracker;
final _prefs = Prefs.instance;
Timer? timer;
bool _shouldAutoSync = false;
@override
bool get shouldAutoSync => _shouldAutoSync;
@override
set shouldAutoSync(bool shouldAutoSync) {
if (_shouldAutoSync != shouldAutoSync) {
_shouldAutoSync = shouldAutoSync;
if (!shouldAutoSync) {
timer?.cancel();
timer = null;
} else {
refresh();
}
}
}
@override
Balance get balance => _balance ??= getCachedBalance();
Balance? _balance;
@override
Future<Map<String, dynamic>> prepareSend({required String address, required Amount amount, Map<String, dynamic>? args}) async {
try {
if (amount.decimals != coin.decimals) {
throw Exception("Amount decimals do not match coin decimals!");
}
var fee = int.parse((await estimateFeeFor(amount, (args!["feeRate"] as FeeRateType).index)).raw.toString());
Map<String, dynamic> txData = {
"fee": fee,
"address": address,
"recipientAmt": amount,
};
return Future.value(txData);
} catch (e) {
return Future.error(e);
}
}
@override
Future<String> confirmSend({required Map<String, dynamic> txData}) async {
try {
final node = getCurrentNode().host + getCurrentNode().port.toString();
final int amountInMicroTez = ((int.parse((txData["recipientAmt"] as Amount).raw.toString()) * 1000000)).round();
final int feeInMicroTez = int.parse(txData["fee"].toString());
final String destinationAddress = txData["address"] as String;
final String sourceAddress = await currentReceivingAddress;
return Future.value(""); // TODO: return tx hash
} catch (e) {
Logging.instance.log(e.toString(), level: LogLevel.Error);
return Future.error(e);
}
}
@override
Future<String> get currentReceivingAddress async {
var mneString = await mnemonicString;
if (mneString == null) {
throw Exception("No mnemonic found!");
}
return Future.value((Keystore.fromMnemonic(mneString)).address);
}
@override
Future<Amount> estimateFeeFor(Amount amount, int feeRate) {
return Future.value(
Amount(rawValue: BigInt.parse(100000.toString()), fractionDigits: coin.decimals),
);
}
@override
Future<void> exit() {
_hasCalledExit = true;
return Future.value();
}
@override
Future<FeeObject> get fees async {
// TODO: Change this to get fees from node and fix numberOfBlocks
return FeeObject(
numberOfBlocksFast: 1,
numberOfBlocksAverage: 1,
numberOfBlocksSlow: 1,
fast: 1000000,
medium: 100000,
slow: 10000,
);
}
@override
Future<void> fullRescan(int maxUnusedAddressGap, int maxNumberOfIndexesToCheck) {
refresh();
return Future.value();
}
@override
Future<bool> generateNewAddress() {
// TODO: implement generateNewAddress
throw UnimplementedError();
}
@override
bool get hasCalledExit => _hasCalledExit;
bool _hasCalledExit = false;
@override
Future<void> initializeExisting() async {
await _prefs.init();
}
@override
Future<void> initializeNew() async {
var newKeystore = Keystore.random();
await _secureStore.write(
key: '${_walletId}_mnemonic',
value: newKeystore.mnemonic,
);
await _secureStore.write(
key: '${_walletId}_mnemonicPassphrase',
value: "",
);
final address = Address(
walletId: walletId,
value: newKeystore.address,
publicKey: [], // TODO: Add public key
derivationIndex: 0,
derivationPath: null,
type: AddressType.unknown,
subType: AddressSubType.unknown,
);
await db.putAddress(address);
await Future.wait([
updateCachedId(walletId),
updateCachedIsFavorite(false),
]);
}
@override
bool get isConnected => _isConnected;
bool _isConnected = false;
@override
bool get isRefreshing => refreshMutex;
bool refreshMutex = false;
@override
// TODO: implement maxFee
Future<int> get maxFee => throw UnimplementedError();
@override
Future<List<String>> get mnemonic async {
final mnemonic = await mnemonicString;
final mnemonicPassphrase = await this.mnemonicPassphrase;
if (mnemonic == null) {
throw Exception("No mnemonic found!");
}
if (mnemonicPassphrase == null) {
throw Exception("No mnemonic passphrase found!");
}
return mnemonic.split(" ");
}
@override
Future<String?> get mnemonicPassphrase => _secureStore.read(key: '${_walletId}_mnemonicPassphrase');
@override
Future<String?> get mnemonicString => _secureStore.read(key: '${_walletId}_mnemonic');
@override
Future<void> recoverFromMnemonic({required String mnemonic, String? mnemonicPassphrase, required int maxUnusedAddressGap, required int maxNumberOfIndexesToCheck, required int height}) async {
if ((await mnemonicString) != null ||
(await this.mnemonicPassphrase) != null) {
throw Exception("Attempted to overwrite mnemonic on restore!");
}
await _secureStore.write(
key: '${_walletId}_mnemonic', value: mnemonic.trim());
await _secureStore.write(
key: '${_walletId}_mnemonicPassphrase',
value: mnemonicPassphrase ?? "",
);
final address = Address(
walletId: walletId,
value: Keystore.fromMnemonic(mnemonic).address,
publicKey: [], // TODO: Add public key
derivationIndex: 0,
derivationPath: null,
type: AddressType.unknown,
subType: AddressSubType.unknown,
);
await db.putAddress(address);
await Future.wait([
updateCachedId(walletId),
updateCachedIsFavorite(false),
]);
}
Future<void> updateBalance() async {
var api = "https://api.mainnet.tzkt.io/v1/accounts/${await currentReceivingAddress}/balance"; // TODO: Can we use current node instead of this?
var theBalance = await get(Uri.parse(api)).then((value) => value.body);
Logging.instance.log("Balance for ${await currentReceivingAddress}: $theBalance", level: LogLevel.Info);
var balanceInAmount = Amount(rawValue: BigInt.parse(theBalance.toString()), fractionDigits: 6);
_balance = Balance(
total: balanceInAmount,
spendable: balanceInAmount,
blockedTotal: Amount(rawValue: BigInt.parse("0"), fractionDigits: 6),
pendingSpendable: Amount(rawValue: BigInt.parse("0"), fractionDigits: 6),
);
await updateCachedBalance(_balance!);
}
Future<void> updateTransactions() async {
var api = "https://api.mainnet.tzkt.io/v1/accounts/${await currentReceivingAddress}/balance_history"; // TODO: Can we use current node instead of this?
var returnedTxs = await get(Uri.parse(api)).then((value) => value.body);
Logging.instance.log(
"Transactions for ${await currentReceivingAddress}: $returnedTxs",
level: LogLevel.Info);
List<Tuple2<Transaction, Address>> txs = [];
Object? jsonTxs = jsonDecode(returnedTxs);
if (jsonTxs == null) {
await db.addNewTransactionData(txs, walletId);
} else {
for (var tx in jsonTxs as List) {
var theTx = Transaction(
walletId: walletId,
txid: "",
timestamp: DateTime.parse(tx["timestamp"].toString()).toUtc().millisecondsSinceEpoch ~/ 1000,
type: TransactionType.unknown,
subType: TransactionSubType.none,
amount: int.parse(tx["balance"].toString()),
amountString: Amount(
rawValue: BigInt.parse(tx["balance"].toString()),
fractionDigits: 6
).toJsonString(),
fee: 0,
height: int.parse(tx["level"].toString()),
isCancelled: false,
isLelantus: false,
slateId: "",
otherData: "",
inputs: [],
outputs: [],
nonce: 0
);
var theAddress = Address(
walletId: walletId,
value: await currentReceivingAddress,
publicKey: [], // TODO: Add public key
derivationIndex: 0,
derivationPath: null,
type: AddressType.unknown,
subType: AddressSubType.unknown,
);
txs.add(Tuple2(theTx, theAddress));
}
await db.addNewTransactionData(txs, walletId);
}
}
Future<void> updateChainHeight() async {
var api = "https://api.tzkt.io/v1/blocks/count"; // TODO: Can we use current node instead of this?
var returnedHeight = await get(Uri.parse(api)).then((value) => value.body);
final int intHeight = int.parse(returnedHeight.toString());
await updateCachedChainHeight(intHeight);
}
@override
Future<void> refresh() {
updateChainHeight();
updateBalance();
updateTransactions();
return Future.value();
}
@override
int get storedChainHeight => getCachedChainHeight();
@override
Future<bool> testNetworkConnection() async{
try {
await get(Uri.parse("https://api.mainnet.tzkt.io/v1/accounts/${await currentReceivingAddress}/balance"));
return true;
} catch (e) {
return false;
}
}
@override
Future<List<Transaction>> get transactions => db.getTransactions(walletId).findAll();
@override
Future<void> updateNode(bool shouldRefresh) async {
_xtzNode = NodeService(secureStorageInterface: _secureStore).getPrimaryNodeFor(coin: coin) ?? DefaultNodes.getNodeFor(coin);
if (shouldRefresh) {
await refresh();
}
}
@override
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) {
// TODO: implement updateSentCachedTxData
throw UnimplementedError();
}
@override
// TODO: implement utxos
Future<List<UTXO>> get utxos => throw UnimplementedError();
@override
bool validateAddress(String address) {
return RegExp(r"^tz[1-9A-HJ-NP-Za-km-z]{34}$").hasMatch(address);
}
}

View file

@ -35,6 +35,8 @@ final coinIconProvider = Provider.family<String, Coin>((ref, coin) {
return assets.namecoin; return assets.namecoin;
case Coin.particl: case Coin.particl:
return assets.particl; return assets.particl;
case Coin.tezos:
return assets.tezos;
case Coin.ethereum: case Coin.ethereum:
return assets.ethereum; return assets.ethereum;
} }

View file

@ -31,6 +31,8 @@ final coinImageProvider = Provider.family<String, Coin>((ref, coin) {
return assets.namecoinImage; return assets.namecoinImage;
case Coin.particl: case Coin.particl:
return assets.particlImage; return assets.particlImage;
case Coin.tezos:
return assets.tezosImage;
case Coin.bitcoinTestNet: case Coin.bitcoinTestNet:
return assets.bitcoinImage; return assets.bitcoinImage;
case Coin.bitcoincashTestnet: case Coin.bitcoincashTestnet:
@ -75,6 +77,8 @@ final coinImageSecondaryProvider = Provider.family<String, Coin>((ref, coin) {
return assets.namecoinImageSecondary; return assets.namecoinImageSecondary;
case Coin.particl: case Coin.particl:
return assets.particlImageSecondary; return assets.particlImageSecondary;
case Coin.tezos:
return assets.tezosImageSecondary;
case Coin.bitcoinTestNet: case Coin.bitcoinTestNet:
return assets.bitcoinImageSecondary; return assets.bitcoinImageSecondary;
case Coin.bitcoincashTestnet: case Coin.bitcoincashTestnet:

View file

@ -18,6 +18,7 @@ class CoinThemeColorDefault {
Color get namecoin => const Color(0xFF91B1E1); Color get namecoin => const Color(0xFF91B1E1);
Color get wownero => const Color(0xFFED80C1); Color get wownero => const Color(0xFFED80C1);
Color get particl => const Color(0xFF8175BD); Color get particl => const Color(0xFF8175BD);
Color get tezos => const Color(0xFF0F61FF);
Color forCoin(Coin coin) { Color forCoin(Coin coin) {
switch (coin) { switch (coin) {
@ -50,6 +51,8 @@ class CoinThemeColorDefault {
return wownero; return wownero;
case Coin.particl: case Coin.particl:
return particl; return particl;
case Coin.tezos:
return tezos;
} }
} }
} }

View file

@ -1697,6 +1697,8 @@ class StackColors extends ThemeExtension<StackColors> {
return _coin.wownero; return _coin.wownero;
case Coin.particl: case Coin.particl:
return _coin.particl; return _coin.particl;
case Coin.tezos:
return _coin.tezos;
} }
} }

View file

@ -74,6 +74,8 @@ class AddressUtils {
return Address.validateAddress(address, namecoin, namecoin.bech32!); return Address.validateAddress(address, namecoin, namecoin.bech32!);
case Coin.particl: case Coin.particl:
return Address.validateAddress(address, particl); return Address.validateAddress(address, particl);
case Coin.tezos:
return RegExp(r"^tz[1-9A-HJ-NP-Za-km-z]{34}$").hasMatch(address);
case Coin.bitcoinTestNet: case Coin.bitcoinTestNet:
return Address.validateAddress(address, testnet); return Address.validateAddress(address, testnet);
case Coin.litecoinTestNet: case Coin.litecoinTestNet:

View file

@ -43,6 +43,8 @@ Uri getDefaultBlockExplorerUrlFor({
return Uri.parse("https://chainz.cryptoid.info/nmc/tx.dws?$txid.htm"); return Uri.parse("https://chainz.cryptoid.info/nmc/tx.dws?$txid.htm");
case Coin.particl: case Coin.particl:
return Uri.parse("https://chainz.cryptoid.info/part/tx.dws?$txid.htm"); return Uri.parse("https://chainz.cryptoid.info/part/tx.dws?$txid.htm");
case Coin.tezos:
return Uri.parse("https://tzstats.com/$txid");
} }
} }

View file

@ -29,12 +29,14 @@ abstract class Constants {
static const int _satsPerCoinECash = 100; static const int _satsPerCoinECash = 100;
static const int _satsPerCoinMonero = 1000000000000; static const int _satsPerCoinMonero = 1000000000000;
static const int _satsPerCoinWownero = 100000000000; static const int _satsPerCoinWownero = 100000000000;
static const int _satsPerCoinTezos = 1000000;
static const int _satsPerCoin = 100000000; static const int _satsPerCoin = 100000000;
static const int _decimalPlaces = 8; static const int _decimalPlaces = 8;
static const int _decimalPlacesWownero = 11; static const int _decimalPlacesWownero = 11;
static const int _decimalPlacesMonero = 12; static const int _decimalPlacesMonero = 12;
static const int _decimalPlacesEthereum = 18; static const int _decimalPlacesEthereum = 18;
static const int _decimalPlacesECash = 2; static const int _decimalPlacesECash = 2;
static const int _decimalPlacesTezos = 6;
static const int notificationsMax = 0xFFFFFFFF; static const int notificationsMax = 0xFFFFFFFF;
static const Duration networkAliveTimerDuration = Duration(seconds: 10); static const Duration networkAliveTimerDuration = Duration(seconds: 10);
@ -76,6 +78,9 @@ abstract class Constants {
case Coin.eCash: case Coin.eCash:
return _satsPerCoinECash; return _satsPerCoinECash;
case Coin.tezos:
return _satsPerCoinTezos;
} }
} }
@ -107,6 +112,9 @@ abstract class Constants {
case Coin.eCash: case Coin.eCash:
return _decimalPlacesECash; return _decimalPlacesECash;
case Coin.tezos:
return _decimalPlacesTezos;
} }
} }
@ -128,6 +136,7 @@ abstract class Constants {
case Coin.ethereum: case Coin.ethereum:
case Coin.namecoin: case Coin.namecoin:
case Coin.particl: case Coin.particl:
case Coin.tezos:
values.addAll([24, 21, 18, 15, 12]); values.addAll([24, 21, 18, 15, 12]);
break; break;
@ -180,6 +189,9 @@ abstract class Constants {
case Coin.particl: case Coin.particl:
return 600; return 600;
case Coin.tezos:
return 60;
} }
} }

View file

@ -169,7 +169,20 @@ abstract class DefaultNodes {
enabled: true, enabled: true,
coinName: Coin.particl.name, coinName: Coin.particl.name,
isFailover: true, isFailover: true,
isDown: false); isDown: false
);
static NodeModel get tezos => NodeModel( // TODO: Change this to original one
host: "mainnet.api.tez.ie",
port: 443,
name: defaultName,
id: _nodeId(Coin.tezos),
useSSL: true,
enabled: true,
coinName: Coin.tezos.name,
isFailover: true,
isDown: false
);
static NodeModel get bitcoinTestnet => NodeModel( static NodeModel get bitcoinTestnet => NodeModel(
host: "bitcoin-testnet.stackwallet.com", host: "bitcoin-testnet.stackwallet.com",
@ -269,6 +282,9 @@ abstract class DefaultNodes {
case Coin.particl: case Coin.particl:
return particl; return particl;
case Coin.tezos:
return tezos;
case Coin.bitcoinTestNet: case Coin.bitcoinTestNet:
return bitcoinTestnet; return bitcoinTestnet;

View file

@ -16,6 +16,7 @@ import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart'
as nmc; as nmc;
import 'package:stackwallet/services/coins/particl/particl_wallet.dart' import 'package:stackwallet/services/coins/particl/particl_wallet.dart'
as particl; as particl;
import 'package:stackwallet/services/coins/tezos/tezos_wallet.dart' as tezos;
import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart' as wow; import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart' as wow;
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -31,6 +32,7 @@ enum Coin {
monero, monero,
namecoin, namecoin,
particl, particl,
tezos,
wownero, wownero,
/// ///
@ -71,6 +73,8 @@ extension CoinExt on Coin {
return "Monero"; return "Monero";
case Coin.particl: case Coin.particl:
return "Particl"; return "Particl";
case Coin.tezos:
return "Tezos";
case Coin.wownero: case Coin.wownero:
return "Wownero"; return "Wownero";
case Coin.namecoin: case Coin.namecoin:
@ -110,6 +114,8 @@ extension CoinExt on Coin {
return "XMR"; return "XMR";
case Coin.particl: case Coin.particl:
return "PART"; return "PART";
case Coin.tezos:
return "XTZ";
case Coin.wownero: case Coin.wownero:
return "WOW"; return "WOW";
case Coin.namecoin: case Coin.namecoin:
@ -150,6 +156,8 @@ extension CoinExt on Coin {
return "monero"; return "monero";
case Coin.particl: case Coin.particl:
return "particl"; return "particl";
case Coin.tezos:
return "tezos";
case Coin.wownero: case Coin.wownero:
return "wownero"; return "wownero";
case Coin.namecoin: case Coin.namecoin:
@ -187,6 +195,7 @@ extension CoinExt on Coin {
case Coin.epicCash: case Coin.epicCash:
case Coin.ethereum: case Coin.ethereum:
case Coin.monero: case Coin.monero:
case Coin.tezos:
case Coin.wownero: case Coin.wownero:
return false; return false;
} }
@ -207,6 +216,7 @@ extension CoinExt on Coin {
case Coin.eCash: case Coin.eCash:
case Coin.epicCash: case Coin.epicCash:
case Coin.monero: case Coin.monero:
case Coin.tezos:
case Coin.wownero: case Coin.wownero:
case Coin.dogecoinTestNet: case Coin.dogecoinTestNet:
case Coin.bitcoinTestNet: case Coin.bitcoinTestNet:
@ -229,6 +239,7 @@ extension CoinExt on Coin {
case Coin.epicCash: case Coin.epicCash:
case Coin.ethereum: case Coin.ethereum:
case Coin.monero: case Coin.monero:
case Coin.tezos:
case Coin.wownero: case Coin.wownero:
case Coin.eCash: case Coin.eCash:
return false; return false;
@ -254,6 +265,7 @@ extension CoinExt on Coin {
case Coin.epicCash: case Coin.epicCash:
case Coin.ethereum: case Coin.ethereum:
case Coin.monero: case Coin.monero:
case Coin.tezos:
case Coin.wownero: case Coin.wownero:
case Coin.eCash: case Coin.eCash:
return this; return this;
@ -312,6 +324,9 @@ extension CoinExt on Coin {
case Coin.particl: case Coin.particl:
return particl.MINIMUM_CONFIRMATIONS; return particl.MINIMUM_CONFIRMATIONS;
case Coin.tezos:
return tezos.MINIMUM_CONFIRMATIONS;
case Coin.wownero: case Coin.wownero:
return wow.MINIMUM_CONFIRMATIONS; return wow.MINIMUM_CONFIRMATIONS;
@ -367,6 +382,10 @@ Coin coinFromPrettyName(String name) {
case "particl": case "particl":
return Coin.particl; return Coin.particl;
case "Tezos":
case "tezos":
return Coin.tezos;
case "Namecoin": case "Namecoin":
case "namecoin": case "namecoin":
return Coin.namecoin; return Coin.namecoin;
@ -436,6 +455,8 @@ Coin coinFromTickerCaseInsensitive(String ticker) {
return Coin.namecoin; return Coin.namecoin;
case "part": case "part":
return Coin.particl; return Coin.particl;
case "xtz":
return Coin.tezos;
case "tltc": case "tltc":
return Coin.litecoinTestNet; return Coin.litecoinTestNet;
case "tbtc": case "tbtc":

View file

@ -37,6 +37,7 @@ extension DerivePathTypeExt on DerivePathType {
case Coin.epicCash: case Coin.epicCash:
case Coin.monero: case Coin.monero:
case Coin.wownero: case Coin.wownero:
case Coin.tezos: // TODO: Is this true?
throw UnsupportedError( throw UnsupportedError(
"$coin does not use bitcoin style derivation paths"); "$coin does not use bitcoin style derivation paths");
} }

View file

@ -5,18 +5,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: _fe_analyzer_shared name: _fe_analyzer_shared
sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8" sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "47.0.0" version: "61.0.0"
analyzer: analyzer:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: analyzer name: analyzer
sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80" sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.7.0" version: "5.13.0"
animations: animations:
dependency: "direct main" dependency: "direct main"
description: description:
@ -33,6 +33,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.12.29" version: "1.12.29"
ansicolor:
dependency: transitive
description:
name: ansicolor
sha256: "607f8fa9786f392043f169898923e6c59b4518242b68b8862eb8a8b7d9c30b4a"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
app_settings: app_settings:
dependency: "direct main" dependency: "direct main"
description: description:
@ -490,6 +498,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.5.5" version: "0.5.5"
dio:
dependency: transitive
description:
name: dio
sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8"
url: "https://pub.dev"
source: hosted
version: "4.0.6"
dropdown_button2: dropdown_button2:
dependency: "direct main" dependency: "direct main"
description: description:
@ -966,6 +982,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.2" version: "3.0.2"
json_serializable:
dependency: transitive
description:
name: json_serializable
sha256: dadc08bd61f72559f938dd08ec20dbfec6c709bba83515085ea943d2078d187a
url: "https://pub.dev"
source: hosted
version: "6.6.1"
jsonrpc2: jsonrpc2:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1037,6 +1061,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0" version: "0.2.0"
memoize:
dependency: transitive
description:
name: memoize
sha256: "51481d328c86cbdc59711369179bac88551ca0556569249be5317e66fc796cac"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -1285,6 +1317,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.1.0" version: "5.1.0"
pinenacl:
dependency: transitive
description:
name: pinenacl
sha256: e5fb0bce1717b7f136f35ee98b5c02b3e6383211f8a77ca882fa7812232a07b9
url: "https://pub.dev"
source: hosted
version: "0.3.4"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -1317,6 +1357,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.5.1" version: "1.5.1"
pretty_dio_logger:
dependency: transitive
description:
name: pretty_dio_logger
sha256: "948f7eeb36e7aa0760b51c1a8e3331d4b21e36fabd39efca81f585ed93893544"
url: "https://pub.dev"
source: hosted
version: "1.2.0-beta-1"
process: process:
dependency: transitive dependency: transitive
description: description:
@ -1365,6 +1413,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
quiver:
dependency: transitive
description:
name: quiver
sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47
url: "https://pub.dev"
source: hosted
version: "3.2.1"
rational: rational:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1373,6 +1429,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.2" version: "2.2.2"
retry:
dependency: transitive
description:
name: retry
sha256: a8a1e475a100a0bdc73f529ca8ea1e9c9c76bec8ad86a1f47780139a34ce7aea
url: "https://pub.dev"
source: hosted
version: "3.1.1"
riverpod: riverpod:
dependency: transitive dependency: transitive
description: description:
@ -1659,6 +1723,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.20" version: "0.4.20"
tezart:
dependency: "direct main"
description:
name: tezart
sha256: "35d526f2e6ca250c64461ebfb4fa9f64b6599fab8c4242c8e89ae27d4ac2e15a"
url: "https://pub.dev"
source: hosted
version: "2.0.5"
time: time:
dependency: transitive dependency: transitive
description: description:

View file

@ -153,6 +153,7 @@ dependencies:
rational: ^2.2.2 rational: ^2.2.2
archive: ^3.3.2 archive: ^3.3.2
desktop_drop: ^0.4.1 desktop_drop: ^0.4.1
tezart: ^2.0.5
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -198,6 +199,7 @@ dependency_overrides:
url: https://github.com/cypherstack/stack-bip39.git url: https://github.com/cypherstack/stack-bip39.git
ref: 3bef5acc21340f3cc78df0ad1dce5868a3ed68a5 ref: 3bef5acc21340f3cc78df0ad1dce5868a3ed68a5
crypto: 3.0.2 crypto: 3.0.2
analyzer: ^5.2.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec