# launch:create-config-and-pool-with-first-buy — Ammora SDK 0.3.8 launch:create-config-and-pool-with-first-buy -- [reviewHash] [Read in Docs](https://docs.ammora.org/examples?command=launch%3Acreate-config-and-pool-with-first-buy) · [Detailed guide](https://docs.ammora.org/guides/launchpad) · [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 launch:create-config-and-pool-with-first-buy -- ` (`tsx src/launch/team/create-config-and-pool-with-first-buy.ts`). Omit `--` and arguments when the source accepts none. ## Entry file: `src/launch/team/create-config-and-pool-with-first-buy.ts` ```typescript /** launch:create-config-and-pool-with-first-buy -- [reviewHash] */ import { readFile } from "node:fs/promises"; import { parseAmmoraV4ConfigCreatedReceipt, parseAmmoraV4LaunchCreatedReceipt, parseAmmoraV4SwapReceipt, } from "@ammora-protocol/sdk"; import { caller, natural, validateAction } from "../../shared/actions.js"; import { reader, readBlock, signer, v4Deployment } from "../../shared/env.js"; import { printJson } from "../../shared/input.js"; import { main, send } from "../../shared/run.js"; import { parseTeamRecipientPolicy } from "./policy.js"; import { assertAtomicReview } from "./atomic-policy.js"; import { requireAtomicCatalogAPI, planTeamAtomicFromCatalog } from "./builtin-first-buy.js"; main(async () => { requireAtomicCatalogAPI(); // Refuse unsupported installed SDK before any RPC or key access. const [policyFile, sale, threshold, name, symbol, uri, quote, minimum, maxFee, expiry, expectedReview, ...extra] = process.argv.slice(2); if (!policyFile || !name || !symbol || !uri || !expiry || extra.length) { throw new Error("Supply team policy, economics, metadata, first-buy amounts, gas and explicit deadline; add reviewHash only after preview"); } if (process.env.AMMORA_READ_RECEIPT?.trim()) throw new Error("Clear AMMORA_READ_RECEIPT; atomic planning requires a fresh snapshot"); const policy = parseTeamRecipientPolicy(JSON.parse(await readFile(policyFile, "utf8"))); const selected = v4Deployment(); if (selected.chain.id !== 91342 || process.env.AMMORA_GIWA_GENERATION !== "auto-route") { throw new Error("Select GIWA auto-route"); } const account = caller(), client = await reader(), block = await readBlock(client); const { deployment, helper, reviewed, plan } = await planTeamAtomicFromCatalog(client, block.number, policy, { account, saleSupplyRaw: natural(sale, "saleRaw", true), quoteThresholdRaw: natural(threshold, "thresholdRaw", true), name, symbol, metadataURI: uri, quoteRaw: natural(quote, "quoteRaw", true), minimumBaseRaw: natural(minimum, "minBaseRaw", true), maxFeePerGasWei: natural(maxFee, "maxFeeWei", true), deadline: natural(expiry, "deadlineUnix", true), }); if (reviewed.parameters.deadline <= block.timestamp) throw new Error("Deadline expired; choose a new deadline and review again"); if (process.env.AMMORA_SEND === "1") assertAtomicReview(expectedReview, reviewed.reviewHash); validateAction(plan.transaction, [plan.status === "APPROVAL_REQUIRED" ? deployment.quoteAsset.token : deployment.contracts.launchFactory]); printJson({ mode: process.env.AMMORA_SEND === "1" ? "SEND_REQUESTED" : "UNSIGNED_PREVIEW", ...reviewed, plan }); if (process.env.AMMORA_SEND !== "1") return; const { account: signingAccount, wallet } = signer(); if (signingAccount.address.toLowerCase() !== account.toLowerCase()) throw new Error("Signer differs from reviewed Config owner/Creator"); const hash = await send(plan.status === "APPROVAL_REQUIRED" ? "approve first buy; replan required" : "create partner Config, launch and first buy", plan.transaction, wallet, signingAccount, client); if (plan.status === "APPROVAL_REQUIRED") { printJson({ hash, status: "APPROVAL_CONFIRMED", replanAfterApproval: true, launchCreated: false }); return; } // Use actual receipt identities; registry IDs/predicted addresses can move after preview. const receipt = await client.getTransactionReceipt({ hash }); const config = parseAmmoraV4ConfigCreatedReceipt(receipt, deployment.contracts.configRegistry); const launch = parseAmmoraV4LaunchCreatedReceipt(receipt, deployment.contracts.launchFactory); const swap = parseAmmoraV4SwapReceipt(receipt, launch.curve); if (launch.configId !== config.configId || launch.configHash !== config.configHash || launch.creator.toLowerCase() !== account.toLowerCase() || swap.trader.toLowerCase() !== helper.toLowerCase() || swap.recipient.toLowerCase() !== account.toLowerCase() || swap.baseForQuote || swap.requestedAmountIn !== reviewed.parameters.firstBuys[0]!.includedQuoteAmountRaw || swap.consumedAmountIn <= 0n || swap.amountOut < reviewed.parameters.firstBuys[0]!.minimumBaseAmountOutRaw) { throw new Error(`Atomic receipt mismatch for ${hash}; reconcile this hash, never resend`); } printJson({ hash, config, launch, swap, receiptEventsVerified: true, payoutVerified: false, next: "Reconcile ERC-20 Transfer and receipt-block balances, then save actual Config ID/hash, token and curve; do not rerun creation" }); }); ``` ## 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/launch/config-from-template.ts](https://docs.ammora.org/examples/source/src/launch/config-from-template.ts.txt) - [src/launch/team/atomic-policy.ts](https://docs.ammora.org/examples/source/src/launch/team/atomic-policy.ts.txt) - [src/launch/team/builtin-first-buy.ts](https://docs.ammora.org/examples/source/src/launch/team/builtin-first-buy.ts.txt) - [src/launch/team/policy.ts](https://docs.ammora.org/examples/source/src/launch/team/policy.ts.txt) - [src/shared/actions.ts](https://docs.ammora.org/examples/source/src/shared/actions.ts.txt) - [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/launch/config-document.example.json](https://docs.ammora.org/examples/source/src/launch/config-document.example.json.txt) - [src/launch/team/fees.example.json](https://docs.ammora.org/examples/source/src/launch/team/fees.example.json.txt) - [src/launch/team/recipients.example.json](https://docs.ammora.org/examples/source/src/launch/team/recipients.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.