11// This file is automatically generated, so please do not edit it.
2- // Generated by `flutter_rust_bridge`@ 2.0 .0.
2+ // @generated by `flutter_rust_bridge`@ 2.9 .0.
33
44// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
55
66import '../frb_generated.dart' ;
77import 'error.dart' ;
88import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart' ;
9- import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
109import 'types.dart' ;
11- part 'btc_ln.freezed.dart' ;
1210
1311// These functions are ignored because they are not marked as `pub`: `extract_id`
1412// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `assert_receiver_is_total_eq`, `clone`, `eq`
1513
1614/// Bitcoin-Lightning Swap Class
17- @freezed
18- class BtcLnSwap with _$BtcLnSwap {
19- const BtcLnSwap ._();
20- const factory BtcLnSwap ({
21- required String id,
22- required SwapType kind,
23- required Chain network,
24- required KeyPair keys,
25- required BigInt keyIndex,
26- required PreImage preimage,
27- required BtcSwapScriptStr swapScript,
28- required String invoice,
29- required String scriptAddress,
30- required BigInt outAmount,
31- required String electrumUrl,
32- required String boltzUrl,
33- String ? referralId,
34- }) = _BtcLnSwap ;
15+ class BtcLnSwap {
16+ final String id;
17+ final SwapType kind;
18+ final Chain network;
19+ final KeyPair keys;
20+ final BigInt keyIndex;
21+ final PreImage preimage;
22+ final BtcSwapScriptStr swapScript;
23+ final String invoice;
24+ final String scriptAddress;
25+ final BigInt outAmount;
26+ final String electrumUrl;
27+ final String boltzUrl;
28+ final String ? referralId;
29+
30+ const BtcLnSwap ({
31+ required this .id,
32+ required this .kind,
33+ required this .network,
34+ required this .keys,
35+ required this .keyIndex,
36+ required this .preimage,
37+ required this .swapScript,
38+ required this .invoice,
39+ required this .scriptAddress,
40+ required this .outAmount,
41+ required this .electrumUrl,
42+ required this .boltzUrl,
43+ this .referralId,
44+ });
3545
3646 /// Broadcast using boltz's electrum server
3747 Future <String > broadcastBoltz ({required String signedHex}) => BoltzCore
@@ -54,6 +64,11 @@ class BtcLnSwap with _$BtcLnSwap {
5464 minerFee: minerFee,
5565 tryCooperate: tryCooperate);
5666
67+ /// Get the size of the claim transaction. Can be used to estimate the absolute miner fees required, given a fee rate.
68+ Future <BigInt > claimTxSize ({required bool isCooperative}) =>
69+ BoltzCore .instance.api.crateApiBtcLnBtcLnSwapClaimTxSize (
70+ that: this , isCooperative: isCooperative);
71+
5772 /// After boltz completes a submarine swap, call this function to close the swap cooperatively using Musig.
5873 /// If this function is not called within ~1 hour, the swap will be closed via the script path.
5974 /// The benefit of a cooperative close is that the onchain footprint is smaller and makes the transaction look like a single sig tx, while the script path spend is clearly a swap tx.
@@ -162,13 +177,49 @@ class BtcLnSwap with _$BtcLnSwap {
162177 minerFee: minerFee,
163178 tryCooperate: tryCooperate);
164179
180+ /// Get the size of the refund transaction. Can be used to estimate the absolute miner fees required, given a fee rate.
181+ Future <BigInt > refundTxSize ({required bool isCooperative}) =>
182+ BoltzCore .instance.api.crateApiBtcLnBtcLnSwapRefundTxSize (
183+ that: this , isCooperative: isCooperative);
184+
165185 /// Convert instance to a JSON string.
166186 Future <String > toJson () =>
167187 BoltzCore .instance.api.crateApiBtcLnBtcLnSwapToJson (
168188 that: this ,
169189 );
170190
171- /// Get the size of the transaction. Can be used to estimate the absolute miner fees required, given a fee rate.
172- Future <BigInt > txSize ({required bool isCooperative}) => BoltzCore .instance.api
173- .crateApiBtcLnBtcLnSwapTxSize (that: this , isCooperative: isCooperative);
191+ @override
192+ int get hashCode =>
193+ id.hashCode ^
194+ kind.hashCode ^
195+ network.hashCode ^
196+ keys.hashCode ^
197+ keyIndex.hashCode ^
198+ preimage.hashCode ^
199+ swapScript.hashCode ^
200+ invoice.hashCode ^
201+ scriptAddress.hashCode ^
202+ outAmount.hashCode ^
203+ electrumUrl.hashCode ^
204+ boltzUrl.hashCode ^
205+ referralId.hashCode;
206+
207+ @override
208+ bool operator == (Object other) =>
209+ identical (this , other) ||
210+ other is BtcLnSwap &&
211+ runtimeType == other.runtimeType &&
212+ id == other.id &&
213+ kind == other.kind &&
214+ network == other.network &&
215+ keys == other.keys &&
216+ keyIndex == other.keyIndex &&
217+ preimage == other.preimage &&
218+ swapScript == other.swapScript &&
219+ invoice == other.invoice &&
220+ scriptAddress == other.scriptAddress &&
221+ outAmount == other.outAmount &&
222+ electrumUrl == other.electrumUrl &&
223+ boltzUrl == other.boltzUrl &&
224+ referralId == other.referralId;
174225}
0 commit comments