// This file is automatically generated, so please do not edit it. // @generated by `flutter_rust_bridge`@ 2.7.0. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import import 'bindings.dart'; import 'frb_generated.dart'; import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; import 'package:freezed_annotation/freezed_annotation.dart' hide protected; part 'model.freezed.dart'; /// An argument when calling [crate::sdk::LiquidSdk::accept_payment_proposed_fees]. class AcceptPaymentProposedFeesRequest { final FetchPaymentProposedFeesResponse response; const AcceptPaymentProposedFeesRequest({ required this.response, }); @override int get hashCode => response.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is AcceptPaymentProposedFeesRequest && runtimeType == other.runtimeType && response == other.response; } /// An argument when calling [crate::sdk::LiquidSdk::backup]. class BackupRequest { /// Path to the backup. /// /// If not set, it defaults to `backup.sql` for mainnet and `backup-testnet.sql` for testnet. /// The file will be saved in [ConnectRequest]'s `data_dir`. final String? backupPath; const BackupRequest({ this.backupPath, }); @override int get hashCode => backupPath.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is BackupRequest && runtimeType == other.runtimeType && backupPath == other.backupPath; } /// An argument of [PrepareBuyBitcoinRequest] when calling [crate::sdk::LiquidSdk::prepare_buy_bitcoin]. enum BuyBitcoinProvider { moonpay, ; } /// An argument when calling [crate::sdk::LiquidSdk::buy_bitcoin]. class BuyBitcoinRequest { final PrepareBuyBitcoinResponse prepareResponse; /// The optional URL to redirect to after completing the buy. /// /// For Moonpay, see final String? redirectUrl; const BuyBitcoinRequest({ required this.prepareResponse, this.redirectUrl, }); @override int get hashCode => prepareResponse.hashCode ^ redirectUrl.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is BuyBitcoinRequest && runtimeType == other.runtimeType && prepareResponse == other.prepareResponse && redirectUrl == other.redirectUrl; } /// An argument when calling [crate::sdk::LiquidSdk::check_message]. class CheckMessageRequest { /// The message that was signed. final String message; /// The public key of the node that signed the message. final String pubkey; /// The zbase encoded signature to verify. final String signature; const CheckMessageRequest({ required this.message, required this.pubkey, required this.signature, }); @override int get hashCode => message.hashCode ^ pubkey.hashCode ^ signature.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is CheckMessageRequest && runtimeType == other.runtimeType && message == other.message && pubkey == other.pubkey && signature == other.signature; } /// Returned when calling [crate::sdk::LiquidSdk::check_message]. class CheckMessageResponse { /// Boolean value indicating whether the signature covers the message and /// was signed by the given pubkey. final bool isValid; const CheckMessageResponse({ required this.isValid, }); @override int get hashCode => isValid.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is CheckMessageResponse && runtimeType == other.runtimeType && isValid == other.isValid; } /// Configuration for the Liquid SDK class Config { final String liquidElectrumUrl; final String bitcoinElectrumUrl; /// The mempool.space API URL, has to be in the format: `https://mempool.space/api` final String mempoolspaceUrl; /// Directory in which the DB and log files are stored. /// /// Prefix can be a relative or absolute path to this directory. final String workingDir; /// Directory in which the Liquid wallet cache is stored. Defaults to `working_dir` final String? cacheDir; final LiquidNetwork network; /// Send payment timeout. See [LiquidSdk::send_payment](crate::sdk::LiquidSdk::send_payment) final BigInt paymentTimeoutSec; /// Zero-conf minimum accepted fee-rate in millisatoshis per vbyte final int zeroConfMinFeeRateMsat; /// The url of the real-time sync service final String syncServiceUrl; /// Maximum amount in satoshi to accept zero-conf payments with /// Defaults to [DEFAULT_ZERO_CONF_MAX_SAT] final BigInt? zeroConfMaxAmountSat; /// The Breez API key used for making requests to their mempool service final String? breezApiKey; /// A set of external input parsers that are used by [LiquidSdk::parse](crate::sdk::LiquidSdk::parse) when the input /// is not recognized. See [ExternalInputParser] for more details on how to configure /// external parsing. final List? externalInputParsers; /// The SDK includes some default external input parsers /// ([DEFAULT_EXTERNAL_INPUT_PARSERS](crate::sdk::DEFAULT_EXTERNAL_INPUT_PARSERS)). /// Set this to false in order to prevent their use. final bool useDefaultExternalInputParsers; /// For payments where the onchain fees can only be estimated on creation, this can be used /// in order to automatically allow slightly more expensive fees. If the actual fee rate ends up /// being above the sum of the initial estimate and this leeway, the payment will require /// user fee acceptance. See [WaitingFeeAcceptance](PaymentState::WaitingFeeAcceptance). /// /// Defaults to zero. final int? onchainFeeRateLeewaySatPerVbyte; const Config({ required this.liquidElectrumUrl, required this.bitcoinElectrumUrl, required this.mempoolspaceUrl, required this.workingDir, this.cacheDir, required this.network, required this.paymentTimeoutSec, required this.zeroConfMinFeeRateMsat, required this.syncServiceUrl, this.zeroConfMaxAmountSat, this.breezApiKey, this.externalInputParsers, required this.useDefaultExternalInputParsers, this.onchainFeeRateLeewaySatPerVbyte, }); @override int get hashCode => liquidElectrumUrl.hashCode ^ bitcoinElectrumUrl.hashCode ^ mempoolspaceUrl.hashCode ^ workingDir.hashCode ^ cacheDir.hashCode ^ network.hashCode ^ paymentTimeoutSec.hashCode ^ zeroConfMinFeeRateMsat.hashCode ^ syncServiceUrl.hashCode ^ zeroConfMaxAmountSat.hashCode ^ breezApiKey.hashCode ^ externalInputParsers.hashCode ^ useDefaultExternalInputParsers.hashCode ^ onchainFeeRateLeewaySatPerVbyte.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is Config && runtimeType == other.runtimeType && liquidElectrumUrl == other.liquidElectrumUrl && bitcoinElectrumUrl == other.bitcoinElectrumUrl && mempoolspaceUrl == other.mempoolspaceUrl && workingDir == other.workingDir && cacheDir == other.cacheDir && network == other.network && paymentTimeoutSec == other.paymentTimeoutSec && zeroConfMinFeeRateMsat == other.zeroConfMinFeeRateMsat && syncServiceUrl == other.syncServiceUrl && zeroConfMaxAmountSat == other.zeroConfMaxAmountSat && breezApiKey == other.breezApiKey && externalInputParsers == other.externalInputParsers && useDefaultExternalInputParsers == other.useDefaultExternalInputParsers && onchainFeeRateLeewaySatPerVbyte == other.onchainFeeRateLeewaySatPerVbyte; } /// An argument when calling [crate::sdk::LiquidSdk::connect]. class ConnectRequest { final Config config; final String mnemonic; const ConnectRequest({ required this.config, required this.mnemonic, }); @override int get hashCode => config.hashCode ^ mnemonic.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is ConnectRequest && runtimeType == other.runtimeType && config == other.config && mnemonic == other.mnemonic; } /// An argument when calling [crate::sdk::LiquidSdk::fetch_payment_proposed_fees]. class FetchPaymentProposedFeesRequest { final String swapId; const FetchPaymentProposedFeesRequest({ required this.swapId, }); @override int get hashCode => swapId.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is FetchPaymentProposedFeesRequest && runtimeType == other.runtimeType && swapId == other.swapId; } /// Returned when calling [crate::sdk::LiquidSdk::fetch_payment_proposed_fees]. class FetchPaymentProposedFeesResponse { final String swapId; final BigInt feesSat; /// Amount sent by the swap payer final BigInt payerAmountSat; /// Amount that will be received if these fees are accepted final BigInt receiverAmountSat; const FetchPaymentProposedFeesResponse({ required this.swapId, required this.feesSat, required this.payerAmountSat, required this.receiverAmountSat, }); @override int get hashCode => swapId.hashCode ^ feesSat.hashCode ^ payerAmountSat.hashCode ^ receiverAmountSat.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is FetchPaymentProposedFeesResponse && runtimeType == other.runtimeType && swapId == other.swapId && feesSat == other.feesSat && payerAmountSat == other.payerAmountSat && receiverAmountSat == other.receiverAmountSat; } /// Returned when calling [crate::sdk::LiquidSdk::get_info]. class GetInfoResponse { /// Usable balance. This is the confirmed onchain balance minus `pending_send_sat`. final BigInt balanceSat; /// Amount that is being used for ongoing Send swaps final BigInt pendingSendSat; /// Incoming amount that is pending from ongoing Receive swaps final BigInt pendingReceiveSat; /// The wallet's fingerprint. It is used to build the working directory in [Config::get_wallet_dir]. final String fingerprint; /// The wallet's pubkey. Used to verify signed messages. final String pubkey; const GetInfoResponse({ required this.balanceSat, required this.pendingSendSat, required this.pendingReceiveSat, required this.fingerprint, required this.pubkey, }); @override int get hashCode => balanceSat.hashCode ^ pendingSendSat.hashCode ^ pendingReceiveSat.hashCode ^ fingerprint.hashCode ^ pubkey.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is GetInfoResponse && runtimeType == other.runtimeType && balanceSat == other.balanceSat && pendingSendSat == other.pendingSendSat && pendingReceiveSat == other.pendingReceiveSat && fingerprint == other.fingerprint && pubkey == other.pubkey; } @freezed sealed class GetPaymentRequest with _$GetPaymentRequest { const GetPaymentRequest._(); /// The Lightning payment hash of the payment const factory GetPaymentRequest.lightning({ required String paymentHash, }) = GetPaymentRequest_Lightning; } /// Returned when calling [crate::sdk::LiquidSdk::fetch_lightning_limits]. class LightningPaymentLimitsResponse { /// Amount limits for a Send Payment to be valid final Limits send; /// Amount limits for a Receive Payment to be valid final Limits receive; const LightningPaymentLimitsResponse({ required this.send, required this.receive, }); @override int get hashCode => send.hashCode ^ receive.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is LightningPaymentLimitsResponse && runtimeType == other.runtimeType && send == other.send && receive == other.receive; } /// The minimum and maximum in satoshis of a Lightning or onchain payment. class Limits { final BigInt minSat; final BigInt maxSat; final BigInt maxZeroConfSat; const Limits({ required this.minSat, required this.maxSat, required this.maxZeroConfSat, }); @override int get hashCode => minSat.hashCode ^ maxSat.hashCode ^ maxZeroConfSat.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is Limits && runtimeType == other.runtimeType && minSat == other.minSat && maxSat == other.maxSat && maxZeroConfSat == other.maxZeroConfSat; } /// Network chosen for this Liquid SDK instance. Note that it represents both the Liquid and the /// Bitcoin network used. enum LiquidNetwork { /// Mainnet Bitcoin and Liquid chains mainnet, /// Testnet Bitcoin and Liquid chains testnet, ; } @freezed sealed class ListPaymentDetails with _$ListPaymentDetails { const ListPaymentDetails._(); /// The Liquid BIP21 URI or address of the payment const factory ListPaymentDetails.liquid({ required String destination, }) = ListPaymentDetails_Liquid; /// The Bitcoin address of the payment const factory ListPaymentDetails.bitcoin({ required String address, }) = ListPaymentDetails_Bitcoin; } /// An argument when calling [crate::sdk::LiquidSdk::list_payments]. class ListPaymentsRequest { final List? filters; final List? states; /// Epoch time, in seconds final PlatformInt64? fromTimestamp; /// Epoch time, in seconds final PlatformInt64? toTimestamp; final int? offset; final int? limit; final ListPaymentDetails? details; const ListPaymentsRequest({ this.filters, this.states, this.fromTimestamp, this.toTimestamp, this.offset, this.limit, this.details, }); @override int get hashCode => filters.hashCode ^ states.hashCode ^ fromTimestamp.hashCode ^ toTimestamp.hashCode ^ offset.hashCode ^ limit.hashCode ^ details.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is ListPaymentsRequest && runtimeType == other.runtimeType && filters == other.filters && states == other.states && fromTimestamp == other.fromTimestamp && toTimestamp == other.toTimestamp && offset == other.offset && limit == other.limit && details == other.details; } /// Represents the payment LNURL info class LnUrlInfo { final String? lnAddress; final String? lnurlPayComment; final String? lnurlPayDomain; final String? lnurlPayMetadata; final SuccessActionProcessed? lnurlPaySuccessAction; final SuccessAction? lnurlPayUnprocessedSuccessAction; final String? lnurlWithdrawEndpoint; const LnUrlInfo({ this.lnAddress, this.lnurlPayComment, this.lnurlPayDomain, this.lnurlPayMetadata, this.lnurlPaySuccessAction, this.lnurlPayUnprocessedSuccessAction, this.lnurlWithdrawEndpoint, }); @override int get hashCode => lnAddress.hashCode ^ lnurlPayComment.hashCode ^ lnurlPayDomain.hashCode ^ lnurlPayMetadata.hashCode ^ lnurlPaySuccessAction.hashCode ^ lnurlPayUnprocessedSuccessAction.hashCode ^ lnurlWithdrawEndpoint.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is LnUrlInfo && runtimeType == other.runtimeType && lnAddress == other.lnAddress && lnurlPayComment == other.lnurlPayComment && lnurlPayDomain == other.lnurlPayDomain && lnurlPayMetadata == other.lnurlPayMetadata && lnurlPaySuccessAction == other.lnurlPaySuccessAction && lnurlPayUnprocessedSuccessAction == other.lnurlPayUnprocessedSuccessAction && lnurlWithdrawEndpoint == other.lnurlWithdrawEndpoint; } /// An argument when calling [crate::sdk::LiquidSdk::lnurl_pay]. class LnUrlPayRequest { /// The response from calling [crate::sdk::LiquidSdk::prepare_lnurl_pay] final PrepareLnUrlPayResponse prepareResponse; const LnUrlPayRequest({ required this.prepareResponse, }); @override int get hashCode => prepareResponse.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is LnUrlPayRequest && runtimeType == other.runtimeType && prepareResponse == other.prepareResponse; } @freezed sealed class LnUrlPayResult with _$LnUrlPayResult { const LnUrlPayResult._(); const factory LnUrlPayResult.endpointSuccess({ required LnUrlPaySuccessData data, }) = LnUrlPayResult_EndpointSuccess; const factory LnUrlPayResult.endpointError({ required LnUrlErrorData data, }) = LnUrlPayResult_EndpointError; const factory LnUrlPayResult.payError({ required LnUrlPayErrorData data, }) = LnUrlPayResult_PayError; } class LnUrlPaySuccessData { final Payment payment; final SuccessActionProcessed? successAction; const LnUrlPaySuccessData({ required this.payment, this.successAction, }); @override int get hashCode => payment.hashCode ^ successAction.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is LnUrlPaySuccessData && runtimeType == other.runtimeType && payment == other.payment && successAction == other.successAction; } /// Internal SDK log entry used in the Uniffi and Dart bindings class LogEntry { final String line; final String level; const LogEntry({ required this.line, required this.level, }); @override int get hashCode => line.hashCode ^ level.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is LogEntry && runtimeType == other.runtimeType && line == other.line && level == other.level; } /// Returned when calling [crate::sdk::LiquidSdk::fetch_onchain_limits]. class OnchainPaymentLimitsResponse { /// Amount limits for a Send Onchain Payment to be valid final Limits send; /// Amount limits for a Receive Onchain Payment to be valid final Limits receive; const OnchainPaymentLimitsResponse({ required this.send, required this.receive, }); @override int get hashCode => send.hashCode ^ receive.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is OnchainPaymentLimitsResponse && runtimeType == other.runtimeType && send == other.send && receive == other.receive; } @freezed sealed class PayAmount with _$PayAmount { const PayAmount._(); /// The amount in satoshi that will be received const factory PayAmount.receiver({ required BigInt amountSat, }) = PayAmount_Receiver; /// Indicates that all available funds should be sent const factory PayAmount.drain() = PayAmount_Drain; } /// An argument when calling [crate::sdk::LiquidSdk::pay_onchain]. class PayOnchainRequest { final String address; final PreparePayOnchainResponse prepareResponse; const PayOnchainRequest({ required this.address, required this.prepareResponse, }); @override int get hashCode => address.hashCode ^ prepareResponse.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PayOnchainRequest && runtimeType == other.runtimeType && address == other.address && prepareResponse == other.prepareResponse; } /// Represents an SDK payment. /// /// By default, this is an onchain tx. It may represent a swap, if swap metadata is available. class Payment { /// The destination associated with the payment, if it was created via our SDK. /// Can be either a Liquid/Bitcoin address, a Liquid BIP21 URI or an invoice final String? destination; final String? txId; /// Data to use in the `blinded` param when unblinding the transaction in an explorer. /// See: https://docs.liquid.net/docs/unblinding-transactions final String? unblindingData; /// Composite timestamp that can be used for sorting or displaying the payment. /// /// If this payment has an associated swap, it is the swap creation time. Otherwise, the point /// in time when the underlying tx was included in a block. If there is no associated swap /// available and the underlying tx is not yet confirmed, the value is `now()`. final int timestamp; /// The payment amount, which corresponds to the onchain tx amount. /// /// In case of an outbound payment (Send), this is the payer amount. Otherwise it's the receiver amount. final BigInt amountSat; /// Represents the fees paid by this wallet for this payment. /// /// ### Swaps /// If there is an associated Send Swap, these fees represent the total fees paid by this wallet /// (the sender). It is the difference between the amount that was sent and the amount received. /// /// If there is an associated Receive Swap, these fees represent the total fees paid by this wallet /// (the receiver). It is also the difference between the amount that was sent and the amount received. /// /// ### Pure onchain txs /// If no swap is associated with this payment: /// - for Send payments, this is the onchain tx fee /// - for Receive payments, this is zero final BigInt feesSat; /// Service fees paid to the swapper service. This is only set for swaps (i.e. doesn't apply to /// direct Liquid payments). final BigInt? swapperFeesSat; /// If it is a `Send` or `Receive` payment final PaymentType paymentType; /// Composite status representing the overall status of the payment. /// /// If the tx has no associated swap, this reflects the onchain tx status (confirmed or not). /// /// If the tx has an associated swap, this is determined by the swap status (pending or complete). final PaymentState status; /// The details of a payment, depending on its [destination](Payment::destination) and /// [type](Payment::payment_type) final PaymentDetails details; const Payment({ this.destination, this.txId, this.unblindingData, required this.timestamp, required this.amountSat, required this.feesSat, this.swapperFeesSat, required this.paymentType, required this.status, required this.details, }); @override int get hashCode => destination.hashCode ^ txId.hashCode ^ unblindingData.hashCode ^ timestamp.hashCode ^ amountSat.hashCode ^ feesSat.hashCode ^ swapperFeesSat.hashCode ^ paymentType.hashCode ^ status.hashCode ^ details.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is Payment && runtimeType == other.runtimeType && destination == other.destination && txId == other.txId && unblindingData == other.unblindingData && timestamp == other.timestamp && amountSat == other.amountSat && feesSat == other.feesSat && swapperFeesSat == other.swapperFeesSat && paymentType == other.paymentType && status == other.status && details == other.details; } @freezed sealed class PaymentDetails with _$PaymentDetails { const PaymentDetails._(); /// Swapping to or from Lightning const factory PaymentDetails.lightning({ required String swapId, /// Represents the invoice description required String description, /// In case of a Send swap, this is the preimage of the paid invoice (proof of payment). String? preimage, /// Represents the Bolt11 invoice associated with a payment /// In the case of a Send payment, this is the invoice paid by the swapper /// In the case of a Receive payment, this is the invoice paid by the user String? bolt11, String? bolt12Offer, /// The payment hash of the invoice String? paymentHash, /// The payment LNURL info LnUrlInfo? lnurlInfo, /// For a Send swap which was refunded, this is the refund tx id String? refundTxId, /// For a Send swap which was refunded, this is the refund amount BigInt? refundTxAmountSat, }) = PaymentDetails_Lightning; /// Direct onchain payment to a Liquid address const factory PaymentDetails.liquid({ /// Represents either a Liquid BIP21 URI or pure address required String destination, /// Represents the BIP21 `message` field required String description, }) = PaymentDetails_Liquid; /// Swapping to or from the Bitcoin chain const factory PaymentDetails.bitcoin({ required String swapId, /// Represents the invoice description required String description, /// For a Send swap which was refunded, this is the refund tx id String? refundTxId, /// For a Send swap which was refunded, this is the refund amount BigInt? refundTxAmountSat, }) = PaymentDetails_Bitcoin; } /// The send/receive methods supported by the SDK enum PaymentMethod { lightning, bitcoinAddress, liquidAddress, ; } /// The payment state of an individual payment. enum PaymentState { created, /// ## Receive Swaps /// /// Covers the cases when /// - the lockup tx is seen in the mempool or /// - our claim tx is broadcast /// /// When the claim tx is broadcast, `claim_tx_id` is set in the swap. /// /// ## Send Swaps /// /// This is the status when our lockup tx was broadcast /// /// ## Chain Swaps /// /// This is the status when the user lockup tx was broadcast /// /// ## No swap data available /// /// If no associated swap is found, this indicates the underlying tx is not confirmed yet. pending, /// ## Receive Swaps /// /// Covers the case when the claim tx is confirmed. /// /// ## Send and Chain Swaps /// /// This is the status when the claim tx is broadcast and we see it in the mempool. /// /// ## No swap data available /// /// If no associated swap is found, this indicates the underlying tx is confirmed. complete, /// ## Receive Swaps /// /// This is the status when the swap failed for any reason and the Receive could not complete. /// /// ## Send and Chain Swaps /// /// This is the status when a swap refund was initiated and the refund tx is confirmed. failed, /// ## Send and Outgoing Chain Swaps /// /// This covers the case when the swap state is still Created and the swap fails to reach the /// Pending state in time. The TimedOut state indicates the lockup tx should never be broadcast. timedOut, /// ## Incoming Chain Swaps /// /// This covers the case when the swap failed for any reason and there is a user lockup tx. /// The swap in this case has to be manually refunded with a provided Bitcoin address refundable, /// ## Send and Chain Swaps /// /// This is the status when a refund was initiated and/or our refund tx was broadcast /// /// When the refund tx is broadcast, `refund_tx_id` is set in the swap. refundPending, /// ## Chain Swaps /// /// This is the state when the user needs to accept new fees before the payment can proceed. /// /// Use [LiquidSdk::fetch_payment_proposed_fees](crate::sdk::LiquidSdk::fetch_payment_proposed_fees) /// to find out the current fees and /// [LiquidSdk::accept_payment_proposed_fees](crate::sdk::LiquidSdk::accept_payment_proposed_fees) /// to accept them, allowing the payment to proceed. /// /// Otherwise, this payment can be immediately refunded using /// [prepare_refund](crate::sdk::LiquidSdk::prepare_refund)/[refund](crate::sdk::LiquidSdk::refund). waitingFeeAcceptance, ; } enum PaymentType { receive, send, ; } /// An argument when calling [crate::sdk::LiquidSdk::prepare_buy_bitcoin]. class PrepareBuyBitcoinRequest { final BuyBitcoinProvider provider; final BigInt amountSat; const PrepareBuyBitcoinRequest({ required this.provider, required this.amountSat, }); @override int get hashCode => provider.hashCode ^ amountSat.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareBuyBitcoinRequest && runtimeType == other.runtimeType && provider == other.provider && amountSat == other.amountSat; } /// Returned when calling [crate::sdk::LiquidSdk::prepare_buy_bitcoin]. class PrepareBuyBitcoinResponse { final BuyBitcoinProvider provider; final BigInt amountSat; final BigInt feesSat; const PrepareBuyBitcoinResponse({ required this.provider, required this.amountSat, required this.feesSat, }); @override int get hashCode => provider.hashCode ^ amountSat.hashCode ^ feesSat.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareBuyBitcoinResponse && runtimeType == other.runtimeType && provider == other.provider && amountSat == other.amountSat && feesSat == other.feesSat; } /// An argument when calling [crate::sdk::LiquidSdk::prepare_lnurl_pay]. class PrepareLnUrlPayRequest { /// The [LnUrlPayRequestData] returned by [crate::input_parser::parse] final LnUrlPayRequestData data; /// The amount in millisatoshis for this payment final BigInt amountMsat; /// An optional comment for this payment final String? comment; /// Validates that, if there is a URL success action, the URL domain matches /// the LNURL callback domain. Defaults to `true` final bool? validateSuccessActionUrl; const PrepareLnUrlPayRequest({ required this.data, required this.amountMsat, this.comment, this.validateSuccessActionUrl, }); @override int get hashCode => data.hashCode ^ amountMsat.hashCode ^ comment.hashCode ^ validateSuccessActionUrl.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareLnUrlPayRequest && runtimeType == other.runtimeType && data == other.data && amountMsat == other.amountMsat && comment == other.comment && validateSuccessActionUrl == other.validateSuccessActionUrl; } /// Returned when calling [crate::sdk::LiquidSdk::prepare_lnurl_pay]. class PrepareLnUrlPayResponse { /// The destination of the payment final SendDestination destination; /// The fees in satoshis to send the payment final BigInt feesSat; /// The [LnUrlPayRequestData] returned by [crate::input_parser::parse] final LnUrlPayRequestData data; /// An optional comment for this payment final String? comment; /// The unprocessed LUD-09 success action. This will be processed and decrypted if /// needed after calling [crate::sdk::LiquidSdk::lnurl_pay] final SuccessAction? successAction; const PrepareLnUrlPayResponse({ required this.destination, required this.feesSat, required this.data, this.comment, this.successAction, }); @override int get hashCode => destination.hashCode ^ feesSat.hashCode ^ data.hashCode ^ comment.hashCode ^ successAction.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareLnUrlPayResponse && runtimeType == other.runtimeType && destination == other.destination && feesSat == other.feesSat && data == other.data && comment == other.comment && successAction == other.successAction; } /// An argument when calling [crate::sdk::LiquidSdk::prepare_pay_onchain]. class PreparePayOnchainRequest { final PayAmount amount; /// The optional fee rate of the Bitcoin claim transaction in sat/vB. Defaults to the swapper estimated claim fee. final int? feeRateSatPerVbyte; const PreparePayOnchainRequest({ required this.amount, this.feeRateSatPerVbyte, }); @override int get hashCode => amount.hashCode ^ feeRateSatPerVbyte.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PreparePayOnchainRequest && runtimeType == other.runtimeType && amount == other.amount && feeRateSatPerVbyte == other.feeRateSatPerVbyte; } /// Returned when calling [crate::sdk::LiquidSdk::prepare_pay_onchain]. class PreparePayOnchainResponse { final BigInt receiverAmountSat; final BigInt claimFeesSat; final BigInt totalFeesSat; const PreparePayOnchainResponse({ required this.receiverAmountSat, required this.claimFeesSat, required this.totalFeesSat, }); @override int get hashCode => receiverAmountSat.hashCode ^ claimFeesSat.hashCode ^ totalFeesSat.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PreparePayOnchainResponse && runtimeType == other.runtimeType && receiverAmountSat == other.receiverAmountSat && claimFeesSat == other.claimFeesSat && totalFeesSat == other.totalFeesSat; } /// An argument when calling [crate::sdk::LiquidSdk::prepare_receive_payment]. class PrepareReceiveRequest { final BigInt? payerAmountSat; final PaymentMethod paymentMethod; const PrepareReceiveRequest({ this.payerAmountSat, required this.paymentMethod, }); @override int get hashCode => payerAmountSat.hashCode ^ paymentMethod.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareReceiveRequest && runtimeType == other.runtimeType && payerAmountSat == other.payerAmountSat && paymentMethod == other.paymentMethod; } /// Returned when calling [crate::sdk::LiquidSdk::prepare_receive_payment]. class PrepareReceiveResponse { final PaymentMethod paymentMethod; final BigInt? payerAmountSat; /// Generally represents the total fees that would be paid to send or receive this payment. /// /// In case of Zero-Amount Receive Chain swaps, the swapper service fee (`swapper_feerate` times /// the amount) is paid in addition to `fees_sat`. The swapper service feerate is already known /// in the beginning, but the exact swapper service fee will only be known when the /// `payer_amount_sat` is known. /// /// In all other types of swaps, the swapper service fee is included in `fees_sat`. final BigInt feesSat; /// The minimum amount the payer can send for this swap to succeed. /// /// When the method is [PaymentMethod::LiquidAddress], this is empty. final BigInt? minPayerAmountSat; /// The maximum amount the payer can send for this swap to succeed. /// /// When the method is [PaymentMethod::LiquidAddress], this is empty. final BigInt? maxPayerAmountSat; /// The percentage of the sent amount that will count towards the service fee. /// /// When the method is [PaymentMethod::LiquidAddress], this is empty. final double? swapperFeerate; const PrepareReceiveResponse({ required this.paymentMethod, this.payerAmountSat, required this.feesSat, this.minPayerAmountSat, this.maxPayerAmountSat, this.swapperFeerate, }); @override int get hashCode => paymentMethod.hashCode ^ payerAmountSat.hashCode ^ feesSat.hashCode ^ minPayerAmountSat.hashCode ^ maxPayerAmountSat.hashCode ^ swapperFeerate.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareReceiveResponse && runtimeType == other.runtimeType && paymentMethod == other.paymentMethod && payerAmountSat == other.payerAmountSat && feesSat == other.feesSat && minPayerAmountSat == other.minPayerAmountSat && maxPayerAmountSat == other.maxPayerAmountSat && swapperFeerate == other.swapperFeerate; } /// An argument when calling [crate::sdk::LiquidSdk::prepare_refund]. class PrepareRefundRequest { /// The address where the swap funds are locked up final String swapAddress; /// The address to refund the swap funds to final String refundAddress; /// The fee rate in sat/vB for the refund transaction final int feeRateSatPerVbyte; const PrepareRefundRequest({ required this.swapAddress, required this.refundAddress, required this.feeRateSatPerVbyte, }); @override int get hashCode => swapAddress.hashCode ^ refundAddress.hashCode ^ feeRateSatPerVbyte.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareRefundRequest && runtimeType == other.runtimeType && swapAddress == other.swapAddress && refundAddress == other.refundAddress && feeRateSatPerVbyte == other.feeRateSatPerVbyte; } /// Returned when calling [crate::sdk::LiquidSdk::prepare_refund]. class PrepareRefundResponse { final int txVsize; final BigInt txFeeSat; final String? refundTxId; const PrepareRefundResponse({ required this.txVsize, required this.txFeeSat, this.refundTxId, }); @override int get hashCode => txVsize.hashCode ^ txFeeSat.hashCode ^ refundTxId.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareRefundResponse && runtimeType == other.runtimeType && txVsize == other.txVsize && txFeeSat == other.txFeeSat && refundTxId == other.refundTxId; } /// An argument when calling [crate::sdk::LiquidSdk::prepare_send_payment]. class PrepareSendRequest { /// The destination we intend to pay to. /// Supports BIP21 URIs, BOLT11 invoices, BOLT12 offers and Liquid addresses final String destination; /// Should only be set when paying directly onchain or to a BIP21 URI /// where no amount is specified, or when the caller wishes to drain final PayAmount? amount; const PrepareSendRequest({ required this.destination, this.amount, }); @override int get hashCode => destination.hashCode ^ amount.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareSendRequest && runtimeType == other.runtimeType && destination == other.destination && amount == other.amount; } /// Returned when calling [crate::sdk::LiquidSdk::prepare_send_payment]. class PrepareSendResponse { final SendDestination destination; final BigInt feesSat; const PrepareSendResponse({ required this.destination, required this.feesSat, }); @override int get hashCode => destination.hashCode ^ feesSat.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is PrepareSendResponse && runtimeType == other.runtimeType && destination == other.destination && feesSat == other.feesSat; } /// An argument when calling [crate::sdk::LiquidSdk::receive_payment]. class ReceivePaymentRequest { final PrepareReceiveResponse prepareResponse; /// The description for this payment request. final String? description; /// If set to true, then the hash of the description will be used. final bool? useDescriptionHash; const ReceivePaymentRequest({ required this.prepareResponse, this.description, this.useDescriptionHash, }); @override int get hashCode => prepareResponse.hashCode ^ description.hashCode ^ useDescriptionHash.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is ReceivePaymentRequest && runtimeType == other.runtimeType && prepareResponse == other.prepareResponse && description == other.description && useDescriptionHash == other.useDescriptionHash; } /// Returned when calling [crate::sdk::LiquidSdk::receive_payment]. class ReceivePaymentResponse { /// Either a BIP21 URI (Liquid or Bitcoin), a Liquid address /// or an invoice, depending on the [PrepareReceiveResponse] parameters final String destination; const ReceivePaymentResponse({ required this.destination, }); @override int get hashCode => destination.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is ReceivePaymentResponse && runtimeType == other.runtimeType && destination == other.destination; } /// Returned when calling [crate::sdk::LiquidSdk::recommended_fees]. class RecommendedFees { final BigInt fastestFee; final BigInt halfHourFee; final BigInt hourFee; final BigInt economyFee; final BigInt minimumFee; const RecommendedFees({ required this.fastestFee, required this.halfHourFee, required this.hourFee, required this.economyFee, required this.minimumFee, }); @override int get hashCode => fastestFee.hashCode ^ halfHourFee.hashCode ^ hourFee.hashCode ^ economyFee.hashCode ^ minimumFee.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is RecommendedFees && runtimeType == other.runtimeType && fastestFee == other.fastestFee && halfHourFee == other.halfHourFee && hourFee == other.hourFee && economyFee == other.economyFee && minimumFee == other.minimumFee; } /// An argument when calling [crate::sdk::LiquidSdk::refund]. class RefundRequest { /// The address where the swap funds are locked up final String swapAddress; /// The address to refund the swap funds to final String refundAddress; /// The fee rate in sat/vB for the refund transaction final int feeRateSatPerVbyte; const RefundRequest({ required this.swapAddress, required this.refundAddress, required this.feeRateSatPerVbyte, }); @override int get hashCode => swapAddress.hashCode ^ refundAddress.hashCode ^ feeRateSatPerVbyte.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is RefundRequest && runtimeType == other.runtimeType && swapAddress == other.swapAddress && refundAddress == other.refundAddress && feeRateSatPerVbyte == other.feeRateSatPerVbyte; } /// Returned when calling [crate::sdk::LiquidSdk::refund]. class RefundResponse { final String refundTxId; const RefundResponse({ required this.refundTxId, }); @override int get hashCode => refundTxId.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is RefundResponse && runtimeType == other.runtimeType && refundTxId == other.refundTxId; } /// Returned when calling [crate::sdk::LiquidSdk::list_refundables]. class RefundableSwap { final String swapAddress; final int timestamp; /// Amount that is refundable, from all UTXOs final BigInt amountSat; const RefundableSwap({ required this.swapAddress, required this.timestamp, required this.amountSat, }); @override int get hashCode => swapAddress.hashCode ^ timestamp.hashCode ^ amountSat.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is RefundableSwap && runtimeType == other.runtimeType && swapAddress == other.swapAddress && timestamp == other.timestamp && amountSat == other.amountSat; } /// An argument when calling [crate::sdk::LiquidSdk::restore]. class RestoreRequest { final String? backupPath; const RestoreRequest({ this.backupPath, }); @override int get hashCode => backupPath.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is RestoreRequest && runtimeType == other.runtimeType && backupPath == other.backupPath; } @freezed sealed class SdkEvent with _$SdkEvent { const SdkEvent._(); const factory SdkEvent.paymentFailed({ required Payment details, }) = SdkEvent_PaymentFailed; const factory SdkEvent.paymentPending({ required Payment details, }) = SdkEvent_PaymentPending; const factory SdkEvent.paymentRefunded({ required Payment details, }) = SdkEvent_PaymentRefunded; const factory SdkEvent.paymentRefundPending({ required Payment details, }) = SdkEvent_PaymentRefundPending; const factory SdkEvent.paymentSucceeded({ required Payment details, }) = SdkEvent_PaymentSucceeded; const factory SdkEvent.paymentWaitingConfirmation({ required Payment details, }) = SdkEvent_PaymentWaitingConfirmation; const factory SdkEvent.paymentWaitingFeeAcceptance({ required Payment details, }) = SdkEvent_PaymentWaitingFeeAcceptance; const factory SdkEvent.synced() = SdkEvent_Synced; } @freezed sealed class SendDestination with _$SendDestination { const SendDestination._(); const factory SendDestination.liquidAddress({ required LiquidAddressData addressData, }) = SendDestination_LiquidAddress; const factory SendDestination.bolt11({ required LNInvoice invoice, }) = SendDestination_Bolt11; const factory SendDestination.bolt12({ required LNOffer offer, required BigInt receiverAmountSat, }) = SendDestination_Bolt12; } /// An argument when calling [crate::sdk::LiquidSdk::send_payment]. class SendPaymentRequest { final PrepareSendResponse prepareResponse; const SendPaymentRequest({ required this.prepareResponse, }); @override int get hashCode => prepareResponse.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is SendPaymentRequest && runtimeType == other.runtimeType && prepareResponse == other.prepareResponse; } /// Returned when calling [crate::sdk::LiquidSdk::send_payment]. class SendPaymentResponse { final Payment payment; const SendPaymentResponse({ required this.payment, }); @override int get hashCode => payment.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is SendPaymentResponse && runtimeType == other.runtimeType && payment == other.payment; } /// An argument when calling [crate::sdk::LiquidSdk::sign_message]. class SignMessageRequest { final String message; const SignMessageRequest({ required this.message, }); @override int get hashCode => message.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is SignMessageRequest && runtimeType == other.runtimeType && message == other.message; } /// Returned when calling [crate::sdk::LiquidSdk::sign_message]. class SignMessageResponse { final String signature; const SignMessageResponse({ required this.signature, }); @override int get hashCode => signature.hashCode; @override bool operator ==(Object other) => identical(this, other) || other is SignMessageResponse && runtimeType == other.runtimeType && signature == other.signature; }