mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
fix paynym broadcast tx functionality
This commit is contained in:
parent
d5e8d3fe3e
commit
c841b969b2
2 changed files with 16 additions and 19 deletions
|
@ -39,7 +39,7 @@ import 'package:stackwallet/wallets/isar/providers/eth/current_token_wallet_prov
|
|||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
import 'package:stackwallet/wallets/models/tx_data.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/firo_wallet.dart';
|
||||
// import 'package:stackwallet/wallets/example/libepiccash.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -129,16 +129,11 @@ class _ConfirmTransactionViewState
|
|||
|
||||
try {
|
||||
if (widget.isTokenTx) {
|
||||
// TODO: [prio=high] fixme
|
||||
throw UnimplementedError("fixme");
|
||||
// txidFuture = ref
|
||||
// .read(tokenServiceProvider)!
|
||||
// .confirmSend(txData: transactionInfo);
|
||||
txDataFuture =
|
||||
ref.read(pCurrentTokenWallet)!.confirmSend(txData: widget.txData);
|
||||
} else if (widget.isPaynymNotificationTransaction) {
|
||||
// TODO: [prio=high] fixme
|
||||
throw UnimplementedError("fixme");
|
||||
// txidFuture = (wallet as PaynymWalletInterface)
|
||||
// .broadcastNotificationTx(preparedTx: transactionInfo);
|
||||
txDataFuture = (wallet as PaynymInterface)
|
||||
.broadcastNotificationTx(txData: widget.txData);
|
||||
} else if (widget.isPaynymTransaction) {
|
||||
txDataFuture = wallet.confirmSend(txData: widget.txData);
|
||||
} else {
|
||||
|
|
|
@ -787,19 +787,18 @@ mixin PaynymInterface on Bip39HDWallet, ElectrumXInterface {
|
|||
}
|
||||
}
|
||||
|
||||
Future<String> broadcastNotificationTx({
|
||||
required Map<String, dynamic> preparedTx,
|
||||
Future<TxData> broadcastNotificationTx({
|
||||
required TxData txData,
|
||||
}) async {
|
||||
try {
|
||||
Logging.instance.log("confirmNotificationTx txData: $preparedTx",
|
||||
level: LogLevel.Info);
|
||||
final txHash = await electrumXClient.broadcastTransaction(
|
||||
rawTx: preparedTx["hex"] as String);
|
||||
Logging.instance
|
||||
.log("confirmNotificationTx txData: $txData", level: LogLevel.Info);
|
||||
final txHash =
|
||||
await electrumXClient.broadcastTransaction(rawTx: txData.raw!);
|
||||
Logging.instance.log("Sent txHash: $txHash", level: LogLevel.Info);
|
||||
|
||||
// TODO: only refresh transaction data
|
||||
try {
|
||||
await refresh();
|
||||
await updateTransactions();
|
||||
} catch (e) {
|
||||
Logging.instance.log(
|
||||
"refresh() failed in confirmNotificationTx (${info.name}::$walletId): $e",
|
||||
|
@ -807,7 +806,10 @@ mixin PaynymInterface on Bip39HDWallet, ElectrumXInterface {
|
|||
);
|
||||
}
|
||||
|
||||
return txHash;
|
||||
return txData.copyWith(
|
||||
txid: txHash,
|
||||
txHash: txHash,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception rethrown from confirmSend(): $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
|
|
Loading…
Reference in a new issue