-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
- ( Fixed in TypeScript doesn't catch missing required parameters for RPC methods #83 ) in the second parameter of query, tx, block is declared as optional, which means no TS errors are raised when running query(client), tx(client), block(client), even though the request isn't valid and returns HTTP 400
- the following code couldn't run without
syncCheckpointarg, which I believe isn't required as declared
await query(client, {
accountId: "",
methodName: "41",
argsBase64: "{}",
requestType: "call_function",
syncCheckpoint: "earliest_available",
});- the return type of query consists of many intersections and unions, but essentially VSCode resolves all of that to only
blockHashandblockHeight
P.S. I'd recommend using Prettify to make types look more human-readable. guide
P.S.S. also, you might consider running typechecks with vitest, here's the example of how we've done that for brand new TypedContract in near-api-js
-
for
viewAccount, it's the other way around, you can see everything, except for blockHash and blockHeight, even though they exist in the object -
clientConfig always fails validation for https://test.rpc.fastnear.com, with the following error
[
{
"expected": "number",
"code": "invalid_type",
"path": [
"chunkValidationThreads"
],
"message": "Invalid input"
},
{
"expected": "boolean",
"code": "invalid_type",
"path": [
"saveInvalidWitnesses"
],
"message": "Invalid input"
},
{
"expected": "boolean",
"code": "invalid_type",
"path": [
"saveTxOutcomes"
],
"message": "Invalid input"
},
{
"expected": "number",
"code": "invalid_type",
"path": [
"stateRequestServerThreads"
],
"message": "Invalid input"
},
{
"expected": "array",
"code": "invalid_type",
"path": [
"stateRequestThrottlePeriod"
],
"message": "Invalid input"
},
{
"expected": "number",
"code": "invalid_type",
"path": [
"stateRequestsPerThrottlePeriod"
],
"message": "Invalid input"
}
]Metadata
Metadata
Assignees
Labels
No labels