View Contract Call

Sends a view contract request to NEAR Protocol

Overview

This node, named "View Contract Call," allows users to send a view call request to a smart contract deployed on the NEAR Protocol blockchain. It is designed to query read-only methods of a NEAR smart contract without altering the blockchain state. This is useful for retrieving data stored in contracts, such as fetching user balances, configuration parameters, or any other publicly accessible information.

Common scenarios include:

  • Querying contract state variables.
  • Fetching data from decentralized applications (dApps) built on NEAR.
  • Integrating NEAR contract data into workflows for monitoring or reporting.

For example, you might use this node to call a method like get_value_by_key on a contract to retrieve specific stored values by passing appropriate arguments.

Properties

Name Meaning
Network ID The NEAR network to connect to. Options: "mainnet" or "testnet".
Contract Account ID The account ID of the NEAR smart contract you want to query (e.g., example.near).
Method Name The name of the view method on the contract to call (e.g., get_value_by_key).
Arguments JSON A JSON string representing the arguments to pass to the method (e.g., {"key": "value"}).

Output

The node outputs an array of items where each item contains a json field with a result property. This result holds the response returned by the called contract method, which can be any JSON-serializable data depending on the contract's implementation.

Example output structure:

{
  "json": {
    "result": { /* data returned by the contract method */ }
  }
}

The node does not output binary data.

Dependencies

  • Requires access to the NEAR Protocol RPC endpoints. The node uses predefined URLs for mainnet and testnet.
  • No explicit API keys or authentication tokens are required since it performs read-only view calls.
  • Uses the near-api-js library internally to interact with the NEAR blockchain.

Troubleshooting

  • Invalid JSON in Arguments JSON: If the Arguments JSON input is not valid JSON, the node will throw a parsing error. Ensure the JSON string is correctly formatted.
  • Incorrect Network ID: Using a network ID other than "mainnet" or "testnet" will cause connection failures. Use one of the supported network IDs.
  • Contract or Method Not Found: If the specified contract account ID or method name does not exist, the node will fail. Verify that the contract is deployed and the method is a valid view method.
  • Network Connectivity Issues: Failure to reach the NEAR RPC endpoints may result in errors. Check your internet connection and firewall settings.
  • Continue On Fail: If enabled, the node will continue processing subsequent items even if some calls fail, returning error details alongside successful results.

Links and References

Discussion