-
Notifications
You must be signed in to change notification settings - Fork 76
Add javascript language bindings #1190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f5f8b8f
d5d1129
98b7697
ea1fc17
85c63a2
1d7da1a
f7dbefa
990930b
4568bb4
cc5f328
cf265f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| [codespell] | ||
| skip = .git,target,Cargo.toml,Cargo.lock,Cargo-minimal.lock,Cargo-recent.lock | ||
| skip = .git,target,Cargo.toml,Cargo.lock,Cargo-minimal.lock,Cargo-recent.lock,package-lock.json | ||
| ignore-words-list = crate,ser,ot |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Build and Test JavaScript | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - payjoin-ffi/** | ||
| env: | ||
| # Override the value from the rust-toolchain file | ||
| # This is necessary because even though the correct toolchain | ||
| # is explicitly specified for the rust-toolchain action, | ||
| # rustup honors the rust-toolchain file over the default | ||
| RUSTUP_TOOLCHAIN: 1.85 | ||
|
|
||
| jobs: | ||
| build-js-and-test: | ||
| name: "Build and test javascript" | ||
| runs-on: ${{ matrix.os }} | ||
| defaults: | ||
| run: | ||
| working-directory: payjoin-ffi/javascript | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust 1.85.0 | ||
| uses: dtolnay/[email protected] | ||
|
|
||
| - name: "Use cache" | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Install Node | ||
| uses: actions/setup-node@v6 | ||
|
|
||
| - name: Install llvm | ||
| if: matrix.os == 'macos-latest' | ||
| run: brew install llvm | ||
|
|
||
| - name: Install wasm-bindgen | ||
| run: cargo install wasm-bindgen-cli | ||
|
|
||
| - name: "Install dependencies" | ||
| run: npm ci | ||
|
Comment on lines
+43
to
+44
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thebrandonlucas is npm the thing to use or is there another javascript package manager we should be using? Bun? TBF, it seems like js package managers is a rotating fashion choice and I think npm is lindy and fine. |
||
|
|
||
| - name: Generate bindings and binaries | ||
| run: bash ./scripts/generate_bindings.sh | ||
|
|
||
| - name: Run tests | ||
| run: npm test | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| fn main() { | ||
| uniffi::generate_scaffolding("src/payjoin_ffi.udl").unwrap(); | ||
| #[cfg(feature = "dart")] | ||
| uniffi_dart::generate_scaffolding("src/payjoin_ffi.udl".into()).unwrap(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Build outputs | ||
| dist/ | ||
| node_modules/ | ||
|
|
||
| # Generated by uniffi-bindgen-react-native | ||
| rust_modules/ | ||
| src/generated/ | ||
|
|
||
| # Generated by napi-rs (test-utils) | ||
| test-utils/*.node | ||
| test-utils/index.d.ts |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| tabWidth: 4 | ||
| } |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new README under javascript/ still opens with “Payjoin Dart Bindings”
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, thanks! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Payjoin JavaScript Bindings | ||
|
|
||
| Welcome to the JavaScript language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)! | ||
|
|
||
| ## Running Tests | ||
|
|
||
| Follow these steps to clone the repository and run the tests. | ||
| This assumes you already have Rust and Node.js installed. | ||
|
|
||
|
|
||
| ```shell | ||
| git clone https://github.com/payjoin/rust-payjoin.git | ||
| cd rust-payjoin/payjoin-ffi/javascript | ||
|
|
||
| # Install dependencies | ||
| cargo install wasm-bindgen-cli | ||
| npm install | ||
| # (macOS only - secp256k1-sys requires a WASM-capable C compiler) | ||
| brew install llvm | ||
|
|
||
| # Generate the bindings | ||
| bash ./scripts/generate_bindings.sh | ||
|
|
||
| # Run all tests | ||
| npm test | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: put this commit before the offending commit so that no intermediate commits fail ci