You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The getFeeForMessage() method on the Connection class can return both a number and null value, which is inconsistent with the types defined in the TypeScript package.
Steps to reproduce:
Import and initialize the Connection object from the library
Call getFeeForMessage() on a Connection instance, and pass an expired blockhash
Observe that both a number and null value can be returned.
Expected outcome: The getFeeForMessage() function should only return a number, as indicated by the types defined in the TypeScript package, or throw an error.
Actual outcome: The function returns both a number and null value, causing unexpected behavior in the code.
Proposed Solution
2 Solutions come to my mind:
raise an error if the RPC call returns null - no need to change the types
change the return type from RpcResponseAndContext<number> to RpcResponseAndContext<number | null>
The text was updated successfully, but these errors were encountered:
PirosB3
changed the title
Solana Connection.getFeeForMessage() type hints do not consider the null value
Connection.getFeeForMessage() type hints do not consider the null value
Jan 30, 2023
Problem
The
getFeeForMessage()
method on the Connection class can return both a number and null value, which is inconsistent with the types defined in the TypeScript package.Steps to reproduce:
Expected outcome: The getFeeForMessage() function should only return a number, as indicated by the types defined in the TypeScript package, or throw an error.
Actual outcome: The function returns both a number and null value, causing unexpected behavior in the code.
Proposed Solution
2 Solutions come to my mind:
null
- no need to change the typesRpcResponseAndContext<number>
toRpcResponseAndContext<number | null>
The text was updated successfully, but these errors were encountered: