Skip to content

Commit 2cfd5c8

Browse files
authored
Merge pull request #33 from SatoshiPortal/main
Align with main
2 parents d38ee3e + a68b4f5 commit 2cfd5c8

23 files changed

+850
-108
lines changed

ios/Classes/frb_generated.h

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ typedef struct wire_cst_chain_swap {
105105
struct wire_cst_list_prim_u_8_strict *blinding_key;
106106
} wire_cst_chain_swap;
107107

108+
typedef struct wire_cst_boltz_error {
109+
struct wire_cst_list_prim_u_8_strict *kind;
110+
struct wire_cst_list_prim_u_8_strict *message;
111+
} wire_cst_boltz_error;
112+
108113
typedef struct wire_cst_fees {
109114
struct wire_cst_list_prim_u_8_strict *boltz_url;
110115
} wire_cst_fees;
@@ -126,11 +131,6 @@ typedef struct wire_cst_lbtc_ln_swap {
126131
struct wire_cst_list_prim_u_8_strict *referral_id;
127132
} wire_cst_lbtc_ln_swap;
128133

129-
typedef struct wire_cst_boltz_error {
130-
struct wire_cst_list_prim_u_8_strict *kind;
131-
struct wire_cst_list_prim_u_8_strict *message;
132-
} wire_cst_boltz_error;
133-
134134
typedef struct wire_cst_swap_limits {
135135
uint64_t minimal;
136136
uint64_t maximal;
@@ -211,6 +211,9 @@ void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_coop_close_submarine(int
211211
void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_from_json(int64_t port_,
212212
struct wire_cst_list_prim_u_8_strict *json_str);
213213

214+
void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_get_completed_submarine_preimage(int64_t port_,
215+
struct wire_cst_btc_ln_swap *that);
216+
214217
void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new(int64_t port_,
215218
struct wire_cst_list_prim_u_8_strict *id,
216219
int32_t kind,
@@ -228,6 +231,7 @@ void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new(int64_t port_,
228231

229232
void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_reverse(int64_t port_,
230233
struct wire_cst_list_prim_u_8_strict *mnemonic,
234+
struct wire_cst_list_prim_u_8_strict *passphrase,
231235
uint64_t index,
232236
uint64_t out_amount,
233237
struct wire_cst_list_prim_u_8_strict *out_address,
@@ -239,6 +243,7 @@ void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_reverse(int64_t port
239243

240244
void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_submarine(int64_t port_,
241245
struct wire_cst_list_prim_u_8_strict *mnemonic,
246+
struct wire_cst_list_prim_u_8_strict *passphrase,
242247
uint64_t index,
243248
struct wire_cst_list_prim_u_8_strict *invoice,
244249
int32_t network,
@@ -307,6 +312,7 @@ void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_new(int64_t port_,
307312
void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_new_swap(int64_t port_,
308313
int32_t direction,
309314
struct wire_cst_list_prim_u_8_strict *mnemonic,
315+
struct wire_cst_list_prim_u_8_strict *passphrase,
310316
uint64_t index,
311317
uint64_t amount,
312318
bool is_testnet,
@@ -324,6 +330,9 @@ void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_refund(int64_t port_,
324330
void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_to_json(int64_t port_,
325331
struct wire_cst_chain_swap *that);
326332

333+
void frbgen_boltz_wire__crate__api__error__boltz_error_detail(int64_t port_,
334+
struct wire_cst_boltz_error *that);
335+
327336
void frbgen_boltz_wire__crate__api__error__boltz_error_new(int64_t port_,
328337
struct wire_cst_list_prim_u_8_strict *kind,
329338
struct wire_cst_list_prim_u_8_strict *message);
@@ -357,6 +366,9 @@ void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_coop_close_submarine(i
357366
void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_from_json(int64_t port_,
358367
struct wire_cst_list_prim_u_8_strict *json_str);
359368

369+
void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_get_completed_submarine_preimage(int64_t port_,
370+
struct wire_cst_lbtc_ln_swap *that);
371+
360372
void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new(int64_t port_,
361373
struct wire_cst_list_prim_u_8_strict *id,
362374
int32_t kind,
@@ -375,6 +387,7 @@ void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new(int64_t port_,
375387

376388
void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_reverse(int64_t port_,
377389
struct wire_cst_list_prim_u_8_strict *mnemonic,
390+
struct wire_cst_list_prim_u_8_strict *passphrase,
378391
uint64_t index,
379392
uint64_t out_amount,
380393
struct wire_cst_list_prim_u_8_strict *out_address,
@@ -386,6 +399,7 @@ void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_reverse(int64_t po
386399

387400
void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_submarine(int64_t port_,
388401
struct wire_cst_list_prim_u_8_strict *mnemonic,
402+
struct wire_cst_list_prim_u_8_strict *passphrase,
389403
uint64_t index,
390404
struct wire_cst_list_prim_u_8_strict *invoice,
391405
int32_t network,
@@ -428,6 +442,7 @@ void frbgen_boltz_wire__crate__api__types__invoice_from_lnurl(int64_t port_,
428442

429443
void frbgen_boltz_wire__crate__api__types__key_pair_generate(int64_t port_,
430444
struct wire_cst_list_prim_u_8_strict *mnemonic,
445+
struct wire_cst_list_prim_u_8_strict *passphrase,
431446
int32_t network,
432447
uint64_t index,
433448
int32_t swap_type);
@@ -460,6 +475,8 @@ void frbgen_boltz_wire__crate__api__types__withdraw(int64_t port_,
460475
struct wire_cst_list_prim_u_8_strict *lnurl,
461476
struct wire_cst_list_prim_u_8_strict *invoice);
462477

478+
struct wire_cst_boltz_error *frbgen_boltz_cst_new_box_autoadd_boltz_error(void);
479+
463480
struct wire_cst_btc_ln_swap *frbgen_boltz_cst_new_box_autoadd_btc_ln_swap(void);
464481

465482
struct wire_cst_btc_swap_script_str *frbgen_boltz_cst_new_box_autoadd_btc_swap_script_str(void);
@@ -483,6 +500,7 @@ struct wire_cst_tx_fee *frbgen_boltz_cst_new_box_autoadd_tx_fee(void);
483500
struct wire_cst_list_prim_u_8_strict *frbgen_boltz_cst_new_list_prim_u_8_strict(int32_t len);
484501
static int64_t dummy_method_to_enforce_bundling(void) {
485502
int64_t dummy_var = 0;
503+
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_boltz_error);
486504
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_btc_ln_swap);
487505
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_btc_swap_script_str);
488506
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_chain_swap);
@@ -499,6 +517,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
499517
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_claim);
500518
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_coop_close_submarine);
501519
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_from_json);
520+
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_get_completed_submarine_preimage);
502521
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new);
503522
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_reverse);
504523
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_submarine);
@@ -515,6 +534,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
515534
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__chain_swap__chain_swap_new_swap);
516535
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__chain_swap__chain_swap_refund);
517536
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__chain_swap__chain_swap_to_json);
537+
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__error__boltz_error_detail);
518538
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__error__boltz_error_new);
519539
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__fees__fees_chain);
520540
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__fees__fees_new);
@@ -525,6 +545,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
525545
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_claim);
526546
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_coop_close_submarine);
527547
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_from_json);
548+
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_get_completed_submarine_preimage);
528549
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new);
529550
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_reverse);
530551
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_submarine);

lib/src/generated/api/btc_ln.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ class BtcLnSwap with _$BtcLnSwap {
6666
static Future<BtcLnSwap> fromJson({required String jsonStr}) =>
6767
BoltzCore.instance.api.crateApiBtcLnBtcLnSwapFromJson(jsonStr: jsonStr);
6868

69+
/// Retrieves the preimage for a completed submarine swap.
70+
Future<String> getCompletedSubmarinePreimage() => BoltzCore.instance.api
71+
.crateApiBtcLnBtcLnSwapGetCompletedSubmarinePreimage(
72+
that: this,
73+
);
74+
6975
// HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class.
7076
/// Manually create the class. Primarily used when recovering a swap.
7177
static Future<BtcLnSwap> newInstance(
@@ -102,6 +108,7 @@ class BtcLnSwap with _$BtcLnSwap {
102108
/// The client is expected to manage (increment) the use of index to ensure keys are not reused.
103109
static Future<BtcLnSwap> newReverse(
104110
{required String mnemonic,
111+
required String passphrase,
105112
required BigInt index,
106113
required BigInt outAmount,
107114
String? outAddress,
@@ -112,6 +119,7 @@ class BtcLnSwap with _$BtcLnSwap {
112119
String? referralId}) =>
113120
BoltzCore.instance.api.crateApiBtcLnBtcLnSwapNewReverse(
114121
mnemonic: mnemonic,
122+
passphrase: passphrase,
115123
index: index,
116124
outAmount: outAmount,
117125
outAddress: outAddress,
@@ -126,6 +134,7 @@ class BtcLnSwap with _$BtcLnSwap {
126134
/// The client is expected to manage (increment) the use of index to ensure keys are not reused.
127135
static Future<BtcLnSwap> newSubmarine(
128136
{required String mnemonic,
137+
required String passphrase,
129138
required BigInt index,
130139
required String invoice,
131140
required Chain network,
@@ -134,6 +143,7 @@ class BtcLnSwap with _$BtcLnSwap {
134143
String? referralId}) =>
135144
BoltzCore.instance.api.crateApiBtcLnBtcLnSwapNewSubmarine(
136145
mnemonic: mnemonic,
146+
passphrase: passphrase,
137147
index: index,
138148
invoice: invoice,
139149
network: network,

lib/src/generated/api/chain_swap.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class ChainSwap with _$ChainSwap {
124124
static Future<ChainSwap> newSwap(
125125
{required ChainSwapDirection direction,
126126
required String mnemonic,
127+
required String passphrase,
127128
required BigInt index,
128129
required BigInt amount,
129130
required bool isTestnet,
@@ -134,6 +135,7 @@ class ChainSwap with _$ChainSwap {
134135
BoltzCore.instance.api.crateApiChainSwapChainSwapNewSwap(
135136
direction: direction,
136137
mnemonic: mnemonic,
138+
passphrase: passphrase,
137139
index: index,
138140
amount: amount,
139141
isTestnet: isTestnet,

lib/src/generated/api/error.dart

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,25 @@
55

66
import '../frb_generated.dart';
77
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
8+
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
9+
part 'error.freezed.dart';
810

911
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `fmt`, `from`
1012

11-
class BoltzError implements FrbException {
12-
final String kind;
13-
final String message;
14-
15-
const BoltzError({
16-
required this.kind,
17-
required this.message,
18-
});
13+
@freezed
14+
class BoltzError with _$BoltzError implements FrbException {
15+
const BoltzError._();
16+
const factory BoltzError({
17+
required String kind,
18+
required String message,
19+
}) = _BoltzError;
20+
Future<void> detail() => BoltzCore.instance.api.crateApiErrorBoltzErrorDetail(
21+
that: this,
22+
);
1923

2024
// HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class.
2125
static Future<BoltzError> newInstance(
2226
{required String kind, required String message}) =>
2327
BoltzCore.instance.api
2428
.crateApiErrorBoltzErrorNew(kind: kind, message: message);
25-
26-
@override
27-
int get hashCode => kind.hashCode ^ message.hashCode;
28-
29-
@override
30-
bool operator ==(Object other) =>
31-
identical(this, other) ||
32-
other is BoltzError &&
33-
runtimeType == other.runtimeType &&
34-
kind == other.kind &&
35-
message == other.message;
3629
}

0 commit comments

Comments
 (0)