@cubewire/hardhat-wallet
v1.0.1
Published
Hardhat plugin for Cubewire Wallet — HSM-backed signing via Cubewire's custodial wallet API
Readme
@cubewire/hardhat-wallet
Hardhat plugin for Cubewire Wallet — HSM-backed signing via Cubewire's custodial wallet API.
Features
- HSM-backed signing — private keys never leave Google Cloud KMS
- Hardhat v3 integration — auto-wraps your network provider
- Ethers v6 compatible — full
AbstractSignerimplementation - EIP-191 & EIP-712 — personal messages, Permit2, typed data
Installation
npm install @cubewire/hardhat-wallet @nomicfoundation/hardhat-ethers ethersQuick Start
1. Get API credentials from the Cubewire Dashboard → Settings → API Keys.
2. Configure Hardhat:
import { defineConfig, configVariable } from "hardhat/config";
import hardhatCubewire from "@cubewire/hardhat-wallet";
import hardhatEthers from "@nomicfoundation/hardhat-ethers";
export default defineConfig({
plugins: [hardhatEthers, hardhatCubewire],
networks: {
myNetwork: {
type: "http",
url: "https://your-rpc-url",
cubewire: {
clientId: configVariable("CUBEWIRE_CLIENT_ID"),
clientSecret: configVariable("CUBEWIRE_CLIENT_SECRET"),
address: configVariable("CUBEWIRE_VAULT_ADDRESS"),
},
},
},
});3. Set environment variables:
export CUBEWIRE_CLIENT_ID=your_client_id
export CUBEWIRE_CLIENT_SECRET=your_client_secret
export CUBEWIRE_VAULT_ADDRESS=0x...Hardhat v3 does not auto-load
.envfiles. Useset -a && source .env && set +a, or Hardhat's encrypted keystore (npx hardhat keystore set).
4. Use in scripts:
import hre from "hardhat";
import { getCubewireSigner } from "@cubewire/hardhat-wallet";
const signer = await getCubewireSigner(hre);
const tx = await signer.sendTransaction({ to: "0x...", value: ethers.parseEther("0.1") });Examples
See the examples/ directory for ready-to-run scripts:
| Script | Description |
|---|---|
| 01-send-transaction.ts | Send native currency |
| 02-sign-message.ts | Sign a personal message (EIP-191) |
| 03-sign-typed-data.ts | Sign typed data (EIP-712) |
| 04-deploy-contract.ts | Deploy a smart contract |
| 05-read-contract.ts | Read contract state |
| 06-get-balance.ts | Get native & token balances |
| 07-full-workflow.ts | End-to-end workflow |
Documentation
Full guides and API reference at docs.cubewire.com:
- Introduction
- Authentication & OAuth2
- Managing Vaults
- Transactions
- Smart Contracts
- Policies & Approvals
- Networks
Contributing
Contributions welcome — fork, branch, and open a PR.
License
MIT © Cubewire
