fix: add UR to cw_bitcoin, fix payjoin issue

This commit is contained in:
Czarek Nakamoto 2025-05-13 10:31:43 +02:00 committed by cyan
parent a5b6ae6475
commit 355218753d
5 changed files with 38 additions and 1 deletions

View file

@ -181,6 +181,7 @@ class BitcoinWalletService extends WalletService<
unspentCoinsInfo: unspentCoinsInfoSource,
networkParam: network,
encryptionFileUtils: encryptionFileUtilsFor(isDirect),
payjoinBox: payjoinSessionSource,
);
await wallet.save();

View file

@ -1,3 +1,6 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:cw_bitcoin/electrum_wallet.dart';
import 'package:grpc/grpc.dart';
import 'package:cw_bitcoin/exceptions.dart';
@ -11,6 +14,9 @@ import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cw_mweb/cw_mweb.dart';
import 'package:cw_mweb/mwebd.pb.dart';
import 'package:ur/cbor_lite.dart';
import 'package:ur/ur.dart';
import 'package:ur/ur_encoder.dart';
class PendingBitcoinTransaction with PendingTransaction {
PendingBitcoinTransaction(
@ -165,6 +171,11 @@ class PendingBitcoinTransaction with PendingTransaction {
@override
Future<String?> commitUR() {
return Future.value("test");
var sourceBytes = Uint8List.fromList(utf8.encode(hex));
var cborEncoder = CBOREncoder();
cborEncoder.encodeBytes(sourceBytes);
var ur = UR("psbt", cborEncoder.getBytes());
var encoded = UREncoder.encode(ur);
return Future.value(encoded);
}
}

View file

@ -1101,6 +1101,23 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.0"
ur:
dependency: "direct main"
description:
path: "."
ref: "5738f70d0ec3d50977ac3dd01fed62939600238b"
resolved-ref: "5738f70d0ec3d50977ac3dd01fed62939600238b"
url: "https://github.com/bukata-sa/bc-ur-dart"
source: git
version: "0.1.0"
uuid:
dependency: transitive
description:
name: uuid
sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff
url: "https://pub.dev"
source: hosted
version: "4.5.1"
vector_math:
dependency: transitive
description:

View file

@ -58,6 +58,10 @@ dependencies:
git:
url: https://github.com/sneurlax/socks_socket
ref: e6232c53c1595469931ababa878759a067c02e94
ur:
git:
url: https://github.com/bukata-sa/bc-ur-dart
ref: 5738f70d0ec3d50977ac3dd01fed62939600238b
dev_dependencies:
flutter_test:

View file

@ -130,6 +130,10 @@ dependencies:
url: https://github.com/MrCyjaneK/flutter_daemon
ref: c24ee99f2f3070ea02d8108bbdd7727d73f7e5f1
flutter_local_notifications: ^19.0.0
ur:
git:
url: https://github.com/bukata-sa/bc-ur-dart
ref: 5738f70d0ec3d50977ac3dd01fed62939600238b
dev_dependencies:
flutter_test: