mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
reset tezos address type from unknown to tezos
This commit is contained in:
parent
90deb600b4
commit
d0bd99e0fc
6 changed files with 22 additions and 12 deletions
|
@ -86,8 +86,10 @@ Future<void> migrateWalletsToIsar({
|
|||
}
|
||||
}
|
||||
|
||||
// reset stellar address type
|
||||
if (old.coin == Coin.stellar || old.coin == Coin.stellarTestnet) {
|
||||
// reset stellar + tezos address type
|
||||
if (old.coin == Coin.stellar ||
|
||||
old.coin == Coin.stellarTestnet ||
|
||||
old.coin == Coin.tezos) {
|
||||
await MainDB.instance.deleteWalletBlockchainData(old.walletId);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@ enum AddressType {
|
|||
banano,
|
||||
spark,
|
||||
stellar,
|
||||
tezos,
|
||||
;
|
||||
|
||||
String get readableName {
|
||||
|
@ -190,6 +191,8 @@ enum AddressType {
|
|||
return "Spark";
|
||||
case AddressType.stellar:
|
||||
return "Stellar";
|
||||
case AddressType.tezos:
|
||||
return "Tezos";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,6 +265,7 @@ const _AddresstypeEnumValueMap = {
|
|||
'banano': 9,
|
||||
'spark': 10,
|
||||
'stellar': 11,
|
||||
'tezos': 12,
|
||||
};
|
||||
const _AddresstypeValueEnumMap = {
|
||||
0: AddressType.p2pkh,
|
||||
|
@ -279,6 +280,7 @@ const _AddresstypeValueEnumMap = {
|
|||
9: AddressType.banano,
|
||||
10: AddressType.spark,
|
||||
11: AddressType.stellar,
|
||||
12: AddressType.tezos,
|
||||
};
|
||||
|
||||
Id _addressGetId(Address object) {
|
||||
|
|
|
@ -387,9 +387,7 @@ extension CoinExt on Coin {
|
|||
return AddressType.ethereum;
|
||||
|
||||
case Coin.tezos:
|
||||
// should not be unknown but since already used in prod changing
|
||||
// this requires a migrate
|
||||
return AddressType.unknown;
|
||||
return AddressType.tezos;
|
||||
|
||||
case Coin.nano:
|
||||
return AddressType.nano;
|
||||
|
|
|
@ -264,6 +264,7 @@ const _WalletInfomainAddressTypeEnumValueMap = {
|
|||
'banano': 9,
|
||||
'spark': 10,
|
||||
'stellar': 11,
|
||||
'tezos': 12,
|
||||
};
|
||||
const _WalletInfomainAddressTypeValueEnumMap = {
|
||||
0: AddressType.p2pkh,
|
||||
|
@ -278,6 +279,7 @@ const _WalletInfomainAddressTypeValueEnumMap = {
|
|||
9: AddressType.banano,
|
||||
10: AddressType.spark,
|
||||
11: AddressType.stellar,
|
||||
12: AddressType.tezos,
|
||||
};
|
||||
|
||||
Id _walletInfoGetId(WalletInfo object) {
|
||||
|
|
|
@ -146,11 +146,14 @@ class TezosWallet extends Bip39Wallet<Tezos> {
|
|||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
final _address = await getCurrentReceivingAddress();
|
||||
if (_address == null) {
|
||||
final address = await _getAddressFromMnemonic();
|
||||
|
||||
await mainDB.updateOrPutAddresses([address]);
|
||||
try {
|
||||
final _address = await getCurrentReceivingAddress();
|
||||
if (_address == null) {
|
||||
final address = await _getAddressFromMnemonic();
|
||||
await mainDB.updateOrPutAddresses([address]);
|
||||
}
|
||||
} catch (_) {
|
||||
// do nothing, still allow user into wallet
|
||||
}
|
||||
|
||||
await super.init();
|
||||
|
@ -527,7 +530,7 @@ class TezosWallet extends Bip39Wallet<Tezos> {
|
|||
|
||||
@override
|
||||
Future<void> updateTransactions() async {
|
||||
// TODO: optimize updateTransactions
|
||||
// TODO: optimize updateTransactions and use V2
|
||||
|
||||
final myAddress = (await getCurrentReceivingAddress())!;
|
||||
final txs = await TezosAPI.getTransactions(myAddress.value);
|
||||
|
@ -589,7 +592,7 @@ class TezosWallet extends Bip39Wallet<Tezos> {
|
|||
publicKey: [],
|
||||
derivationIndex: 0,
|
||||
derivationPath: null,
|
||||
type: AddressType.unknown,
|
||||
type: AddressType.tezos,
|
||||
subType: AddressSubType.unknown,
|
||||
);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue