How can I get the transaction ID from a test contract call?

How can I get the transaction ID from a test contract call?

5 Likes

You have receipts inside CallResponce, you can use it like in the code below:

let receipts = instance
        .methods()
        .YOUR_CALL()
        .tx_params(TxParameters::new(Some(1), Some(1000000), None))
        .call()
        .await
        .unwrap().receipts;
println!("{:#?}", receipts);

And the output will be like

[
    Call {
        id: 0x0000000000000000000000000000000000000000000000000000000000000000,
        to: 0x2cffcbc96717e5a102db1d5da45c189248d00a070cd65a822096b9733d3b071e,
        amount: 0,
        asset_id: 0x0000000000000000000000000000000000000000000000000000000000000000,
        gas: 1000000,
        param1: 3850959357,
        param2: 10472,
        pc: 11672,
        is: 11672,
    },
    Return {
        id: 0x0000000000000000000000000000000000000000000000000000000000000000,
        val: 1,
        pc: 10372,
        is: 10344,
    },
    ScriptResult {
        result: Success,
        gas_used: 13057,
    },
]

Iā€™m not sure but it looks like you can find txId here

5 Likes

Quite a nice silky experience

3 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.