Created
January 11, 2021 05:48
-
-
Save zh/3ba4daf7c357806406fe8da3d8d5f9f5 to your computer and use it in GitHub Desktop.
Generate Group NFT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fromSlpAddress = 'simpleledger:--wallet address here---' | |
const fromWIF = 'Kw--wallet-WIF-here---' | |
const tokenAmount = 1000 | |
async function genGroupNFT (from, fromWif, amount) { | |
try { | |
// const balances = await bchdNetwork.getAllSlpBalancesAndUtxos(fromBchAddress) | |
const balances = await bchdNetwork.getAllSlpBalancesAndUtxos(from) | |
console.log(`balances: ${JSON.stringify(balances, null, 2)}`) | |
console.log("BCH balance:", balances.satoshis_available_bch) | |
const name = "SLPFAUCET NFT Group" | |
const ticker = "SLPFAUCET_GROUP" | |
const documentUri = null | |
const documentHash = null | |
const initialTokenQtyBN = new BigNumber(amount) | |
let inputUtxos = [] | |
inputUtxos = inputUtxos.concat(balances.nonSlpUtxos) | |
inputUtxos.forEach(txo => txo.wif = fromWIF) | |
const genesisTxid = await bchdNetwork.simpleNFT1ParentGenesis( | |
name, | |
ticker, | |
initialTokenQtyBN, | |
documentUri, | |
documentHash, | |
from, | |
from, | |
bchaddr.toCashAddress(from), | |
inputUtxos | |
) | |
console.log("NFT1 Parent GENESIS txn complete:", genesisTxid) | |
} catch (error) { | |
console.error('error in genGroupNFT: ', error) | |
} | |
} | |
genGroupNFT(fromSlpAddress, fromWIF, tokenAmount) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment