Update boltz-rust and add receive payment description (#409)

* Update boltz-rust

* Store description and add to Payment struct

* Fix examples
This commit is contained in:
Ross Savage
2024-07-25 12:46:40 +02:00
committed by GitHub
parent 535be71d84
commit baa8096852
41 changed files with 855 additions and 458 deletions

View File

@@ -422,6 +422,9 @@ class Payment {
/// In the case of a Receive payment, this is the invoice paid by the user
final String? bolt11;
/// Represents the invoice description
final String description;
/// For a Send swap which was refunded, this is the refund tx id
final String? refundTxId;
@@ -446,6 +449,7 @@ class Payment {
required this.feesSat,
this.preimage,
this.bolt11,
required this.description,
this.refundTxId,
this.refundTxAmountSat,
required this.paymentType,
@@ -461,6 +465,7 @@ class Payment {
feesSat.hashCode ^
preimage.hashCode ^
bolt11.hashCode ^
description.hashCode ^
refundTxId.hashCode ^
refundTxAmountSat.hashCode ^
paymentType.hashCode ^
@@ -478,6 +483,7 @@ class Payment {
feesSat == other.feesSat &&
preimage == other.preimage &&
bolt11 == other.bolt11 &&
description == other.description &&
refundTxId == other.refundTxId &&
refundTxAmountSat == other.refundTxAmountSat &&
paymentType == other.paymentType &&
@@ -694,10 +700,10 @@ class PrepareReceiveOnchainResponse {
}
/// An argument when calling [crate::sdk::LiquidSdk::prepare_receive_payment].
class PrepareReceiveRequest {
class PrepareReceivePaymentRequest {
final BigInt payerAmountSat;
const PrepareReceiveRequest({
const PrepareReceivePaymentRequest({
required this.payerAmountSat,
});
@@ -707,17 +713,17 @@ class PrepareReceiveRequest {
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PrepareReceiveRequest &&
other is PrepareReceivePaymentRequest &&
runtimeType == other.runtimeType &&
payerAmountSat == other.payerAmountSat;
}
/// Returned when calling [crate::sdk::LiquidSdk::prepare_receive_payment].
class PrepareReceiveResponse {
class PrepareReceivePaymentResponse {
final BigInt payerAmountSat;
final BigInt feesSat;
const PrepareReceiveResponse({
const PrepareReceivePaymentResponse({
required this.payerAmountSat,
required this.feesSat,
});
@@ -728,7 +734,7 @@ class PrepareReceiveResponse {
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is PrepareReceiveResponse &&
other is PrepareReceivePaymentResponse &&
runtimeType == other.runtimeType &&
payerAmountSat == other.payerAmountSat &&
feesSat == other.feesSat;
@@ -850,6 +856,28 @@ class ReceiveOnchainResponse {
bip21 == other.bip21;
}
/// An argument when calling [crate::sdk::LiquidSdk::receive_payment].
class ReceivePaymentRequest {
final String? description;
final PrepareReceivePaymentResponse prepareRes;
const ReceivePaymentRequest({
this.description,
required this.prepareRes,
});
@override
int get hashCode => description.hashCode ^ prepareRes.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ReceivePaymentRequest &&
runtimeType == other.runtimeType &&
description == other.description &&
prepareRes == other.prepareRes;
}
/// Returned when calling [crate::sdk::LiquidSdk::receive_payment].
class ReceivePaymentResponse {
final String id;