I am doing some rust tests in the elrond blockchain.
When I print a token identifier outside of execute_query, my token is well printed. Whereas, it throws an error when I try to print it in the execute_query.
#[test]
fn test_foo() {
let mut setup = utils::setup(equip_penguin::contract_obj);
let token = TokenIdentifier::<DebugApi>::from_esdt_bytes(b"ITEM-a1a1a1");
// works
println!("{:x?}", token);
let b_wrapper = &mut setup.blockchain_wrapper;
let _ = b_wrapper.execute_query(&setup.cf_wrapper, |sc| {
// throw errors
println!("{:x?}", token);
});
}
The error is
thread 'build_url_with_one_item' panicked at 'called `Option::unwrap()` on a `None` value', /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-debug-0.27.4/src/tx_mock/tx_managed_types.rs:38:31
The utils::setup used in the above snippet code from this doc https://docs.elrond.com/developers/developer-reference/rust-testing-framework/
How does this error happens?