mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
WIP nextChangeAddress
WIP move reserve_change_addresses(int addresses) to fusion interface
This commit is contained in:
parent
6246b6c931
commit
c620a5e23a
3 changed files with 36 additions and 6 deletions
|
@ -1 +1 @@
|
|||
Subproject commit b4209c1523cf53d9db805ce0924e6902c716c0f3
|
||||
Subproject commit ad107a683cfdf72040270921062fc6f43ae63f6b
|
|
@ -26,7 +26,8 @@ import 'package:stackwallet/db/isar/main_db.dart';
|
|||
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart';
|
||||
import 'package:stackwallet/electrumx_rpc/electrumx.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/address.dart'
|
||||
as stack_address;
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models;
|
||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||
import 'package:stackwallet/models/signing_data.dart';
|
||||
|
@ -197,8 +198,25 @@ class BitcoinCashWallet extends CoinServiceAPI
|
|||
.findFirst()) ??
|
||||
await _generateAddressForChain(0, 0, DerivePathTypeExt.primaryFor(coin));
|
||||
|
||||
Future<String> get currentChangeAddress async =>
|
||||
(await _currentChangeAddress).value;
|
||||
Future<String> get currentChangeAddress async => (await _currentChangeAddress)
|
||||
.value; // could return Address to cast Stack's Address to Fusiondart's Address like `(await _currentChangeAddress).toFusionAddress();`
|
||||
|
||||
Future<String> get nextChangeAddress async {
|
||||
// get change <Address>
|
||||
final currentChange = await _currentChangeAddress;
|
||||
// use <Address>.derivationmIndex + 1 to get next change address derivation path
|
||||
final int nextChangeIndex = currentChange.derivationIndex + 1;
|
||||
// generate next change address
|
||||
final stack_address.Address newChangeAddress =
|
||||
await _generateAddressForChain(
|
||||
1,
|
||||
nextChangeIndex,
|
||||
DerivePathTypeExt.primaryFor(
|
||||
coin)); // may need to pick other derive path type, eg 44, 49, 84
|
||||
|
||||
return newChangeAddress
|
||||
.value; // could return Address to cast Stack's Address to Fusiondart's Address like `newChangeAddress.toFusionAddress();`
|
||||
}
|
||||
|
||||
Future<isar_models.Address> get _currentChangeAddress async =>
|
||||
(await db
|
||||
|
@ -2147,10 +2165,10 @@ class BitcoinCashWallet extends CoinServiceAPI
|
|||
walletId: walletId,
|
||||
value: possible,
|
||||
publicKey: [],
|
||||
type: AddressType.nonWallet,
|
||||
type: stack_address.AddressType.nonWallet,
|
||||
derivationIndex: -1,
|
||||
derivationPath: null,
|
||||
subType: AddressSubType.nonWallet,
|
||||
subType: stack_address.AddressSubType.nonWallet,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -30,6 +30,18 @@ mixin FusionInterface {
|
|||
_getCurrentChangeAddress = getCurrentChangeAddress;
|
||||
}
|
||||
|
||||
static List<Address> reserve_change_addresses(int number_addresses) {
|
||||
// TODO
|
||||
// get current change address
|
||||
// get int number_addresses next addresses
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<Address> unreserve_change_address(Address addr) {
|
||||
//implement later based on wallet.
|
||||
return [];
|
||||
}
|
||||
|
||||
void fuse() async {
|
||||
// Initial attempt for CashFusion integration goes here.
|
||||
Fusion mainFusionObject = Fusion();
|
||||
|
|
Loading…
Reference in a new issue