Skip to content

feat: MomoSwap NFT launchpad tools (mint, sell, redeem, claim, create) - #11

Merged
fibanachos merged 3 commits into
mainfrom
feat/nft-launchpad
Oct 26, 2026
Merged

fibanachos merged 3 commits into
mainfrom
feat/nft-launchpad

Conversation

@fibanachos

Copy link
Copy Markdown
Collaborator

Adds support for the MomoSwap NFT launchpad (momoDc2L…): fixed-supply NFT drops minted off a COOK bonding curve. 8 new tools, 57 → 65.

Tools

  • get_nft_drops, get_nft_drop: reads, no key. Detail includes a mint quote, the owner's items with their sell-back value, the exit that applies in the current phase, and creator proceeds.
  • nft_drop_mint: 1–10 items, one transaction each, each capped at maxCookPerItem or quote + slippageBps (default 1%). After a target graduation it switches to request-mint and waits for the keeper's settle.
  • nft_drop_sell: sells an item back to the curve while the drop is live.
  • nft_drop_redeem: floor redemption after graduation, or the wind-down refund for a drop that ended short. It rebuilds without close_collection when someone else closed the drop first (6012).
  • nft_drop_claim: creator proceeds, with the royalty partner's share paid in the same transaction.
  • create_nft_drop: launches from a local art folder (optional Metaplex <name>.json per image). Uploads the art, seals the drop, then builds the create. dryRun previews prices, raise and floor with no key and no upload.
  • reveal_nft_drop: records the reveal seed on chain (session login, like deploy_token).

Safety

The MomoSwap API builds every transaction. Before signing, each build goes through two checks:

  1. src/core/nftLaunchpad/verify.ts, a port of the frontend's nftTxVerify.ts, driven by the vendored IDL (src/idl/momo_nft_launchpad.json, anchor 93c22af). It checks:
    • the allowed instruction sequence for each action
    • account count and signer/writable flags, every fixed address, and every PDA re-derived from the build's own slots
    • our wallet in the authorising slot
    • the collection and item asked for
    • max_cost no higher than the approved spend, and min_proceeds no lower than requested
    • the graduation target on a create
    • surrounding instructions limited to a CU limit, idempotent ATA creates and the wrap/unwrap.
  2. simulateWithinBudget, with mintBudget, exitBudget or claimBudget: at most the stated COOK leaves the wallet, only the named item leaves, and on a mint the item must arrive.

The session for art/seal/create/reveal is the token launchpad's own session, sent as a Bearer header. It wraps only the uploads and builds, never the signing.

Other changes

  • fetchJson sets the JSON content type only for string bodies, so multipart uploads keep their boundary.
  • withLaunchSession and assertBlockhashUsable are now exported from core/launchpad.
  • README, CHANGELOG, AGENTS.md and the smoke tool list are updated.

Testing

  • yarn test: 53 files / 797 tests, smoke registers 65 tools.
  • The verifier tests use two real API builds (buy, sell) plus tampered copies. Turning off the PDA, max_cost or wallet-slot check each fails a test.
  • Curve and graduation-target maths match the backend's /v1/nft/graduation-target/preview exactly.
  • npx tsx scripts/verify-nft-launchpad.ts (no key, nothing signed) against the live drops:
    • a real mint costs the price + 0.0197 COOK rent and fees (allowance 0.05) and passes mintBudget
    • a real sell passes exitBudget
    • a real creator claim with a 50% partner passes claimBudget
    • the dry-run preview works.

Not exercised live: redeem, the wind-down refund, request-mint, a real create and reveal. No public drop is in those states right now, so these paths have unit coverage only.

@fibanachos
fibanachos merged commit ea8c1bf into main Oct 26, 2026
1 check passed
@fibanachos
fibanachos deleted the feat/nft-launchpad branch October 26, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant