@tortoise-os/burner-wallet
v0.2.0
Published
Burner wallet connector for Sui dApp development
Maintainers
Readme
@tortoise-os/burner-wallet
Burner wallet for Sui dApp local development. Auto-creates and persists wallets for testing.
Features
- Auto-generates Ed25519 keypair
- Persists in localStorage
- Auto-requests funds from local faucet
- Perfect for development/testing
Installation
bun add @tortoise-os/burner-walletUsage
Basic Usage
import { createBurnerWallet } from "@tortoise-os/burner-wallet";
const wallet = createBurnerWallet();
console.log("Address:", wallet.getAddress());
// Request funds from local faucet
await wallet.requestFunds();Singleton Pattern
import { getBurnerWallet } from "@tortoise-os/burner-wallet";
// Always returns same instance
const wallet = getBurnerWallet();Configuration
const wallet = createBurnerWallet({
persist: true, // Save to localStorage
autoFund: true, // Auto-request from faucet
faucetUrl: "http://localhost:9123/gas", // Faucet endpoint
});With Sui dApp Kit
import { getBurnerWallet } from "@tortoise-os/burner-wallet";
import { TransactionBlock } from "@mysten/sui.js/transactions";
import { SuiClient } from "@mysten/sui.js/client";
const wallet = getBurnerWallet();
const client = new SuiClient({ url: "http://localhost:9000" });
// Sign transaction
const tx = new TransactionBlock();
// ... build transaction
const signature = await wallet.getKeypair().signTransactionBlock(
await tx.build({ client })
);Clear Wallet
wallet.clear(); // Removes from localStorageAPI
createBurnerWallet(config?)
Creates new burner wallet instance.
getBurnerWallet(config?)
Gets singleton burner wallet instance.
BurnerWallet
Methods
getAddress(): string- Get Sui addressgetKeypair(): Ed25519Keypair- Get keypair for signingrequestFunds(): Promise<boolean>- Request from faucetclear(): void- Clear from storage
Static Methods
BurnerWallet.isBurnerWalletSupported(): boolean- Check if localStorage available
Development Workflow
- Start local Sui network with faucet
- Create burner wallet - auto-funded
- Develop and test
- Wallet persists across refreshes
Security
⚠️ FOR DEVELOPMENT ONLY
- Never use in production
- Never send real funds
- Keys stored in localStorage (not secure)
- Auto-clears on browser data clear
Example: React Hook
import { useEffect, useState } from "react";
import { getBurnerWallet } from "@tortoise-os/burner-wallet";
export function useBurnerWallet() {
const [wallet, setWallet] = useState<ReturnType<typeof getBurnerWallet>>();
useEffect(() => {
if (process.env.NODE_ENV === "development") {
const w = getBurnerWallet();
w.requestFunds(); // Auto-fund on mount
setWallet(w);
}
}, []);
return wallet;
}License
MIT
