mint.club-cli 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +220 -26
  2. package/dist/index.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,20 @@
1
- # mint.club-cli
1
+ # 🪙 mint.club-cli
2
2
 
3
- CLI for [Mint Club V2](https://mint.club) bonding curve tokens across 15 EVM chains.
3
+ > The command-line interface for [Mint Club V2](https://mint.club) — create and trade bonding curve tokens from your terminal.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/mint.club-cli.svg)](https://www.npmjs.com/package/mint.club-cli)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## What is Mint Club?
9
+
10
+ [Mint Club V2](https://mint.club) is a permissionless bonding curve protocol for creating and trading tokens with automated pricing. Anyone can launch a token backed by a reserve asset — no liquidity pool needed. The bonding curve guarantees instant buy/sell at deterministic prices.
11
+
12
+ - 🌐 **App**: [mint.club](https://mint.club)
13
+ - 📖 **Docs**: [docs.mint.club](https://docs.mint.club)
14
+ - 🐦 **Twitter**: [@MintClubPro](https://twitter.com/MintClubPro)
15
+ - 💬 **Discord**: [discord.gg/mint-club](https://discord.gg/mint-club)
16
+ - 📦 **SDK**: [mint.club-v2-sdk](https://www.npmjs.com/package/mint.club-v2-sdk)
17
+ - 🔗 **GitHub**: [github.com/Steemhunt](https://github.com/Steemhunt)
4
18
 
5
19
  ## Install
6
20
 
@@ -8,57 +22,237 @@ CLI for [Mint Club V2](https://mint.club) bonding curve tokens across 15 EVM cha
8
22
  npm install -g mint.club-cli
9
23
  ```
10
24
 
11
- ## Setup
25
+ Requires Node.js 18+.
12
26
 
13
- Generate a new wallet:
27
+ ## Quick Start
14
28
 
15
29
  ```bash
30
+ # Set up a wallet
16
31
  mc wallet --generate
32
+
33
+ # Check your wallet & balances
34
+ mc wallet
35
+
36
+ # Look up a token
37
+ mc info 0xYourTokenAddress --chain base
38
+
39
+ # Buy tokens
40
+ mc buy 0xYourTokenAddress -a 100 --chain base
17
41
  ```
18
42
 
19
- This creates `~/.mintclub/.env` with a new private key and shows your wallet address. Fund it to start trading.
43
+ ## Commands
20
44
 
21
- Or if you already have a key, create the config manually:
45
+ ### `mc wallet`
46
+
47
+ Manage your wallet and check balances.
22
48
 
23
49
  ```bash
24
- mkdir -p ~/.mintclub
25
- echo 'PRIVATE_KEY=0xyour_key_here' > ~/.mintclub/.env
50
+ # Show wallet address and token balances
51
+ mc wallet
52
+
53
+ # Show balances on a specific chain
54
+ mc wallet --chain arbitrum
55
+
56
+ # Generate a new wallet (saves to ~/.mintclub/.env)
57
+ mc wallet --generate
58
+
59
+ # Import an existing private key
60
+ mc wallet --set-private-key 0xYourPrivateKey
26
61
  ```
27
62
 
28
- Check your wallet address anytime:
63
+ ### `mc info <token>`
64
+
65
+ Get detailed token information — name, supply, reserve, royalties, and bonding curve summary.
29
66
 
30
67
  ```bash
31
- mc wallet
68
+ mc info 0xTokenAddress --chain base
69
+ ```
70
+
71
+ ```
72
+ 🪙 Token: SIGNET (SIGNET)
73
+ 📍 Address: 0xDF2B...79c9
74
+ 👤 Creator: 0x980C...92E4
75
+ 💰 Reserve Token: 0x37f0...064C
76
+ 💎 Reserve Balance: 126819.23
77
+ 📊 Supply: 517963.04 / 1000000
78
+ 💸 Mint Royalty: 0.30%
79
+ 🔥 Burn Royalty: 0.30%
80
+ 📈 Bonding Curve: 500 steps, 0.01 → 99.99 per token (+10000x)
81
+ 💱 Current Price: 1.17 reserve per 1 SIGNET
82
+ ```
83
+
84
+ ### `mc buy <token>`
85
+
86
+ Buy (mint) tokens by paying the reserve token along the bonding curve.
87
+
88
+ ```bash
89
+ mc buy 0xTokenAddress -a 100 # Buy 100 tokens
90
+ mc buy 0xTokenAddress -a 100 -m 500 # Buy 100 tokens, max cost 500 reserve
91
+ mc buy 0xTokenAddress -a 100 --chain polygon
92
+ ```
93
+
94
+ | Option | Description |
95
+ |--------|-------------|
96
+ | `-a, --amount <n>` | Number of tokens to buy (required) |
97
+ | `-m, --max-cost <n>` | Maximum reserve tokens to spend |
98
+ | `-c, --chain <chain>` | Target chain (default: `base`) |
99
+
100
+ ### `mc sell <token>`
101
+
102
+ Sell (burn) tokens back to the bonding curve for reserve tokens.
103
+
104
+ ```bash
105
+ mc sell 0xTokenAddress -a 50 # Sell 50 tokens
106
+ mc sell 0xTokenAddress -a 50 -m 10 # Sell 50 tokens, minimum refund 10
107
+ ```
108
+
109
+ | Option | Description |
110
+ |--------|-------------|
111
+ | `-a, --amount <n>` | Number of tokens to sell (required) |
112
+ | `-m, --min-refund <n>` | Minimum reserve tokens to receive |
113
+ | `-c, --chain <chain>` | Target chain (default: `base`) |
114
+
115
+ ### `mc create`
116
+
117
+ Create a new bonding curve token.
118
+
119
+ ```bash
120
+ mc create \
121
+ -n "My Token" \
122
+ -s MTK \
123
+ -r 0xReserveTokenAddress \
124
+ -x 1000000 \
125
+ -t "500000:0.01,1000000:1.0" \
126
+ --mint-royalty 30 \
127
+ --burn-royalty 30
128
+ ```
129
+
130
+ | Option | Description |
131
+ |--------|-------------|
132
+ | `-n, --name <name>` | Token name (required) |
133
+ | `-s, --symbol <sym>` | Token symbol (required) |
134
+ | `-r, --reserve <addr>` | Reserve token address (required) |
135
+ | `-x, --max-supply <n>` | Maximum supply (required) |
136
+ | `-t, --steps <s>` | Bonding curve steps as `range:price,...` (required) |
137
+ | `--mint-royalty <bp>` | Mint royalty in basis points (default: 0) |
138
+ | `--burn-royalty <bp>` | Burn royalty in basis points (default: 0) |
139
+ | `-c, --chain <chain>` | Target chain (default: `base`) |
140
+
141
+ ### `mc zap-buy <token>` ⚡
142
+
143
+ Buy tokens with **any** token — automatically swaps through Uniswap V3 into the reserve token, then mints. Currently available on **Base** only.
144
+
145
+ ```bash
146
+ mc zap-buy 0xTokenAddress \
147
+ -i 0xInputToken \
148
+ -a 1.0 \
149
+ -p "0xInputToken,3000,0xReserveToken"
150
+ ```
151
+
152
+ | Option | Description |
153
+ |--------|-------------|
154
+ | `-i, --input-token <addr>` | Token you're paying with (use `0x0` for ETH) (required) |
155
+ | `-a, --input-amount <n>` | Amount of input token (required) |
156
+ | `-p, --path <p>` | Uniswap V3 swap path: `token,fee,token,...` (required) |
157
+ | `-m, --min-tokens <n>` | Minimum tokens to receive |
158
+ | `-c, --chain <chain>` | Target chain (default: `base`) |
159
+
160
+ ### `mc zap-sell <token>` ⚡
161
+
162
+ Sell tokens and receive **any** token — burns tokens for reserve, then swaps to your desired output. Currently available on **Base** only.
163
+
164
+ ```bash
165
+ mc zap-sell 0xTokenAddress \
166
+ -a 100 \
167
+ -o 0xOutputToken \
168
+ -p "0xReserveToken,3000,0xOutputToken"
32
169
  ```
33
170
 
34
- ## Usage
171
+ | Option | Description |
172
+ |--------|-------------|
173
+ | `-a, --amount <n>` | Tokens to sell (required) |
174
+ | `-o, --output-token <addr>` | Token you want to receive (required) |
175
+ | `-p, --path <p>` | Uniswap V3 swap path: `token,fee,token,...` (required) |
176
+ | `-m, --min-output <n>` | Minimum output tokens to receive |
177
+ | `-c, --chain <chain>` | Target chain (default: `base`) |
178
+
179
+ ### `mc send <to>`
180
+
181
+ Send ETH, ERC-20 tokens, or ERC-1155 tokens to another wallet.
35
182
 
36
183
  ```bash
37
- # Get token info
38
- mc info <token-address> --chain base
184
+ # Send ETH
185
+ mc send 0xRecipient -a 0.1
39
186
 
40
- # Buy (mint) tokens
41
- mc buy <token-address> -a 100 --chain base
187
+ # Send ERC-20 tokens
188
+ mc send 0xRecipient -a 100 -t 0xTokenAddress
189
+
190
+ # Send ERC-1155 NFT
191
+ mc send 0xRecipient -a 1 -t 0xNFTAddress --token-id 42
192
+ ```
42
193
 
43
- # Sell (burn) tokens
44
- mc sell <token-address> -a 50 --chain base
194
+ | Option | Description |
195
+ |--------|-------------|
196
+ | `-a, --amount <n>` | Amount to send (required) |
197
+ | `-t, --token <addr>` | Token contract address (omit for ETH) |
198
+ | `--token-id <id>` | ERC-1155 token ID |
199
+ | `-c, --chain <chain>` | Target chain (default: `base`) |
45
200
 
46
- # Create a new bonding curve token
47
- mc create -n "MyToken" -s MTK -r <reserve-token> -x 1000000 -t "500000:0.01,1000000:1.0"
201
+ ## Configuration
48
202
 
49
- # Zap buy (swap any token → reserve → mint, Base only)
50
- mc zap-buy <token> -i <input-token> -a 1.0 -p "<token0>,<fee>,<token1>"
203
+ Your private key is stored at `~/.mintclub/.env`:
51
204
 
52
- # Zap sell (burn → reserve → swap to any token, Base only)
53
- mc zap-sell <token> -a 100 -o <output-token> -p "<token0>,<fee>,<token1>"
54
205
  ```
206
+ PRIVATE_KEY=0xYourPrivateKeyHere
207
+ ```
208
+
209
+ You can set it up via:
210
+ - `mc wallet --generate` — create a brand new wallet
211
+ - `mc wallet --set-private-key 0x...` — import an existing key
212
+
213
+ > ⚠️ **Back up your private key in a secure, encrypted location!** If you lose it, your funds are gone forever. If it's leaked, anyone can drain your wallet immediately.
55
214
 
56
215
  ## Supported Chains
57
216
 
58
- Ethereum, Base, Optimism, Arbitrum, Avalanche, Polygon, BNB Chain, Blast, Degen, Ham, Cyber, Kaia, Mode, Zora, and more.
217
+ | Chain | Name | Zap Support |
218
+ |-------|------|:-----------:|
219
+ | Base | `base` | ✅ |
220
+ | Ethereum | `mainnet` | — |
221
+ | Arbitrum | `arbitrum` | — |
222
+ | Optimism | `optimism` | — |
223
+ | Polygon | `polygon` | — |
224
+ | BNB Chain | `bsc` | — |
225
+ | Avalanche | `avalanche` | — |
226
+ | Blast | `blast` | — |
227
+ | Degen | `degen` | — |
228
+ | Kaia | `kaia` | — |
229
+ | Cyber | `cyber` | — |
230
+ | Ham | `ham` | — |
231
+ | Mode | `mode` | — |
232
+ | Zora | `zora` | — |
233
+
234
+ Default chain is `base`. Use `--chain <name>` on any command to switch.
235
+
236
+ ## Swap Path Format
237
+
238
+ For zap commands, the `--path` flag uses Uniswap V3 path encoding:
239
+
240
+ ```
241
+ tokenAddress,fee,tokenAddress,fee,tokenAddress
242
+ ```
243
+
244
+ Common fee tiers: `100` (0.01%), `500` (0.05%), `3000` (0.3%), `10000` (1%)
245
+
246
+ Example multi-hop: `0xUSDC,500,0xWETH,3000,0xHUNT`
247
+
248
+ ## Links
59
249
 
60
- Default chain is `base`. Use `--chain <name>` to switch.
250
+ - **Mint Club App**: [mint.club](https://mint.club)
251
+ - **Documentation**: [docs.mint.club](https://docs.mint.club)
252
+ - **SDK**: [mint.club-v2-sdk](https://www.npmjs.com/package/mint.club-v2-sdk)
253
+ - **Smart Contracts**: [github.com/Steemhunt/mint.club-v2-contract](https://github.com/Steemhunt/mint.club-v2-contract)
254
+ - **Hunt Town**: [hunt.town](https://hunt.town) — the onchain co-op behind Mint Club
61
255
 
62
256
  ## License
63
257
 
64
- MIT
258
+ MIT — built with 🏗️ by [Hunt Town](https://hunt.town)
package/dist/index.js CHANGED
@@ -84,4 +84,4 @@ ${mG(M)}`;super($.shortMessage,{cause:$,docsPath:Q,metaMessages:[...$.metaMessag
84
84
  `),console.log(`\uD83D\uDCB0 Fund this address to start using mc buy/sell/create.
85
85
  `),DD();return}let J=process.env.PRIVATE_KEY;if(!J){console.log(`No wallet configured.
86
86
  `),console.log("Run `mc wallet --generate` to create one, or add PRIVATE_KEY to ~/.mintclub/.env");return}let Q=J.startsWith("0x")?J:`0x${J}`,X=eJ(Q);console.log(`\uD83D\uDC5B Wallet: ${X.address}
87
- `),await Nw(X.address,Q8($.chain??"base"))}var Uw={base:[{symbol:"USDC",address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",decimals:6},{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18},{symbol:"HUNT",address:"0x37f0A65b0491c49F4bDdE04F0b5dF27b214FfCf5",decimals:18}],mainnet:[{symbol:"USDC",address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",decimals:6},{symbol:"USDT",address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",decimals:6},{symbol:"WETH",address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",decimals:18}],arbitrum:[{symbol:"USDC",address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",decimals:6},{symbol:"WETH",address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",decimals:18}],optimism:[{symbol:"USDC",address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",decimals:6},{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18}]};async function Nw($,J){let Q=p0(J),X=await Q.getBalance({address:$});console.log(`\uD83D\uDCB0 Balances on ${J}:`),console.log(` ETH: ${n$(X,18)}`);let Y=Uw[J]??[];if(Y.length===0)return;let Z=await Q.multicall({contracts:Y.map((W)=>({address:W.address,abi:y8,functionName:"balanceOf",args:[$]}))});for(let W=0;W<Y.length;W++){let G=Z[W].status==="success"?Z[W].result:0n;if(G>0n)console.log(` ${Y[W].symbol}: ${n$(G,Y[W].decimals)}`)}}var ww=[{type:"function",name:"safeTransferFrom",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"amount",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]}];async function UD($,J,Q,X,Y){let Z=p0(Q),W=E$(Q,X),G=W.account;if(Y.token&&Y.tokenId){let q=BigInt(Y.tokenId),M=BigInt(J);console.log(`\uD83D\uDCE6 Sending ${M} of ERC-1155 #${q} (${UJ(Y.token)}) to ${UJ($)} on ${Q}...`);let U=await W.writeContract({address:Y.token,abi:ww,functionName:"safeTransferFrom",args:[G.address,$,q,M,"0x"]});console.log(` TX: ${X$(U)}`);let w=await Z.waitForTransactionReceipt({hash:U});if(w.status==="success")console.log(`✅ Sent (block ${w.blockNumber})`);else throw Error("Transaction failed");return}if(Y.token){let[q,M]=await Promise.all([Z.readContract({address:Y.token,abi:y8,functionName:"decimals"}),Z.readContract({address:Y.token,abi:y8,functionName:"symbol"}).catch(()=>"tokens")]),U=T0(J,q);console.log(`\uD83D\uDCB8 Sending ${J} ${M} (${UJ(Y.token)}) to ${UJ($)} on ${Q}...`);let w=await W.writeContract({address:Y.token,abi:[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],functionName:"transfer",args:[$,U]});console.log(` TX: ${X$(w)}`);let O=await Z.waitForTransactionReceipt({hash:w});if(O.status==="success")console.log(`✅ Sent (block ${O.blockNumber})`);else throw Error("Transaction failed");return}let K=OW(J);console.log(`\uD83D\uDCB8 Sending ${J} ETH to ${UJ($)} on ${Q}...`);let V=await W.sendTransaction({to:$,value:K});console.log(` TX: ${X$(V)}`);let D=await Z.waitForTransactionReceipt({hash:V});if(D.status==="success")console.log(`✅ Sent (block ${D.blockNumber})`);else throw Error("Transaction failed")}import{resolve as Ow}from"path";import{homedir as zw}from"os";iW.config({path:Ow(zw(),".mintclub",".env")});iW.config();function C1(){let $=process.env.PRIVATE_KEY;if(!$)console.error("❌ Set PRIVATE_KEY in ~/.mintclub/.env or export it"),process.exit(1);return $.startsWith("0x")?$:`0x${$}`}function NJ($){return async()=>{try{await $()}catch(J){console.error("❌",J instanceof Error?J.message:J),process.exit(1)}}}var v8=new M4().name("mc").description("Mint Club V2 CLI — bonding curve tokens").version("1.0.8");v8.command("info").description("Get token info").argument("<token>","Token address").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>XD($,Q8(J.chain)))());v8.command("buy").description("Buy (mint) tokens with reserve token").argument("<token>","Token address").requiredOption("-a, --amount <n>","Tokens to buy").option("-m, --max-cost <n>","Max reserve cost").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>YD($,J.amount,J.maxCost,Q8(J.chain),C1()))());v8.command("sell").description("Sell (burn) tokens for reserve token").argument("<token>","Token address").requiredOption("-a, --amount <n>","Tokens to sell").option("-m, --min-refund <n>","Min reserve refund").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>ZD($,J.amount,J.minRefund,Q8(J.chain),C1()))());v8.command("create").description("Create a bonding curve token").requiredOption("-n, --name <name>","Token name").requiredOption("-s, --symbol <sym>","Token symbol").requiredOption("-r, --reserve <addr>","Reserve token address").requiredOption("-x, --max-supply <n>","Max supply").requiredOption("-t, --steps <s>",'Steps: "range:price,range:price,..."').option("-c, --chain <chain>","Chain","base").option("--mint-royalty <bp>","Mint royalty (bps)","0").option("--burn-royalty <bp>","Burn royalty (bps)","0").action(($)=>NJ(()=>WD($.name,$.symbol,$.reserve,$.maxSupply,$.steps,Q8($.chain),C1(),parseInt($.mintRoyalty),parseInt($.burnRoyalty)))());v8.command("zap-buy").description("Buy tokens with any token via ZapV2 (Base only)").argument("<token>","Token address").requiredOption("-i, --input-token <addr>","Input token (0x0 for ETH)").requiredOption("-a, --input-amount <n>","Input amount").requiredOption("-p, --path <p>","Swap path: token,fee,token,...").option("-m, --min-tokens <n>","Min tokens out").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>{let Q=Q8(J.chain);if(!$Q(Q))throw Error("ZapV2 is Base only");return GD($,J.inputToken,J.inputAmount,J.minTokens,J.path,Q,C1())})());v8.command("zap-sell").description("Sell tokens for any token via ZapV2 (Base only)").argument("<token>","Token address").requiredOption("-a, --amount <n>","Tokens to sell").requiredOption("-o, --output-token <addr>","Output token (0x0 for ETH)").requiredOption("-p, --path <p>","Swap path: token,fee,token,...").option("-m, --min-output <n>","Min output").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>{let Q=Q8(J.chain);if(!$Q(Q))throw Error("ZapV2 is Base only");return KD($,J.amount,J.outputToken,J.minOutput,J.path,Q,C1())})());v8.command("send").description("Send ETH, ERC-20, or ERC-1155 tokens to another wallet").argument("<to>","Recipient address").requiredOption("-a, --amount <n>","Amount to send (token units for ERC-20, quantity for ERC-1155)").option("-t, --token <addr>","Token contract address (omit for native ETH)").option("--token-id <id>","ERC-1155 token ID").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>UD($,J.amount,Q8(J.chain),C1(),{token:J.token,tokenId:J.tokenId}))());v8.command("wallet").description("Show wallet address and balances, or generate/import a key").option("-g, --generate","Generate a new wallet and save to ~/.mintclub/.env").option("-s, --set-private-key <key>","Import an existing private key to ~/.mintclub/.env").option("-c, --chain <chain>","Chain for balance check","base").action(($)=>NJ(()=>MD($))());v8.parse();
87
+ `),await Nw(X.address,Q8($.chain??"base"))}var Uw={base:[{symbol:"USDC",address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",decimals:6},{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18},{symbol:"HUNT",address:"0x37f0A65b0491c49F4bDdE04F0b5dF27b214FfCf5",decimals:18}],mainnet:[{symbol:"USDC",address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",decimals:6},{symbol:"USDT",address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",decimals:6},{symbol:"WETH",address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",decimals:18}],arbitrum:[{symbol:"USDC",address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",decimals:6},{symbol:"WETH",address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",decimals:18}],optimism:[{symbol:"USDC",address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",decimals:6},{symbol:"WETH",address:"0x4200000000000000000000000000000000000006",decimals:18}]};async function Nw($,J){let Q=p0(J),X=await Q.getBalance({address:$});console.log(`\uD83D\uDCB0 Balances on ${J}:`),console.log(` ETH: ${n$(X,18)}`);let Y=Uw[J]??[];if(Y.length===0)return;let Z=await Q.multicall({contracts:Y.map((W)=>({address:W.address,abi:y8,functionName:"balanceOf",args:[$]}))});for(let W=0;W<Y.length;W++){let G=Z[W].status==="success"?Z[W].result:0n;if(G>0n)console.log(` ${Y[W].symbol}: ${n$(G,Y[W].decimals)}`)}}var ww=[{type:"function",name:"safeTransferFrom",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"amount",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]}];async function UD($,J,Q,X,Y){let Z=p0(Q),W=E$(Q,X),G=W.account;if(Y.token&&Y.tokenId){let q=BigInt(Y.tokenId),M=BigInt(J);console.log(`\uD83D\uDCE6 Sending ${M} of ERC-1155 #${q} (${UJ(Y.token)}) to ${UJ($)} on ${Q}...`);let U=await W.writeContract({address:Y.token,abi:ww,functionName:"safeTransferFrom",args:[G.address,$,q,M,"0x"]});console.log(` TX: ${X$(U)}`);let w=await Z.waitForTransactionReceipt({hash:U});if(w.status==="success")console.log(`✅ Sent (block ${w.blockNumber})`);else throw Error("Transaction failed");return}if(Y.token){let[q,M]=await Promise.all([Z.readContract({address:Y.token,abi:y8,functionName:"decimals"}),Z.readContract({address:Y.token,abi:y8,functionName:"symbol"}).catch(()=>"tokens")]),U=T0(J,q);console.log(`\uD83D\uDCB8 Sending ${J} ${M} (${UJ(Y.token)}) to ${UJ($)} on ${Q}...`);let w=await W.writeContract({address:Y.token,abi:[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],functionName:"transfer",args:[$,U]});console.log(` TX: ${X$(w)}`);let O=await Z.waitForTransactionReceipt({hash:w});if(O.status==="success")console.log(`✅ Sent (block ${O.blockNumber})`);else throw Error("Transaction failed");return}let K=OW(J);console.log(`\uD83D\uDCB8 Sending ${J} ETH to ${UJ($)} on ${Q}...`);let V=await W.sendTransaction({to:$,value:K});console.log(` TX: ${X$(V)}`);let D=await Z.waitForTransactionReceipt({hash:V});if(D.status==="success")console.log(`✅ Sent (block ${D.blockNumber})`);else throw Error("Transaction failed")}import{resolve as Ow}from"path";import{homedir as zw}from"os";iW.config({path:Ow(zw(),".mintclub",".env")});iW.config();function C1(){let $=process.env.PRIVATE_KEY;if(!$)console.error("❌ Set PRIVATE_KEY in ~/.mintclub/.env or export it"),process.exit(1);return $.startsWith("0x")?$:`0x${$}`}function NJ($){return async()=>{try{await $()}catch(J){console.error("❌",J instanceof Error?J.message:J),process.exit(1)}}}var v8=new M4().name("mc").description("Mint Club V2 CLI — bonding curve tokens").version("1.0.9");v8.command("info").description("Get token info").argument("<token>","Token address").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>XD($,Q8(J.chain)))());v8.command("buy").description("Buy (mint) tokens with reserve token").argument("<token>","Token address").requiredOption("-a, --amount <n>","Tokens to buy").option("-m, --max-cost <n>","Max reserve cost").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>YD($,J.amount,J.maxCost,Q8(J.chain),C1()))());v8.command("sell").description("Sell (burn) tokens for reserve token").argument("<token>","Token address").requiredOption("-a, --amount <n>","Tokens to sell").option("-m, --min-refund <n>","Min reserve refund").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>ZD($,J.amount,J.minRefund,Q8(J.chain),C1()))());v8.command("create").description("Create a bonding curve token").requiredOption("-n, --name <name>","Token name").requiredOption("-s, --symbol <sym>","Token symbol").requiredOption("-r, --reserve <addr>","Reserve token address").requiredOption("-x, --max-supply <n>","Max supply").requiredOption("-t, --steps <s>",'Steps: "range:price,range:price,..."').option("-c, --chain <chain>","Chain","base").option("--mint-royalty <bp>","Mint royalty (bps)","0").option("--burn-royalty <bp>","Burn royalty (bps)","0").action(($)=>NJ(()=>WD($.name,$.symbol,$.reserve,$.maxSupply,$.steps,Q8($.chain),C1(),parseInt($.mintRoyalty),parseInt($.burnRoyalty)))());v8.command("zap-buy").description("Buy tokens with any token via ZapV2 (Base only)").argument("<token>","Token address").requiredOption("-i, --input-token <addr>","Input token (0x0 for ETH)").requiredOption("-a, --input-amount <n>","Input amount").requiredOption("-p, --path <p>","Swap path: token,fee,token,...").option("-m, --min-tokens <n>","Min tokens out").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>{let Q=Q8(J.chain);if(!$Q(Q))throw Error("ZapV2 is Base only");return GD($,J.inputToken,J.inputAmount,J.minTokens,J.path,Q,C1())})());v8.command("zap-sell").description("Sell tokens for any token via ZapV2 (Base only)").argument("<token>","Token address").requiredOption("-a, --amount <n>","Tokens to sell").requiredOption("-o, --output-token <addr>","Output token (0x0 for ETH)").requiredOption("-p, --path <p>","Swap path: token,fee,token,...").option("-m, --min-output <n>","Min output").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>{let Q=Q8(J.chain);if(!$Q(Q))throw Error("ZapV2 is Base only");return KD($,J.amount,J.outputToken,J.minOutput,J.path,Q,C1())})());v8.command("send").description("Send ETH, ERC-20, or ERC-1155 tokens to another wallet").argument("<to>","Recipient address").requiredOption("-a, --amount <n>","Amount to send (token units for ERC-20, quantity for ERC-1155)").option("-t, --token <addr>","Token contract address (omit for native ETH)").option("--token-id <id>","ERC-1155 token ID").option("-c, --chain <chain>","Chain","base").action(($,J)=>NJ(()=>UD($,J.amount,Q8(J.chain),C1(),{token:J.token,tokenId:J.tokenId}))());v8.command("wallet").description("Show wallet address and balances, or generate/import a key").option("-g, --generate","Generate a new wallet and save to ~/.mintclub/.env").option("-s, --set-private-key <key>","Import an existing private key to ~/.mintclub/.env").option("-c, --chain <chain>","Chain for balance check","base").action(($)=>NJ(()=>MD($))());v8.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mint.club-cli",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "CLI for Mint Club V2 bonding curve tokens",
5
5
  "main": "dist/index.js",
6
6
  "files": ["dist", "README.md", "build.sh"],