I have a function that returns an object. I want to be able to take out "results" from that object but I'm having difficulty. My error is
'results' does not exist on type 'SimulationResponse'. Property 'results' does not exist on type 'RelayResponseError'
The code is currently
const response = await flashbotsProvider.simulate(
simulateTransaction,
blockNumber + 1
);
console.log(typeof response);
console.log(response.results);
And if i only console.log(response) then the output is:
object
{
bundleHash: '0x7765d8cf3063adb1bf9a2e524071a86ddcd3abf96acee689989f0a574073d9ac',
coinbaseDiff: BigNumber { _hex: '0x02b959fc8d06f000', _isBigNumber: true },
results: [
{
coinbaseDiff: '196287000000000000',
ethSentToCoinbase: '0',
fromAddress: '0xd612c9fBc4047E1cd50bf0996B8D277d0bF425F9',
gasFees: '196287000000000000',
gasPrice: '2100000000000',
gasUsed: 93470,
toAddress: '0x20EE855E43A7af19E407E39E5110c2C1Ee41F64D',
txHash: '0x883597fc3df0e70bf78383c381394c6b39ca8f8cfe1885ad4b889f37339874dc',
value: '0x'
}
],
totalGasUsed: 93470,
firstRevert: undefined
}
any idea?
if ("error" in response || response.firstRevert !== undefined) {
console.log(Simulation Error: ${response});
process.exit(1);
}
I checked it if there is error, and when there is error you can get results by response.results.