Skip to content

Commit

Permalink
Merge pull request #115 from LtbLightning/macOS
Browse files Browse the repository at this point in the history
macOS support
  • Loading branch information
BitcoinZavior authored Oct 14, 2023
2 parents d536a1d + d3029d2 commit fff0921
Show file tree
Hide file tree
Showing 70 changed files with 19,541 additions and 2,739 deletions.
32 changes: 0 additions & 32 deletions .githooks/pre-commit

This file was deleted.

18 changes: 9 additions & 9 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled.

version:
revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
revision: 796c8ef79279f9c774545b3771238c3098dbefab
channel: stable

project_type: plugin
Expand All @@ -13,17 +13,17 @@ project_type: plugin
migration:
platforms:
- platform: root
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: android
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: ios
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: macos
create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab

# User provided section

Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
## [0.29.2]
Support macOs and unit testing.

Updated flutter dependencies.

## [0.29.1]
Strongly typed exceptions

Updated Rust and Flutter dependencies.

Exposed strongly-typed exceptions.

## [0.29.0]
Support Dart 3.

Updated Rust and Flutter dependencies.
#### APIs added
- Add `isMine` method to `Wallet`.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ To use the `bdk_flutter` package in your project, add it as a dependency in your

```dart
dependencies:
bdk_flutter: ^0.29.1
bdk_flutter: ^0.29.2
```

### Examples
Expand Down Expand Up @@ -109,7 +109,7 @@ final feeRate = await estimateFeeRate(25);
final txBuilderResult = await txBuilder.feeRate( feeRate.asSatPerVb() )
.addRecipient( script, 2000 )
.finish( bdkWallet );
final serializedPsbt = await txBuilderResult.psbt.jsonSerialize();
final jsonObject = json.decode(serializedPsbt);
final outputs = jsonObject['unsigned_tx']['output'] as List;
Expand All @@ -120,13 +120,13 @@ debugPrint("=========Inputs=====");
debugPrint("amount: ${e['value']}");
debugPrint("script_pubkey: ${e['script_pubkey']}");
}
debugPrint("=========Outputs=====");
for (var e in outputs) {
debugPrint("amount: ${e['value']}");
debugPrint("script_pubkey: ${e['script_pubkey']}");
}
```

### Create an `internal` and `extarnal` wallet descriptors from derivation path.
Expand Down Expand Up @@ -169,7 +169,7 @@ final address =
await bdkWallet.getAddress(addressIndex: const AddressIndex());
final internalAddress =
await bdkWallet.getInternalAddress(addressIndex: const AddressIndex());
```

### API Documentation
Expand Down Expand Up @@ -219,10 +219,10 @@ _Note that Flutter version `3.0` or later is required to build the plugin._
Please use the [Dart documentation generator](https://pub.dev/packages/dartdoc) to generate the API documentation.
### References:
- Setting up a local Esplora instance for testing:
https://bitcoin.stackexchange.com/questions/116937/how-do-i-setup-an-esplora-instance-for-local-testing/116938#116938
https://bitcoin.stackexchange.com/questions/116937/how-do-i-setup-an-esplora-instance-for-local-testing/116938#116938
_Note: Caution this is Beta at this stage
Please consider reviewing, experimenting, and contributing ⚡️_
Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ analyzer:
- lib/src/generated/bindings.dart
- lib/src/generated/bridge_definitions.dart
- lib/src/generated/bridge_definitions.freezed.dart
- README.md
Binary file modified android/src/main/jniLibs/arm64-v8a/librust_bdk_ffi.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/armeabi-v7a/librust_bdk_ffi.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86/librust_bdk_ffi.so
Binary file not shown.
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
6 changes: 3 additions & 3 deletions example/lib/bdk_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ class BdkLibrary {
try {
final txBuilder = TxBuilder();
final address = await Address.create(address: addressStr);

final script = await address.scriptPubKey();
final feeRate = await estimateFeeRate(25, blockchain);
final txBuilderResult = await txBuilder
.addRecipient(script, 750)
.feeRate(feeRate.asSatPerVb())
.finish(aliceWallet);
getInputOutPuts(txBuilderResult, blockchain);

final aliceSbt = await aliceWallet.sign(psbt: txBuilderResult.psbt);
final tx = await aliceSbt.extractTx();
Isolate.run(() async => {await blockchain.broadcast(tx)});
} on FormatException catch (e) {
debugPrint(e.message);
} on Exception catch (_) {
rethrow;
}
}
}
7 changes: 7 additions & 0 deletions example/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
2 changes: 2 additions & 0 deletions example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
2 changes: 2 additions & 0 deletions example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
10 changes: 10 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation


func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
}
43 changes: 43 additions & 0 deletions example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
16 changes: 16 additions & 0 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PODS:
- FlutterMacOS (1.0.0)

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.11.3
Loading

0 comments on commit fff0921

Please sign in to comment.