diff --git a/README.md b/README.md index c36eb1e6..9321762e 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,14 @@ curl -fsSL https://docs.openwallet.sh/install.sh | bash Or install only what you need: ```bash -npm install @open-wallet-standard/core # Node.js SDK -npm install -g @open-wallet-standard/core # Node.js SDK + CLI (provides `ows` command) +npm install @open-wallet-standard/core # Node.js SDK +npm install -g @open-wallet-standard/core # Node.js SDK + CLI (provides `ows` command) +npm install @open-wallet-standard/adapters # Framework adapters (viem, Solana, WDK) pip install open-wallet-standard # Python cd ows && cargo build --workspace --release # From source ``` -The language bindings are **fully self-contained** — they embed the Rust core via native FFI. Installing globally with `-g` also provides the `ows` CLI. +The language bindings are **fully self-contained** — they embed the Rust core via native FFI. Installing globally with `-g` also provides the `ows` CLI. The [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) package plugs an OWS wallet into viem, `@solana/web3.js`, and the Tether WDK. ## Quick Start diff --git a/bindings/node-adapters/README.md b/bindings/node-adapters/README.md new file mode 100644 index 00000000..79ff1473 --- /dev/null +++ b/bindings/node-adapters/README.md @@ -0,0 +1,90 @@ +# @open-wallet-standard/adapters + +Framework adapters for the Open Wallet Standard — drop an OWS wallet into viem, Solana web3.js, or the Tether WDK without surfacing private keys. + +[![npm](https://img.shields.io/npm/v/@open-wallet-standard/adapters)](https://www.npmjs.com/package/@open-wallet-standard/adapters) +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/open-wallet-standard/core/blob/main/LICENSE) + +## Install + +```bash +npm install @open-wallet-standard/adapters @open-wallet-standard/core +``` + +Then install whichever framework you use alongside it: + +```bash +npm install viem # for the viem adapter +npm install @solana/web3.js # for the Solana adapter +npm install @tetherto/wdk-wallet # for the WDK adapter +``` + +Framework SDKs are declared as optional peer dependencies — install only what you need. + +## Adapters + +| Adapter | Entry point | Returns | +|---------|-------------|---------| +| viem | `@open-wallet-standard/adapters/viem` | `viem` `Account` that signs via OWS | +| Solana | `@open-wallet-standard/adapters/solana` | `@solana/web3.js` `Keypair` | +| WDK | `@open-wallet-standard/adapters/wdk` | WDK `IWalletAccount`-compatible object | + +All three delegate signing to `@open-wallet-standard/core`, so keys remain encrypted in the OWS vault. + +## viem + +```javascript +import { owsToViemAccount } from "@open-wallet-standard/adapters/viem"; +import { createWalletClient, http } from "viem"; +import { mainnet } from "viem/chains"; + +const account = owsToViemAccount("agent-treasury"); + +const client = createWalletClient({ account, chain: mainnet, transport: http() }); +const hash = await client.sendTransaction({ to: "0x...", value: 0n }); +``` + +Options: `chain` (CAIP-2, defaults to `eip155:1`), `passphrase`, `index`, `vaultPath`. + +## Solana + +```javascript +import { owsToSolanaKeypair } from "@open-wallet-standard/adapters/solana"; +import { Connection, SystemProgram, Transaction } from "@solana/web3.js"; + +const keypair = owsToSolanaKeypair("agent-treasury"); + +const connection = new Connection("https://api.mainnet-beta.solana.com"); +const tx = new Transaction().add( + SystemProgram.transfer({ fromPubkey: keypair.publicKey, toPubkey: keypair.publicKey, lamports: 0 }), +); +tx.sign(keypair); +``` + +Options: `passphrase`, `vaultPath`. + +The Solana adapter requires a wallet imported from a raw ed25519 private key. Mnemonic-derived wallets cannot be unwrapped into a `Keypair` — use `signMessage` / `signTransaction` from `@open-wallet-standard/core` directly. + +## WDK (Tether Wallet Development Kit) + +```javascript +import { owsToWdkAccount } from "@open-wallet-standard/adapters/wdk"; + +const account = owsToWdkAccount("agent-treasury", "evm"); + +const address = await account.getAddress(); +const signature = await account.sign("hello"); +const txHash = await account.sendTransaction("deadbeef..."); +``` + +`chain` accepts WDK short names (`"evm"`, `"solana"`, `"btc"`, `"ton"`, `"tron"`, `"cosmos"`, `"sui"`, `"xrpl"`, `"filecoin"`, `"spark"`) or CAIP-2 identifiers. + +Options: `passphrase`, `index`, `rpcUrl`, `vaultPath`. + +## Documentation + +Full spec and docs at [openwallet.sh](https://openwallet.sh) and the [GitHub repo](https://github.com/open-wallet-standard/core). + +## License + +MIT diff --git a/bindings/node/README.md b/bindings/node/README.md index bd6badc4..3d95ce8f 100644 --- a/bindings/node/README.md +++ b/bindings/node/README.md @@ -23,6 +23,8 @@ npm install -g @open-wallet-standard/core # Node.js SDK + CLI (provides `ows` co The package is **fully self-contained** — it embeds the Rust core via native FFI. Installing globally with `-g` also provides the `ows` CLI. +Using viem, `@solana/web3.js`, or the Tether WDK? Install [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) alongside this package to drop an OWS wallet into those frameworks without ever exposing a private key. + ## Quick Start ```javascript diff --git a/docs/quickstart.md b/docs/quickstart.md index 7820e6d9..8e6bb516 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -13,7 +13,8 @@ curl -fsSL https://docs.openwallet.sh/install.sh | bash This installs the `ows` CLI, Node.js SDK, and Python bindings. Or install only what you need: ```bash -npm install @open-wallet-standard/core # Node.js +npm install @open-wallet-standard/core # Node.js +npm install @open-wallet-standard/adapters # Node.js — viem, Solana, WDK adapters pip install open-wallet-standard # Python ``` diff --git a/docs/sdk-node.md b/docs/sdk-node.md index 6cdada6f..26f1c92a 100644 --- a/docs/sdk-node.md +++ b/docs/sdk-node.md @@ -14,6 +14,8 @@ npm install @open-wallet-standard/core The package includes prebuilt native binaries for macOS (arm64, x64) and Linux (x64, arm64). No Rust toolchain required. +For viem, `@solana/web3.js`, or Tether WDK integrations, install [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) alongside this package — it wraps an OWS wallet as a framework-native signer without exposing private keys. + ## Quick Start ```javascript diff --git a/ows/README.md b/ows/README.md index cbf4e82c..cfa82041 100644 --- a/ows/README.md +++ b/ows/README.md @@ -50,6 +50,7 @@ The bindings are **standalone** — they embed the Rust core via native FFI. No | Language | Package | Install | |----------|---------|---------| | Node.js | [`@open-wallet-standard/core`](https://www.npmjs.com/package/@open-wallet-standard/core) | `npm install @open-wallet-standard/core` | +| Node.js adapters (viem, Solana, WDK) | [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) | `npm install @open-wallet-standard/adapters` | | Python | [`open-wallet-standard`](https://pypi.org/project/open-wallet-standard/) | `pip install open-wallet-standard` | ```javascript diff --git a/ows/crates/ows-cli/README.md b/ows/crates/ows-cli/README.md index cbf4e82c..cfa82041 100644 --- a/ows/crates/ows-cli/README.md +++ b/ows/crates/ows-cli/README.md @@ -50,6 +50,7 @@ The bindings are **standalone** — they embed the Rust core via native FFI. No | Language | Package | Install | |----------|---------|---------| | Node.js | [`@open-wallet-standard/core`](https://www.npmjs.com/package/@open-wallet-standard/core) | `npm install @open-wallet-standard/core` | +| Node.js adapters (viem, Solana, WDK) | [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) | `npm install @open-wallet-standard/adapters` | | Python | [`open-wallet-standard`](https://pypi.org/project/open-wallet-standard/) | `pip install open-wallet-standard` | ```javascript diff --git a/ows/crates/ows-core/README.md b/ows/crates/ows-core/README.md index cbf4e82c..cfa82041 100644 --- a/ows/crates/ows-core/README.md +++ b/ows/crates/ows-core/README.md @@ -50,6 +50,7 @@ The bindings are **standalone** — they embed the Rust core via native FFI. No | Language | Package | Install | |----------|---------|---------| | Node.js | [`@open-wallet-standard/core`](https://www.npmjs.com/package/@open-wallet-standard/core) | `npm install @open-wallet-standard/core` | +| Node.js adapters (viem, Solana, WDK) | [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) | `npm install @open-wallet-standard/adapters` | | Python | [`open-wallet-standard`](https://pypi.org/project/open-wallet-standard/) | `pip install open-wallet-standard` | ```javascript diff --git a/ows/crates/ows-lib/README.md b/ows/crates/ows-lib/README.md index cbf4e82c..cfa82041 100644 --- a/ows/crates/ows-lib/README.md +++ b/ows/crates/ows-lib/README.md @@ -50,6 +50,7 @@ The bindings are **standalone** — they embed the Rust core via native FFI. No | Language | Package | Install | |----------|---------|---------| | Node.js | [`@open-wallet-standard/core`](https://www.npmjs.com/package/@open-wallet-standard/core) | `npm install @open-wallet-standard/core` | +| Node.js adapters (viem, Solana, WDK) | [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) | `npm install @open-wallet-standard/adapters` | | Python | [`open-wallet-standard`](https://pypi.org/project/open-wallet-standard/) | `pip install open-wallet-standard` | ```javascript diff --git a/ows/crates/ows-signer/README.md b/ows/crates/ows-signer/README.md index cbf4e82c..cfa82041 100644 --- a/ows/crates/ows-signer/README.md +++ b/ows/crates/ows-signer/README.md @@ -50,6 +50,7 @@ The bindings are **standalone** — they embed the Rust core via native FFI. No | Language | Package | Install | |----------|---------|---------| | Node.js | [`@open-wallet-standard/core`](https://www.npmjs.com/package/@open-wallet-standard/core) | `npm install @open-wallet-standard/core` | +| Node.js adapters (viem, Solana, WDK) | [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) | `npm install @open-wallet-standard/adapters` | | Python | [`open-wallet-standard`](https://pypi.org/project/open-wallet-standard/) | `pip install open-wallet-standard` | ```javascript diff --git a/readme/templates/node.md b/readme/templates/node.md index 0d4845e7..69e18efc 100644 --- a/readme/templates/node.md +++ b/readme/templates/node.md @@ -18,6 +18,8 @@ npm install -g @open-wallet-standard/core # Node.js SDK + CLI (provides `ows` co The package is **fully self-contained** — it embeds the Rust core via native FFI. Installing globally with `-g` also provides the `ows` CLI. +Using viem, `@solana/web3.js`, or the Tether WDK? Install [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) alongside this package to drop an OWS wallet into those frameworks without ever exposing a private key. + ## Quick Start ```javascript diff --git a/readme/templates/ows.md b/readme/templates/ows.md index 55f45534..5fbe64c4 100644 --- a/readme/templates/ows.md +++ b/readme/templates/ows.md @@ -29,6 +29,7 @@ The bindings are **standalone** — they embed the Rust core via native FFI. No | Language | Package | Install | |----------|---------|---------| | Node.js | [`@open-wallet-standard/core`](https://www.npmjs.com/package/@open-wallet-standard/core) | `npm install @open-wallet-standard/core` | +| Node.js adapters (viem, Solana, WDK) | [`@open-wallet-standard/adapters`](https://www.npmjs.com/package/@open-wallet-standard/adapters) | `npm install @open-wallet-standard/adapters` | | Python | [`open-wallet-standard`](https://pypi.org/project/open-wallet-standard/) | `pip install open-wallet-standard` | ```javascript