mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
fixes
This commit is contained in:
parent
381a6b7b4b
commit
ea04ea9796
3 changed files with 29 additions and 1 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit a7e034e4c3aca9df1b186ed1814793c5fe0012f4
|
Subproject commit 65643acb54f829d29bb07939e16e3002e85eede7
|
|
@ -151,6 +151,7 @@ class BitcoinCashWallet extends CoinServiceAPI
|
||||||
mnemonic: mnemonicString,
|
mnemonic: mnemonicString,
|
||||||
mnemonicPassphrase: mnemonicPassphrase,
|
mnemonicPassphrase: mnemonicPassphrase,
|
||||||
network: _network,
|
network: _network,
|
||||||
|
convertToScriptHash: _convertToScriptHash,
|
||||||
);
|
);
|
||||||
initCoinControlInterface(
|
initCoinControlInterface(
|
||||||
walletId: walletId,
|
walletId: walletId,
|
||||||
|
|
|
@ -125,6 +125,8 @@ mixin FusionWalletInterface {
|
||||||
late final CachedElectrumX Function() _getWalletCachedElectrumX;
|
late final CachedElectrumX Function() _getWalletCachedElectrumX;
|
||||||
late final Future<int> Function() _getChainHeight;
|
late final Future<int> Function() _getChainHeight;
|
||||||
late final Future<void> Function() _updateWalletUTXOS;
|
late final Future<void> Function() _updateWalletUTXOS;
|
||||||
|
late final String Function(String bchAddress, btcdart.NetworkType network)
|
||||||
|
_convertToScriptHash;
|
||||||
|
|
||||||
// Fusion object.
|
// Fusion object.
|
||||||
fusion.Fusion? _mainFusionObject;
|
fusion.Fusion? _mainFusionObject;
|
||||||
|
@ -154,6 +156,9 @@ mixin FusionWalletInterface {
|
||||||
required Future<String?> mnemonic,
|
required Future<String?> mnemonic,
|
||||||
required Future<String?> mnemonicPassphrase,
|
required Future<String?> mnemonicPassphrase,
|
||||||
required btcdart.NetworkType network,
|
required btcdart.NetworkType network,
|
||||||
|
required final String Function(
|
||||||
|
String bchAddress, btcdart.NetworkType network)
|
||||||
|
convertToScriptHash,
|
||||||
}) async {
|
}) async {
|
||||||
// Set passed in wallet data.
|
// Set passed in wallet data.
|
||||||
_walletId = walletId;
|
_walletId = walletId;
|
||||||
|
@ -167,6 +172,7 @@ mixin FusionWalletInterface {
|
||||||
_mnemonic = mnemonic;
|
_mnemonic = mnemonic;
|
||||||
_mnemonicPassphrase = mnemonicPassphrase;
|
_mnemonicPassphrase = mnemonicPassphrase;
|
||||||
_network = network;
|
_network = network;
|
||||||
|
_convertToScriptHash = convertToScriptHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// callback to update the ui state object
|
// callback to update the ui state object
|
||||||
|
@ -409,6 +415,26 @@ mixin FusionWalletInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> _checkUtxoExists(
|
||||||
|
String address,
|
||||||
|
String prevTxid,
|
||||||
|
int prevIndex,
|
||||||
|
) async {
|
||||||
|
final scriptHash = _convertToScriptHash(address, _network);
|
||||||
|
|
||||||
|
final utxos = await _getWalletCachedElectrumX()
|
||||||
|
.electrumXClient
|
||||||
|
.getUTXOs(scripthash: scriptHash);
|
||||||
|
|
||||||
|
for (final utxo in utxos) {
|
||||||
|
if (utxo["tx_hash"] == prevTxid && utxo["tx_pos"] == prevIndex) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Initial attempt for CashFusion integration goes here.
|
// Initial attempt for CashFusion integration goes here.
|
||||||
|
|
||||||
/// Fuse the wallet's UTXOs.
|
/// Fuse the wallet's UTXOs.
|
||||||
|
@ -446,6 +472,7 @@ mixin FusionWalletInterface {
|
||||||
getSocksProxyAddress: _getSocksProxyAddress,
|
getSocksProxyAddress: _getSocksProxyAddress,
|
||||||
getChainHeight: _getChainHeight,
|
getChainHeight: _getChainHeight,
|
||||||
updateStatusCallback: _updateStatus,
|
updateStatusCallback: _updateStatus,
|
||||||
|
checkUtxoExists: _checkUtxoExists,
|
||||||
getTransactionJson: (String txid) async =>
|
getTransactionJson: (String txid) async =>
|
||||||
await _getWalletCachedElectrumX().getTransaction(
|
await _getWalletCachedElectrumX().getTransaction(
|
||||||
coin: _coin,
|
coin: _coin,
|
||||||
|
|
Loading…
Reference in a new issue