eip7702-sweeper
v1.0.2
Published
Automated sweeper bot for EIP-7702 delegated accounts
Downloads
187
Readme
EIP-7702 Sweeper
Automated sweeper bot for EIP-7702 delegated accounts.
eip7702-sweeper is a lightweight Node.js library that helps automate fund sweeping from delegated EIP-7702 accounts using a sponsor wallet. It simplifies the process of authorizing and forwarding transactions via delegate contracts across multiple EVM networks.
Features
- 🔁 Automatic delegation and sweeping of EIP-7702 wallets
- ⛽ Gas estimation with configurable buffer
- 🌐 Multi-chain support
- 🛡️ Validation of input parameters
- 🔍 Optional delegate monitoring mode
- 🚀 Easy integration in JavaScript/TypeScript projects
Installation
Install the package using npm:
npm install eip7702-sweeperUsage
Basic Example
import bot from "eip7702-sweeper";
bot({
targetWallet: "0xTARGET_PRIVATE_KEY",
sponsorWallet: "0xSPONSOR_PRIVATE_KEY",
fundSweepRecipient: "0xRECIPIENT_ADDRESS",
rpcUrl: "https://your-rpc-url",
});Configuration Options
Required Parameters
| Parameter | Type | Description |
|--------------------|--------|-------------|
| targetWallet | string | Private key of the wallet to be delegated |
| sponsorWallet | string | Private key of the wallet paying for gas |
| fundSweepRecipient | string | Address where swept funds will be forwarded |
| rpcUrl | string | RPC endpoint URL |
Optional Settings
You can pass an optional setting object:
await bot({
targetWallet,
sponsorWallet,
fundSweepRecipient,
rpcUrl,
setting: {
delegateMode: true,
delegateModeInterval: 10,
gasBuffer: 1.2,
},
});| Option | Type | Default | Description |
|------|------|---------|-------------|
| delegateMode | boolean | false | Keep monitoring delegation status |
| delegateModeInterval | number | 0 | Interval between checks (seconds) |
| gasBuffer | number | 1.2 | Multiplier added to estimated gas |
Supported Networks
The package supports multiple EVM-compatible networks including:
- Ethereum Mainnet
- Ethereum Sepolia
- Binance Smart Chain
- Base
- Arbitrum
- polygon
- Optimism
- Avalanche
- Gnosis
- Scroll
- Zora
- Celo
- Sonic
- Berachain
- Unichain
- Ronin
Networks are automatically detected from the provided RPC URL.
How It Works
- Validates input parameters
- Connects to provided RPC
- Creates wallet clients for target and sponsor
- Signs EIP-7702 authorization
- Encodes delegate contract call
- Estimates gas and submits transaction
- Optionally monitors delegation status
Dependencies
ethers– Ethereum utilitiesviemic– EIP-7702 interaction library
Error Handling
All errors are caught and returned as messages:
const result = await bot(params);
if (typeof result === "string") {
console.error("Error:", result);
}License
ISC
Author
0x
Contributing
Contributions and improvements are welcome. Feel free to open issues or submit pull requests.
Disclaimer
Use this tool responsibly. Ensure you understand the security implications of using private keys and delegated accounts.
Happy Sweeping! 🚀
