{"_id":"@bun-eth/burner-connector","_rev":"3-fa11b32bf6dd9f2251caee30dfce28b0","name":"@bun-eth/burner-connector","dist-tags":{"latest":"0.3.0"},"versions":{"0.2.0":{"name":"@bun-eth/burner-connector","version":"0.2.0","keywords":["ethereum","burner","wallet","testing","wagmi"],"license":"MIT","_id":"@bun-eth/burner-connector@0.2.0","maintainers":[{"name":"decebal","email":"decebal1988@gmail.com"}],"dist":{"shasum":"fffc27157486b7e71cb6453de1a9e51b47806e40","tarball":"https://registry.npmjs.org/@bun-eth/burner-connector/-/burner-connector-0.2.0.tgz","fileCount":10,"integrity":"sha512-7ygyjCpqv+6snk8OOpZVaR3pW/2klIDkRl6uLaiswy1tp69nuuzT6Aw8xUHi2Tu7g3ektFa0fJC/I2zzoZwtrg==","signatures":[{"sig":"MEUCIDmJpo0MrfTEoe4+TMaK0TfDhZ9jovM9s5ISxW/yKdHCAiEA7h36kUQnX8dSqQ0URL28tko9tM3uoipfKlJWIC91J7s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23370},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"36cff4286800f55ee1853fc4aa156ffdffac8aad","scripts":{"dev":"tsup src/index.ts --format cjs,esm --watch --external wagmi --external viem","build":"tsup src/index.ts --format cjs,esm --external wagmi --external viem"},"_npmUser":{"name":"decebal","email":"decebal1988@gmail.com"},"_npmVersion":"11.5.2","description":"Burner wallet connector for quick local testing","directories":{},"_nodeVersion":"23.7.0","dependencies":{"viem":"^2.7.8","wagmi":"^2.16.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.6.2","@types/node":"^20.11.5"},"_npmOperationalInternal":{"tmp":"tmp/burner-connector_0.2.0_1759548133417_0.9120557008499233","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@bun-eth/burner-connector","version":"0.2.1","keywords":["ethereum","burner","wallet","testing","wagmi"],"license":"MIT","_id":"@bun-eth/burner-connector@0.2.1","maintainers":[{"name":"decebal","email":"decebal1988@gmail.com"}],"dist":{"shasum":"185f8f22a8cb0a94db4548e13cca2d4108e99a65","tarball":"https://registry.npmjs.org/@bun-eth/burner-connector/-/burner-connector-0.2.1.tgz","fileCount":11,"integrity":"sha512-qiinO77j2Kc8URl4lwKo4ZGpzl3PTaZnf/k+XZyEZTNWbYoTf3a+ESVbjRTEt7bkGKUotbm813fiGOhMzPpyhQ==","signatures":[{"sig":"MEQCIGYK8Bc5yakXxZZ9l7+/rBiQOiRa4a4EZPP4n+kFJcIiAiB0MBjyUcXBT6waEX9voQWo05I48DvHAOsAdgFvpp1jtQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23849},"main":"./src/index.ts","types":"./src/index.ts","module":"./src/index.ts","exports":{".":{"bun":"./src/index.ts","import":"./src/index.ts","require":"./src/index.ts"}},"gitHead":"0e1eea35310744a8ba6e5abc0f2dfa23ac5a1b25","scripts":{"dev":"echo 'No dev build needed - import source files directly'","build":"echo 'No build needed - Bun uses TypeScript directly'"},"_npmUser":{"name":"decebal","email":"decebal1988@gmail.com"},"_npmVersion":"11.6.2","description":"Burner wallet connector for quick local testing","directories":{},"_nodeVersion":"24.12.0","dependencies":{"viem":"^2.7.8","wagmi":"^2.16.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","typescript":"^5.6.2","@types/node":"^20.11.5"},"_npmOperationalInternal":{"tmp":"tmp/burner-connector_0.2.1_1768915625810_0.3456256994196125","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@bun-eth/burner-connector","version":"0.3.0","description":"Burner wallet connector for quick local testing","sideEffects":false,"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"bun":"./src/index.ts","import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"scripts":{"build":"tsup","dev":"tsup --watch","prepublishOnly":"bun run build"},"dependencies":{"viem":"^2.7.8","wagmi":"^2.16.4"},"devDependencies":{"@types/node":"^20.11.5","tsup":"^8.5.1","typescript":"^5.6.2"},"keywords":["ethereum","burner","wallet","testing","wagmi"],"license":"MIT","gitHead":"09767f7fff984089f8dd69753836127fef95cb4a","_id":"@bun-eth/burner-connector@0.3.0","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-jW3GnHnB8AHH4fkp+IlxEl8x3gW0bzEYb76zT1Y7CZ7SxtRXA+vJHV2i4JB9kTLqlZRq1AiAxt35c2Ms3fGpQw==","shasum":"136f207d6a2e90b2286f56070efb92797c7830ca","tarball":"https://registry.npmjs.org/@bun-eth/burner-connector/-/burner-connector-0.3.0.tgz","fileCount":12,"unpackedSize":43084,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICsmdrUkWgSWZ/mO4ldH7KOi8xaHfBI3wAdX6M8dRfaWAiAwgxOLsTmiYxkjEvKvj3sRrRhDPqyV/3cWUfUR81uBOA=="}]},"_npmUser":{"name":"decebal","email":"decebal1988@gmail.com"},"directories":{},"maintainers":[{"name":"decebal","email":"decebal1988@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/burner-connector_0.3.0_1768940344550_0.49418843488060826"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-04T03:22:13.345Z","modified":"2026-01-20T20:19:04.842Z","0.2.0":"2025-10-04T03:22:13.635Z","0.2.1":"2026-01-20T13:27:05.949Z","0.3.0":"2026-01-20T20:19:04.698Z"},"license":"MIT","keywords":["ethereum","burner","wallet","testing","wagmi"],"description":"Burner wallet connector for quick local testing","maintainers":[{"name":"decebal","email":"decebal1988@gmail.com"}],"readme":"# @bun-eth/burner-connector\n\nEphemeral burner wallet connector for wagmi - perfect for quick local testing without MetaMask.\n\n## Features\n\n- 🔥 **Instant Testing** - No wallet setup required\n- 💾 **Persistent** - Stored in localStorage (survives page refresh)\n- 🔒 **Local Only** - Restricted to localhost by default (Chain ID: 31337)\n- 🎯 **Type-Safe** - Full TypeScript support\n- ⚡ **Bun-Optimized** - Works seamlessly with Bun-Eth stack\n\n## Installation\n\n```bash\nbun add @bun-eth/burner-connector\n```\n\n## Usage\n\n### Basic Setup with wagmi\n\n```typescript\nimport { createConfig } from \"wagmi\";\nimport { localhost } from \"wagmi/chains\";\nimport { burnerWalletConnector } from \"@bun-eth/burner-connector\";\n\nconst config = createConfig({\n  chains: [localhost],\n  connectors: [\n    burnerWalletConnector({\n      storageKey: \"my-burner-wallet\",\n      allowedChainIds: [31337], // Only localhost\n    }),\n  ],\n});\n```\n\n### With RainbowKit\n\n```typescript\nimport { connectorsForWallets } from \"@rainbow-me/rainbowkit\";\nimport { burnerWalletConnector } from \"@bun-eth/burner-connector\";\n\nconst connectors = connectorsForWallets(\n  [\n    {\n      groupName: \"Development\",\n      wallets: [burnerWalletConnector()],\n    },\n  ],\n  {\n    appName: \"My dApp\",\n    projectId: \"YOUR_PROJECT_ID\",\n  }\n);\n```\n\n### Utility Functions\n\n#### Generate a New Burner Wallet\n\n```typescript\nimport { generateBurnerWallet, clearBurnerWallet } from \"@bun-eth/burner-connector\";\n\n// Generate new burner wallet (replaces existing)\nconst account = generateBurnerWallet();\nconsole.log(\"New burner address:\", account.address);\n\n// Clear burner wallet\nclearBurnerWallet();\n```\n\n#### Get Current Burner Private Key\n\n```typescript\nimport { getBurnerPrivateKey } from \"@bun-eth/burner-connector\";\n\n// Get or create burner private key\nconst privateKey = getBurnerPrivateKey();\n```\n\n## Configuration Options\n\n```typescript\ntype BurnerWalletOptions = {\n  // Storage key for localStorage (default: \"bun-eth-burner-wallet\")\n  storageKey?: string;\n\n  // Only enable on specific chain IDs (default: [31337])\n  allowedChainIds?: number[];\n};\n```\n\n## Security Considerations\n\n⚠️ **Important Security Notes:**\n\n1. **Development Only** - Burner wallets are for testing, NOT production\n2. **Private Keys in LocalStorage** - Keys are stored unencrypted in browser\n3. **Localhost Only** - Default configuration restricts to Chain ID 31337\n4. **No Real Funds** - Never send real ETH to a burner wallet\n5. **Clear After Use** - Consider clearing burner wallets after testing\n\n## Use Cases\n\n### 1. Quick dApp Testing\n\nTest your dApp without constantly switching MetaMask networks:\n\n```typescript\n// Connect to burner wallet\nawait connect({ connector: burnerConnector });\n\n// Burner wallet is ready with test ETH (from local faucet)\n```\n\n### 2. Automated Testing\n\nUse in E2E tests for consistent wallet state:\n\n```typescript\nimport { getBurnerAccount } from \"@bun-eth/burner-connector\";\n\nconst testAccount = getBurnerAccount(\"test-wallet-1\");\n// Use in Playwright/Cypress tests\n```\n\n### 3. Demo Applications\n\nLet users try your dApp without wallet installation:\n\n```typescript\n// Show \"Try Demo\" button\n// Connects to burner wallet automatically\n// Pre-fund with test tokens\n```\n\n## Storage Format\n\nThe burner wallet stores the private key in localStorage:\n\n```javascript\n// Key: \"bun-eth-burner-wallet\" (or custom key)\n// Value: \"0x...\" (private key hex string)\nlocalStorage.getItem(\"bun-eth-burner-wallet\");\n// => \"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80\"\n```\n\n## Integration with Bun-Eth Stack\n\n### With Faucet Component\n\n```typescript\nimport { FaucetButton } from \"@bun-eth/components\";\nimport { useAccount } from \"wagmi\";\nimport { burnerWalletConnector } from \"@bun-eth/burner-connector\";\n\nfunction DevTools() {\n  const { address, connector } = useAccount();\n  const isBurner = connector?.id === \"burner-wallet\";\n\n  return (\n    <div>\n      {isBurner && <p>🔥 Using Burner Wallet</p>}\n      {address && <FaucetButton />}\n    </div>\n  );\n}\n```\n\n### Conditional Rendering\n\nOnly show burner wallet on localhost:\n\n```typescript\nimport { useAccount } from \"wagmi\";\n\nconst { chain } = useAccount();\nconst isLocalhost = chain?.id === 31337;\n\n// Only show burner option on localhost\n{isLocalhost && <BurnerWalletButton />}\n```\n\n## API Reference\n\n### `burnerWalletConnector(options?)`\n\nCreates a wagmi connector for burner wallet.\n\n**Parameters:**\n- `options.storageKey` - localStorage key (default: \"bun-eth-burner-wallet\")\n- `options.allowedChainIds` - Allowed chain IDs (default: [31337])\n\n**Returns:** Wagmi connector\n\n### `getBurnerPrivateKey(storageKey?)`\n\nGets or generates a burner private key.\n\n**Parameters:**\n- `storageKey` - localStorage key (optional)\n\n**Returns:** Private key as `0x${string}`\n\n### `generateBurnerWallet(storageKey?)`\n\nGenerates a new burner wallet (replaces existing).\n\n**Parameters:**\n- `storageKey` - localStorage key (optional)\n\n**Returns:** `PrivateKeyAccount` from viem\n\n### `clearBurnerWallet(storageKey?)`\n\nClears the burner wallet from localStorage.\n\n**Parameters:**\n- `storageKey` - localStorage key (optional)\n\n**Returns:** void\n\n### `getBurnerAccount(storageKey?)`\n\nGets the current burner wallet account.\n\n**Parameters:**\n- `storageKey` - localStorage key (optional)\n\n**Returns:** `PrivateKeyAccount` from viem\n\n## Comparison with MetaMask\n\n| Feature | Burner Wallet | MetaMask |\n|---------|--------------|----------|\n| Setup Time | Instant | Requires extension |\n| Test Network | Localhost only | Any network |\n| Private Key | localStorage | Encrypted vault |\n| Security | ⚠️ Low | ✅ High |\n| Use Case | Testing | Production |\n| Persistence | Session | Permanent |\n\n## Troubleshooting\n\n### Burner wallet not connecting\n\nCheck that you're on localhost (Chain ID 31337):\n\n```typescript\nconst { chain } = useAccount();\nconsole.log(\"Current chain:\", chain?.id);\n// Should be 31337 for burner wallet\n```\n\n### Private key not persisting\n\nEnsure localStorage is available:\n\n```typescript\nif (typeof window !== \"undefined\") {\n  console.log(\"LocalStorage available\");\n}\n```\n\n### Cannot use on mainnet\n\nThis is by design! Burner wallets are restricted to test networks:\n\n```typescript\nburnerWalletConnector({\n  allowedChainIds: [31337], // Only localhost\n});\n```\n\n## Examples\n\nSee the [Bun-Eth example app](../../apps/web) for a complete implementation with:\n- RainbowKit integration\n- Burner wallet UI\n- Faucet integration\n- Network detection\n\n## License\n\nMIT\n\n---\n\n⚠️ **Remember:** Burner wallets are for development only. Never use in production or with real funds!\n","readmeFilename":"README.md"}