Skip to content

Commit

Permalink
Merge pull request #8 from LtbLightning/release-prep
Browse files Browse the repository at this point in the history
Release prep
  • Loading branch information
BitcoinZavior authored May 27, 2024
2 parents 99015b0 + 41aa0b1 commit d6e86ae
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/precompile_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
channel: 'stable'
- name: Configure git with access token
run: |
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com".insteadOf "https://github.com"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
Expand Down
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,31 @@ payjoin_flutter: 0.13.0
- Deployment target : iOS 12.0 or greater.

### Build and run code

Before building the code, we need to set up the Bitcoin core properly in the regtest network. If you "don't"
have Bitcoin Core locally, please refer to this [page](https://learn.saylor.org/mod/page/view.php?id=36347). Or you can
First we need to set up the `bitcoin core` and `esplora` locally in the regtest network. If you don't
have these, please refer to this [page](https://learn.saylor.org/mod/page/view.php?id=36347). Or you can
install `Nigiri Bitcoin`, which is a tool designed to simplify the process of running local instances of Bitcoin and
Liquid networks for development and testing purposes. You can refer to
this [link](https://github.com/vulpemventures/nigiri), to install it on your local machine.

NB: The default credentials would be the following
```
rpc_user = "admin1"
rpc_password = "123"
rpc_host = "localhost"
rpc_port = "18443"
Once the nigiri bitcoin starts running, you need to mine a few blocks. Please refer to the following [link](https://developer.bitcoin.org/reference/rpc/generatetoaddress.html?highlight=generate)
on how to mine blocks.

Before running the integration tests, please replace following snippet in `example/integration_test/bitcoin_core_full_cycle_test.dart` with your
nigiri bitcoin core credentials.

```dart
// Bitcoin core credentials
String rpcUser = "admin1";
String rpcPassword = "123";
int rpcPort = 18443;
```

## Running the integration tests
Once we have set up the Bitcoin core properly in the `Regtest` network,

```shell
git clone https://github.com/LtbLightning/payjoin-flutter.git
cd payjoin-flutter
git checkout v0.13

cd example
#Run integration tests with bitcoin_core and bdk_flutter
Expand Down
5 changes: 4 additions & 1 deletion example/lib/bdk_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import 'package:bdk_flutter/bdk_flutter.dart';
import 'package:flutter/cupertino.dart';

class BdkClient {
// Bitcoin core credentials
String localEsploraUrl = 'http://0.0.0.0:30000';

late Wallet wallet;
late Blockchain blockchain;
final String mnemonic;
Expand Down Expand Up @@ -47,7 +50,7 @@ class BdkClient {

Future<void> initBlockchain() async {
String esploraUrl =
Platform.isAndroid ? 'http://10.0.2.2:30000' : 'http://127.0.0.1:30000';
Platform.isAndroid ? 'http://10.0.2.2:30000' : localEsploraUrl;
try {
blockchain = await Blockchain.create(
config: BlockchainConfig.esplora(
Expand Down
12 changes: 9 additions & 3 deletions example/lib/btc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';

class BtcClient {
// Bitcoin core credentials
String rpcUser = "admin1";
String rpcPassword = "123";
int rpcPort = 18443;

Dio? _dioClient;
late Map<String, String> _headers;
late String _url;
Expand All @@ -17,10 +22,11 @@ class BtcClient {
BtcClient(this.wallet) {
_headers = {
'Content-Type': 'application/json',
'authorization': 'Basic ${base64.encode(utf8.encode('admin1:123'))}'
'authorization':
'Basic ${base64.encode(utf8.encode("$rpcUser:$rpcPassword"))}'
};
_url = getConnectionString(
Platform.isAndroid ? "10.0.2.2" : "0.0.0.0", 18443, wallet);
Platform.isAndroid ? "10.0.2.2" : "0.0.0.0", rpcPort, wallet);
_dioClient = Dio();
}

Expand Down Expand Up @@ -48,7 +54,7 @@ class BtcClient {
}

Future<String> getNewAddress() async {
var params = ["", "bech32"];
var params = [];
final res = await call("getnewaddress", params);
return res;
}
Expand Down
28 changes: 14 additions & 14 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -335,26 +335,26 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "3.0.1"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -391,10 +391,10 @@ packages:
dependency: "direct main"
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.12.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -540,10 +540,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "0.7.0"
timing:
dependency: transitive
description:
Expand Down Expand Up @@ -580,10 +580,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "13.0.0"
version: "14.2.1"
watcher:
dependency: transitive
description:
Expand Down Expand Up @@ -617,5 +617,5 @@ packages:
source: hosted
version: "2.1.1"
sdks:
dart: ">=3.2.3 <4.0.0"
flutter: ">=3.3.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
4 changes: 1 addition & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: payjoin_flutter
description: "A new Flutter FFI plugin project."
version: 0.13.0
homepage:
homepage: https://github.com/LtbLightning/payjoin-flutter

environment:
sdk: '>=3.2.3 <4.0.0'
Expand All @@ -16,8 +16,6 @@ dependencies:
freezed_annotation: ^2.2.0
meta: ^1.10.0
uuid: ^4.2.1



dev_dependencies:
ffigen: ^9.0.0
Expand Down
56 changes: 28 additions & 28 deletions rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ crate-type = ["cdylib", "staticlib"]
anyhow = "1.0.68"
[dependencies]
ohttp = { version = "0.5.1" }
payjoin_ffi = {git = "https://github.com/LtbLightning/payjoin-ffi", branch = "v0.13"}
payjoin_ffi = {git = "https://github.com/LtbLightning/payjoin-ffi", branch = "main"}
flutter_rust_bridge = "=2.0.0-dev.31"
anyhow = "1.0.68"
tokio = "1.36.0"
Expand Down
Loading

0 comments on commit d6e86ae

Please sign in to comment.