-
Notifications
You must be signed in to change notification settings - Fork 263
FailoverRPCProvider fails when returning null #1639
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
NEW❗