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
30 changes: 15 additions & 15 deletions flake.lock

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

3 changes: 0 additions & 3 deletions payjoin-cli/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ pub(crate) mod v1;
pub(crate) mod v2;

#[async_trait::async_trait]
// [TODO] remove this clippy ignore once https://github.com/dtolnay/async-trait/pull/303 is included
// in a new release
#[allow(clippy::double_must_use)]
pub trait App: Send + Sync {
async fn new(config: Config) -> Result<Self>
where
Expand Down
5 changes: 2 additions & 3 deletions payjoin-ffi/dart/test/fetch_ohttp_keys_http_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ void _handleConnectProxyClient(Socket client) {
final headerEnd = _headerEnd(buffer);
if (headerEnd == -1) return;
final request = latin1.decode(buffer.sublist(0, headerEnd));
final match = RegExp(
r'^CONNECT ([^:]+):(\d+) HTTP/1\.1',
).firstMatch(request);
final match = RegExp(r'^CONNECT ([^:]+):(\d+) HTTP/1\.1')
.firstMatch(request);
if (match == null) {
client.destroy();
return;
Expand Down
66 changes: 29 additions & 37 deletions payjoin-ffi/dart/test/test_payjoin_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "package:convert/convert.dart";
import "package:payjoin/http.dart" as payjoin_http;
import "package:payjoin/payjoin.dart" as payjoin;
import "package:payjoin/test_utils.dart" as test_utils;

import "utils.dart";

late test_utils.BitcoindEnv env;
Expand Down Expand Up @@ -119,9 +120,8 @@ class IsInputOwnedCallback implements payjoin.IsInputOwned {
return false;
}
final scriptHex = txOut["scriptPubKey"]["hex"] as String;
return IsScriptOwnedCallback(
connection,
).callback(Uint8List.fromList(hex.decode(scriptHex)));
return IsScriptOwnedCallback(connection)
.callback(Uint8List.fromList(hex.decode(scriptHex)));
} catch (e) {
return false;
}
Expand Down Expand Up @@ -387,36 +387,28 @@ Future<payjoin.ReceiveSession?> process_receiver_proposal(

void main() {
group('fetchOhttpKeys', () {
test(
'fetches and decodes keys via relay proxy',
() async {
final services = test_utils.TestServices.initialize();
services.waitForServicesReady();
final keys = await payjoin_http.fetchOhttpKeys(
test('fetches and decodes keys via relay proxy', () async {
final services = test_utils.TestServices.initialize();
services.waitForServicesReady();
final keys = await payjoin_http.fetchOhttpKeys(
ohttpRelayUrl: services.ohttpRelayUrl(),
directoryUrl: services.directoryUrl(),
certificate: services.cert(),
);
expect(keys, isA<payjoin.OhttpKeys>());
}, timeout: const Timeout(Duration(minutes: 2)));

test('without trusted certificate throws', () async {
final services = test_utils.TestServices.initialize();
services.waitForServicesReady();
await expectLater(
payjoin_http.fetchOhttpKeys(
ohttpRelayUrl: services.ohttpRelayUrl(),
directoryUrl: services.directoryUrl(),
certificate: services.cert(),
);
expect(keys, isA<payjoin.OhttpKeys>());
},
timeout: const Timeout(Duration(minutes: 2)),
);

test(
'without trusted certificate throws',
() async {
final services = test_utils.TestServices.initialize();
services.waitForServicesReady();
await expectLater(
payjoin_http.fetchOhttpKeys(
ohttpRelayUrl: services.ohttpRelayUrl(),
directoryUrl: services.directoryUrl(),
),
throwsA(isA<Exception>()),
);
},
timeout: const Timeout(Duration(minutes: 2)),
);
),
throwsA(isA<Exception>()),
);
}, timeout: const Timeout(Duration(minutes: 2)));
});

group('Test integration', () {
Expand Down Expand Up @@ -471,9 +463,9 @@ void main() {
// Use a real v2 payjoin URI from the test harness to avoid v1 panics.
final envLocal = test_utils.initBitcoindSenderReceiver();
final receiverRpc = envLocal.getReceiver();
final receiverAddress =
jsonDecode(receiverRpc.call(method: "getnewaddress", params: []))
as String;
final receiverAddress = jsonDecode(
receiverRpc.call(method: "getnewaddress", params: []),
) as String;
final services = test_utils.TestServices.initialize();
services.waitForServicesReady();
final directory = services.directoryUrl();
Expand Down Expand Up @@ -507,9 +499,9 @@ void main() {
bitcoind = env.getBitcoind();
receiver = env.getReceiver();
sender = env.getSender();
var receiver_address =
jsonDecode(receiver.call(method: "getnewaddress", params: []))
as String;
var receiver_address = jsonDecode(
receiver.call(method: "getnewaddress", params: []),
) as String;
var services = test_utils.TestServices.initialize();

services.waitForServicesReady();
Expand Down
5 changes: 3 additions & 2 deletions payjoin-ffi/dart/test/test_payjoin_unit_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'dart:typed_data';

import 'package:convert/convert.dart';
import 'package:test/test.dart';
import "package:payjoin/payjoin.dart" as payjoin;

import "utils.dart";

void main() {
Expand Down Expand Up @@ -307,8 +309,7 @@ void main() {

test("Validation sender builder rejects bad psbt", () {
final uri = payjoin.Uri.parse(
uri:
"bitcoin:tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4?pj=https://example.com/pj",
uri: "bitcoin:tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4?pj=https://example.com/pj",
).checkPjSupported();
expect(
() => payjoin.SenderBuilder(psbt: "not-a-psbt", uri: uri),
Expand Down
3 changes: 0 additions & 3 deletions payjoin-ffi/src/receive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1769,9 +1769,6 @@ impl payjoin::persist::SessionPersister for CallbackPersisterAdapter {
/// Async session persister that should save and load events as JSON strings.
#[uniffi::export(with_foreign)]
#[async_trait::async_trait]
// [TODO] remove this clippy ignore once https://github.com/dtolnay/async-trait/pull/303 is included
// in a new release
#[allow(clippy::double_must_use)]
pub trait JsonReceiverSessionPersisterAsync: Send + Sync {
async fn save(&self, event: String) -> Result<(), ForeignError>;
async fn load(&self) -> Result<Vec<String>, ForeignError>;
Expand Down
3 changes: 0 additions & 3 deletions payjoin-ffi/src/send/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,6 @@ impl payjoin::persist::SessionPersister for CallbackPersisterAdapter {
/// Async session persister that should save and load events as JSON strings.
#[uniffi::export(with_foreign)]
#[async_trait::async_trait]
// [TODO] remove this clippy ignore once https://github.com/dtolnay/async-trait/pull/303 is included
// in a new release
#[allow(clippy::double_must_use)]
pub trait JsonSenderSessionPersisterAsync: Send + Sync {
async fn save(&self, event: String) -> Result<(), ForeignError>;
async fn load(&self) -> Result<Vec<String>, ForeignError>;
Expand Down
Loading