mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
implement-payjoin (#1949)
* Initial Payjoin * Initial Payjoin * More payjoin stuff * Minor fixes * Minor fixes * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Fix minor bug causes by data inconsistency in the btc utxos * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Initial Payjoin * Initial Payjoin * More payjoin stuff * Minor fixes * Minor fixes * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Fix minor bug causes by data inconsistency in the btc utxos * Minor cleanup * Minor cleanup * Minor cleanup * Minor cleanup * Fix Rebase issues * Move PJ Receiver to isolate * Add Payjoin Setting * Payjoin Sender are now isolated * Added Payjoin sessions to tx overview. Fix Fee issue with payjoin * Clean up code * Fix taproot for payjoin * Fix CI Errors * Add Payjoin UI elements and details page * Add Payjoin UI elements and details page * Fix Translations * feat: Detect Payjoin URIs in pasted text and show to the User sending Payjoin * feat: rename pjUri to payjoinURI for more code clarity * Update res/values/strings_pl.arb Co-authored-by: cyan <cyjan@mrcyjanek.net> * Update cw_bitcoin/lib/payjoin/manager.dart Co-authored-by: cyan <cyjan@mrcyjanek.net> * Update cw_bitcoin/lib/payjoin/manager.dart Co-authored-by: cyan <cyjan@mrcyjanek.net> * feat: Disable Payjoin per default * feat: Disable Payjoin fully if disabled or no Inputs available * feat: Resume Payjoin if app comes back to foreground * chore: Revert overly aggressive code formats * feat: show correct Payjoin amount for receivers * feat: Improved payjoin status * feat: Show payjoin errors on payjoin details screen * deps: update flutter to 3.27.4 * feat: Revert localisations * bug: Remove duplicate transaction id on payjoin details * style: remove double await in payjoin sender * refactor(cw_bitcoin): Refactor method signatures and convert constructor to factory * refactor(cw_bitcoin): Refactor wallet service and PSBT signer for cleaner code Removed unnecessary `CakeHive` dependency and refactored `BitcoinWallet` initialization to use `payjoinSessionSource`. Improved code readability in `PsbtSigner` by reformatting lines and simplifying constructor methods for `UtxoWithPrivateKey`. * fix: Resume Payjoin Sessions and load PJUri after sleep * feat: Add "Copy Payjoin URL button" to receive screen * fix: Add "Payjoin enabled"-Box below QR Code on the receive screen * fix: Set payjoin_enabled color to black independent of the theme * refactor: Payjoin session management and cleanup unused code. --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> Co-authored-by: cyan <cyjan@mrcyjanek.net>
This commit is contained in:
parent
4a08e18f00
commit
82e3ebf4fa
84 changed files with 2622 additions and 198 deletions
|
@ -21,3 +21,4 @@ const HARDWARE_WALLET_TYPE_TYPE_ID = 19;
|
|||
const MWEB_UTXO_TYPE_ID = 20;
|
||||
const HAVEN_SEED_STORE_TYPE_ID = 21;
|
||||
const ZANO_ASSET_TYPE_ID = 22;
|
||||
const PAYJOIN_SESSION_TYPE_ID = 23;
|
||||
|
|
67
cw_core/lib/payjoin_session.dart
Normal file
67
cw_core/lib/payjoin_session.dart
Normal file
|
@ -0,0 +1,67 @@
|
|||
import 'package:cw_core/hive_type_ids.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'payjoin_session.g.dart';
|
||||
|
||||
@HiveType(typeId: PAYJOIN_SESSION_TYPE_ID)
|
||||
class PayjoinSession extends HiveObject {
|
||||
PayjoinSession({
|
||||
required this.walletId,
|
||||
this.receiver,
|
||||
this.sender,
|
||||
this.pjUri,
|
||||
this.status = "created",
|
||||
this.inProgressSince,
|
||||
this.rawAmount,
|
||||
}) {
|
||||
if (receiver == null) {
|
||||
assert(sender != null);
|
||||
assert(pjUri != null);
|
||||
} else {
|
||||
assert(receiver != null);
|
||||
}
|
||||
}
|
||||
|
||||
static const typeId = PAYJOIN_SESSION_TYPE_ID;
|
||||
static const boxName = 'PayjoinSessions';
|
||||
|
||||
@HiveField(0)
|
||||
final String walletId;
|
||||
|
||||
@HiveField(1)
|
||||
final String? sender;
|
||||
|
||||
@HiveField(2)
|
||||
final String? receiver;
|
||||
|
||||
@HiveField(3)
|
||||
final String? pjUri;
|
||||
|
||||
@HiveField(4)
|
||||
String status;
|
||||
|
||||
@HiveField(5)
|
||||
DateTime? inProgressSince;
|
||||
|
||||
@HiveField(6)
|
||||
String? txId;
|
||||
|
||||
@HiveField(7)
|
||||
String? rawAmount;
|
||||
|
||||
@HiveField(8)
|
||||
String? error;
|
||||
|
||||
bool get isSenderSession => sender != null;
|
||||
|
||||
BigInt get amount => BigInt.parse(rawAmount ?? "0");
|
||||
set amount(BigInt amount) => rawAmount = amount.toString();
|
||||
|
||||
}
|
||||
|
||||
enum PayjoinSessionStatus {
|
||||
created,
|
||||
inProgress,
|
||||
success,
|
||||
unrecoverable,
|
||||
}
|
|
@ -810,4 +810,4 @@ packages:
|
|||
version: "3.1.3"
|
||||
sdks:
|
||||
dart: ">=3.5.0 <4.0.0"
|
||||
flutter: ">=3.24.0"
|
||||
flutter: ">=3.27.4"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue