An example Keyspace client implemented in TypeScript. This client is the basis for the Keyspace documentation and will eventually become a client library for Keyspace.
bun installcast wallet newbun run scripts/create-p256-key.tsbun automatically loads environment variables from a .env file. Create a .env file in the root of the project.
touch .env| Environment Variable | Description |
|---|---|
| RPC_URL | Ethereum RPC URL for general RPC calls |
| BUNDLER_RPC_URL | Ethereum RPC URL for ERC-4337 calls |
| KEYSPACE_RPC_URL | Keyspace RPC URL |
| RECOVERY_RPC_URL | Recovery Service RPC URL |
bun run scripts/get-keyspace-key.ts| Argument | Environment Variable | Description |
|---|---|---|
| --private-key | PRIVATE_KEY | secp256k1 private key or P256 JWK |
| --signature-type | secp256k1 (default) or webauthn |
bun run scripts/send-eth.ts| Argument | Environment Variable | Description |
|---|---|---|
| --keyspace-key | KEYSPACE_KEY | The wallet's Keyspace key |
| --private-key | PRIVATE_KEY | secp256k1 private key or P256 JWK |
| --signature-type | secp256k1 (default) or webauthn |
Make sure there's ETH in the account you're sending from. You can get the Ethereum address of the smart wallet by running bun run scripts/get-keyspace-key.ts.
bun run scripts/change-owner.ts| Argument | Environment Variable | Description |
|---|---|---|
| --keyspace-key | KEYSPACE_KEY | The wallet's Keyspace key |
| --private-key | PRIVATE_KEY | secp256k1 private key or P256 JWK |
| --new-private-key | NEW_PRIVATE_KEY | new secp256k1 private key or P256 JWK |
| --signature-type | secp256k1 (default) or webauthn |
bun run docs:dev
bun run docs:build