Skip to content

Commit f78edcf

Browse files
committed
Rename payjoin_ffi namespace to payjoin
Downstream bindings consumers should be able to just "import payjoin", it's cleaner than "import payjoin_ffi". Furthermore, the "bitcoin" namespace is not suffixed with `_ffi` so it's also more consistent internally.
1 parent 319772e commit f78edcf

File tree

13 files changed

+24
-24
lines changed

13 files changed

+24
-24
lines changed

payjoin-ffi/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
2-
uniffi::generate_scaffolding("src/payjoin_ffi.udl").unwrap();
2+
uniffi::generate_scaffolding("src/payjoin.udl").unwrap();
33
#[cfg(feature = "dart")]
4-
uniffi_dart::generate_scaffolding("src/payjoin_ffi.udl".into()).unwrap();
4+
uniffi_dart::generate_scaffolding("src/payjoin.udl".into()).unwrap();
55
}

payjoin-ffi/dart/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ doc/api/
1111
*.dll
1212

1313
# Auto-generated bindings
14-
lib/payjoin_ffi.dart
14+
lib/payjoin.dart
1515
lib/bitcoin.dart

payjoin-ffi/dart/test/test_payjoin_integration_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "package:http/http.dart" as http;
55
import 'package:test/test.dart';
66
import "package:convert/convert.dart";
77

8-
import "package:payjoin/payjoin_ffi.dart" as payjoin;
8+
import "package:payjoin/payjoin.dart" as payjoin;
99
import "package:payjoin/bitcoin.dart" as bitcoin;
1010

1111
late payjoin.BitcoindEnv env;

payjoin-ffi/dart/test/test_payjoin_unit_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dart:typed_data';
22
import 'package:convert/convert.dart';
33
import 'package:test/test.dart';
4-
import "package:payjoin/payjoin_ffi.dart" as payjoin;
4+
import "package:payjoin/payjoin.dart" as payjoin;
55
import "package:payjoin/bitcoin.dart" as bitcoin;
66

77
class InMemoryReceiverPersister
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// This script is a dirty hack for Node.JS ESM imports.
22
// TypeScript compiles imports without a `.js` extension, which results in ERR_MODULE_NOT_FOUND when running in Node.JS.
33
// This fixes it by adding the `.js` file extension to the import in the generated files (thankfully there is currently only one such instance).
4-
const fs = require('fs');
4+
const fs = require("fs");
55

6-
const file = 'dist/generated/payjoin_ffi.js';
7-
let content = fs.readFileSync(file, 'utf8');
6+
const file = "dist/generated/payjoin.js";
7+
let content = fs.readFileSync(file, "utf8");
88
content = content.replace('from "./bitcoin"', 'from "./bitcoin.js"');
99
fs.writeFileSync(file, content);

payjoin-ffi/javascript/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Export the generated bindings to the app.
2-
export * as payjoin from "./generated/payjoin_ffi.js";
2+
export * as payjoin from "./generated/payjoin.js";
33
export * as bitcoin from "./generated/bitcoin.js";
44

55
// Now import the bindings so we can:
66
// - initialize them
77
// - export them as namespaced objects as the default export.
88
import * as bitcoin from "./generated/bitcoin.js";
9-
import * as payjoin from "./generated/payjoin_ffi.js";
9+
import * as payjoin from "./generated/payjoin.js";
1010

1111
let initialized = false;
1212

payjoin-ffi/python/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ build/
1616
*.dll
1717

1818
# Auto-generated bindings python file
19-
src/payjoin/payjoin_ffi.py
19+
src/payjoin/payjoin.py
2020
src/payjoin/bitcoin.py
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from payjoin.payjoin_ffi import *
1+
from payjoin.payjoin import *

payjoin-ffi/python/test/test_payjoin_unit_test.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
2-
import payjoin as payjoin
3-
import payjoin.bitcoin
2+
import payjoin
3+
import payjoin.bitcoin
44

55
class TestURIs(unittest.TestCase):
66
def test_todo_url_encoded(self):
@@ -31,7 +31,7 @@ def test_valid_uris(self):
3131
except Exception as e:
3232
self.fail(f"Failed to create a valid Uri for {uri}. Error: {e}")
3333

34-
class InMemoryReceiverPersister(payjoin.payjoin_ffi.JsonReceiverSessionPersister):
34+
class InMemoryReceiverPersister(payjoin.JsonReceiverSessionPersister):
3535
def __init__(self, id):
3636
self.id = id
3737
self.events = []
@@ -50,15 +50,15 @@ class TestReceiverPersistence(unittest.TestCase):
5050
def test_receiver_persistence(self):
5151
persister = InMemoryReceiverPersister(1)
5252
address = payjoin.bitcoin.Address("tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4", payjoin.bitcoin.Network.SIGNET)
53-
payjoin.payjoin_ffi.ReceiverBuilder(
53+
payjoin.ReceiverBuilder(
5454
address,
5555
"https://example.com",
5656
payjoin.OhttpKeys.decode(bytes.fromhex("01001604ba48c49c3d4a92a3ad00ecc63a024da10ced02180c73ec12d8a7ad2cc91bb483824fe2bee8d28bfe2eb2fc6453bc4d31cd851e8a6540e86c5382af588d370957000400010003")),
5757
).build().save(persister)
58-
result = payjoin.payjoin_ffi.replay_receiver_event_log(persister)
58+
result = payjoin.replay_receiver_event_log(persister)
5959
self.assertTrue(result.state().is_INITIALIZED())
6060

61-
class InMemorySenderPersister(payjoin.payjoin_ffi.JsonSenderSessionPersister):
61+
class InMemorySenderPersister(payjoin.JsonSenderSessionPersister):
6262
def __init__(self, id):
6363
self.id = id
6464
self.events = []
@@ -78,7 +78,7 @@ def test_sender_persistence(self):
7878
# Create a receiver to just get the pj uri
7979
persister = InMemoryReceiverPersister(1)
8080
address = payjoin.bitcoin.Address("2MuyMrZHkbHbfjudmKUy45dU4P17pjG2szK", payjoin.bitcoin.Network.TESTNET)
81-
receiver = payjoin.payjoin_ffi.ReceiverBuilder(
81+
receiver = payjoin.ReceiverBuilder(
8282
address,
8383
"https://example.com",
8484
payjoin.OhttpKeys.decode(bytes.fromhex("01001604ba48c49c3d4a92a3ad00ecc63a024da10ced02180c73ec12d8a7ad2cc91bb483824fe2bee8d28bfe2eb2fc6453bc4d31cd851e8a6540e86c5382af588d370957000400010003")),

payjoin-ffi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ pub use crate::send::*;
2424
#[cfg(feature = "_test-utils")]
2525
pub use crate::test_utils::*;
2626
pub use crate::uri::{PjUri, Uri, Url};
27-
uniffi::setup_scaffolding!();
27+
uniffi::setup_scaffolding!("payjoin");

0 commit comments

Comments
 (0)