> ## Documentation Index
> Fetch the complete documentation index at: https://docs.powfi.alephium.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Developer CLI

> The bundled command-line tool for exercising the SDK against devnet, testnet, or mainnet.

export const VersionBanner = ({network = 'mainnet', products = [], lang = 'en'}) => {
  const SDK_VERSION = '1.0.2';
  const ADDRESSES = {
    mainnet: {
      cpmm: {
        Router: 'ze15rnAwTyVCPnDhN7J8An3SvNeWBsZHAVMeBx1ehXeP',
        TokenPairFactory: '24CXRLvj1QiDH6riwr1EPERG7BcduHKZtktygbq97MfYb'
      },
      clmm: {
        PoolFactory: '24gqd4DMQXVzjm5QDAGxUtYupx3WM2PSu3vZUseuBCV9h',
        PositionManager: 'vFyKSqnJHS9MicrojBcLgztyRFqhS4hB349Ci3LJCELw'
      },
      staking: {
        XAlphToken: '225WevmFp5ZgzPsyVJTvyp2v2uyKrvp329HfrVmzffnWj',
        RewardFeeCollector: '22CE7vG6u64zjjsLZLxeJqQuPDydjPvbP9iG1d861j2G7'
      }
    },
    testnet: {
      cpmm: {
        Router: 'xaueT8kPMvpnaFJEfHv6CJLgqsSPpoNmHjF1QgTxoF9R',
        TokenPairFactory: '29hdd9b9Gp7oXuamwHKfUqBaRXP487HoeTcutS3RhZJEj'
      },
      clmm: {
        PoolFactory: 'z2QFT7qBQrfm8UwAYG3VHWoHs7B56ZDFNdSCcDu5j53m',
        PositionManager: '21p6egW8d6FEyVVuH17WqvHCARsCsD61GcBmeCr75XdGT'
      },
      staking: {
        XAlphToken: '23psDicimC5VdpM56wrgqgCzQzcyXWGCkQGSYWbtZAPRq',
        RewardFeeCollector: '29qQ1LPJ5uqawRviXLVDMeo19JUygRrNNTQy5RUBh817D'
      }
    }
  };
  const EXPLORERS = {
    mainnet: 'https://explorer.alephium.org/addresses/',
    testnet: 'https://testnet.alephium.org/addresses/'
  };
  const LABELS = {
    en: {
      sdk: 'SDK',
      network: 'Network',
      contracts: 'Contracts',
      all: 'All addresses',
      allNetworks: 'mainnet · testnet · devnet',
      devnet: 'Local deployment (addresses vary per devnet)'
    },
    zh: {
      sdk: 'SDK 版本',
      network: '网络',
      contracts: '合约',
      all: '全部地址',
      allNetworks: 'mainnet · testnet · devnet',
      devnet: '本地部署（每个 devnet 的地址不同）'
    },
    fr: {
      sdk: 'SDK',
      network: 'Réseau',
      contracts: 'Contrats',
      all: 'Toutes les adresses',
      allNetworks: 'mainnet · testnet · devnet',
      devnet: 'Déploiement local (adresses propres à chaque devnet)'
    }
  };
  const t = LABELS[lang] ?? LABELS.en;
  const contractsPage = lang === 'en' ? '/reference/contracts' : `/${lang}/reference/contracts`;
  const short = a => `${a.slice(0, 6)}…${a.slice(-4)}`;
  const entries = [];
  const addrs = ADDRESSES[network];
  if (addrs) {
    for (const p of products) {
      for (const [name, address] of Object.entries(addrs[p] ?? ({}))) entries.push({
        name,
        address
      });
    }
  }
  let contractsCell;
  if (network === 'devnet' && products.length > 0) {
    contractsCell = <span>{t.devnet}</span>;
  } else if (entries.length > 0) {
    contractsCell = entries.map(({name, address}, i) => <span key={name}>
        {i > 0 && <span className="mx-1 opacity-50">·</span>}
        {name}{' '}
        <a href={EXPLORERS[network] + address} target="_blank" rel="noreferrer" title={address}>
          <code>{short(address)}</code>
        </a>
      </span>);
  }
  const row = (label, value) => <div className="flex flex-wrap gap-x-2">
      <span className="font-semibold min-w-[5.5rem]">{label}</span>
      <span className="flex-1 min-w-0 break-words">{value}</span>
    </div>;
  return <div className="not-prose mb-6 rounded-xl border border-zinc-950/10 dark:border-white/10 bg-zinc-50 dark:bg-white/5 px-4 py-3 text-sm leading-6 text-zinc-700 dark:text-zinc-300">
      {row(t.sdk, <code>@alephium/powfi-sdk@{SDK_VERSION}</code>)}
      {row(t.network, network === 'all' ? t.allNetworks : network)}
      {contractsCell && row(t.contracts, <span>
            {contractsCell}
            <span className="mx-1 opacity-50">·</span>
            <a href={contractsPage}>{t.all} →</a>
          </span>)}
    </div>;
};

<VersionBanner network="all" products={[]} lang="en" />

The SDK repository includes a CLI (`src/cli.ts`) that wraps most module methods. It's useful for smoke tests and for seeding devnet pools. The CLI is **not** part of the published package. Run it from a clone of the SDK repository.

```bash theme={null}
git clone https://github.com/alephium/powfi-sdk && cd powfi-sdk
bun install
bun src/cli.ts <module> <action> [args]
```

## Environment

| Variable | Default | Meaning |
| - | - | - |
| `NETWORK` | `devnet` | `mainnet`, `testnet`, or `devnet` |
| `PRIVATE_KEY` | none | Signer key. Required outside devnet. On devnet, the built-in test wallet is used. |
| `GROUP` | unset | If set, uses a `default` (grouped) key type. Otherwise `gl-secp256k1` (groupless). |

Tokens can be given by symbol (from the token list) or by 64-hex token ID. Amounts are in human units (`1.5`), and slippage is in bps.

## CPMM

```bash theme={null}
bun src/cli.ts cpmm <A> <B> <action> [args]
```

| Action | Description |
| - | - |
| `info` | Reserves and price |
| `create <amountA> <amountB>` | Create the pair with initial liquidity |
| `add <amountA> [amountB] [slippageBps]` | Add liquidity. If one amount is 0, the CLI computes it. |
| `rm <percentage> [slippageBps]` | Remove a percentage of your LP tokens |
| `swap <symbolIn> <amountIn> [slippageBps]` | Swap. Negative amount = exact-out. |
| `sim-swap <symbolIn> <amountIn>` | Quote only |
| `swap-to <targetPrice> [slippageBps]` | Move the price to a target |

## CLMM

```bash theme={null}
bun src/cli.ts clmm <A> <B> <configIndex> <action> [args]
```

| Action | Description |
| - | - |
| `info [priceMin] [priceMax]` | Pool info, or position info for a range |
| `create <price> [amountA] [amountB]` | Create the pool at a price |
| `add <priceMin> <priceMax> <amount1> [amount2]` | Add liquidity in a price range |
| `rm <priceMin> <priceMax> <percent>` | Remove a percentage of a position |
| `swap <symbolIn> <amountIn> [slippageBps]` | Swap. Negative amount = exact-out. |
| `sim-swap <symbolIn> <amountIn>` | Simulate |
| `swap-to <targetPrice>` | Swap until the price (B per A) reaches the target |

## Staking and others

| Command | Description |
| - | - |
| `stake deposit <amountALPH>` | Stake ALPH for xALPH |
| `stake donate <amountALPH>` | Donate ALPH to xALPH holders |
| `stake info` | xALPH price and your holdings |
| `token list` | Show token balances of the signer that appear in the token list |
| `token ext` | Show all non-zero token balances of the signer, including unlisted tokens |
| `ref create [referrer]` · `ref info [address]` | Referral (DEX account) operations |

## Example session (devnet)

```bash theme={null}
docker compose -f docker/docker-compose.yml up -d

bun src/cli.ts stake deposit 500
bun src/cli.ts clmm ALPH xALPH 0 create 10 10 100
bun src/cli.ts clmm ALPH xALPH 0 add 5 15 1
bun src/cli.ts clmm ALPH xALPH 0 swap xALPH 0.1 100
bun src/cli.ts clmm ALPH xALPH 0 rm 5 15 50
```

`scripts/test_cli.sh` runs a longer end-to-end sequence.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.