You can check this by getting the transaction information first using
(async () => {
await rpc.history_get_transaction('b3598da4e007173e6d1b94d7be306299dd0a6813d114cf9a08c8e88a5756f1eb', 46632826)
})();
which returns result like:
{
id: 'b3598da4e007173e6d1b94d7be306299dd0a6813d114cf9a08c8e88a5756f1eb',
trx: {
receipt: {
status: 'executed',
cpu_usage_us: 2070,
net_usage_words: 14,
trx: [Array]
},
trx: {
expiration: '2019-08-28T03:45:47',
ref_block_num: 36720,
ref_block_prefix: 654845510,
max_net_usage_words: 0,
max_cpu_usage_ms: 0,
delay_sec: 0,
context_free_actions: [],
actions: [Array],
transaction_extensions: [],
signatures: [Array],
context_free_data: []
}
},
block_time: '2019-08-28T03:45:21.500',
block_num: 46632826,
last_irreversible_block: 46784285,
traces: []
}
Check if the last_irreversible_block
is greater than block_num
then the transaction is irreversible
.