Skip to content

Commit

Permalink
Move blindbit backend to sp-client behind feature
Browse files Browse the repository at this point in the history
  • Loading branch information
cygnet3 committed Sep 24, 2024
1 parent c40c514 commit 2303803
Show file tree
Hide file tree
Showing 19 changed files with 118 additions and 359 deletions.
1 change: 1 addition & 0 deletions lib/generated/rust/api/psbt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

import '../frb_generated.dart';
import '../lib.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'structs.dart';

Expand Down
3 changes: 2 additions & 1 deletion lib/generated/rust/api/structs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

import '../frb_generated.dart';
import '../lib.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
part 'structs.freezed.dart';
Expand Down Expand Up @@ -47,7 +48,7 @@ sealed class OutputSpendStatus with _$OutputSpendStatus {

class OwnedOutput {
final int blockheight;
final String tweak;
final U8Array32 tweak;
final Amount amount;
final String script;
final String? label;
Expand Down
1 change: 1 addition & 0 deletions lib/generated/rust/api/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

import '../frb_generated.dart';
import '../lib.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'structs.dart';

Expand Down
26 changes: 23 additions & 3 deletions lib/generated/rust/frb_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'dart:convert';
import 'frb_generated.dart';
import 'frb_generated.io.dart'
if (dart.library.js_interop) 'frb_generated.web.dart';
import 'lib.dart';
import 'logger.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
import 'stream.dart';
Expand Down Expand Up @@ -992,7 +993,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
throw Exception('unexpected arr length: expect 6 but see ${arr.length}');
return OwnedOutput(
blockheight: dco_decode_u_32(arr[0]),
tweak: dco_decode_String(arr[1]),
tweak: dco_decode_u_8_array_32(arr[1]),
amount: dco_decode_amount(arr[2]),
script: dco_decode_String(arr[3]),
label: dco_decode_opt_String(arr[4]),
Expand Down Expand Up @@ -1129,6 +1130,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return raw as int;
}

@protected
U8Array32 dco_decode_u_8_array_32(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return U8Array32(dco_decode_list_prim_u_8_strict(raw));
}

@protected
void dco_decode_unit(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
Expand Down Expand Up @@ -1395,7 +1402,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
OwnedOutput sse_decode_owned_output(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var var_blockheight = sse_decode_u_32(deserializer);
var var_tweak = sse_decode_String(deserializer);
var var_tweak = sse_decode_u_8_array_32(deserializer);
var var_amount = sse_decode_amount(deserializer);
var var_script = sse_decode_String(deserializer);
var var_label = sse_decode_opt_String(deserializer);
Expand Down Expand Up @@ -1519,6 +1526,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return deserializer.buffer.getUint8();
}

@protected
U8Array32 sse_decode_u_8_array_32(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var inner = sse_decode_list_prim_u_8_strict(deserializer);
return U8Array32(inner);
}

@protected
void sse_decode_unit(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
Expand Down Expand Up @@ -1781,7 +1795,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
void sse_encode_owned_output(OwnedOutput self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_u_32(self.blockheight, serializer);
sse_encode_String(self.tweak, serializer);
sse_encode_u_8_array_32(self.tweak, serializer);
sse_encode_amount(self.amount, serializer);
sse_encode_String(self.script, serializer);
sse_encode_opt_String(self.label, serializer);
Expand Down Expand Up @@ -1882,6 +1896,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
serializer.buffer.putUint8(self);
}

@protected
void sse_encode_u_8_array_32(U8Array32 self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
sse_encode_list_prim_u_8_strict(self.inner, serializer);
}

@protected
void sse_encode_unit(void self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
Expand Down
10 changes: 10 additions & 0 deletions lib/generated/rust/frb_generated.io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'dart:async';
import 'dart:convert';
import 'dart:ffi' as ffi;
import 'frb_generated.dart';
import 'lib.dart';
import 'logger.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_io.dart';
import 'stream.dart';
Expand Down Expand Up @@ -144,6 +145,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int dco_decode_u_8(dynamic raw);

@protected
U8Array32 dco_decode_u_8_array_32(dynamic raw);

@protected
void dco_decode_unit(dynamic raw);

Expand Down Expand Up @@ -283,6 +287,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int sse_decode_u_8(SseDeserializer deserializer);

@protected
U8Array32 sse_decode_u_8_array_32(SseDeserializer deserializer);

@protected
void sse_decode_unit(SseDeserializer deserializer);

Expand Down Expand Up @@ -423,6 +430,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_u_8(int self, SseSerializer serializer);

@protected
void sse_encode_u_8_array_32(U8Array32 self, SseSerializer serializer);

@protected
void sse_encode_unit(void self, SseSerializer serializer);

Expand Down
10 changes: 10 additions & 0 deletions lib/generated/rust/frb_generated.web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'api/wallet.dart';
import 'dart:async';
import 'dart:convert';
import 'frb_generated.dart';
import 'lib.dart';
import 'logger.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated_web.dart';
import 'stream.dart';
Expand Down Expand Up @@ -146,6 +147,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int dco_decode_u_8(dynamic raw);

@protected
U8Array32 dco_decode_u_8_array_32(dynamic raw);

@protected
void dco_decode_unit(dynamic raw);

Expand Down Expand Up @@ -285,6 +289,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int sse_decode_u_8(SseDeserializer deserializer);

@protected
U8Array32 sse_decode_u_8_array_32(SseDeserializer deserializer);

@protected
void sse_decode_unit(SseDeserializer deserializer);

Expand Down Expand Up @@ -425,6 +432,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
void sse_encode_u_8(int self, SseSerializer serializer);

@protected
void sse_encode_u_8_array_32(U8Array32 self, SseSerializer serializer);

@protected
void sse_encode_unit(void self, SseSerializer serializer);

Expand Down
22 changes: 22 additions & 0 deletions lib/generated/rust/lib.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.3.0.

// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

import 'frb_generated.dart';
import 'package:collection/collection.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';

class U8Array32 extends NonGrowableListView<int> {
static const arraySize = 32;

@internal
Uint8List get inner => _inner;
final Uint8List _inner;

U8Array32(this._inner)
: assert(_inner.length == arraySize),
super(_inner);

U8Array32.init() : this(Uint8List(arraySize));
}
76 changes: 16 additions & 60 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
once_cell = "1.18.0"
bip39 = { version = "2.0.0", features = ["rand"] }
hex = { version = "0.4.3", features = ["serde"] }
serde_with = "3.6.0"
log = "0.4.20"
simplelog = "0.12.1"
reqwest = { version = "0.12.4", features = ["rustls-tls"], default-features = false }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
pushtx = { git = "https://github.com/cygnet3/pushtx", branch = "master" }
futures = "0.3"
Expand Down
Loading

0 comments on commit 2303803

Please sign in to comment.