Casper RPC
How to use it
// yarn add @tatumio/tatum
import { TatumSDK, Casper, Network } from '@tatumio/tatum'
const tatum = await TatumSDK.init<Casper>({ network: Network.CASPER })
const deployHash = '5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa'
const result = await tatum.rpc.infoGetDeploy(deployHash, true)
await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs
Request Example
curl --location 'https://api.tatum.io/v3/blockchain/node/casper-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
"jsonrpc":"2.0",
"method":"info_get_deploy",
"params":[
"5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa",
true
],
"id":1
}'
Overview
info_get_deploy
is an RPC method on the Casper blockchain that retrieves the details of a specific deploy using its hash. This method can also include execution results if specified.
Parameters
The info_get_deploy
method accepts the following parameters:
deploy_hash
: The hash of the deploy to retrieve. Example:"5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa"
include_execution_results
: A boolean to include execution results. Example:true
Return Object
The info_get_deploy
method returns an object with the following fields:
api_version
: The API version. Example:"1.5.6"
deploy
: An object containing the deploy details.execution_results
: An array of objects containing the execution results (ifinclude_execution_results
istrue
).
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"api_version": "1.5.6",
"deploy": {
"hash": "5c9b3b099c1378aa8e4a5f07f59ff1fcdc69a83179427c7e67ae0377d94d93fa",
"header": {
"account": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"timestamp": "2020-11-17T00:39:24.072Z",
"ttl": "1h",
"gas_price": 1,
"body_hash": "d53cf72d17278fd47d399013ca389c50d589352f1a12593c0b8e01872a641b50",
"dependencies": ["0101010101010101010101010101010101010101010101010101010101010101"],
"chain_name": "casper-example"
},
"payment": {
"StoredContractByName": {
"name": "casper-example",
"entry_point": "example-entry-point",
"args": [
[
"amount",
{
"bytes": "e8030000",
"cl_type": "I32",
"parsed": 1000
}
]
]
}
},
"session": {
"Transfer": {
"args": [
[
"amount",
{
"bytes": "e8030000",
"cl_type": "I32",
"parsed": 1000
}
]
]
}
},
"approvals": [
{
"signer": "01d9bf2148748a85c89da5aad8ee0b0fc2d105fd39d41a4c796536354f0ae2900c",
"signature": "014c1a89f92e29dd74fc648f741137d9caf4edba97c5f9799ce0c9aa6b0c9b58db368c64098603dbecef645774c05dff057cb1f91f2cf390bbacce78aa6f084007"
}
]
},
"execution_results": [
{
"block_hash": "13c2d7a68ecdd4b74bf4393c88915c836c863fc4bf11d7f2bd930a1bbccacdcb",
"result": {
"Success": {
"cost": "123456",
"effect": {
"operations": [
{
"key": "account-hash-2c4a11c062a8a337bfc97e27fd66291caeb2c65865dcb5d3ef3759c4c97efecb",
"kind": "Write"
},
{
"key": "deploy-af684263911154d26fa05be9963171802801a0b6aff8f199b7391eacb8edc9e1",
"kind": "Read"
}
],
"transforms": [
{
"key": "uref-2c4a11c062a8a337bfc97e27fd66291caeb2c65865dcb5d3ef3759c4c97efecb-007",
"transform": {
"AddUInt64": 8
}
},
{
"key": "deploy-af684263911154d26fa05be9963171802801a0b6aff8f199b7391eacb8edc9e1",
"transform": "Identity"
}
]
},
"transfers": [
"transfer-5959595959595959595959595959595959595959595959595959595959595959",
"transfer-8282828282828282828282828282828282828282828282828282828282828282"
]
}
}
}
]
}
}
Notes
- This method returns the details of a specific deploy, including execution results if specified.
- Ensure to replace the deploy hash with the actual deploy hash you intend to query.
For more detailed information, refer to the official Casper documentation.