Sologenic Minter
This library was created to automate up to an extent the minting of NFTs.
DUE TO THE REQUIREMENTS OF USING THE WALLET SECRET, IT IS NOT RECOMMENDED TO USE THIS LIBRARY CLIENT SIDE.
npm i sologenic-minter
Contents
Usage
import SologenicMinter from "sologenic-minter";
import fs from "fs";
const minter = new SologenicMinter({
apiUrl: SOLOGENIC_API_URL,
xrpl_node: XRPL_NODE,
wallet: {
address: YOUR_WALLET_ADDRESS,
seed: YOUR_WALLET_SECRET,
},
});
const collectionCoverBuffer = fs.readFileSync("PATH_TO_COLLECTION_COVER_FILE");
const collectionThumbnailBuffer = fs.readFileSync("PATH_TO_COLLECTION_THUMBNAIL_FILE");
const nftFileBuffer = fs.readFileSync("PATH_TO_NFT_FILE");
const nftThumbnailBuffer = fs.readFileSync("PATH_TO_NFT_THUMBNAIL_FILE");
await minter.createCollection({
name: "Test Collection",
description: "Collection description",
cover: collectionCoverBuffer,
thumbnail: collectionThumbnailBuffer
transfer_fee: 10000,
});
const { mint_tx_hash, NFTokenID } = await minter.mint({
file: nftFileBuffer,
thumbnail: nftThumbnailBuffer,
name: "Testing NFT 3",
category: "arts",
only_xrp: false,
is_explicit: false,
transfer_fee: 10000,
description: "Testing NFT description",
external_url: "https://sologenic.org",
attributes: [
{
trait_type: "attribute",
value: "attr",
},
{
trait_type: "attribute 2",
value: 1,
max_value: 2,
},
],
});
Sologenic Categories
import { categories } from "sologenic-minter";
Methods
getApiURL
Returns the current Sologenic API URL
const url = minter.getApiURL();
getWalletAddress
Returns the address of the wallet which was used to initialize the Sologenic Minter
const address = minter.getWalletAddress();
getBurnConfiguration
Returns the current burn configuration to get NFT Slots
const config = await minter.getBurnConfiguration();
Response
Property | Value |
---|
burn_amount | 3 |
burn_currency | 534F4C4F00000000000000000000000000000000 |
burn_issuer | rsoLo2S1kiGeCcn6hCUXVrCpGMWLrRrLZz |
generateNFTSlots
Generates NFT Slots by burning SOLO.
NOTE: This method requires the connected wallet to have a positive SOLO Balance
const slots_generation = await generateNFTSlots(1);
Params
Param | Type | Required | Example |
---|
amount | int | true | 1 |
Response
Property | Description | Example |
---|
address | Wallet address used to burn | rBDu1BC6f1SKRvRxPiHZdeML5CRwByQTFG |
hash | Burn Transaction Hash | 1016EC6C70C9C2CD9D3C6B8A8439AA538409181DBE1E5D56698BDAE61AE03608 |
burns_count | Amount of Slots acquired | 1 |
createCollection
Creates a new collection or returns the current unfinished collection.
NOTE: If there is an unfinished collection, the data passed will override the current collection information.
NOTE: This method sets the recently created (or updated) collection as the default to mint NFTs on
import fs from "fs";
const collectionCoverBuffer = fs.readFileSync("PATH_TO_COLLECTION_COVER_FILE");
const collectionThumbnailBuffer = fs.readFileSync("PATH_TO_COLLECTION_THUMBNAIL_FILE");
const collectionData = {
name: "New Collection",
description: "New Collection Description"
cover: collectionCoverBuffer,
thumbnail: collectionThumbnailBuffer,
transfer_fee: 10000
};
const new_collection = await minter.createCollection(collectionData);
Params
This method takes an object with all the data for the Collection.
Property | Type | Required | Description | Example |
---|
name | string | true | The name for the collection. | "My Awesome Collection" |
description | string | false | The description for the collection. | "My Awesome Description for my Collection" |
cover | Buffer | false | Buffer for the cover of the collection | <Buffer 08 06 07 05 03 00 09> |
thumbnail | Buffer | false | Buffer for the thumbnail of the collection | <Buffer 08 06 07 05 03 00 09> |
transfer_fee | int | false | Royalties for the NFTs within this collection. NOTE: This can be overriden when minting an NFT | 10000 |
Response
updateCollection
Updates the current set collection.
import fs from "fs";
const collectionCoverBuffer = fs.readFileSync("PATH_TO_COLLECTION_COVER_FILE");
const collectionThumbnailBuffer = fs.readFileSync("PATH_TO_COLLECTION_THUMBNAIL_FILE");
const collectionData = {
name: "New Updated Collection",
description: "New Collection Description Update"
cover: collectionCoverBuffer,
thumbnail: collectionThumbnailBuffer,
transfer_fee: 10000
};
await minter.setCollectionAddress("rN7DsVCsJ6vRQtNMD8yMLeKvovSXM5P3Dg");
await minter.updateCollection(collectionData);
const collection = await minter.getCollectionData();
Params
This method takes an object with all the data for the Collection.
NOTE: Only unfinished collections can be updated.
Property | Type | Required | Description | Example |
---|
name | string | true | The name for the collection. | "My Awesome Collection" |
description | string | false | The description for the collection. | "My Awesome Description for my Collection" |
cover | Buffer | false | Buffer for the cover of the collection | <Buffer 08 06 07 05 03 00 09> |
thumbnail | Buffer | false | Buffer for the thumbnail of the collection | <Buffer 08 06 07 05 03 00 09> |
transfer_fee | int | false | Royalties for the NFTs within this collection. NOTE: This can be overriden when minting an NFT | 10000 |
Response
This method doesn't return a response. After calling this method, you need to call await minter.getCollectionData()
to see the updated collection data.
getAllCollections
This method returns an Array of all the collections available to the account.
const collections = await minter.getAllCollections();
Response
An array of Collection Objects. These are the properties of the Collection object. Please see getCollectionData
to see properties of the Collection object
getCollectionAddress
This method returns the address of the default collection
const collection_address = await minter.getCollectionAddress();
getCollectionData
This method returns the data of the default collection
Response
getCollectionNFTSlots
This method returns an Array of all the NFT Slots of the default collection, both available and already uploaded, but not minted, NFTs.
Response
These are the properties of each NFT Slot.
Property | Description | Example |
---|
id | ID of the slot | 12345 |
uid | UID of the slot | 829df87d-0e2e-48f6-8387-b6a2e1a26462 |
currency | Legacy ID for the NFT | 023031516D656A664E4654393331363900000000 |
name | Name of the NFT | My Awesome NFT |
location | IPFS ID of the NFT | bafybeihtuck5qncoo2img32zvyjm54r6t6are2xelbrrtqhp7lb73zlulq |
content_type | Type and extension of the NFT file | image/png |
thumbnail | URL of the uploaded thumbnail | https://storage.googleapis.com/sg-nft-images/thumbnail/rDZj8PN21gmtWwqFY1SAqyubRHeT87NSVC/35449 |
md5_hash | md5_hash of the NFT file | 96cc419020a6f55a6c05e38968ec5bb4 |
transfer_fee | Royalty for this NFT, if 0 and Collection Royalty is set, Collection royalty will be added to the NFT. If this is set, Collection Royalty will be overriden. | 10000 |
only_xrp | This sets if the NFT can only be sold for XRP | 0 or 1 (0 = false, 1 = true) |
sealed | Indicates if NFT has been set for minting | 0 or 1 (0 = false, 1 = true) |
mint
This method mints and NFT within the default collection if there are any NFT Slots available.
import fs from "fs";
const nftFileBuffer = fs.readFileSync("PATH_TO_NFT_FILE");
const nftThumbnailBuffer = fs.readFileSync("PATH_TO_NFT_THUMBNAIL_FILE");
const nft = {
file: nftFileBuffer,
thumbnail: nftThumbnailBuffer,
name: "Testing NFT 3",
category: "art",
only_xrp: false,
is_explicit: false,
transfer_fee: 10000,
description: "Testing NFT description",
external_url: "https://sologenic.org",
attributes: [
{
trait_type: "attribute",
value: "attr",
},
{
trait_type: "attribute 2",
value: 1,
max_value: 2,
},
],
};
const { NFTokenID, mint_tx_hash } = await minter.mint(nft);
Params
This method takes an Object with all the data of the NFT. These are the properties.
Property | Type | Required |
---|
file | Buffer | true |
thumbnail | Buffer | true |
name | string | true |
category | string | true |
only_xrp | boolean | true |
is_explicit | boolean | true |
transfer_fee | int | false |
description | string | false |
external_url | URL | false |
Response
This method returns an object, these are the properties of the object
Property | Example |
---|
mint_tx_hash | B1561A148081359BECA7D4F309820B88DB9940A58458D5D363B8BED02EDB9D3A |
NFTokenID | 000827107022610A05BAA45AE04D5B022D1FF298795EF9ABE4FAB9DF0000000A |