NEAR Protocol RPC: View global contract code (1.0.0)

Returns a globally deployed contract code by its code hash

Languages
Servers
Mainnet
https://rpc.mainnet.fastnear.com/
Testnet
https://rpc.testnet.fastnear.com/

View global contract code

Request

Returns a globally deployed contract code by its code hash

Bodyapplication/jsonrequired
jsonrpcstringrequired
Value"2.0"
idstringrequired
Example: "fastnear"
methodstringrequired
Value"query"
paramsobjectrequired
params.​request_typestringrequired
Value"view_global_contract_code"
params.​code_hashstringrequired

Base58-encoded hash

params.​finalitystringrequired

Block finality

Enum"final""optimistic"
curl -i -X POST \
  https://rpc.mainnet.fastnear.com/ \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": "fastnear",
    "method": "query",
    "params": {
      "code_hash": "ExampleCodeHash",
      "request_type": "view_global_contract_code",
      "finality": "final"
    }
  }'

Responses

Successful response

Bodyapplication/json
jsonrpcstringrequired
Value"2.0"
idstring or numberrequired
One of:
string
resultobject

A view of the contract code.

errorobject
Response
application/json
{ "jsonrpc": "2.0", "id": "string", "result": { "code_base64": "string", "hash": "string" }, "error": { "code": 0, "message": "string", "data": {} } }