const e=require(`../../constants/chains.constants.cjs`),t=require(`../../data-structures/http/HttpClient.cjs`),n=require(`./tron.utils.cjs`);var r=async(r,i,a,o,s,c,l)=>{let u=n.addressToHexFormat(i),d=n.addressToHexFormat(c),f=e.networkRegistry[r].fetchRpcUrl;if(!f)throw Error(`missing rpc url for tron simulation`);let p=n.createTronCallData(o,a,s),m=await t.httpClient.post(f,{jsonrpc:`2.0`,id:1,method:`eth_call`,params:[{from:d,to:u,data:p,value:l?`0x${(l??0n).toString(16)}`:void 0},`latest`]});if(m.error){let e=m.error.message||`Unknown revert`;throw Error(`Tron Transaction Simulation reverted: ${e}`)}};exports.simulateTronTransaction=r;