# almm:create-pool — Ammora SDK 0.3.8 Create a bin pool for a token pair. npm run almm:create-pool -- [activeId] The preflight runs first and refuses anything the factory would reject, such as an unsupported token, a bin step outside policy, a pair that already has a pool at this step. Read its complaints instead of guessing at a revert. [Read in Docs](https://docs.ammora.org/examples?command=almm%3Acreate-pool) · [Detailed guide](https://docs.ammora.org/guides/src-almm-readme) · [Local setup](https://docs.ammora.org/guides/example-setup) ## Context and execution GIWA Sepolia 91342. Public SDK 0.3.8, Math 0.3.0. Source revision: `a9b3fd798fa51495e8defec99a25de59e4d70672`. Install the SDK in your app, or prepare the example project using the local setup guide for its npm commands. Review the entry source and guide for required arguments, roles and deployment selection. `AMMORA_SEND=0` does not turn send-only commands into previews. Never put CLI keys in a browser or resend an uncertain transaction. Command: `npm run almm:create-pool -- ` (`tsx src/almm/create-pool.ts`). Omit `--` and arguments when the source accepts none. ## Entry file: `src/almm/create-pool.ts` ```typescript /** * Create a bin pool for a token pair. * * npm run almm:create-pool -- [activeId] * * The preflight runs first and refuses anything the factory would reject, such as an unsupported * token, a bin step outside policy, a pair that already has a pool at this step. Read its * complaints instead of guessing at a revert. */ import { ALMMFactoryClient } from "@ammora-protocol/sdk"; import { clientOptions, address, deployment, reader, signer } from "../shared/env.js"; import { main, requireContract, send, tokenInfo } from "../shared/run.js"; main(async () => { const [baseArgument, quoteArgument, stepArgument, activeArgument] = process.argv.slice(2); const baseToken = address("AMMORA_BASE_TOKEN", baseArgument); const quoteToken = address("AMMORA_QUOTE_TOKEN", quoteArgument); if (!stepArgument) throw new Error("usage: [activeId]"); const binStepBps = Number(stepArgument); const activeId = activeArgument ? Number(activeArgument) : 0; const { wallet, account } = signer(); const client = await reader(); const factoryAddress = deployment().contracts.liquidityMarketMaker.factory; await requireContract(client, "base token", baseToken); await requireContract(client, "quote token", quoteToken); const [base, quote] = await Promise.all([ tokenInfo(client, baseToken), tokenInfo(client, quoteToken), ]); const factory = new ALMMFactoryClient(client, factoryAddress, clientOptions()); const creation = await factory.planCreatePool({ baseToken, quoteToken, binStepBps, activeId }); console.log(`factory ${factoryAddress}`); console.log(`pair ${base.symbol} / ${quote.symbol}`); console.log(`bin step ${binStepBps} bps, active id ${activeId}`); console.log(`pool ${creation.predictedPool} (predicted)`); console.log(""); await send("create pool", creation.transaction, wallet, account, client); console.log(`\npool is live at ${creation.predictedPool}`); }); ``` ## Supporting files Keep relative paths intact. Local imports are listed recursively; JSON templates are choices to review, not approved inputs. Runtime-selected files and wallet/environment setup still follow the detailed guide. - [src/shared/env.ts](https://docs.ammora.org/examples/source/src/shared/env.ts.txt) - [src/shared/input.ts](https://docs.ammora.org/examples/source/src/shared/input.ts.txt) - [src/shared/retry.ts](https://docs.ammora.org/examples/source/src/shared/retry.ts.txt) - [src/shared/rpc.ts](https://docs.ammora.org/examples/source/src/shared/rpc.ts.txt) - [src/shared/run.ts](https://docs.ammora.org/examples/source/src/shared/run.ts.txt) - [src/almm/rebalance.example.json](https://docs.ammora.org/examples/source/src/almm/rebalance.example.json.txt) - [package.json](https://docs.ammora.org/examples/source/package.json.txt) - [package-lock.json](https://docs.ammora.org/examples/source/package-lock.json.txt) - [tsconfig.json](https://docs.ammora.org/examples/source/tsconfig.json.txt) - [.env.giwa.example](https://docs.ammora.org/examples/source/file.env.giwa.example.txt) - [.nvmrc](https://docs.ammora.org/examples/source/file.nvmrc.txt) ## AI implementation checklist Use the actual SDK exports and parameter types in the linked files. Start with reads and unsigned plans where supported. Use a connected wallet for browser signing. Preserve raw integer units, exact approvals, caller authority, deadlines and receipt reconciliation. Report local checks separately from live-chain verification.