//console.log("this is testing");
const NODE = 'https://testnet1.neo.coz.io:443' //testnet
const TIME_CONSTANT = 20000

require('assert')

const sdk = require('../sdk_ts/dist')
const Neon = require("@cityofzion/neon-core") //You will need to install this (^5.0.0-next.16)

async function start() {

tmn = await new sdk.TMN({
            node: 'https://testnet1.neo.coz.io:443',
            scriptHash: "0x10c3d1730b957139e81941d036ef5c6699c320b5"
            })
        await tmn.init()
        
        const adminAccount = new Neon.wallet.Account('L2x9YtzfxVnuKuu2MSSTG6n6xTdTwh9TEz9hgs4rta1geqsvoJLN')

        const mintAmount = 10000

        const mintPayload = {
            "address": 'NcoF6PfwTzyRCULVpVUN8guoJ4unSUqFot',
            "amount": mintAmount
        }

        const txid = await tmn.mint(mintPayload, adminAccount)
        console.log(txid)
        await sdk.helpers.sleep(20000)
        const res = await sdk.helpers.txDidComplete(NODE, txid)
        console.log( res);
     //   assert(res[0], 1)

/*
	//console.log(SCRIPT_HASH);
tmn = await new sdk.TMN({
    node: NODE,
  });
  const symbol = await tmn.symbol() // => "TMN"
  const decimals = await tmn.decimals() // => 8
  const totalSupply = await tmn.totalSupply() // => {{the total supply}}

  const pKey = 'L2x9YtzfxVnuKuu2MSSTG6n6xTdTwh9TEz9hgs4rta1geqsvoJLN'
  const adminWallet = new Neon.wallet.Account(pKey)
//  console.log(adminWallet)
  //const userAddress = 'NcoF6PfwTzyRCULVpVUN8guoJ4unSUqFot'
  const newAccount = new Neon.wallet.Account()
//const address = newAccount.address;
//console.log( address )
  const mintPayload = {
    "address": newAccount,  // example: "NSEQNxueCAf6Qp3QEARj5ztpkhBi1cxayY"
    "amount": 1000 //number of tokens to mint
  }
  const txid = await tmn.mint(mintPayload, adminWallet)

  await sdk.helpers.sleep(TIME_CONSTANT) // wait for the transaction to persist on-chain before doing anything associated with the minting
*/
  const balance = await sdk.balanceOf(mintPayload.address) // get the balance of the address
  console.log(balance);

}


start();