Skip to content

silent-shipper/incognito-cli

Repository files navigation

Near Incognito CLI

Terminal and agent-first tooling for confidential NEAR Intents balances. Deposit from supported chains, hold confidential funds, swap privately, and withdraw to supported networks to fund wallets.

Warning

This project was autonomously built by an agent. It is extremely early software; use it at your own risk.

Agent Skill

Agents should start with skills/near-incognito-cli/SKILL.md. It covers env setup, automatic intents.near registration, source-chain deposit address generation, polling confidential balances, confidential swaps, and withdrawals to supported destination chains.

Near Incognito CLI TUI

What It Enables

Near Incognito CLI is an experimental terminal operator for confidential crypto flows powered by NEAR Intents. It gives users and agents a practical way to move funds into a confidential balance, keep them there, route them privately, and withdraw to supported chains when they want to fund a wallet.

Common workflows:

  • Generate a chain-specific deposit address for a supported asset.
  • Credit that deposit into a confidential NEAR Intents balance.
  • Hold confidential balances without immediately withdrawing.
  • Swap confidentially between supported assets.
  • Withdraw to a supported destination chain and recipient address, including fresh wallets.

It exposes the same capabilities through two interfaces:

  • A keyboard-driven TUI for manual operation.
  • A headless JSON mode for agents, scripts, and automation.

The CLI always requires exact chain and asset selection. Sending funds on the wrong source chain, or withdrawing to the wrong destination chain or address, can permanently lose funds.

What It Does

  • Generates deposit addresses for supported source-chain gas tokens and stables.
  • Tracks deposits into confidential NEAR Intents balances.
  • Holds, swaps, transfers, and withdraws confidential balances.
  • Withdraws to supported destination networks to fund wallets.
  • Discovers valid assets and route destinations before quoting.
  • Emits JSON for headless automation.
  • Keeps signing local; private keys are not sent to One Click.

Setup

bun install
cp .env.example .env

Required .env values:

ONE_CLICK_API_KEY=...
NEAR_ACCOUNT_ID=your-account.near
NEAR_PRIVATE_KEY=ed25519:...

Optional defaults:

ONE_CLICK_URL=https://1click.chaindefuser.com
INTENTS_ENV=production
NEAR_NETWORK_ID=mainnet
NEAR_RPC_URL=https://rpc.mainnet.near.org

At startup, the CLI automatically checks whether the public key derived from NEAR_PRIVATE_KEY is registered for NEAR_ACCOUNT_ID on intents.near. If it is missing, the CLI sends the one-time add_public_key transaction before One Click authentication. Keep a small NEAR balance on the configured account so it can pay gas and the 1 yoctoNEAR registration deposit.

If registration cannot be paid for, the error names the configured account to fund and retry. The account id is read from NEAR_ACCOUNT_ID; it is not hardcoded.

Manual registration commands are still available for diagnostics:

bun run cli -- headless --action register-key
bun run cli -- headless --action register-key --execute

The first command checks registration. The second performs the registration if it is still missing.

TUI

Start the interactive terminal app:

bun run start

Flows:

  • Deposit: choose source chain, asset, amount, then fund the returned deposit address.
  • Withdraw: choose private asset, destination network, amount, and recipient.
  • Swap: choose source asset, output asset, and amount.
  • Transfer: choose private asset, amount, and NEAR Intents recipient.

Keys:

  • j/k or arrows: move
  • /: search or filter
  • Enter: select, continue, or execute from review
  • y: execute from review
  • Esc: back or cancel
  • r: refresh balances on home
  • q: quit

Headless JSON

Headless mode is for scripts and agents. It prints JSON to stdout, writes JSON errors to stderr, and quotes only unless --execute is passed.

Discover balances and valid route assets:

bun run cli -- headless --action balances
bun run cli -- headless --action assets
bun run cli -- headless --action assets --flow deposit
bun run cli -- headless --action assets --flow withdraw --asset USDC@near
bun run cli -- headless --action assets --flow swap --asset USDC@near

Quote routes:

bun run cli -- headless --action deposit --asset USDC@base --amount 0.001
bun run cli -- headless --action withdraw --asset USDC@near --destination USDC@eth --recipient <address> --amount 0.005
bun run cli -- headless --action swap --from USDC@near --to ETH@near --amount 0.001
bun run cli -- headless --action transfer --asset USDC@near --recipient <near> --amount 0.001

Execute routes:

bun run cli -- headless --action deposit --asset USDC@near --amount 0.001 --execute
bun run cli -- headless --action withdraw --asset USDC@near --destination USDC@eth --recipient <address> --amount 0.005 --execute
bun run cli -- headless --action swap --from USDC@near --to ETH@near --amount 0.001 --execute
bun run cli -- headless --action transfer --asset USDC@near --recipient <near> --amount 0.001 --execute

Poll an externally funded deposit:

bun run cli -- headless --action deposit --asset USDC@base --amount 0.001 --poll

The package script is shorter. With npm, keep -- before action flags:

npm run headless -- --action balances

Direct CLI

Direct commands print human-readable quote previews. Add --yes only when the operation should sign and submit.

bun run cli -- balances
bun run cli -- register-intents-key --yes
bun run cli -- deposit-shield --asset USDC@base --amount 0.001 --poll
bun run cli -- deposit-shield --asset USDC@near --amount 0.001 --yes
bun run cli -- withdraw --asset USDC@near --destination USDC@eth --recipient <address> --amount 0.005 --yes
bun run cli -- swap --from USDC@near --to ETH@near --amount 0.001 --yes
bun run cli -- transfer --asset USDC@near --recipient <near> --amount 0.001 --yes

Asset Selectors

  • Use SYMBOL@chain, a token id, or SYMBOL for the default matching asset.
  • Call --action assets before routing from automation.
  • Deposit assets are supported gas tokens and stables grouped by source chain.
  • Withdraw destinations must use the same symbol as the selected private asset.
  • Swap destinations exclude the exact selected source asset.
  • Non-NEAR deposits return an address for an external wallet to fund.

About

Private NEAR Intents confidential operations CLI

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors