Skip to content

Commit

Permalink
Merge pull request #16 from LtbLightning/fix-build-issue
Browse files Browse the repository at this point in the history
Fix build issue
  • Loading branch information
BitcoinZavior authored Jul 19, 2024
2 parents 5e62e87 + a61b9be commit ca003fa
Show file tree
Hide file tree
Showing 17 changed files with 373 additions and 312 deletions.
25 changes: 12 additions & 13 deletions ios/Classes/frb_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ typedef struct wire_cst_ffi_request_context {
} wire_cst_ffi_request_context;

typedef struct wire_cst_ffi_pj_uri_builder {
uintptr_t field0;
uintptr_t internal;
} wire_cst_ffi_pj_uri_builder;

typedef struct wire_cst_ffi_uri {
Expand Down Expand Up @@ -298,19 +298,16 @@ void frbgen_payjoin_flutter_wire__crate__api__io__fetch_ohttp_keys(int64_t port_
void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_extract_req(int64_t port_,
struct wire_cst_ffi_active_session *ptr);

void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_uri_builder(int64_t port_,
struct wire_cst_ffi_active_session *ptr);
WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_uri_builder(struct wire_cst_ffi_active_session *ptr);

void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_url(int64_t port_,
struct wire_cst_ffi_active_session *ptr);
WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_pj_url(struct wire_cst_ffi_active_session *ptr);

void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_process_res(int64_t port_,
struct wire_cst_ffi_active_session *that,
struct wire_cst_list_prim_u_8_loose *body,
struct wire_cst_ffi_client_response *ctx);

void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_public_key(int64_t port_,
struct wire_cst_ffi_active_session *that);
WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__receive__ffi_active_session_public_key(struct wire_cst_ffi_active_session *that);

void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_maybe_inputs_owned_check_inputs_not_owned(int64_t port_,
struct wire_cst_ffi_maybe_inputs_owned *ptr,
Expand Down Expand Up @@ -367,7 +364,7 @@ void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_e

void frbgen_payjoin_flutter_wire__crate__api__receive__ffi_session_initializer_new(int64_t port_,
struct wire_cst_list_prim_u_8_strict *address,
uint64_t expire_after,
uint64_t *expire_after,
int32_t network,
struct wire_cst_ffi_url *directory,
struct wire_cst_ffi_ohttp_keys *ohttp_keys,
Expand Down Expand Up @@ -521,16 +518,18 @@ WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_bu

WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_build(struct wire_cst_ffi_pj_uri_builder *that);

void frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_create(int64_t port_,
struct wire_cst_list_prim_u_8_strict *address,
struct wire_cst_ffi_url *pj,
struct wire_cst_ffi_ohttp_keys *ohttp_keys,
uint64_t *expiry);

WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_label(struct wire_cst_ffi_pj_uri_builder *that,
struct wire_cst_list_prim_u_8_strict *label);

WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_message(struct wire_cst_ffi_pj_uri_builder *that,
struct wire_cst_list_prim_u_8_strict *message);

WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_new(struct wire_cst_list_prim_u_8_strict *address,
struct wire_cst_ffi_url *pj,
struct wire_cst_ffi_ohttp_keys *ohttp_keys);

WireSyncRust2DartDco frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_pjos(struct wire_cst_ffi_pj_uri_builder *that,
bool pjos);

Expand Down Expand Up @@ -884,9 +883,9 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_as_string);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_amount);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_build);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_create);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_label);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_message);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_new);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_pj_uri_builder_pjos);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_address);
dummy_var ^= ((int64_t) (void*) frbgen_payjoin_flutter_wire__crate__api__uri__ffi_uri_amount);
Expand Down
28 changes: 15 additions & 13 deletions lib/receive/v2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import '../common.dart';
import '../src/exceptions.dart';
import '../src/generated/api/receive.dart';
import '../src/generated/utils/error.dart' as error;
import '../uri.dart' as uri;
import '../uri.dart';

class SessionInitializer extends FfiSessionInitializer {
Expand Down Expand Up @@ -47,7 +46,7 @@ class SessionInitializer extends FfiSessionInitializer {
try {
final res = await FfiSessionInitializer.extractReq(ptr: this);
final request =
Request(await uri.Url.fromString(res.$1.$1.query()!), res.$1.$2);
Request(await Url.fromString(res.$1.$1.query()!), res.$1.$2);
return (request, ClientResponse._(field0: res.$2.field0));
} on error.PayjoinError catch (e) {
throw mapPayjoinError(e);
Expand All @@ -61,7 +60,7 @@ class ActiveSession extends FfiActiveSession {
try {
final res = await FfiActiveSession.extractReq(ptr: this);
final request =
Request(await uri.Url.fromString(res.$1.$1.query()!), res.$1.$2);
Request(await Url.fromString(res.$1.$1.query()!), res.$1.$2);
return (request, ClientResponse._(field0: res.$2.field0));
} on error.PayjoinError catch (e) {
throw mapPayjoinError(e);
Expand All @@ -81,15 +80,18 @@ class ActiveSession extends FfiActiveSession {
throw mapPayjoinError(e);
}
}
//
// @override
// Future<String> fallbackTarget({dynamic hint}) {
// try {
// return super.fallbackTarget();
// } on error.PayjoinError catch (e) {
// throw mapPayjoinError(e);
// }
// }

/// The contents of the `&pj=` query parameter including the base64url-encoded public key receiver subdirectory.
/// This identifies a session at the payjoin directory server.
Future<Url> pjUrl() {
final res = FfiActiveSession.pjUrl(ptr: super);
return Url.fromString(res.asString());
}

PjUriBuilder pjUriBuilder() {
final res = FfiActiveSession.pjUriBuilder(ptr: super);
return PjUriBuilder(internal: res.internal);
}
}

class UncheckedProposal extends FfiV2UncheckedProposal {
Expand Down Expand Up @@ -295,7 +297,7 @@ class PayjoinProposal extends FfiV2PayjoinProposal {
try {
final res = await FfiV2PayjoinProposal.extractV2Req(ptr: this);
final request =
Request(await uri.Url.fromString(res.$1.$1.toString()), res.$1.$2);
Request(await Url.fromString(res.$1.$1.toString()), res.$1.$2);
return (request, ClientResponse._(field0: res.$2.field0));
} on error.PayjoinError catch (e) {
throw mapPayjoinError(e);
Expand Down
10 changes: 5 additions & 5 deletions lib/src/generated/api/receive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ class FfiActiveSession {
{required FfiActiveSession ptr}) =>
core.instance.api.crateApiReceiveFfiActiveSessionExtractReq(ptr: ptr);

static Future<FfiPjUriBuilder> pjUriBuilder(
{required FfiActiveSession ptr}) =>
static FfiPjUriBuilder pjUriBuilder({required FfiActiveSession ptr}) =>
core.instance.api.crateApiReceiveFfiActiveSessionPjUriBuilder(ptr: ptr);

static Future<FfiUrl> pjUrl({required FfiActiveSession ptr}) =>
static FfiUrl pjUrl({required FfiActiveSession ptr}) =>
core.instance.api.crateApiReceiveFfiActiveSessionPjUrl(ptr: ptr);

Future<FfiV2UncheckedProposal?> processRes(
{required List<int> body, required FfiClientResponse ctx}) =>
core.instance.api.crateApiReceiveFfiActiveSessionProcessRes(
that: this, body: body, ctx: ctx);

Future<String> publicKey() =>
///The per-session public key to use as an identifier
String publicKey() =>
core.instance.api.crateApiReceiveFfiActiveSessionPublicKey(
that: this,
);
Expand Down Expand Up @@ -271,7 +271,7 @@ class FfiSessionInitializer {
// HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class.
static Future<FfiSessionInitializer> newInstance(
{required String address,
required BigInt expireAfter,
BigInt? expireAfter,
required Network network,
required FfiUrl directory,
required FfiOhttpKeys ohttpKeys,
Expand Down
27 changes: 15 additions & 12 deletions lib/src/generated/api/uri.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ class FfiPjUri {
}

class FfiPjUriBuilder {
final PjUriBuilder field0;
final PjUriBuilder internal;

const FfiPjUriBuilder.raw({
required this.field0,
const FfiPjUriBuilder({
required this.internal,
});

///Accepts the amount you want to receive in sats and sets it in btc.
FfiPjUriBuilder amount({required BigInt amount}) => core.instance.api
.crateApiUriFfiPjUriBuilderAmount(that: this, amount: amount);

Expand All @@ -77,6 +78,14 @@ class FfiPjUriBuilder {
that: this,
);

static Future<FfiPjUriBuilder> create(
{required String address,
required FfiUrl pj,
FfiOhttpKeys? ohttpKeys,
BigInt? expiry}) =>
core.instance.api.crateApiUriFfiPjUriBuilderCreate(
address: address, pj: pj, ohttpKeys: ohttpKeys, expiry: expiry);

///Set the label.
FfiPjUriBuilder label({required String label}) => core.instance.api
.crateApiUriFfiPjUriBuilderLabel(that: this, label: label);
Expand All @@ -85,25 +94,19 @@ class FfiPjUriBuilder {
FfiPjUriBuilder message({required String message}) => core.instance.api
.crateApiUriFfiPjUriBuilderMessage(that: this, message: message);

factory FfiPjUriBuilder(
{required String address,
required FfiUrl pj,
FfiOhttpKeys? ohttpKeys}) =>
core.instance.api.crateApiUriFfiPjUriBuilderNew(
address: address, pj: pj, ohttpKeys: ohttpKeys);

///Set whether payjoin output substitution is allowed.
FfiPjUriBuilder pjos({required bool pjos}) =>
core.instance.api.crateApiUriFfiPjUriBuilderPjos(that: this, pjos: pjos);

@override
int get hashCode => field0.hashCode;
int get hashCode => internal.hashCode;

@override
bool operator ==(Object other) =>
identical(this, other) ||
other is FfiPjUriBuilder &&
runtimeType == other.runtimeType &&
field0 == other.field0;
internal == other.internal;
}

class FfiUri {
Expand Down
Loading

0 comments on commit ca003fa

Please sign in to comment.