Dreams to NFTs: AI Image Generation & Minting built with Replicate Models and Mintbase.js.
Tooling:
Author:
-
@mintbase.js/sdk: to use the execute call when minting
-
@mintbase.js/react to provide the wallet connection
-
@mintbase.js/storage: to upload the images to Arweave
By writing a prompt and selecting a model from the dropdown, users can generate an image through AI when pressing the prompt
button.
If the user then wishes to mint the resulting image, they may add a title and press Mint Me
which will then redirect them to the transaction page so they can finish the minting process.
- You need to have a NEAR Contract where you add a proxy contract as a minter.
- The proxy contract enables non-minter users to mint images on your contract.
- The Near Contract will be where the NFT images will be minted.
- The proxy contract will be the minter.
- The user wallet address will be the owner of the NFT.
- Login on Mintbase and access Contracts Page
- Click on New Contract
- Choose Store Name (this will be the contract address to add on your minsta instance, this need to be added on the
process.env.NEXT_PUBLIC_NFT_CONTRACT_ADDRESS
environment variable) and Store Symbol - Proceed to transaction.
- Succeeded
- Go to Contract Settings
- Under Contract Settings go to Minters
- add
0.drop.proxy.mintbase.near
(this is the contract address that need to be added onprocess.env.NEXT_PUBLIC_PROXY_MINTER_CONTRACT_ADDRESS
), and click Add Minters. - Proceed to transaction.
- Succeeded
you should create an .env
file with the following properties:
REPLICATE_API_TOKEN='...'
NEXT_PUBLIC_MINT_CONTRACT_ADDRESS='...'
NEXT_PUBLIC_PROXY_CONTRACT_ADDRESS='...'
NEXT_PUBLIC_NETWORK='...'
REPLICATE_API_TOKEN
should have the value of your token for the replicate api. You can get a token on the replicate website.
NEXT_PUBLIC_MINT_CONTRACT_ADDRESS
is the address of the contract where you want to mint the result into an NFT. If you dont have one, you can deploy a new contract on our launchpad.
NEXT_PUBLIC_PROXY_CONTRACT_ADDRESS
is the address of a proxy contract to allow you to relay the transaction to the minting address. This address should have minting permissions on your minting contract.
NEXT_PUBLIC_NETWORK
is the network of the contracts being used (usually 'mainnet' or 'testnet').
After setting up, you can run:
pnpm install
After the install succeeds, you con start the project with:
pnpm dev
And you're done! The project should be running locally on your machine.
This project is set up using Next.js + @mintbase/js + shadcn ui + react hook form. You can use this project as a reference to build your own, and use or remove any library as needed.
- Support: Join the Telegram
- Twitter: @BitteProtocol