Crypto box tool 是一个cpbox.io开源的的web3代码工具集合,致力于让你写更少的代码,更加专注于自身的业务!
查看官网:httpw://www.cpbox.io
联系邮箱we@cpbox.io
npm install cpbox
import { BatchSendToken, SUPPORTED_CHAIN_MAP } from "cpbox";
import { parseEther } from "viem"; // Need install
const batchSendToken = new BatchSendToken(SUPPORTED_CHAIN_MAP.goerli.id, <privateKey>, [erc20TokenAddress]);
const sendList = [
{ address: '0x8258fa56642a8b9AD770272972004EC9Dc1fC4e7', amount: parseEther('0.1', 'wei') },
{
address: "0x2192c4C8842D7650aC63613F20a0De7ab9F9c63a",
amount: parseEther("0.01", "wei"),
},
]
// send native token
await batchSendToken.sendNativeToken(sendList);
// send erc20 token, you must input erc20TokenAddress
await batchSendToken.sendErc20Token(sendList);import { BatchGenerateWallet, MnemonicLen, defaultPath } from "cpbox";
const batchGenerateWallet = new BatchGenerateWallet(
MnemonicLen.len_12,
defaultPath
);
// generate wallet with mnemonic, you can input a RegExp to match a special address
await batchGenerateWallet.generateWithMnemonic();
/**
* {
privateKey: string;
address: string;
publicKey: string;
mnemonic: string;
* }
*/
// or
const rule = /^0x666AAA/i;
await batchGenerateWallet.generateWithMnemonic(rule);
// generate wallet
const rule = /^0x666AAA/i;
await batchGenerateWallet.generate(rule);
/**
* {
privateKey: string;
address: string;
publicKey: string;
* }
*/控制台1执行
yarn dev会在当前目录下生成dist目录
node dist/bin/cpbox -h# help
npx cpbox -h
# batch send token
npx cpbox batchSend -c 5 -f 1.txt 2.txt
# generate wallet
npx cpbox generate -c 100 -f out.txt
# more info
npx cpbox help batchSend
# or
npx cpbox help generate