Skip to content
New issue

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

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

Already on GitHub? # to your account

XDR parse error for Option<Vec<Object>> #1050

Open
BlaineHeffron opened this issue Sep 17, 2024 · 1 comment
Open

XDR parse error for Option<Vec<Object>> #1050

BlaineHeffron opened this issue Sep 17, 2024 · 1 comment
Assignees
Labels

Comments

@BlaineHeffron
Copy link
Contributor

BlaineHeffron commented Sep 17, 2024

Describe the bug
Option is not getting properly parsed when it is for a vector of objects

What version are you on?
12.3.0

To Reproduce
Steps to reproduce the behavior:
I added a type to other_custom_types wasm for a test case: stellar/soroban-examples#326
With that wasm you can add this to the custom types e2e tests:

  it("get_object_vec_option", async function () {
    const expectedResult = [
      { a: 1, b: true, c: "hi" },
      { a: 2, b: false, c: "hello" }
    ];

    const result = await this.context.client.get_object_vec_option();
    expect(result.result).to.deep.equal(expectedResult);
  });

Expected behavior
It should return the vector of objects (or null if the option is null)

Additional context

TypeError: Type [object Object] was not vec, but [object Object] is
    at Spec.scValToNative (lib/contract/spec.js:848:19)
    at Spec.funcResToNative (lib/contract/spec.js:529:19)
    at Object.parseResultXdr (lib/contract/client.js:59:25)
    at AssembledTransaction.result (lib/contract/assembled_transaction.js:433:29)
    at Context.<anonymous> (test/e2e/src/test-custom-types.js:291:19)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Sep 17, 2024
@Shaptic
Copy link
Contributor

Shaptic commented Sep 17, 2024

Looks like this is coming from this line in spec.ts, so assigning this to @willemneal as the author 🫡

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
Status: Todo (Ready for Dev)
Development

No branches or pull requests

4 participants