Skip to content

Commit 38f8699

Browse files
committed
feat: add solana address creation via WASM
Implement the initial wasm-solana package to support Solana address generation using Rust compiled to WebAssembly. This is the first phase of replacing JavaScript Solana dependencies (@solana/web3.js, tweetnacl) with secure Rust implementations to mitigate npm supply chain attack risks. Architecture follows wasm-utxo patterns: - Two-layer Rust design: core logic (src/*.rs) + thin WASM wrappers (src/wasm/*.rs) - TypeScript wrappers (js/*.ts) providing idiomatic camelCase APIs - Comprehensive test suite with BitGoJS compatibility tests Components added: - Keypair: Ed25519 keypair generation from random or 32/64-byte secret keys - Pubkey: Base58 encoding/decoding for Solana addresses - Error handling using js_sys::Error for proper JS exceptions Build tooling: - Cargo.toml with wasm-bindgen, solana-client-wasm, ed25519-dalek - Makefile matching wasm-utxo's wasm-pack workflow - TypeScript configs for ESM and CJS output Verified compatibility with BitGoJS sdk-coin-sol test vectors to ensure byte-identical address derivation from the same secret keys. Ticket: BTC-2927
1 parent de6894d commit 38f8699

26 files changed

Lines changed: 2074 additions & 9 deletions

package-lock.json

Lines changed: 125 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/wasm-solana/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
target/
2+
node_modules/
3+
# we actually only track the .ts files
4+
dist/
5+
test/*.js
6+
test/*.d.ts
7+
js/*.js
8+
js/*.d.ts
9+
js/wasm
10+
.vscode

packages/wasm-solana/.mocharc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extensions": ["ts", "tsx", "js", "jsx"],
3+
"spec": ["test/**/*.ts"],
4+
"node-option": ["import=tsx/esm", "experimental-wasm-modules"]
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist/
2+
target/
3+
js/wasm/
4+
pkg/
5+
node_modules/

0 commit comments

Comments
 (0)