Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions ios/Classes/frb_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ typedef struct wire_cst_chain_swap {
struct wire_cst_list_prim_u_8_strict *blinding_key;
} wire_cst_chain_swap;

typedef struct wire_cst_boltz_error {
struct wire_cst_list_prim_u_8_strict *kind;
struct wire_cst_list_prim_u_8_strict *message;
} wire_cst_boltz_error;

typedef struct wire_cst_fees {
struct wire_cst_list_prim_u_8_strict *boltz_url;
} wire_cst_fees;
Expand All @@ -126,11 +131,6 @@ typedef struct wire_cst_lbtc_ln_swap {
struct wire_cst_list_prim_u_8_strict *referral_id;
} wire_cst_lbtc_ln_swap;

typedef struct wire_cst_boltz_error {
struct wire_cst_list_prim_u_8_strict *kind;
struct wire_cst_list_prim_u_8_strict *message;
} wire_cst_boltz_error;

typedef struct wire_cst_swap_limits {
uint64_t minimal;
uint64_t maximal;
Expand Down Expand Up @@ -211,6 +211,9 @@ void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_coop_close_submarine(int
void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_from_json(int64_t port_,
struct wire_cst_list_prim_u_8_strict *json_str);

void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_get_completed_submarine_preimage(int64_t port_,
struct wire_cst_btc_ln_swap *that);

void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new(int64_t port_,
struct wire_cst_list_prim_u_8_strict *id,
int32_t kind,
Expand All @@ -228,6 +231,7 @@ void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new(int64_t port_,

void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_reverse(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *passphrase,
uint64_t index,
uint64_t out_amount,
struct wire_cst_list_prim_u_8_strict *out_address,
Expand All @@ -239,6 +243,7 @@ void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_reverse(int64_t port

void frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_submarine(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *passphrase,
uint64_t index,
struct wire_cst_list_prim_u_8_strict *invoice,
int32_t network,
Expand Down Expand Up @@ -307,6 +312,7 @@ void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_new(int64_t port_,
void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_new_swap(int64_t port_,
int32_t direction,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *passphrase,
uint64_t index,
uint64_t amount,
bool is_testnet,
Expand All @@ -324,6 +330,9 @@ void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_refund(int64_t port_,
void frbgen_boltz_wire__crate__api__chain_swap__chain_swap_to_json(int64_t port_,
struct wire_cst_chain_swap *that);

void frbgen_boltz_wire__crate__api__error__boltz_error_detail(int64_t port_,
struct wire_cst_boltz_error *that);

void frbgen_boltz_wire__crate__api__error__boltz_error_new(int64_t port_,
struct wire_cst_list_prim_u_8_strict *kind,
struct wire_cst_list_prim_u_8_strict *message);
Expand Down Expand Up @@ -357,6 +366,9 @@ void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_coop_close_submarine(i
void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_from_json(int64_t port_,
struct wire_cst_list_prim_u_8_strict *json_str);

void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_get_completed_submarine_preimage(int64_t port_,
struct wire_cst_lbtc_ln_swap *that);

void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new(int64_t port_,
struct wire_cst_list_prim_u_8_strict *id,
int32_t kind,
Expand All @@ -375,6 +387,7 @@ void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new(int64_t port_,

void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_reverse(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *passphrase,
uint64_t index,
uint64_t out_amount,
struct wire_cst_list_prim_u_8_strict *out_address,
Expand All @@ -386,6 +399,7 @@ void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_reverse(int64_t po

void frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_submarine(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *passphrase,
uint64_t index,
struct wire_cst_list_prim_u_8_strict *invoice,
int32_t network,
Expand Down Expand Up @@ -428,6 +442,7 @@ void frbgen_boltz_wire__crate__api__types__invoice_from_lnurl(int64_t port_,

void frbgen_boltz_wire__crate__api__types__key_pair_generate(int64_t port_,
struct wire_cst_list_prim_u_8_strict *mnemonic,
struct wire_cst_list_prim_u_8_strict *passphrase,
int32_t network,
uint64_t index,
int32_t swap_type);
Expand Down Expand Up @@ -460,6 +475,8 @@ void frbgen_boltz_wire__crate__api__types__withdraw(int64_t port_,
struct wire_cst_list_prim_u_8_strict *lnurl,
struct wire_cst_list_prim_u_8_strict *invoice);

struct wire_cst_boltz_error *frbgen_boltz_cst_new_box_autoadd_boltz_error(void);

struct wire_cst_btc_ln_swap *frbgen_boltz_cst_new_box_autoadd_btc_ln_swap(void);

struct wire_cst_btc_swap_script_str *frbgen_boltz_cst_new_box_autoadd_btc_swap_script_str(void);
Expand All @@ -483,6 +500,7 @@ struct wire_cst_tx_fee *frbgen_boltz_cst_new_box_autoadd_tx_fee(void);
struct wire_cst_list_prim_u_8_strict *frbgen_boltz_cst_new_list_prim_u_8_strict(int32_t len);
static int64_t dummy_method_to_enforce_bundling(void) {
int64_t dummy_var = 0;
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_boltz_error);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_btc_ln_swap);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_btc_swap_script_str);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_cst_new_box_autoadd_chain_swap);
Expand All @@ -499,6 +517,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_claim);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_coop_close_submarine);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_from_json);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_get_completed_submarine_preimage);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_reverse);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__btc_ln__btc_ln_swap_new_submarine);
Expand All @@ -515,6 +534,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__chain_swap__chain_swap_new_swap);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__chain_swap__chain_swap_refund);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__chain_swap__chain_swap_to_json);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__error__boltz_error_detail);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__error__boltz_error_new);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__fees__fees_chain);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__fees__fees_new);
Expand All @@ -525,6 +545,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_claim);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_coop_close_submarine);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_from_json);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_get_completed_submarine_preimage);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_reverse);
dummy_var ^= ((int64_t) (void*) frbgen_boltz_wire__crate__api__lbtc_ln__lbtc_ln_swap_new_submarine);
Expand Down
10 changes: 10 additions & 0 deletions lib/src/generated/api/btc_ln.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ class BtcLnSwap with _$BtcLnSwap {
static Future<BtcLnSwap> fromJson({required String jsonStr}) =>
BoltzCore.instance.api.crateApiBtcLnBtcLnSwapFromJson(jsonStr: jsonStr);

/// Retrieves the preimage for a completed submarine swap.
Future<String> getCompletedSubmarinePreimage() => BoltzCore.instance.api
.crateApiBtcLnBtcLnSwapGetCompletedSubmarinePreimage(
that: this,
);

// HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class.
/// Manually create the class. Primarily used when recovering a swap.
static Future<BtcLnSwap> newInstance(
Expand Down Expand Up @@ -102,6 +108,7 @@ class BtcLnSwap with _$BtcLnSwap {
/// The client is expected to manage (increment) the use of index to ensure keys are not reused.
static Future<BtcLnSwap> newReverse(
{required String mnemonic,
required String passphrase,
required BigInt index,
required BigInt outAmount,
String? outAddress,
Expand All @@ -112,6 +119,7 @@ class BtcLnSwap with _$BtcLnSwap {
String? referralId}) =>
BoltzCore.instance.api.crateApiBtcLnBtcLnSwapNewReverse(
mnemonic: mnemonic,
passphrase: passphrase,
index: index,
outAmount: outAmount,
outAddress: outAddress,
Expand All @@ -126,6 +134,7 @@ class BtcLnSwap with _$BtcLnSwap {
/// The client is expected to manage (increment) the use of index to ensure keys are not reused.
static Future<BtcLnSwap> newSubmarine(
{required String mnemonic,
required String passphrase,
required BigInt index,
required String invoice,
required Chain network,
Expand All @@ -134,6 +143,7 @@ class BtcLnSwap with _$BtcLnSwap {
String? referralId}) =>
BoltzCore.instance.api.crateApiBtcLnBtcLnSwapNewSubmarine(
mnemonic: mnemonic,
passphrase: passphrase,
index: index,
invoice: invoice,
network: network,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/generated/api/chain_swap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class ChainSwap with _$ChainSwap {
static Future<ChainSwap> newSwap(
{required ChainSwapDirection direction,
required String mnemonic,
required String passphrase,
required BigInt index,
required BigInt amount,
required bool isTestnet,
Expand All @@ -134,6 +135,7 @@ class ChainSwap with _$ChainSwap {
BoltzCore.instance.api.crateApiChainSwapChainSwapNewSwap(
direction: direction,
mnemonic: mnemonic,
passphrase: passphrase,
index: index,
amount: amount,
isTestnet: isTestnet,
Expand Down
31 changes: 12 additions & 19 deletions lib/src/generated/api/error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,25 @@

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 'error.freezed.dart';

// 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`

class BoltzError implements FrbException {
final String kind;
final String message;

const BoltzError({
required this.kind,
required this.message,
});
@freezed
class BoltzError with _$BoltzError implements FrbException {
const BoltzError._();
const factory BoltzError({
required String kind,
required String message,
}) = _BoltzError;
Future<void> detail() => BoltzCore.instance.api.crateApiErrorBoltzErrorDetail(
that: this,
);

// HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class.
static Future<BoltzError> newInstance(
{required String kind, required String message}) =>
BoltzCore.instance.api
.crateApiErrorBoltzErrorNew(kind: kind, message: message);

@override
int get hashCode => kind.hashCode ^ message.hashCode;

@override
bool operator ==(Object other) =>
identical(this, other) ||
other is BoltzError &&
runtimeType == other.runtimeType &&
kind == other.kind &&
message == other.message;
}
Loading
Loading