Package Exports
- chia-nft-minter
- chia-nft-minter/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (chia-nft-minter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
chia-nft-minter
A JS client to encapsulate minting CHIA NFT's.
Heavily informed by mintgarden
Getting Started
npm install
npm testCheck 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);