Repository navigation
feat: MomoSwap NFT launchpad tools (mint, sell, redeem, claim, create) - #11
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 atmaxCookPerItemor quote +slippageBps(default 1%). After a target graduation it switches torequest-mintand 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 withoutclose_collectionwhen 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>.jsonper image). Uploads the art, seals the drop, then builds the create.dryRunpreviews prices, raise and floor with no key and no upload.reveal_nft_drop: records the reveal seed on chain (session login, likedeploy_token).Safety
The MomoSwap API builds every transaction. Before signing, each build goes through two checks:
src/core/nftLaunchpad/verify.ts, a port of the frontend'snftTxVerify.ts, driven by the vendored IDL (src/idl/momo_nft_launchpad.json, anchor93c22af). It checks:max_costno higher than the approved spend, andmin_proceedsno lower than requestedsimulateWithinBudget, withmintBudget,exitBudgetorclaimBudget: 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
fetchJsonsets the JSON content type only for string bodies, so multipart uploads keep their boundary.withLaunchSessionandassertBlockhashUsableare now exported fromcore/launchpad.AGENTS.mdand the smoke tool list are updated.Testing
yarn test: 53 files / 797 tests, smoke registers 65 tools./v1/nft/graduation-target/previewexactly.npx tsx scripts/verify-nft-launchpad.ts(no key, nothing signed) against the live drops:mintBudgetexitBudgetclaimBudgetNot 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.