How to get txId from a ScriptCall?

Hello there, can you help me get the tx id of the ScriptCall from the code listing below?

        let provider = wallet.provider().unwrap();

        let mut inputs = vec![];
        let mut outputs = vec![];
        //... some code
        let script_call = ScriptCallHandler::new(
            vec![],
            UnresolvedBytes::default(),
            wallet.clone(),
            provider.clone(),
            Default::default(),
        )
        .with_inputs(inputs)
        .with_outputs(outputs)
        .tx_params(TxParameters::default().set_gas_price(1));

        script_call.call().await
4 Likes

Starting with fuels = "0.42.0", tx_id should be inside the FuelCallResponse struct returned by ScriptCallHandler::call.

1 Like

@Br1ght0ne So, I have this error on that line on v 0.42

const RPC: &str = "beta-3.fuel.network";
//some code...
  let provider = Provider::connect(RPC).await.unwrap();
thread 'testnet_tests::fulfill_order_test::fulfill_order_test' panicked at 'called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: Other, error: "Response errors; Unknown field \"messageReceiptCount\" on type \"Header\".; Unknown field \"messageReceiptRoot\" on type \"Header\".; Unknown field \"chainId\" on type \"ConsensusParameters\"." })', tests/testnet_tests/fulfill_order_test.rs:46:49
stack backtrace:
   0: rust_begin_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
   1: core::panicking::panic_fmt
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
   2: core::result::unwrap_failed
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1090:23
   4: integration_tests::testnet_tests::fulfill_order_test::fulfill_order_test::{{closure}}
             at ./tests/testnet_tests/fulfill_order_test.rs:46:20
   5: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/future/future.rs:125:9
   6: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/future/future.rs:125:9
   7: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:541:57
   8: tokio::runtime::coop::with_budget
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/coop.rs:107:5
   9: tokio::runtime::coop::budget
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/coop.rs:73:5
  10: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:541:25
  11: tokio::runtime::scheduler::current_thread::Context::enter
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:350:19
  12: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:540:36
  13: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:615:57
  14: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/macros/scoped_tls.rs:61:9
  15: tokio::runtime::scheduler::current_thread::CoreGuard::enter
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:615:27
  16: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:530:19
  17: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/scheduler/current_thread.rs:154:24
  18: tokio::runtime::runtime::Runtime::block_on
             at /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.28.1/src/runtime/runtime.rs:302:47
  19: integration_tests::testnet_tests::fulfill_order_test::fulfill_order_test
             at ./tests/testnet_tests/fulfill_order_test.rs:184:5
  20: integration_tests::testnet_tests::fulfill_order_test::fulfill_order_test::{{closure}}
             at ./tests/testnet_tests/fulfill_order_test.rs:41:31
  21: core::ops::function::FnOnce::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
  22: core::ops::function::FnOnce::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test testnet_tests::fulfill_order_test::fulfill_order_test ... FAILED

failures:

failures:
    testnet_tests::fulfill_order_test::fulfill_order_test

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.27s

error: test failed, to rerun pass `-p limit-order-predicate --test integration_tests`

 *  The terminal process "cargo 'test', '--package', 'limit-order-predicate', '--test', 'integration_tests', '--', 'testnet_tests::fulfill_order_test::fulfill_order_test', '--exact', '--nocapture'" terminated with exit code: 101. 
 *  Terminal will be reused by tasks, press any key to close it. 

Is there any way to get the tx id using v0.39?

Can you please make sure that you are using the right fuel-core version, ie 0.18.1. This definitely looks like a fuel-core version mismatch.
Also it is always better to not multiply the sources for an issue, I’m closing the github issue related to this to avoid having multiple sources of truth.

>>> fuelup show                                             13:08:08 
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
--------------------
beta-3-aarch64-apple-darwin
latest-aarch64-apple-darwin (default)
forc-0.39-toolchain
my-custom-toolchain

active toolchain
-----------------
latest-aarch64-apple-darwin (default)
  forc : 0.40.1
    - forc-client
      - forc-deploy : 0.40.1
      - forc-run : 0.40.1
    - forc-doc : 0.40.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.40.1
    - forc-index : 0.16.2
    - forc-lsp : 0.40.1
    - forc-tx : 0.40.1
    - forc-wallet : 0.2.2
  fuel-core : 0.18.1
  fuel-indexer : 0.16.2

fuels versions
---------------
forc : 0.42

My bro has the same error as well with the latest toolchain
You can try to run it on your laptop, to see the error

git clone https://github.com/chlenc/fuel-counter-contract.git
cd fuel-counter-contract
forc build
echo "SECRET=<YOUR_PRIVATE_KEY>" >> .env
cargo test
1 Like

The fact that fuelup show shows 0.18.1 unfortunately doesn’t guarantee that you are indeed running 0.18.1. Can you please run fuel-core --version?

 >>> fuel-core --version                                                                                                                   
fuel-core 0.18.1

Sorry, my mistake. The issue comes from the fact that the SDK version 0.42 does not work with the beta-3 network, which uses the previous 0.17 fuel-core version.

Ok, and how can I fix that?

I need just to get a tx id from the script call, maybe there is another way how to do that?

GM
@iqdecay @oleksii
Are any updates here?

We’ve been asking ourselves the question, but can’t figure out how we used to do it before this. I think your best bet would be to get the txid from the block header? It’s a terrible solution but before the new endpoint supports fuel-core 0.19 (it actually will skip 0.18) I’m sorry but I don’t know how.

It doesn’t work for me and btw I had the same error on v0.41
Did you try using v0.42 yourself?
Which toolchain and hardware do you use?
I just created an issue

Where I can find a block header?

@oleksii @iqdecay
I see there is already v0.43 of Rust SDK
Can I use it to fix my problem? Is it good with beta-3?

No the beta-3 endpoint is compatible with the beta-3 toolchain on fuelup, which works with the 0.39-0.41 versions of the SDK. Later versions will not work as the 0.42 release of the SDK uses the 0.18.1 version of fuel-core, which is not the one from the beta-3 endpoint.

1 Like

Ok, thanks, got it

I have one more request for you: can you please look at this topic, is this problem related to rust-sdk or maybe I should change the category?