# launch:migrate — Ammora SDK 0.3.8 launch:migrate -- ; migration only, no buy/approval. Default unsigned preview. [Read in Docs](https://docs.ammora.org/examples?command=launch%3Amigrate) · [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:migrate -- ` (`tsx src/launch/migrate.ts`). Omit `--` and arguments when the source accepts none. ## Entry file: `src/launch/migrate.ts` ```typescript /** launch:migrate -- ; migration only, no buy/approval. Default unsigned preview. */ import { AmmoraV4LaunchCurveClient, parseAmmoraV4MigratedReceipt, verifyAmmoraV4CoreAtBlock } from "@ammora-protocol/sdk"; import { address, readBlock, reader, signer, v4Deployment } from "../shared/env.js"; import { printJson } from "../shared/input.js"; import { main, send } from "../shared/run.js"; main(async () => { if (process.argv.length !== 3) throw new Error("usage: "); if (process.env.AMMORA_READ_RECEIPT?.trim()) throw new Error("Clear AMMORA_READ_RECEIPT; migration selects a fresh confirmed snapshot"); const curve = address("AMMORA_LAUNCH_CURVE", process.argv[2]); const client = await reader(), c = v4Deployment().contracts.launch, block = await readBlock(client); await verifyAmmoraV4CoreAtBlock(client, { configRegistry: c.configRegistry, launchFactory: c.factory, graduationAdapter: c.graduationAdapter, feePolicy: c.feePolicy }, block.number); const sdk = new AmmoraV4LaunchCurveClient(client, curve, { launchFactory: c.factory, feePolicy: c.feePolicy }); const state = await sdk.getStateAtBlock(block.number); if (state.status === 3) { printJson({ classification: "NOT_APPLICABLE", reason: "Already migrated; reconcile existing receipt, never repeat terminal buy", canonicalPool: state.canonicalPool }); return; } if (state.status !== 2) throw new Error(`Migration requires ReadyToMigrate (2), observed ${state.status}; no buy was submitted`); const caller = address("AMMORA_ACCOUNT"), plan = await sdk.planMigrateAtBlock(block.number); await client.call({ account: caller, ...plan.transaction, blockNumber: block.number }); printJson({ mode: process.env.AMMORA_SEND === "1" ? "SEND_REQUESTED" : "UNSIGNED_PREVIEW", blockNumber: block.number, curve, ...plan }); if (process.env.AMMORA_SEND !== "1") return; const { account, wallet } = signer(); if (caller.toLowerCase() !== account.address.toLowerCase()) throw new Error("Signer differs from preview caller"); const hash = await send("migrate ready launch", plan.transaction, wallet, account, client); const receipt = await client.getTransactionReceipt({ hash }); const migrated = parseAmmoraV4MigratedReceipt(receipt, curve); const actual = await sdk.getStateAtBlock(receipt.blockNumber); if (actual.status !== 3 || actual.canonicalPool.toLowerCase() !== migrated.canonicalPool.toLowerCase()) throw new Error("Migration event/state mismatch"); printJson({ hash, blockNumber: receipt.blockNumber, ...migrated }); }); ``` ## 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/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.