account_put_deploy

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 deployParams = {
  approvals: [
    {
      signer: '01f8b29f39c38600ecb3bbb082951e04ab63a4ad4f7c9048a5057e461a5a8d58a5',
      signature:
        '019d6ef5c62c80ad4e50df343fba6f0fced17dea4c65e7976f66335ffcfcde2a7f02e928c8507cef3c76c3151e0e9cc9c3f7838b9f7a99ac4be5522ca092841100',
    },
  ],
  hash: '00a8677713222df88b6988926e0b14adeda6c663957f5075003395da4e5c6888',
  header: {
    account: '01f8b29f39c38600ecb3bbb082951e04ab63a4ad4f7c9048a5057e461a5a8d58a5',
    body_hash: '145ae09d6da5bc290051db8cb7132a41a30473d5900eaaf409d92b666325ca00',
    chain_name: 'casper-net-1',
    dependencies: ['0101010101010101010101010101010101010101010101010101010101010101'],
    gas_price: 1,
    timestamp: '2023-09-26T14:07:10.024Z',
    ttl: '1h',
  },
  payment: {
    StoredContractByName: {
      args: [
        [
          'amount',
          {
            bytes: '0400f90295',
            cl_type: 'U512',
          },
        ],
      ],
      entry_point: 'example-entry-point',
      name: 'casper-example',
    },
  },
  session: {
    Transfer: {
      args: [
        [
          'amount',
          {
            cl_type: 'U512',
            bytes: '0400f90295',
          },
        ],
        [
          'target',
          {
            cl_type: 'URef',
            bytes: '09480c3248ef76b603d386f3f4f8a5f87f597d4eaffd475433f861af187ab5db07',
          },
        ],
      ],
    },
  },
}

const result = await tatum.rpc.accountPutDeploy(deployParams)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs

Overview

account_put_deploy is an RPC method on the Casper blockchain that allows you to deploy a transaction. This can be used to execute various smart contract functions and state changes on the Casper network.

Parameters

The account_put_deploy method accepts the following parameters:

  • approvals: A list of approvals for the deploy. Each approval contains a signer and a signature.

    • signer: The public key of the signer. Example: "01f8b29f39c38600ecb3bbb082951e04ab63a4ad4f7c9048a5057e461a5a8d58a5"
    • signature: The signature of the signer. Example: "019d6ef5c62c80ad4e50df343fba6f0fced17dea4c65e7976f66335ffcfcde2a7f02e928c8507cef3c76c3151e0e9cc9c3f7838b9f7a99ac4be5522ca092841100"
  • hash: The hash of the deploy. Example: "00a8677713222df88b6988926e0b14adeda6c663957f5075003395da4e5c6888"

  • header: An object containing the deploy header.

    • account: The public key of the account. Example: "01f8b29f39c38600ecb3bbb082951e04ab63a4ad4f7c9048a5057e461a5a8d58a5"
    • body_hash: The hash of the deploy body. Example: "145ae09d6da5bc290051db8cb7132a41a30473d5900eaaf409d92b666325ca00"
    • chain_name: The name of the chain. Example: "casper-net-1"
    • dependencies: A list of dependencies. Example: ["0101010101010101010101010101010101010101010101010101010101010101"]
    • gas_price: The gas price for the deploy. Example: 1
    • timestamp: The timestamp of the deploy. Example: "2023-09-26T14:07:10.024Z"
    • ttl: The time-to-live for the deploy. Example: "1h"
  • payment: An object containing the payment information.

    • StoredContractByName: An object specifying the payment contract by name.
      • args: The arguments for the payment contract. Example: [["amount", { "bytes": "0400f90295", "cl_type": "U512" }]]
      • entry_point: The entry point for the contract. Example: "example-entry-point"
      • name: The name of the contract. Example: "casper-example"
  • session: An object containing the session information.

    • Transfer: An object specifying the transfer details.
      • args: The arguments for the transfer.
        • amount: The amount to transfer. Example: { "cl_type": "U512", "bytes": "0400f90295" }
        • target: The target of the transfer. Example: { "cl_type": "URef", "bytes": "09480c3248ef76b603d386f3f4f8a5f87f597d4eaffd475433f861af187ab5db07" }

Return Object

The account_put_deploy method returns an object with the following fields:

  • deploy_hash: The hash of the deployed transaction. Example: "00a8677713222df88b6988926e0b14adeda6c663957f5075003395da4e5c6888"

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "deploy_hash": "00a8677713222df88b6988926e0b14adeda6c663957f5075003395da4e5c6888"
  }
}

Notes

  • This method returns the transfer details for a specific block from the network.
  • Ensure to replace the block height with the actual block height you intend to query.

For more detailed information, refer to the official Casper documentation.