Trying to access details of a shared object on a contract level I am getting following error SharedObjectOperationNotAllowed
:
This is the contact level code:
public fun get_x_types(
xs: &vector<X>
): vector<u8> {
let mut list_types = vector::empty<u8>();
let mut i = 0;
while (vector::length(xs) > i) {
let x_details = &xs[i];
let mut xtype: u8 = 9;
if(&x_details.x_type == XType::hh) {
xtype = 0;
} else if(&x_details.x_type == XType::aa) {
xtype = 1;
};
vector::push_back(&mut list_types, xtype);
i = i + 1;
};
list_types
}
This is the frontend code:
const tx = new Transaction();
tx.moveCall({
target: `${UPGRADED_PACKAGE_ADDRESS}::collections::get_x_types`,
arguments: [
tx.makeMoveVec({ elements: xEngineIds })
],
});
const res = await suiClient.devInspectTransactionBlock({
transactionBlock: tx,
sender: account?.address + "",
});
Why I am not allowed to access the data of the shared objects? I only want to get the related data of the shared objects not mutate it?