Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to ReadDict #133

Open
RyszardWojcikElympics opened this issue Jan 9, 2025 · 0 comments
Open

Unable to ReadDict #133

RyszardWojcikElympics opened this issue Jan 9, 2025 · 0 comments

Comments

@RyszardWojcikElympics
Copy link

Hi,

We've been trying to read dict from tonapi with no success.

The contract method returns Dict<uint16, uint64>. No matter the HashmapOptions, trying to read it throws this exception

Trying to replicate the issue I've written such a test:

` HashmapOptions<uint, CellSlice> opt = new HashmapOptions<uint, CellSlice>()
{
KeySize = 32,
Serializers = new HashmapSerializers<uint, CellSlice>
{
Key = k => new BitsBuilder(32).StoreUInt(k, 32).Build(),
Value = v => new CellBuilder().Build()
},
Deserializers = new HashmapDeserializers<uint, CellSlice>
{
Key = k => (uint)k.Parse().LoadUInt(32),
Value = v => v.Parse()
}
};

    HashmapE<uint, CellSlice> hm = new(opt);
    hm.Set(0,IntToCell(600000000));
    hm.Set(1,IntToCell(250000000));
    hm.Set(2,IntToCell(150000000));


    Cell cell = builder.StoreDict<uint, CellSlice>(hm).Build();

    var result = cell.Parse().ReadDict(opt);



static CellSlice IntToCell(uint x) => new CellBuilder().StoreUInt(x, 64).Build().Parse();

`

As you can see I'm using HashmapOptions straight from your Docs. I tried several other configurations as well, with various types, key lengths and (de)serilizers.

Even though the stored hashmap contain values, the parsed and read one has always 0 entries.

We'd be happy to continue using TON, but for that we need this basic funcionality to work.

Please advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant