Skip to content

Various issues #82

@petersalomonsen

Description

@petersalomonsen
  1. ( 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
  2. the following code couldn't run without syncCheckpoint arg, which I believe isn't required as declared
await query(client, {
          accountId: "",
          methodName: "41",
          argsBase64: "{}",
          requestType: "call_function",
          syncCheckpoint: "earliest_available",
        });
  1. the return type of query consists of many intersections and unions, but essentially VSCode resolves all of that to only blockHash and blockHeight

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

  1. for viewAccount, it's the other way around, you can see everything, except for blockHash and blockHeight, even though they exist in the object

  2. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions