mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
implement getAddressFromOutputScript in fusiondart and update comments
This commit is contained in:
parent
386fcdc1d8
commit
7788ec7ace
3 changed files with 18 additions and 12 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 465df4196798b35ac85937df7dd73a861105472c
|
||||
Subproject commit 94e2c31404bd5ca75a4798c430d9c2ae09bc9143
|
|
@ -200,8 +200,9 @@ class BitcoinCashWallet extends CoinServiceAPI
|
|||
.findFirst()) ??
|
||||
await _generateAddressForChain(0, 0, DerivePathTypeExt.primaryFor(coin));
|
||||
|
||||
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 currentChangeAddress async =>
|
||||
(await _currentChangeAddress).value;
|
||||
// TODO return Address instead of String.
|
||||
|
||||
Future<String> get nextChangeAddress async {
|
||||
// get change <Address>
|
||||
|
@ -216,8 +217,8 @@ class BitcoinCashWallet extends CoinServiceAPI
|
|||
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();`
|
||||
return newChangeAddress.value;
|
||||
// TODO return Address instead of String.
|
||||
}
|
||||
|
||||
Future<isar_models.Address> get _currentChangeAddress async =>
|
||||
|
|
|
@ -390,10 +390,10 @@ extension FusionAddress on Address {
|
|||
fusion_address.Address toFusionAddress() {
|
||||
return fusion_address.Address(
|
||||
addr: value,
|
||||
publicKey:
|
||||
publicKey, // Assuming List<byte> and List<int> are compatible
|
||||
publicKey: publicKey,
|
||||
derivationPath:
|
||||
fusion_address.DerivationPath(derivationPath?.value ?? ""));
|
||||
// TODO fix default derivation path.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -404,9 +404,14 @@ extension FusionAddress on Address {
|
|||
extension FusionUTXO on UTXO {
|
||||
/// Converts a Stack Wallet UTXO to a FusionDart Input.
|
||||
fusion_input.Input toFusionInput({required List<int> pubKey}) {
|
||||
if (address != null) {
|
||||
// Search isar for address.
|
||||
// TODO
|
||||
}
|
||||
|
||||
return fusion_input.Input(
|
||||
prevTxid: utf8.encode(txid), // TODO verify this is what we want.
|
||||
prevIndex: vout, // TODO verify this is what we want.
|
||||
txid: utf8.encode(txid), // TODO verify this is what we want.
|
||||
index: vout, // TODO verify this is what we want.
|
||||
pubKey: pubKey, // TODO fix public key.
|
||||
amount: value,
|
||||
);
|
||||
|
@ -463,9 +468,9 @@ extension FusionTransaction on Transaction {
|
|||
);
|
||||
|
||||
return fusion_input.Input(
|
||||
prevTxid: utf8.encode(e.txid), // TODO verify this is what we want.
|
||||
prevIndex: e.vout, // TODO verify this is what we want.
|
||||
pubKey: utf8.encode(address.value.toString()), // TODO fix public key.
|
||||
txid: utf8.encode(e.txid), // TODO verify this is what we want.
|
||||
index: e.vout, // TODO verify this is what we want.
|
||||
pubKey: utf8.encode('0000'), // TODO fix public key.
|
||||
amount: value.raw.toInt(),
|
||||
);
|
||||
}).toList());
|
||||
|
|
Loading…
Reference in a new issue