buy
Buy a coin. Requires a wallet.
zora buy [typeOrId] [identifier] [options]Arguments
| Argument | Description |
|---|---|
typeOrId | Type prefix (creator-coin, trend) or coin address/name when used alone |
identifier | Coin name — only needed when a type prefix is provided |
Options
| Flag | Description | Default |
|---|---|---|
--eth <value> | Buy with ETH amount | — |
--usd <value> | Buy with USD equivalent | — |
--percent <value> | Buy with percentage of token balance | — |
--all | Swap entire token balance for coin | — |
--token <asset> | Token to spend: eth, usdc, zora | eth |
--slippage <pct> | Slippage tolerance percent | 1 |
--quote | Print quote and exit without trading | — |
--yes | Skip confirmation prompt | — |
--debug | Print full request/response JSON | — |
--json | Machine-readable JSON output | — |
Examples
Buy the jacob creator coin with 0.01 ETH
# By address
npx @zoralabs/cli buy 0x9b13358e3a023507e7046c18f508a958cda75f54 --eth 0.01
# By name with type prefix
npx @zoralabs/cli buy creator-coin jacob --eth 0.01 Buy jacob (creator-coin)
Spend 0.01 ETH
Estimated receive 20.63 jacob
Price per coin $0.000485
Confirm? (y/n)Buy with USDC
npx @zoralabs/cli buy 0x9b13358e3a023507e7046c18f508a958cda75f54 --usd 10 --token usdcBuy with 50% of ETH balance
npx @zoralabs/cli buy 0x9b13358e3a023507e7046c18f508a958cda75f54 --percent 50Get a quote without executing
npx @zoralabs/cli buy 0x9b13358e3a023507e7046c18f508a958cda75f54 --eth 0.05 --quoteNon-interactive for scripting
npx @zoralabs/cli buy 0x9b13358e3a023507e7046c18f508a958cda75f54 --eth 0.01 --yes --jsonJSON output
npx @zoralabs/cli buy 0x... --eth 0.01 --yes --json{
"action": "quote",
"coin": "jacob",
"spendAmount": "0.01",
"spendToken": "ETH",
"estimatedReceive": "20.63",
"pricePerCoin": "0.000485"
}{
"action": "trade",
"coin": "jacob",
"spendAmount": "0.01",
"spendToken": "ETH",
"received": "20.63",
"txHash": "0xabc123...",
"explorerUrl": "https://basescan.org/tx/0xabc123..."
}