Ephemeral Wallet SDK for Ethereum & EVM chains
Create temporary, single-use wallets with built-in safety (TTL, one-time semantics, sweep helpers, Safe builders).
Designed for one-time payments, demo sessions, disposable accounts, and secure checkout flows.β‘ No servers. No custody. No contracts. Just pure client-side helpers.
Developers often struggle when building short-lived wallet flows for payments, access, or testing:
- β Reusing normal wallets is insecure (private key exposure, replay risks)
- β Building sweeps & gas buffers from scratch is error-prone
- β Safe integrations require verbose boilerplate
- β Permit2 / EIP-712 signing flows are tedious to set up
π TempWallet SDK solves this by giving you:
- πͺͺ Ephemeral wallets β single-use semantics with TTL enforcement
- β½ Gas helpers β estimate, add margin, and sweep correctly with safety buffers
- π Error-proof API β typed errors for expired or reused wallets
- π‘ Safe builders β ready-to-use payloads for Safe Core SDK
- π§Ή Sweep utilities β clean up leftover ETH after payments
- πͺ Permit2 skeletons β plug-and-play flows for token approvals
Built on ethers v6. Type-safe. Tree-shakeable. Zero infra required.
npm install @tempwallet/sdk ethersRequires:
ethersv6.13.0+ (peer dependency)
import { createTempWallet, buildSweepTx } from "@tempwallet/sdk";
import { parseEther } from "ethers";
// 1. Create a temporary wallet
const wallet = createTempWallet({ ttl: 3600, label: "checkout-session-123" });
console.log("Ephemeral address:", wallet.address);
// 2. Send ETH payment
const txHash = await wallet.sendTransaction({
providerUrl: process.env.RPC_URL!,
to: "0xRecipient",
value: parseEther("0.1"),
});
console.log("Payment sent:", txHash);
// 3. Sweep leftover funds (optional)
const sweepTx = await buildSweepTx({
fromAddress: wallet.address,
to: "0xMainWallet",
providerUrl: process.env.RPC_URL!,
gasLimitBuffer: parseEther("0.001"),
});Creates an ephemeral wallet with TTL & one-time semantics.
const wallet = createTempWallet({ ttl: 1800, label: "demo" });Sends a transaction with single-use enforcement.
Throws:
ExpiredSessionErrorif TTL passedAlreadyUsedErrorif reused
Builds a sweep transaction to move all ETH safely with gas buffer.
Gas cost calculators with optional safety margin.
Ready-to-use payloads for Safe Core SDK.
Generates EIP-681 payment URIs (ethereum:0x...).
-
Crypto Checkout
Accept ETH payments with ephemeral wallets that auto-expire & sweep. -
Demo / Sandbox Accounts
Let users play in your dApp without touching their main wallet. -
Disposable Session Keys
Issue one-time wallets for gated content or temporary access. -
Safe Transactions
Build Safe-compatible payment payloads in 1 line. -
Permit2 Token Flows
Generate typed skeletons for Permit2 signatures.
import { ExpiredSessionError, AlreadyUsedError } from "@tempwallet/sdk";
try {
await wallet.sendTransaction(tx);
} catch (err) {
if (err instanceof ExpiredSessionError) {
console.log("Wallet expired β create new one");
}
}| Error | Trigger |
|---|---|
ExpiredSessionError |
TTL exceeded |
AlreadyUsedError |
Wallet reused |
NoBalanceToSweepError |
No ETH to sweep |
InsufficientAfterBufferError |
Not enough balance after gas buffer |
β
Generate keys only client-side
β
Use secure storage (memory/session only for TTL)
β
Always sweep leftovers
β
Enforce TTL (default 1h)
β Never reuse ephemeral wallets
β Donβt use in production without sweep fallback
- [π§] ERC-20 & ERC-721 sweep helpers
- Batch transaction builder
- Auto RPC gas estimator
- Multi-chain presets (Optimism, Base, Polygon, Arbitrum)
- Recovery flows (optional seed phrase support)
Contributions welcome!
Check CONTRIBUTING.md.
MIT β see LICENSE
If this SDK saved you time or you like the philosophy of zero infra helpers, feel free to send a tip β€οΈ:
ETH / USDC: 0x687848FC782Dc20edCa4b535f27fB4b1B398a305
Ephemeral wallet SDK, temporary Ethereum wallet, one-time crypto payments, secure ETH checkout, Safe transaction builder, Permit2 helper, sweep ETH balance, gas estimation utils, client-side EVM flows.