Skip to content

FailoverRPCProvider fails when returning null #1639

@PiVortex

Description

@PiVortex

Prerequisites

  • I'm using the latest version of near-api-js.
  • I have tried to start with a fresh project and reproduce the defect with minimal code changes.
  • I have read the console error messages carefully (if applicable).

Description

https://github.com/near/near-api-js/blob/master/packages/providers/src/failover-rpc-provider.ts#L98

If a smart contract returns null for example Option then the failover rpc will not detect this as a valid response and cause it to fail

Reproducible demo

No response

Steps to reproduce

Create a smart contract that has a view function that returns null

Create a NAJ script that calls it with a normal JSON RPC provider then with a failover RPC provider

The first will succeed, the second will not

Expected behavior

If it returns null, it should return null instead of failing

Actual behavior

it errors instaed of returning null

Your environment

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    NEW❗

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions