mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-19 01:04:43 +00:00
address generation issues mostly resolved
This commit is contained in:
parent
554df09c99
commit
f8d76fb2e1
1 changed files with 7 additions and 43 deletions
|
@ -33,7 +33,6 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
|
||||||
mwebAddrs.add(mwebAddresses[i].address);
|
mwebAddrs.add(mwebAddresses[i].address);
|
||||||
}
|
}
|
||||||
print("initialized with ${mwebAddrs.length} mweb addresses");
|
print("initialized with ${mwebAddrs.length} mweb addresses");
|
||||||
initMwebAddresses();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Bip32Slip10Secp256k1 mwebHd;
|
final Bip32Slip10Secp256k1 mwebHd;
|
||||||
|
@ -47,8 +46,14 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
|
await initMwebAddresses();
|
||||||
await super.init();
|
await super.init();
|
||||||
initMwebAddresses();
|
}
|
||||||
|
|
||||||
|
@computed
|
||||||
|
@override
|
||||||
|
List<BitcoinAddressRecord> get allAddresses {
|
||||||
|
return List.from(super.allAddresses)..addAll(mwebAddresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> ensureMwebAddressUpToIndexExists(int index) async {
|
Future<void> ensureMwebAddressUpToIndexExists(int index) async {
|
||||||
|
@ -60,16 +65,6 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> generateNumAddresses(int num) async {
|
|
||||||
Uint8List scan = Uint8List.fromList(scanSecret);
|
|
||||||
Uint8List spend = Uint8List.fromList(spendPubkey);
|
|
||||||
for (int i = 0; i < num; i++) {
|
|
||||||
final address = await CwMweb.address(scan, spend, mwebAddrs.length);
|
|
||||||
mwebAddrs.add(address!);
|
|
||||||
await Future.delayed(Duration.zero);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initMwebAddresses() async {
|
Future<void> initMwebAddresses() async {
|
||||||
print("Initializing MWEB addresses!");
|
print("Initializing MWEB addresses!");
|
||||||
|
|
||||||
|
@ -86,41 +81,10 @@ abstract class LitecoinWalletAddressesBase extends ElectrumWalletAddresses with
|
||||||
network: network,
|
network: network,
|
||||||
))
|
))
|
||||||
.toList();
|
.toList();
|
||||||
addAddresses(addressRecords);
|
|
||||||
addMwebAddresses(addressRecords);
|
addMwebAddresses(addressRecords);
|
||||||
print("added ${addressRecords.length} mweb addresses");
|
print("added ${addressRecords.length} mweb addresses");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer.periodic(const Duration(seconds: 2), (timer) async {
|
|
||||||
// if (super.allAddresses.length > 1000) {
|
|
||||||
// timer.cancel();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// print("Generating MWEB addresses...");
|
|
||||||
// await generateNumAddresses(250);
|
|
||||||
// await Future.delayed(const Duration(milliseconds: 1500));
|
|
||||||
|
|
||||||
// if (mwebAddrs.length > 1000) {
|
|
||||||
// // convert mwebAddrs to BitcoinAddressRecords:
|
|
||||||
// List<BitcoinAddressRecord> mwebAddresses = mwebAddrs
|
|
||||||
// .asMap()
|
|
||||||
// .entries
|
|
||||||
// .map((e) => BitcoinAddressRecord(
|
|
||||||
// e.value,
|
|
||||||
// index: e.key,
|
|
||||||
// type: SegwitAddresType.mweb,
|
|
||||||
// network: network,
|
|
||||||
// ))
|
|
||||||
// .toList();
|
|
||||||
// // add them to the list of all addresses:
|
|
||||||
// addAddresses(mwebAddresses);
|
|
||||||
// addMwebAddresses(mwebAddresses);
|
|
||||||
// print("MWEB addresses initialized ${mwebAddrs.length}");
|
|
||||||
// timer.cancel();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in a new issue