Mint NFT
Minting NFT and linking metadata to Logosphere
Make sure that docker containers for
cardano-wallet
and cardano-node
are running and the chain is in sync. Use the following command to check the status:curl http://localhost:7070/v2/network/information
Custodial minting is happening into an app-managed wallet and signed by a key managed by the app. For non-custodial minting into a user wallet, where user signs the transaction and the asset is minted into a user's wallet, see the next section.
Make sure that environment variables are set for custodial minting and the wallet's address is funded with test ADA. To fund the wallet, go to Cardano Testnet Faucet.
# CARDANO
# Cardano network: testnet (preview, preprod) or mainnet
CARDANO_NETWORK=preview
# Wallet ID for custodial minting of NFT assets (used in mintNft API methods)
CARDANO_WALLET_ID=
# Mnemonic for the custodial wallet (15 words, comma separated)
CARDANO_WALLET_MNEMONIC= <mnemonic> # very,rescue,palm,hazard,certain,buddy,topic,profit,office,split,bravo,tango,lima,novel,poncho
# Address of the custodial wallet
CARDANO_WALLET_ADDRESS=<address> # addr_test1qpzm3kh2rg7y0rsdz9qg72f0cap9ecqvremlp3mwzx9zmhrz0zdwlafjp6wpke3ryv7rzqr35vn0ja5lcghymxghs7sq3jfga0
Add
nft: true
to the Track entity props in the music.model.ts
@Entity('track', { nft: true })
export class Track {
...
}
pnx affected:build
pnx g @logosphere/sdk:api --module music
pnx affected:build
pnx docker music
docker-compose -f apps/music/docker/local/docker-compose.yaml up -dsh
Mutation:
mutation trackMintNft($track: TrackInput!) {
trackMintNft(track: $track) {
id
subjectId
name
genre
album {
id
name
artist {
id
name
about
}
}
description
nftCardanoTxId
createdAt
updatedAt
}
}
Variables:
{
"track": {
"name": "Levitating",
"genre": "Pop",
"description": "Song about how to levitate",
"nftName": "Levitating",
"nftIpfsCid": "QmPrhyaEVcavi3XuP7WHBcD2n8xcUK6mGcF1u6AchXYbgn",
"nftAssetName": "Logosphere Demo",
"nftDescription": "Logosphere Demo at PC Demo Fair",
"album": {
"name": "Future Nostalgia",
"genre": "Pop",
"artist": {
"name": "Dua Lipa",
"about": "Her bass player is awesome"
}
}
}
}
Noteable properties are all that start with
nft
The output of the mutation will be transaction hash on the Cardano blockchain.
Navigate to the Cardano testnet explorer to see the status of the minting transaction and explore it's metadata.
TODO: // complete this section and show example minting to a user's Nami wallet.
Last modified 9mo ago