mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-25 16:48:48 +00:00
Fix fetch tx error after broadcast
This commit is contained in:
parent
4e3a5d23db
commit
76c57eef64
1 changed files with 308 additions and 330 deletions
|
@ -50,7 +50,7 @@ const String GENESIS_HASH_MAINNET =
|
||||||
const String GENESIS_HASH_TESTNET =
|
const String GENESIS_HASH_TESTNET =
|
||||||
"0000594ada5310b367443ee0afd4fa3d0bbd5850ea4e33cdc7d6a904a7ec7c90";
|
"0000594ada5310b367443ee0afd4fa3d0bbd5850ea4e33cdc7d6a904a7ec7c90";
|
||||||
|
|
||||||
enum DerivePathType { bip84 }
|
enum DerivePathType { bip44, bip84 }
|
||||||
|
|
||||||
bip32.BIP32 getBip32Node(
|
bip32.BIP32 getBip32Node(
|
||||||
int chain,
|
int chain,
|
||||||
|
@ -93,6 +93,8 @@ bip32.BIP32 getBip32NodeFromRoot(
|
||||||
throw Exception("Invalid Particl network type used!");
|
throw Exception("Invalid Particl network type used!");
|
||||||
}
|
}
|
||||||
switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
|
case DerivePathType.bip44:
|
||||||
|
return root.derivePath("m/44'/$coinType'/0'/$chain/$index");
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
return root.derivePath("m/84'/$coinType'/0'/$chain/$index");
|
return root.derivePath("m/84'/$coinType'/0'/$chain/$index");
|
||||||
default:
|
default:
|
||||||
|
@ -228,10 +230,10 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
_getCurrentAddressForChain(0, DerivePathType.bip84);
|
_getCurrentAddressForChain(0, DerivePathType.bip84);
|
||||||
Future<String>? _currentReceivingAddress;
|
Future<String>? _currentReceivingAddress;
|
||||||
|
|
||||||
// Future<String> get currentLegacyReceivingAddress =>
|
Future<String> get currentLegacyReceivingAddress =>
|
||||||
// _currentReceivingAddressP2PKH ??=
|
_currentReceivingAddressP2PKH ??=
|
||||||
// _getCurrentAddressForChain(0, DerivePathType.bip44);
|
_getCurrentAddressForChain(0, DerivePathType.bip44);
|
||||||
// Future<String>? _currentReceivingAddressP2PKH;
|
Future<String>? _currentReceivingAddressP2PKH;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> exit() async {
|
Future<void> exit() async {
|
||||||
|
@ -292,28 +294,28 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
// Base58check decode fail
|
// Base58check decode fail
|
||||||
}
|
}
|
||||||
|
|
||||||
return DerivePathType.bip84;
|
// return DerivePathType.bip84;
|
||||||
// if (decodeBase58 != null) {
|
if (decodeBase58 != null) {
|
||||||
// if (decodeBase58[0] == _network.pubKeyHash) {
|
if (decodeBase58[0] == _network.pubKeyHash) {
|
||||||
// // P2PKH
|
// P2PKH
|
||||||
// return DerivePathType.bip44;
|
return DerivePathType.bip44;
|
||||||
// }
|
}
|
||||||
// throw ArgumentError('Invalid version or Network mismatch');
|
throw ArgumentError('Invalid version or Network mismatch');
|
||||||
// } else {
|
} else {
|
||||||
// try {
|
try {
|
||||||
// decodeBech32 = segwit.decode(address, particl.bech32!);
|
decodeBech32 = segwit.decode(address, particl.bech32!);
|
||||||
// } catch (err) {
|
} catch (err) {
|
||||||
// // Bech32 decode fail
|
// Bech32 decode fail
|
||||||
// }
|
}
|
||||||
// if (_network.bech32 != decodeBech32!.hrp) {
|
if (_network.bech32 != decodeBech32!.hrp) {
|
||||||
// throw ArgumentError('Invalid prefix or Network mismatch');
|
throw ArgumentError('Invalid prefix or Network mismatch');
|
||||||
// }
|
}
|
||||||
// if (decodeBech32.version != 0) {
|
if (decodeBech32.version != 0) {
|
||||||
// throw ArgumentError('Invalid address version');
|
throw ArgumentError('Invalid address version');
|
||||||
// }
|
}
|
||||||
// // P2WPKH
|
// P2WPKH
|
||||||
// return DerivePathType.bip84;
|
return DerivePathType.bip84;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool longMutex = false;
|
bool longMutex = false;
|
||||||
|
@ -339,7 +341,6 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
throw Exception("genesis hash does not match main net!");
|
throw Exception("genesis hash does not match main net!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"Attempted to generate a ParticlWallet using a non particl coin type: ${coin.name}");
|
"Attempted to generate a ParticlWallet using a non particl coin type: ${coin.name}");
|
||||||
|
@ -417,13 +418,13 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
);
|
);
|
||||||
String? address;
|
String? address;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// address = P2PKH(
|
address = P2PKH(
|
||||||
// data: PaymentData(pubkey: node.publicKey),
|
data: PaymentData(pubkey: node.publicKey),
|
||||||
// network: _network)
|
network: _network)
|
||||||
// .data
|
.data
|
||||||
// .address!;
|
.address!;
|
||||||
// break;
|
break;
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
address = P2WPKH(
|
address = P2WPKH(
|
||||||
network: _network,
|
network: _network,
|
||||||
|
@ -510,21 +511,21 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
}) async {
|
}) async {
|
||||||
longMutex = true;
|
longMutex = true;
|
||||||
|
|
||||||
// Map<String, Map<String, String>> p2pkhReceiveDerivations = {};
|
Map<String, Map<String, String>> p2pkhReceiveDerivations = {};
|
||||||
Map<String, Map<String, String>> p2wpkhReceiveDerivations = {};
|
Map<String, Map<String, String>> p2wpkhReceiveDerivations = {};
|
||||||
// Map<String, Map<String, String>> p2pkhChangeDerivations = {};
|
Map<String, Map<String, String>> p2pkhChangeDerivations = {};
|
||||||
Map<String, Map<String, String>> p2wpkhChangeDerivations = {};
|
Map<String, Map<String, String>> p2wpkhChangeDerivations = {};
|
||||||
|
|
||||||
final root = await compute(getBip32RootWrapper, Tuple2(mnemonic, _network));
|
final root = await compute(getBip32RootWrapper, Tuple2(mnemonic, _network));
|
||||||
|
|
||||||
// List<String> p2pkhReceiveAddressArray = [];
|
List<String> p2pkhReceiveAddressArray = [];
|
||||||
List<String> p2wpkhReceiveAddressArray = [];
|
List<String> p2wpkhReceiveAddressArray = [];
|
||||||
// int p2pkhReceiveIndex = -1;
|
int p2pkhReceiveIndex = -1;
|
||||||
int p2wpkhReceiveIndex = -1;
|
int p2wpkhReceiveIndex = -1;
|
||||||
|
|
||||||
// List<String> p2pkhChangeAddressArray = [];
|
List<String> p2pkhChangeAddressArray = [];
|
||||||
List<String> p2wpkhChangeAddressArray = [];
|
List<String> p2wpkhChangeAddressArray = [];
|
||||||
// int p2pkhChangeIndex = -1;
|
int p2pkhChangeIndex = -1;
|
||||||
int p2wpkhChangeIndex = -1;
|
int p2wpkhChangeIndex = -1;
|
||||||
|
|
||||||
// actual size is 24 due to p2pkh, and p2wpkh so 12x2
|
// actual size is 24 due to p2pkh, and p2wpkh so 12x2
|
||||||
|
@ -534,8 +535,8 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
// receiving addresses
|
// receiving addresses
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("checking receiving addresses...", level: LogLevel.Info);
|
.log("checking receiving addresses...", level: LogLevel.Info);
|
||||||
// final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||||
// maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
|
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
|
||||||
|
|
||||||
final resultReceive84 = _checkGaps(maxNumberOfIndexesToCheck,
|
final resultReceive84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 0);
|
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 0);
|
||||||
|
@ -543,19 +544,20 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("checking change addresses...", level: LogLevel.Info);
|
.log("checking change addresses...", level: LogLevel.Info);
|
||||||
// change addresses
|
// change addresses
|
||||||
// final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||||
// maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
|
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
|
||||||
|
|
||||||
final resultChange84 = _checkGaps(maxNumberOfIndexesToCheck,
|
final resultChange84 = _checkGaps(maxNumberOfIndexesToCheck,
|
||||||
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 1);
|
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip84, 1);
|
||||||
|
|
||||||
await Future.wait([resultReceive84, resultChange84]);
|
await Future.wait(
|
||||||
|
[resultReceive44, resultReceive84, resultChange44, resultChange84]);
|
||||||
|
|
||||||
// p2pkhReceiveAddressArray =
|
p2pkhReceiveAddressArray =
|
||||||
// (await resultReceive44)['addressArray'] as List<String>;
|
(await resultReceive44)['addressArray'] as List<String>;
|
||||||
// p2pkhReceiveIndex = (await resultReceive44)['index'] as int;
|
p2pkhReceiveIndex = (await resultReceive44)['index'] as int;
|
||||||
// p2pkhReceiveDerivations = (await resultReceive44)['derivations']
|
p2pkhReceiveDerivations = (await resultReceive44)['derivations']
|
||||||
// as Map<String, Map<String, String>>;
|
as Map<String, Map<String, String>>;
|
||||||
|
|
||||||
p2wpkhReceiveAddressArray =
|
p2wpkhReceiveAddressArray =
|
||||||
(await resultReceive84)['addressArray'] as List<String>;
|
(await resultReceive84)['addressArray'] as List<String>;
|
||||||
|
@ -563,11 +565,11 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
p2wpkhReceiveDerivations = (await resultReceive84)['derivations']
|
p2wpkhReceiveDerivations = (await resultReceive84)['derivations']
|
||||||
as Map<String, Map<String, String>>;
|
as Map<String, Map<String, String>>;
|
||||||
|
|
||||||
// p2pkhChangeAddressArray =
|
p2pkhChangeAddressArray =
|
||||||
// (await resultChange44)['addressArray'] as List<String>;
|
(await resultChange44)['addressArray'] as List<String>;
|
||||||
// p2pkhChangeIndex = (await resultChange44)['index'] as int;
|
p2pkhChangeIndex = (await resultChange44)['index'] as int;
|
||||||
// p2pkhChangeDerivations = (await resultChange44)['derivations']
|
p2pkhChangeDerivations = (await resultChange44)['derivations']
|
||||||
// as Map<String, Map<String, String>>;
|
as Map<String, Map<String, String>>;
|
||||||
|
|
||||||
p2wpkhChangeAddressArray =
|
p2wpkhChangeAddressArray =
|
||||||
(await resultChange84)['addressArray'] as List<String>;
|
(await resultChange84)['addressArray'] as List<String>;
|
||||||
|
@ -576,12 +578,12 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
as Map<String, Map<String, String>>;
|
as Map<String, Map<String, String>>;
|
||||||
|
|
||||||
// save the derivations (if any)
|
// save the derivations (if any)
|
||||||
// if (p2pkhReceiveDerivations.isNotEmpty) {
|
if (p2pkhReceiveDerivations.isNotEmpty) {
|
||||||
// await addDerivations(
|
await addDerivations(
|
||||||
// chain: 0,
|
chain: 0,
|
||||||
// derivePathType: DerivePathType.bip44,
|
derivePathType: DerivePathType.bip44,
|
||||||
// derivationsToAdd: p2pkhReceiveDerivations);
|
derivationsToAdd: p2pkhReceiveDerivations);
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (p2wpkhReceiveDerivations.isNotEmpty) {
|
if (p2wpkhReceiveDerivations.isNotEmpty) {
|
||||||
await addDerivations(
|
await addDerivations(
|
||||||
|
@ -589,12 +591,12 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
derivePathType: DerivePathType.bip84,
|
derivePathType: DerivePathType.bip84,
|
||||||
derivationsToAdd: p2wpkhReceiveDerivations);
|
derivationsToAdd: p2wpkhReceiveDerivations);
|
||||||
}
|
}
|
||||||
// if (p2pkhChangeDerivations.isNotEmpty) {
|
if (p2pkhChangeDerivations.isNotEmpty) {
|
||||||
// await addDerivations(
|
await addDerivations(
|
||||||
// chain: 1,
|
chain: 1,
|
||||||
// derivePathType: DerivePathType.bip44,
|
derivePathType: DerivePathType.bip44,
|
||||||
// derivationsToAdd: p2pkhChangeDerivations);
|
derivationsToAdd: p2pkhChangeDerivations);
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (p2wpkhChangeDerivations.isNotEmpty) {
|
if (p2wpkhChangeDerivations.isNotEmpty) {
|
||||||
await addDerivations(
|
await addDerivations(
|
||||||
|
@ -605,12 +607,12 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
|
|
||||||
// If restoring a wallet that never received any funds, then set receivingArray manually
|
// If restoring a wallet that never received any funds, then set receivingArray manually
|
||||||
// If we didn't do this, it'd store an empty array
|
// If we didn't do this, it'd store an empty array
|
||||||
// if (p2pkhReceiveIndex == -1) {
|
if (p2pkhReceiveIndex == -1) {
|
||||||
// final address =
|
final address =
|
||||||
// await _generateAddressForChain(0, 0, DerivePathType.bip44);
|
await _generateAddressForChain(0, 0, DerivePathType.bip44);
|
||||||
// p2pkhReceiveAddressArray.add(address);
|
p2pkhReceiveAddressArray.add(address);
|
||||||
// p2pkhReceiveIndex = 0;
|
p2pkhReceiveIndex = 0;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (p2wpkhReceiveIndex == -1) {
|
if (p2wpkhReceiveIndex == -1) {
|
||||||
final address =
|
final address =
|
||||||
|
@ -621,12 +623,12 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
|
|
||||||
// If restoring a wallet that never sent any funds with change, then set changeArray
|
// If restoring a wallet that never sent any funds with change, then set changeArray
|
||||||
// manually. If we didn't do this, it'd store an empty array.
|
// manually. If we didn't do this, it'd store an empty array.
|
||||||
// if (p2pkhChangeIndex == -1) {
|
if (p2pkhChangeIndex == -1) {
|
||||||
// final address =
|
final address =
|
||||||
// await _generateAddressForChain(1, 0, DerivePathType.bip44);
|
await _generateAddressForChain(1, 0, DerivePathType.bip44);
|
||||||
// p2pkhChangeAddressArray.add(address);
|
p2pkhChangeAddressArray.add(address);
|
||||||
// p2pkhChangeIndex = 0;
|
p2pkhChangeIndex = 0;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (p2wpkhChangeIndex == -1) {
|
if (p2wpkhChangeIndex == -1) {
|
||||||
final address =
|
final address =
|
||||||
|
@ -643,14 +645,14 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
boxName: walletId,
|
boxName: walletId,
|
||||||
key: 'changeAddressesP2WPKH',
|
key: 'changeAddressesP2WPKH',
|
||||||
value: p2wpkhChangeAddressArray);
|
value: p2wpkhChangeAddressArray);
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'receivingAddressesP2PKH',
|
key: 'receivingAddressesP2PKH',
|
||||||
// value: p2pkhReceiveAddressArray);
|
value: p2pkhReceiveAddressArray);
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'changeAddressesP2PKH',
|
key: 'changeAddressesP2PKH',
|
||||||
// value: p2pkhChangeAddressArray);
|
value: p2pkhChangeAddressArray);
|
||||||
await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
boxName: walletId,
|
boxName: walletId,
|
||||||
key: 'receivingIndexP2WPKH',
|
key: 'receivingIndexP2WPKH',
|
||||||
|
@ -659,12 +661,12 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
boxName: walletId,
|
boxName: walletId,
|
||||||
key: 'changeIndexP2WPKH',
|
key: 'changeIndexP2WPKH',
|
||||||
value: p2wpkhChangeIndex);
|
value: p2wpkhChangeIndex);
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId, key: 'changeIndexP2PKH', value: p2pkhChangeIndex);
|
boxName: walletId, key: 'changeIndexP2PKH', value: p2pkhChangeIndex);
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'receivingIndexP2PKH',
|
key: 'receivingIndexP2PKH',
|
||||||
// value: p2pkhReceiveIndex);
|
value: p2pkhReceiveIndex);
|
||||||
await DB.instance
|
await DB.instance
|
||||||
.put<dynamic>(boxName: walletId, key: "id", value: _walletId);
|
.put<dynamic>(boxName: walletId, key: "id", value: _walletId);
|
||||||
await DB.instance
|
await DB.instance
|
||||||
|
@ -934,15 +936,12 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"Periodic refresh check for $walletId $walletName in object instance: $hashCode",
|
"Periodic refresh check for $walletId $walletName in object instance: $hashCode",
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
// chain height check currently broken
|
|
||||||
// if ((await chainHeight) != (await storedChainHeight)) {
|
|
||||||
if (await refreshIfThereIsNewData()) {
|
if (await refreshIfThereIsNewData()) {
|
||||||
await refresh();
|
await refresh();
|
||||||
GlobalEventBus.instance.fire(UpdatedInBackgroundEvent(
|
GlobalEventBus.instance.fire(UpdatedInBackgroundEvent(
|
||||||
"New data found in $walletId $walletName in background!",
|
"New data found in $walletId $walletName in background!",
|
||||||
walletId));
|
walletId));
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error, strace) {
|
} catch (error, strace) {
|
||||||
|
@ -1228,20 +1227,15 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
confirmations: 0,
|
confirmations: 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
Logging.instance.log("CACHED TX DATA IS: $cachedTxData",
|
|
||||||
level: LogLevel.Info, printFullLength: true);
|
|
||||||
|
|
||||||
if (cachedTxData == null) {
|
if (cachedTxData == null) {
|
||||||
Logging.instance.log("CACHED TX DATA IS NULL : $cachedTxData",
|
|
||||||
level: LogLevel.Info, printFullLength: true);
|
|
||||||
final data = await _fetchTransactionData();
|
final data = await _fetchTransactionData();
|
||||||
_transactionData = Future(() => data);
|
_transactionData = Future(() => data);
|
||||||
|
} else {
|
||||||
|
final transactions = cachedTxData!.getAllTransactions();
|
||||||
|
transactions[tx.txid] = tx;
|
||||||
|
cachedTxData = models.TransactionData.fromMap(transactions);
|
||||||
|
_transactionData = Future(() => cachedTxData!);
|
||||||
}
|
}
|
||||||
|
|
||||||
final transactions = cachedTxData!.getAllTransactions();
|
|
||||||
transactions[tx.txid] = tx;
|
|
||||||
cachedTxData = models.TransactionData.fromMap(transactions);
|
|
||||||
_transactionData = Future(() => cachedTxData!);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1353,11 +1347,11 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
boxName: walletId, key: 'receivingAddressesP2WPKH') as List<dynamic>;
|
boxName: walletId, key: 'receivingAddressesP2WPKH') as List<dynamic>;
|
||||||
final changeAddresses = DB.instance.get<dynamic>(
|
final changeAddresses = DB.instance.get<dynamic>(
|
||||||
boxName: walletId, key: 'changeAddressesP2WPKH') as List<dynamic>;
|
boxName: walletId, key: 'changeAddressesP2WPKH') as List<dynamic>;
|
||||||
// final receivingAddressesP2PKH = DB.instance.get<dynamic>(
|
final receivingAddressesP2PKH = DB.instance.get<dynamic>(
|
||||||
// boxName: walletId, key: 'receivingAddressesP2PKH') as List<dynamic>;
|
boxName: walletId, key: 'receivingAddressesP2PKH') as List<dynamic>;
|
||||||
// final changeAddressesP2PKH =
|
final changeAddressesP2PKH =
|
||||||
// DB.instance.get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH')
|
DB.instance.get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH')
|
||||||
// as List<dynamic>;
|
as List<dynamic>;
|
||||||
|
|
||||||
for (var i = 0; i < receivingAddresses.length; i++) {
|
for (var i = 0; i < receivingAddresses.length; i++) {
|
||||||
if (!allAddresses.contains(receivingAddresses[i])) {
|
if (!allAddresses.contains(receivingAddresses[i])) {
|
||||||
|
@ -1442,10 +1436,10 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
.put<dynamic>(boxName: walletId, key: "receivingIndexP2WPKH", value: 0);
|
.put<dynamic>(boxName: walletId, key: "receivingIndexP2WPKH", value: 0);
|
||||||
await DB.instance
|
await DB.instance
|
||||||
.put<dynamic>(boxName: walletId, key: "changeIndexP2WPKH", value: 0);
|
.put<dynamic>(boxName: walletId, key: "changeIndexP2WPKH", value: 0);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .put<dynamic>(boxName: walletId, key: "receivingIndexP2PKH", value: 0);
|
.put<dynamic>(boxName: walletId, key: "receivingIndexP2PKH", value: 0);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .put<dynamic>(boxName: walletId, key: "changeIndexP2PKH", value: 0);
|
.put<dynamic>(boxName: walletId, key: "changeIndexP2PKH", value: 0);
|
||||||
await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
boxName: walletId,
|
boxName: walletId,
|
||||||
key: 'blocked_tx_hashes',
|
key: 'blocked_tx_hashes',
|
||||||
|
@ -1510,21 +1504,6 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
// DerivePathType.bip44,
|
// DerivePathType.bip44,
|
||||||
// ));
|
// ));
|
||||||
//
|
//
|
||||||
// // P2SH
|
|
||||||
// _generateAddressForChain(0, 0, DerivePathType.bip49).then(
|
|
||||||
// (initialReceivingAddressP2SH) {
|
|
||||||
// _addToAddressesArrayForChain(
|
|
||||||
// initialReceivingAddressP2SH, 0, DerivePathType.bip49);
|
|
||||||
// this._currentReceivingAddressP2SH =
|
|
||||||
// Future(() => initialReceivingAddressP2SH);
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// _generateAddressForChain(1, 0, DerivePathType.bip49)
|
|
||||||
// .then((initialChangeAddressP2SH) => _addToAddressesArrayForChain(
|
|
||||||
// initialChangeAddressP2SH,
|
|
||||||
// 1,
|
|
||||||
// DerivePathType.bip49,
|
|
||||||
// ));
|
|
||||||
|
|
||||||
Logging.instance.log("_generateNewWalletFinished", level: LogLevel.Info);
|
Logging.instance.log("_generateNewWalletFinished", level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
@ -1549,17 +1528,17 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final data = PaymentData(pubkey: node.publicKey);
|
final data = PaymentData(pubkey: node.publicKey);
|
||||||
// String address;
|
String address;
|
||||||
|
|
||||||
// switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// // case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// // address = P2PKH(data: data, network: _network).data.address!;
|
address = P2PKH(data: data, network: _network).data.address!;
|
||||||
// // break;
|
break;
|
||||||
// case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
// address = P2WPKH(network: _network, data: data).data.address!;
|
address = P2WPKH(network: _network, data: data).data.address!;
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
String address = P2WPKH(network: _network, data: data).data.address!;
|
// String address = P2WPKH(network: _network, data: data).data.address!;
|
||||||
|
|
||||||
// add generated address & info to derivations
|
// add generated address & info to derivations
|
||||||
await addDerivation(
|
await addDerivation(
|
||||||
|
@ -1579,15 +1558,14 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
int chain, DerivePathType derivePathType) async {
|
int chain, DerivePathType derivePathType) async {
|
||||||
// Here we assume chain == 1 if it isn't 0
|
// Here we assume chain == 1 if it isn't 0
|
||||||
String indexKey = chain == 0 ? "receivingIndex" : "changeIndex";
|
String indexKey = chain == 0 ? "receivingIndex" : "changeIndex";
|
||||||
// switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// indexKey += "P2PKH";
|
indexKey += "P2PKH";
|
||||||
// break;
|
break;
|
||||||
// case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
// indexKey += "P2WPKH";
|
indexKey += "P2WPKH";
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
indexKey += "P2WPKH";
|
|
||||||
final newIndex =
|
final newIndex =
|
||||||
(DB.instance.get<dynamic>(boxName: walletId, key: indexKey)) + 1;
|
(DB.instance.get<dynamic>(boxName: walletId, key: indexKey)) + 1;
|
||||||
await DB.instance
|
await DB.instance
|
||||||
|
@ -1606,9 +1584,9 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
chainArray = 'changeAddresses';
|
chainArray = 'changeAddresses';
|
||||||
}
|
}
|
||||||
switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// chainArray += "P2PKH";
|
chainArray += "P2PKH";
|
||||||
// break;
|
break;
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
chainArray += "P2WPKH";
|
chainArray += "P2WPKH";
|
||||||
break;
|
break;
|
||||||
|
@ -1643,9 +1621,9 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
// Here, we assume that chain == 1 if it isn't 0
|
// Here, we assume that chain == 1 if it isn't 0
|
||||||
String arrayKey = chain == 0 ? "receivingAddresses" : "changeAddresses";
|
String arrayKey = chain == 0 ? "receivingAddresses" : "changeAddresses";
|
||||||
switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// arrayKey += "P2PKH";
|
arrayKey += "P2PKH";
|
||||||
// break;
|
break;
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
arrayKey += "P2WPKH";
|
arrayKey += "P2WPKH";
|
||||||
break;
|
break;
|
||||||
|
@ -1661,15 +1639,15 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
}) {
|
}) {
|
||||||
String key;
|
String key;
|
||||||
String chainId = chain == 0 ? "receive" : "change";
|
String chainId = chain == 0 ? "receive" : "change";
|
||||||
key = "${walletId}_${chainId}DerivationsP2WPKH";
|
|
||||||
// switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// key = "${walletId}_${chainId}DerivationsP2PKH";
|
key = "${walletId}_${chainId}DerivationsP2PKH";
|
||||||
// break;
|
break;
|
||||||
// case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
// key = "${walletId}_${chainId}DerivationsP2WPKH";
|
key = "${walletId}_${chainId}DerivationsP2WPKH";
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1978,9 +1956,9 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
// Check the new receiving index
|
// Check the new receiving index
|
||||||
String indexKey = "receivingIndex";
|
String indexKey = "receivingIndex";
|
||||||
switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// indexKey += "P2PKH";
|
indexKey += "P2PKH";
|
||||||
// break;
|
break;
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
indexKey += "P2WPKH";
|
indexKey += "P2WPKH";
|
||||||
break;
|
break;
|
||||||
|
@ -1999,9 +1977,9 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
// Set the new receiving address that the service
|
// Set the new receiving address that the service
|
||||||
|
|
||||||
switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// _currentReceivingAddressP2PKH = Future(() => newReceivingAddress);
|
_currentReceivingAddressP2PKH = Future(() => newReceivingAddress);
|
||||||
// break;
|
break;
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
_currentReceivingAddress = Future(() => newReceivingAddress);
|
_currentReceivingAddress = Future(() => newReceivingAddress);
|
||||||
break;
|
break;
|
||||||
|
@ -2032,9 +2010,9 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
// Check the new change index
|
// Check the new change index
|
||||||
String indexKey = "changeIndex";
|
String indexKey = "changeIndex";
|
||||||
switch (derivePathType) {
|
switch (derivePathType) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// indexKey += "P2PKH";
|
indexKey += "P2PKH";
|
||||||
// break;
|
break;
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
indexKey += "P2WPKH";
|
indexKey += "P2WPKH";
|
||||||
break;
|
break;
|
||||||
|
@ -2911,7 +2889,7 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
print("CALLING FETCH BUILD TX DATA");
|
print("CALLING FETCH BUILD TX DATA");
|
||||||
|
|
||||||
// addresses to check
|
// addresses to check
|
||||||
// List<String> addressesP2PKH = [];
|
List<String> addressesP2PKH = [];
|
||||||
List<String> addressesP2WPKH = [];
|
List<String> addressesP2WPKH = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -2933,9 +2911,9 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
}
|
}
|
||||||
(addressTxid[address] as List).add(txid);
|
(addressTxid[address] as List).add(txid);
|
||||||
switch (addressType(address: address)) {
|
switch (addressType(address: address)) {
|
||||||
// case DerivePathType.bip44:
|
case DerivePathType.bip44:
|
||||||
// addressesP2PKH.add(address);
|
addressesP2PKH.add(address);
|
||||||
// break;
|
break;
|
||||||
case DerivePathType.bip84:
|
case DerivePathType.bip84:
|
||||||
addressesP2WPKH.add(address);
|
addressesP2WPKH.add(address);
|
||||||
break;
|
break;
|
||||||
|
@ -2945,62 +2923,62 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
// p2pkh / bip44
|
// p2pkh / bip44
|
||||||
// final p2pkhLength = addressesP2PKH.length;
|
final p2pkhLength = addressesP2PKH.length;
|
||||||
// if (p2pkhLength > 0) {
|
if (p2pkhLength > 0) {
|
||||||
// final receiveDerivations = await _fetchDerivations(
|
final receiveDerivations = await _fetchDerivations(
|
||||||
// chain: 0,
|
chain: 0,
|
||||||
// derivePathType: DerivePathType.bip44,
|
derivePathType: DerivePathType.bip44,
|
||||||
// );
|
);
|
||||||
// final changeDerivations = await _fetchDerivations(
|
final changeDerivations = await _fetchDerivations(
|
||||||
// chain: 1,
|
chain: 1,
|
||||||
// derivePathType: DerivePathType.bip44,
|
derivePathType: DerivePathType.bip44,
|
||||||
// );
|
);
|
||||||
// for (int i = 0; i < p2pkhLength; i++) {
|
for (int i = 0; i < p2pkhLength; i++) {
|
||||||
// // receives
|
// receives
|
||||||
// final receiveDerivation = receiveDerivations[addressesP2PKH[i]];
|
final receiveDerivation = receiveDerivations[addressesP2PKH[i]];
|
||||||
// // if a match exists it will not be null
|
// if a match exists it will not be null
|
||||||
// if (receiveDerivation != null) {
|
if (receiveDerivation != null) {
|
||||||
// final data = P2PKH(
|
final data = P2PKH(
|
||||||
// data: PaymentData(
|
data: PaymentData(
|
||||||
// pubkey: Format.stringToUint8List(
|
pubkey: Format.stringToUint8List(
|
||||||
// receiveDerivation["pubKey"] as String)),
|
receiveDerivation["pubKey"] as String)),
|
||||||
// network: _network,
|
network: _network,
|
||||||
// ).data;
|
).data;
|
||||||
//
|
|
||||||
// for (String tx in addressTxid[addressesP2PKH[i]]!) {
|
for (String tx in addressTxid[addressesP2PKH[i]]!) {
|
||||||
// results[tx] = {
|
results[tx] = {
|
||||||
// "output": data.output,
|
"output": data.output,
|
||||||
// "keyPair": ECPair.fromWIF(
|
"keyPair": ECPair.fromWIF(
|
||||||
// receiveDerivation["wif"] as String,
|
receiveDerivation["wif"] as String,
|
||||||
// network: _network,
|
network: _network,
|
||||||
// ),
|
),
|
||||||
// };
|
};
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// // if its not a receive, check change
|
// if its not a receive, check change
|
||||||
// final changeDerivation = changeDerivations[addressesP2PKH[i]];
|
final changeDerivation = changeDerivations[addressesP2PKH[i]];
|
||||||
// // if a match exists it will not be null
|
// if a match exists it will not be null
|
||||||
// if (changeDerivation != null) {
|
if (changeDerivation != null) {
|
||||||
// final data = P2PKH(
|
final data = P2PKH(
|
||||||
// data: PaymentData(
|
data: PaymentData(
|
||||||
// pubkey: Format.stringToUint8List(
|
pubkey: Format.stringToUint8List(
|
||||||
// changeDerivation["pubKey"] as String)),
|
changeDerivation["pubKey"] as String)),
|
||||||
// network: _network,
|
network: _network,
|
||||||
// ).data;
|
).data;
|
||||||
//
|
|
||||||
// for (String tx in addressTxid[addressesP2PKH[i]]!) {
|
for (String tx in addressTxid[addressesP2PKH[i]]!) {
|
||||||
// results[tx] = {
|
results[tx] = {
|
||||||
// "output": data.output,
|
"output": data.output,
|
||||||
// "keyPair": ECPair.fromWIF(
|
"keyPair": ECPair.fromWIF(
|
||||||
// changeDerivation["wif"] as String,
|
changeDerivation["wif"] as String,
|
||||||
// network: _network,
|
network: _network,
|
||||||
// ),
|
),
|
||||||
// };
|
};
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// p2wpkh / bip84
|
// p2wpkh / bip84
|
||||||
final p2wpkhLength = addressesP2WPKH.length;
|
final p2wpkhLength = addressesP2WPKH.length;
|
||||||
|
@ -3214,38 +3192,38 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
|
|
||||||
// restore from backup
|
// restore from backup
|
||||||
// p2pkh
|
// p2pkh
|
||||||
// final tempReceivingAddressesP2PKH = DB.instance
|
final tempReceivingAddressesP2PKH = DB.instance
|
||||||
// .get<dynamic>(boxName: walletId, key: 'receivingAddressesP2PKH_BACKUP');
|
.get<dynamic>(boxName: walletId, key: 'receivingAddressesP2PKH_BACKUP');
|
||||||
// final tempChangeAddressesP2PKH = DB.instance
|
final tempChangeAddressesP2PKH = DB.instance
|
||||||
// .get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH_BACKUP');
|
.get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH_BACKUP');
|
||||||
// final tempReceivingIndexP2PKH = DB.instance
|
final tempReceivingIndexP2PKH = DB.instance
|
||||||
// .get<dynamic>(boxName: walletId, key: 'receivingIndexP2PKH_BACKUP');
|
.get<dynamic>(boxName: walletId, key: 'receivingIndexP2PKH_BACKUP');
|
||||||
// final tempChangeIndexP2PKH = DB.instance
|
final tempChangeIndexP2PKH = DB.instance
|
||||||
// .get<dynamic>(boxName: walletId, key: 'changeIndexP2PKH_BACKUP');
|
.get<dynamic>(boxName: walletId, key: 'changeIndexP2PKH_BACKUP');
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'receivingAddressesP2PKH',
|
key: 'receivingAddressesP2PKH',
|
||||||
// value: tempReceivingAddressesP2PKH);
|
value: tempReceivingAddressesP2PKH);
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'changeAddressesP2PKH',
|
key: 'changeAddressesP2PKH',
|
||||||
// value: tempChangeAddressesP2PKH);
|
value: tempChangeAddressesP2PKH);
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'receivingIndexP2PKH',
|
key: 'receivingIndexP2PKH',
|
||||||
// value: tempReceivingIndexP2PKH);
|
value: tempReceivingIndexP2PKH);
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'changeIndexP2PKH',
|
key: 'changeIndexP2PKH',
|
||||||
// value: tempChangeIndexP2PKH);
|
value: tempChangeIndexP2PKH);
|
||||||
// await DB.instance.delete<dynamic>(
|
await DB.instance.delete<dynamic>(
|
||||||
// key: 'receivingAddressesP2PKH_BACKUP', boxName: walletId);
|
key: 'receivingAddressesP2PKH_BACKUP', boxName: walletId);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .delete<dynamic>(key: 'changeAddressesP2PKH_BACKUP', boxName: walletId);
|
.delete<dynamic>(key: 'changeAddressesP2PKH_BACKUP', boxName: walletId);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .delete<dynamic>(key: 'receivingIndexP2PKH_BACKUP', boxName: walletId);
|
.delete<dynamic>(key: 'receivingIndexP2PKH_BACKUP', boxName: walletId);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .delete<dynamic>(key: 'changeIndexP2PKH_BACKUP', boxName: walletId);
|
.delete<dynamic>(key: 'changeIndexP2PKH_BACKUP', boxName: walletId);
|
||||||
|
|
||||||
// p2wpkh
|
// p2wpkh
|
||||||
final tempReceivingAddressesP2WPKH = DB.instance.get<dynamic>(
|
final tempReceivingAddressesP2WPKH = DB.instance.get<dynamic>(
|
||||||
|
@ -3282,21 +3260,21 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
.delete<dynamic>(key: 'changeIndexP2WPKH_BACKUP', boxName: walletId);
|
.delete<dynamic>(key: 'changeIndexP2WPKH_BACKUP', boxName: walletId);
|
||||||
|
|
||||||
// P2PKH derivations
|
// P2PKH derivations
|
||||||
// final p2pkhReceiveDerivationsString = await _secureStore.read(
|
final p2pkhReceiveDerivationsString = await _secureStore.read(
|
||||||
// key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
|
key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
|
||||||
// final p2pkhChangeDerivationsString = await _secureStore.read(
|
final p2pkhChangeDerivationsString = await _secureStore.read(
|
||||||
// key: "${walletId}_changeDerivationsP2PKH_BACKUP");
|
key: "${walletId}_changeDerivationsP2PKH_BACKUP");
|
||||||
//
|
|
||||||
// await _secureStore.write(
|
await _secureStore.write(
|
||||||
// key: "${walletId}_receiveDerivationsP2PKH",
|
key: "${walletId}_receiveDerivationsP2PKH",
|
||||||
// value: p2pkhReceiveDerivationsString);
|
value: p2pkhReceiveDerivationsString);
|
||||||
// await _secureStore.write(
|
await _secureStore.write(
|
||||||
// key: "${walletId}_changeDerivationsP2PKH",
|
key: "${walletId}_changeDerivationsP2PKH",
|
||||||
// value: p2pkhChangeDerivationsString);
|
value: p2pkhChangeDerivationsString);
|
||||||
//
|
|
||||||
// await _secureStore.delete(
|
await _secureStore.delete(
|
||||||
// key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
|
key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
|
||||||
// await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH_BACKUP");
|
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH_BACKUP");
|
||||||
|
|
||||||
// P2WPKH derivations
|
// P2WPKH derivations
|
||||||
final p2wpkhReceiveDerivationsString = await _secureStore.read(
|
final p2wpkhReceiveDerivationsString = await _secureStore.read(
|
||||||
|
@ -3332,41 +3310,41 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
|
|
||||||
// backup current and clear data
|
// backup current and clear data
|
||||||
// p2pkh
|
// p2pkh
|
||||||
// final tempReceivingAddressesP2PKH = DB.instance
|
final tempReceivingAddressesP2PKH = DB.instance
|
||||||
// .get<dynamic>(boxName: walletId, key: 'receivingAddressesP2PKH');
|
.get<dynamic>(boxName: walletId, key: 'receivingAddressesP2PKH');
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'receivingAddressesP2PKH_BACKUP',
|
key: 'receivingAddressesP2PKH_BACKUP',
|
||||||
// value: tempReceivingAddressesP2PKH);
|
value: tempReceivingAddressesP2PKH);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .delete<dynamic>(key: 'receivingAddressesP2PKH', boxName: walletId);
|
.delete<dynamic>(key: 'receivingAddressesP2PKH', boxName: walletId);
|
||||||
//
|
|
||||||
// final tempChangeAddressesP2PKH = DB.instance
|
final tempChangeAddressesP2PKH = DB.instance
|
||||||
// .get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH');
|
.get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH');
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'changeAddressesP2PKH_BACKUP',
|
key: 'changeAddressesP2PKH_BACKUP',
|
||||||
// value: tempChangeAddressesP2PKH);
|
value: tempChangeAddressesP2PKH);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .delete<dynamic>(key: 'changeAddressesP2PKH', boxName: walletId);
|
.delete<dynamic>(key: 'changeAddressesP2PKH', boxName: walletId);
|
||||||
//
|
|
||||||
// final tempReceivingIndexP2PKH =
|
final tempReceivingIndexP2PKH =
|
||||||
// DB.instance.get<dynamic>(boxName: walletId, key: 'receivingIndexP2PKH');
|
DB.instance.get<dynamic>(boxName: walletId, key: 'receivingIndexP2PKH');
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'receivingIndexP2PKH_BACKUP',
|
key: 'receivingIndexP2PKH_BACKUP',
|
||||||
// value: tempReceivingIndexP2PKH);
|
value: tempReceivingIndexP2PKH);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .delete<dynamic>(key: 'receivingIndexP2PKH', boxName: walletId);
|
.delete<dynamic>(key: 'receivingIndexP2PKH', boxName: walletId);
|
||||||
//
|
|
||||||
// final tempChangeIndexP2PKH =
|
final tempChangeIndexP2PKH =
|
||||||
// DB.instance.get<dynamic>(boxName: walletId, key: 'changeIndexP2PKH');
|
DB.instance.get<dynamic>(boxName: walletId, key: 'changeIndexP2PKH');
|
||||||
// await DB.instance.put<dynamic>(
|
await DB.instance.put<dynamic>(
|
||||||
// boxName: walletId,
|
boxName: walletId,
|
||||||
// key: 'changeIndexP2PKH_BACKUP',
|
key: 'changeIndexP2PKH_BACKUP',
|
||||||
// value: tempChangeIndexP2PKH);
|
value: tempChangeIndexP2PKH);
|
||||||
// await DB.instance
|
await DB.instance
|
||||||
// .delete<dynamic>(key: 'changeIndexP2PKH', boxName: walletId);
|
.delete<dynamic>(key: 'changeIndexP2PKH', boxName: walletId);
|
||||||
|
|
||||||
// p2wpkh
|
// p2wpkh
|
||||||
final tempReceivingAddressesP2WPKH = DB.instance
|
final tempReceivingAddressesP2WPKH = DB.instance
|
||||||
|
@ -3406,20 +3384,20 @@ class ParticlWallet extends CoinServiceAPI {
|
||||||
.delete<dynamic>(key: 'changeIndexP2WPKH', boxName: walletId);
|
.delete<dynamic>(key: 'changeIndexP2WPKH', boxName: walletId);
|
||||||
|
|
||||||
// P2PKH derivations
|
// P2PKH derivations
|
||||||
// final p2pkhReceiveDerivationsString =
|
final p2pkhReceiveDerivationsString =
|
||||||
// await _secureStore.read(key: "${walletId}_receiveDerivationsP2PKH");
|
await _secureStore.read(key: "${walletId}_receiveDerivationsP2PKH");
|
||||||
// final p2pkhChangeDerivationsString =
|
final p2pkhChangeDerivationsString =
|
||||||
// await _secureStore.read(key: "${walletId}_changeDerivationsP2PKH");
|
await _secureStore.read(key: "${walletId}_changeDerivationsP2PKH");
|
||||||
//
|
|
||||||
// await _secureStore.write(
|
await _secureStore.write(
|
||||||
// key: "${walletId}_receiveDerivationsP2PKH_BACKUP",
|
key: "${walletId}_receiveDerivationsP2PKH_BACKUP",
|
||||||
// value: p2pkhReceiveDerivationsString);
|
value: p2pkhReceiveDerivationsString);
|
||||||
// await _secureStore.write(
|
await _secureStore.write(
|
||||||
// key: "${walletId}_changeDerivationsP2PKH_BACKUP",
|
key: "${walletId}_changeDerivationsP2PKH_BACKUP",
|
||||||
// value: p2pkhChangeDerivationsString);
|
value: p2pkhChangeDerivationsString);
|
||||||
//
|
|
||||||
// await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
|
||||||
// await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
|
||||||
|
|
||||||
// P2WPKH derivations
|
// P2WPKH derivations
|
||||||
final p2wpkhReceiveDerivationsString =
|
final p2wpkhReceiveDerivationsString =
|
||||||
|
|
Loading…
Reference in a new issue