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
8 changes: 7 additions & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ inputs:
description: Install Solana if `true`. Defaults to `false`.
required: false
wasm:
description: Install wasm target for Rust if `true`. Defaults to `false`.
description: Install wasm target and wasm-pack for Rust if `true`. Defaults to `false`.
required: false

runs:
Expand Down Expand Up @@ -59,3 +59,9 @@ runs:
if: ${{ inputs.wasm == 'true' }}
shell: bash
run: rustup target add wasm32-unknown-unknown

- name: Install wasm-pack
if: ${{ inputs.wasm == 'true' }}
uses: taiki-e/install-action@v2
with:
tool: wasm-pack
30 changes: 27 additions & 3 deletions .github/workflows/main.yml
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add pnpm zk-sdk-wasm-js:test-wasm to the workflow as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good idea. This is now added to the workflow.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ jobs:
- name: Lint ZK SDK
run: pnpm zk-sdk:lint

format_and_lint_zk_sdk_wasm_js:
name: Format & Lint ZK SDK WASM JS
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
clippy: true
rustfmt: true
cargo-cache-key: cargo-zk-sdk-wasm-js-lint
cargo-cache-fallback-key: cargo-zk-sdk-wasm-js

- name: Format ZK SDK WASM JS
run: pnpm zk-sdk-wasm-js:format

- name: Lint ZK SDK WASM JS
run: pnpm zk-sdk-wasm-js:lint

format_and_lint_client_js_legacy:
name: Format & Lint Client JS Legacy
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,8 +117,8 @@ jobs:
- name: Run cargo-audit
run: pnpm rust:audit

wasm:
name: Check ZK SDK wasm build
build_and_test_wasm:
name: Build & Test ZK SDK wasm
runs-on: ubuntu-latest
steps:
- name: Git Checkout
Expand All @@ -110,7 +131,10 @@ jobs:
wasm: true

- name: Build ZK SDK Wasm
run: pnpm zk-sdk:build-wasm
run: pnpm zk-sdk-wasm-js:build-wasm

- name: Test ZK SDK Wasm
run: pnpm zk-sdk-wasm-js:test-wasm

build_programs:
name: Check ZK SDK SBF build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules
test-ledger
dist
.idea
zk-sdk/farf/
136 changes: 133 additions & 3 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["zk-sdk"]
members = ["zk-sdk", "zk-sdk-wasm-js"]

[workspace.package]
authors = ["Anza Maintainers <maintainers@anza.xyz>"]
Expand Down Expand Up @@ -52,10 +52,13 @@ solana-seed-derivable = "3.0.0"
solana-seed-phrase = "3.0.0"
solana-signature = { version = "3.0.0", default-features = false }
solana-signer = "3.0.0"
solana-zk-sdk = { path = "zk-sdk", version = "4.0.0" }
solana-zk-sdk-wasm-js = { path = "zk-sdk-wasm-js", version = "0.1.0" }
subtle = "2.6.1"
thiserror = "2.0.16"
tiny-bip39 = "0.8.2"
wasm-bindgen = "0.2"
wasm-bindgen-test = "0.3"
zeroize = { version = "1.7", default-features = false }

[profile.release]
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"private": true,
"scripts": {
"zk-sdk:build-sbf": "zx ./scripts/rust/build-sbf.mjs zk-sdk",
"zk-sdk:build-wasm": "zx ./scripts/rust/build-wasm.mjs zk-sdk",
"zk-sdk:test": "zx ./scripts/rust/test.mjs zk-sdk",
"zk-sdk:format": "zx ./scripts/rust/format.mjs zk-sdk",
"zk-sdk:lint": "zx ./scripts/rust/lint.mjs zk-sdk",
"zk-sdk-wasm-js:build-wasm": "zx ./scripts/rust/build-wasm.mjs zk-sdk-wasm-js",
"zk-sdk-wasm-js:format": "zx ./scripts/rust/format.mjs zk-sdk-wasm-js",
"zk-sdk-wasm-js:lint": "zx ./scripts/rust/lint.mjs zk-sdk-wasm-js",
"zk-sdk-wasm-js:test-wasm": "zx ./scripts/rust/test-wasm.mjs zk-sdk-wasm-js",
"solana:check": "zx ./scripts/check-solana-version.mjs",
"solana:link": "zx ./scripts/link-solana-version.mjs",
"validator:start": "zx ./scripts/start-validator.mjs",
Expand Down
8 changes: 8 additions & 0 deletions scripts/rust/test-wasm.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env zx
import "zx/globals";
import { cliArguments, workingDirectory } from "../utils.mjs";

const [folder, ...args] = cliArguments();
const cratePath = path.join(workingDirectory, folder);

await $`wasm-pack test --node ${cratePath} ${args}`;
29 changes: 29 additions & 0 deletions zk-sdk-wasm-js/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "solana-zk-sdk-wasm-js"
description = "Solana ZK SDK Wasm JS"
version = "0.1.0"
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["wasm32-unknown-unknown"]
all-features = true
rustdoc-args = ["--cfg=docsrs"]

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
solana-zk-sdk = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = { workspace = true }
wasm-bindgen = { workspace = true }
wasm-bindgen-test = { workspace = true }
getrandom = { workspace = true, features = ["js"] }

[lints]
workspace = true
Loading
Loading