tact icon indicating copy to clipboard operation
tact copied to clipboard

call getter function return Unsupported item type: tvm.stackEntrySlice

Open akbariandev opened this issue 2 years ago • 6 comments

Why does this simple getter function always return an Unsupported item type? I also tested common types like String, and Int but only on returning structs have error.

get fun query(index: Int): Order? {
      return self.orders.get(index);
}

the client app call using tonClient

query: () => {
    console.log(contract?.getQuery(BigInt(1)));            
}

akbariandev avatar Dec 23 '23 13:12 akbariandev

can you also share your Order's struct please? did you have any unsized Int property in the struct? If so, please retry with assigned bit size to your Int

struct Order {
    query_id: Int? as uint64 = null;
    product_id: Int? as uint256 = null;
}

hitaspdotnet avatar Jan 11 '24 13:01 hitaspdotnet

can you also share your Order's struct please? did you have any unsized Int property in the struct? If so, please retry with assigned bit size to your Int

struct Order {
    query_id: Int? as uint64 = null;
    product_id: Int? as uint256 = null;
}

Seem issue for me

struct OrderInfo {
    buyer: Address;
    amount: Int as coins;
    orderId: Int;
    time: Int as uint64;
}
``` my Struct

CaoThien96 avatar Mar 27 '24 08:03 CaoThien96

same question , when I get a struct of order, I will get same Error.

but if I get a map of order. it's normal.

xlliu avatar Apr 20 '24 09:04 xlliu

I also encountered this issue, and it appeared to be a problem of @ton/ton on the client side. I hope that my fix will be merged soon.

d0rich avatar Jun 22 '24 12:06 d0rich

I've also faced this Issue, but due to no progress on library's code, I had to wrote polyfill to this issue.

The main problem, as the name of error says, that type tvm.stackEntrySlice is not supported, but if one replace it with tvm.stackEntryCell, everything would work. This is dirty hack, which overrides global XMLHttpRequest, and fixes response text the way that library understands. Its not perfect, but works in my case, maybe in yours would also.

imartemy1524 avatar Jul 23 '24 17:07 imartemy1524

You just need to update @ton/ton libbrary to the latest version to solve the issue.

tus512 avatar Aug 10 '24 03:08 tus512