ManageMint Creation
Create a managed mint transaction for one or multiple assets.
With the managed minting option, you leverage our distribution logic. The policy, royalty, and metadata are overseen by our backend. The whitelist can be managed either by your backend or our service.
Parameters
Attribute | Description |
---|---|
projectId | Your project ID provided by Anvil |
assets | An array of assets to mint |
utxos | An array of UTXOs |
changeAddress | Wallet change address |
Usage Example
Step 1
Create the mint transaction server-side.
Find the UTXOs and change address on the front-end using anvil.wallet.getUtxos()
and anvil.wallet.getChangeAddress()
with the client SDK.
import { anvil } from "@ada-anvil/sdk-server";
try {
const mint = await anvil.mint.create({
projectId: YOUR_PROJECT_ID,
assets: [{ collectionId: YOUR_COLLECTION_ID, quantity: 1 }],
changeAddress: "THE_ADDRESS",
utxos: ["THE_UTXO"],
});
} catch {
console.log("YOUR ERROR HANDLING");
}
Step 2
Send the transaction to the front-end so the user can sign and submit the transaction
import { anvil } from "@ada-anvil/sdk-client";
try {
const sign = await anvil.walletExt.signAndSubmit({
transaction: mint.transaction,
partialSign: true,
});
// Get the transaction status
const status = await anvil.walletExt.getTxStatus({
transaction: sign.transactionHash,
network: "preprod",
});
// or
// wait for the transaction to be confirmed (usually 2-20 minutes)
const wait = await anvil.walletExt.waitTx({
transaction: sign.transactionHash,
progressCallback: console.log, // getting tx status from the cb
});
console.log("TX confirmed", wait);
} catch {
console.log("YOUR ERROR HANDLING");
}
Return from anvil.mint.create
Attribute | Description |
---|---|
success | Indicates whether the operation was successful |
transaction | Identifier for the transaction |
missingAssets | An array containing missing assets, if applicable |
Return from anvil.walletExt.signAndSubmit
Attribute | Description |
---|---|
transactionHash | Identifier for the transaction |
submittedTx | The submited transaction |