Skip to content

Unable to ReadDict #133

@RyszardWojcikElympics

Description

@RyszardWojcikElympics

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions