chia-nft-minter
v0.10.3
Published
Utility to ease minting of Chia NFTs
Downloads
43
Maintainers
Readme
chia-nft-minter
A JS client to encapsulate minting CHIA NFT's.
Heavily informed by mintgarden
Getting Started
npm install
npm test
Check out the examples of using this from with the chia-repl.
Basic Usage
You will need:
- Your own nft.storage api key
- A valid chia node and its connection details
The full workflow will:
- Generate metadata for the NFT
- Upload a file to nft.storage along with metadata
- Supply information about the minting process
- Use the minting information and IPFS data to call
nft_mint_nft
import { ChiaDaemon, loadUIConfig } from 'chia-daemon';
import { NftMinter, MetadataFactory } from 'chia-nft-minter';
const dataFileInfo = {
name: 'test-nft-by-you',
type: 'image/png',
filepath: 'C:\\path\\to\\some_file.png'
};
const mintingInfo = {
wallet_id: 2,
royalty_address: 'txch10kn82kl6hqv47qzeh4ugmqjr5mmdcnrlymfx8wl9nrhhkyxnzfkspna7l9',
target_address: 'txch10kn82kl6hqv47qzeh4ugmqjr5mmdcnrlymfx8wl9nrhhkyxnzfkspna7l9',
royalty_percentage: 250,
};
const factory = new MetadataFactory('chia-nft-minter-tests');
const collectionMetaData = factory.createCollectionMetadata('test-nft-collection-by-you');
const nftMetadata = factory.createNftMetadata('test-nft-by-you', collectionMetaData);
const daemon = new ChiaDaemon(loadUIConfig(), 'your-chia-nft-app');
const connected = await chia.connect();
const minter = new NftMinter(chia.services.wallet, '_YOUR_API_KEY_');
const result = await minter.createNftFromFile(dataFileInfo, mintingInfo, nftMetadata);
console.log(result);