const TronWeb = require('tronweb');
const HttpProvider = TronWeb.providers.HttpProvider;
const fullNode = new HttpProvider("https://api.trongrid.io");
const solidityNode = new HttpProvider("https://api.trongrid.io");
const eventServer = new HttpProvider("https://api.trongrid.io");
const privateKey = "pkey yaz"; //
const tronWeb = new TronWeb(fullNode, solidityNode, eventServer, privateKey);
const blackHole = "T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb"; //black hole address
const memo = 'data:,{"p":"trc-20","op":"mint","tick":"ptrx","amt":"1000"}';
async function main() {
const unSignedTxn = await tronWeb.transactionBuilder.sendTrx(blackHole, 1); //0.000001 TRX is the minimum transfer amount.
const unSignedTxnWithNote = await tronWeb.transactionBuilder.addUpdateData(unSignedTxn, memo, 'utf8');
const signedTxn = await tronWeb.trx.sign(unSignedTxnWithNote);
console.log("signed =>", signedTxn);
const ret = await tronWeb.trx.sendRawTransaction(signedTxn);
console.log("broadcast =>", ret);
}
main().then(() => {
})
.catch((err) => {
console.log("error:", err);
});
// Her 4000 milisaniyede (4 saniye) bir main fonksiyonunu çalıştır
setInterval(main, 3000);