paynym notif tx and tx parsing tweaks

This commit is contained in:
julian 2023-01-05 16:57:53 -06:00
parent ca4cdd40c0
commit 35a8172d35
2 changed files with 9 additions and 9 deletions

View file

@ -1526,7 +1526,7 @@ class _SendViewState extends ConsumerState<SendView> {
// TODO: remove the need for this!! // TODO: remove the need for this!!
final bool isOwnAddress = final bool isOwnAddress =
await manager.isOwnAddress(_address!); await manager.isOwnAddress(_address!);
if (isOwnAddress) { if (isOwnAddress && coin != Coin.dogecoinTestNet) {
await showDialog<dynamic>( await showDialog<dynamic>(
context: context, context: context,
useSafeArea: false, useSafeArea: false,

View file

@ -9,12 +9,11 @@ import 'package:bitcoindart/src/utils/script.dart' as bscript;
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:pointycastle/digests/sha256.dart'; import 'package:pointycastle/digests/sha256.dart';
import 'package:stackwallet/hive/db.dart'; import 'package:stackwallet/hive/db.dart';
import 'package:stackwallet/models/paymint/utxo_model.dart';
import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart'; import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/format.dart'; import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/models/paymint/utxo_model.dart';
extension PayNym on DogecoinWallet { extension PayNym on DogecoinWallet {
// fetch or generate this wallet's bip47 payment code // fetch or generate this wallet's bip47 payment code
Future<PaymentCode> getPaymentCode() async { Future<PaymentCode> getPaymentCode() async {
@ -59,6 +58,7 @@ extension PayNym on DogecoinWallet {
Future<String> createNotificationTx( Future<String> createNotificationTx(
String targetPaymentCodeString, String targetPaymentCodeString,
List<UtxoObject> utxosToUse, List<UtxoObject> utxosToUse,
int dustLimit,
) async { ) async {
final utxoSigningData = await fetchBuildTxData(utxosToUse); final utxoSigningData = await fetchBuildTxData(utxosToUse);
final targetPaymentCode = final targetPaymentCode =
@ -105,14 +105,14 @@ extension PayNym on DogecoinWallet {
txb.setVersion(1); txb.setVersion(1);
txb.addInput( txb.addInput(
"9c6000d597c5008f7bfc2618aed5e4a6ae57677aab95078aae708e1cab11f486", utxo.txid,
txPointIndex, txPointIndex,
); );
txb.addOutput(targetPaymentCode.notificationAddress(), txb.addOutput(targetPaymentCode.notificationAddress(), dustLimit);
Format.decimalAmountToSatoshis(Decimal.one, coin)); txb.addOutput(opReturnScript, 0);
txb.addOutput(
opReturnScript, Format.decimalAmountToSatoshis(Decimal.one, coin)); // TODO: add possible change output and mark output as dangerous
txb.sign( txb.sign(
vin: 0, vin: 0,
@ -234,7 +234,7 @@ Future<Map<String, dynamic>> parseTransaction(
if (mySentFromAddresses.isNotEmpty && myReceivedOnAddresses.isNotEmpty) { if (mySentFromAddresses.isNotEmpty && myReceivedOnAddresses.isNotEmpty) {
// tx is sent to self // tx is sent to self
type = "Sent to self"; type = "Sent to self";
amount = amountReceivedInWallet - amountSentFromWallet; amount = amountSentFromWallet - amountReceivedInWallet - fee;
} else if (mySentFromAddresses.isNotEmpty) { } else if (mySentFromAddresses.isNotEmpty) {
// outgoing tx // outgoing tx
type = "Sent"; type = "Sent";