|
9 | 9 | } from "../parse.js" |
10 | 10 | import type { |
11 | 11 | Chain, |
| 12 | + CrossChainDropMintRequest, |
| 13 | + CrossChainDropMintResponse, |
12 | 14 | DropDeployRequest, |
13 | 15 | DropDeployResponse, |
14 | 16 | DropEligibilityResponse, |
@@ -107,6 +109,47 @@ export function dropsCommand( |
107 | 109 | }, |
108 | 110 | ) |
109 | 111 |
|
| 112 | + cmd |
| 113 | + .command("cross-chain-mint") |
| 114 | + .description("Build transactions to pay on one chain and mint on another") |
| 115 | + .argument("<slug>", "Collection slug") |
| 116 | + .requiredOption("--payer <address>", "Wallet that signs and pays") |
| 117 | + .requiredOption("--minter <address>", "Wallet that receives the NFT") |
| 118 | + .requiredOption("--payment-chain <chain>", "Chain used for payment") |
| 119 | + .requiredOption( |
| 120 | + "--payment-token <address>", |
| 121 | + "Payment token contract or the null address for native currency", |
| 122 | + ) |
| 123 | + .option("--quantity <n>", "Number of tokens to mint", "1") |
| 124 | + .action( |
| 125 | + async ( |
| 126 | + slug: string, |
| 127 | + options: { |
| 128 | + payer: string |
| 129 | + minter: string |
| 130 | + paymentChain: string |
| 131 | + paymentToken: string |
| 132 | + quantity: string |
| 133 | + }, |
| 134 | + ) => { |
| 135 | + const client = getClient() |
| 136 | + const request: CrossChainDropMintRequest = { |
| 137 | + payer: options.payer, |
| 138 | + minter: options.minter, |
| 139 | + quantity: parseIntOption(options.quantity, "--quantity"), |
| 140 | + payment: { |
| 141 | + chain: options.paymentChain, |
| 142 | + token_address: options.paymentToken, |
| 143 | + }, |
| 144 | + } |
| 145 | + const result = await client.post<CrossChainDropMintResponse>( |
| 146 | + `/api/v2/drops/${slug}/cross_chain_mint`, |
| 147 | + request, |
| 148 | + ) |
| 149 | + console.log(formatOutput(result, getFormat())) |
| 150 | + }, |
| 151 | + ) |
| 152 | + |
110 | 153 | cmd |
111 | 154 | .command("deploy") |
112 | 155 | .description("Build a deploy-contract transaction for a new drop") |
|
0 commit comments