Skip to content

Fix bug for nested struct array - #2

Open
zcmmwbd wants to merge 1 commit into
whdev1:mainfrom
zcmmwbd:patch-1
Open

Fix bug for nested struct array#2
zcmmwbd wants to merge 1 commit into
whdev1:mainfrom
zcmmwbd:patch-1

Conversation

@zcmmwbd

@zcmmwbd zcmmwbd commented Dec 6, 2024

Copy link
Copy Markdown

Fix the bug so that the following code can run normally

    s = borsh.schema({
        "struct_array": borsh.types.fixed_array(borsh.types.struct({
                "nested_struct_field1": borsh.types.u8
            }), 3)
    })
    arr = [{ "nested_struct_field1": 1 }, { "nested_struct_field1": 2 }, { "nested_struct_field1": 3 }]
    data = borsh.serialize(s, {
        "struct_array": [ borsh.types.struct(i) for i in arr ]
    })
    print(borsh.deserialize(s, data))

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

Successfully merging this pull request may close these issues.

1 participant