Including account info

Accounts on Casper Mainnet and Testnet networks have the possibility to self-identify themselves in a decentralized with the Casper Account Info Standard smart contract. Many validators and contract owner accounts provide information about themselves to increase trust on the network.

CSPR.cloud REST API allows including account information to simplify the integration with the standard for dApps developers. Typically, account info standard data can be included in responses that contain account identifiers like account hashes or public keys.

In the example below, we'll include validator account info data in the account delegations API response. To demonstrate the possibility of filtering included object data, we'll request only the owner name and logo properties of the account info object.

curl -X 'GET' -G \
  'https://api.testnet.cspr.cloud/accounts/018df66cb0257dd378d1944d665ea001518419408d55db740a9bb1a262093cefd9/delegations' \
  --data-urlencode 'includes=validator_account_info{info{owner{name,branding{logo}}}}' \
  -H 'accept: application/json' \
  -H 'authorization: 55f79117-fc4d-4d60-9956-65423f39a06a'
{
  "data": [
    {
      "bonding_purse": "uref-845ca8130882c27ee0da81252ed0deb7787796a3868df4b771e0518383d89a4b-007",
      "public_key": "018df66cb0257dd378d1944d665ea001518419408d55db740a9bb1a262093cefd9",
      "stake": "235732110487",
      "validator_account_info": null,
      "validator_public_key": "0196948158bf5b35c0c84f680f110b8debaa4e7628e13ba336a95651a214d3b9bd"
    },
    {
      "bonding_purse": "uref-a5bac0a17edeed284a0264f3fbbd189d3c4819f0e788a576792dc028c8476fba-007",
      "public_key": "018df66cb0257dd378d1944d665ea001518419408d55db740a9bb1a262093cefd9",
      "stake": "565388190696",
      "validator_account_info": {
        "info": {
          "owner": {
            "branding": {
              "logo": {
                "png_1024": "",
                "png_256": "https://picsum.photos/256/256",
                "svg": ""
              }
            },
            "name": "ACME"
          }
        }
      },
      "validator_public_key": "0106ca7c39cd272dbf21a86eeb3b36b7c26e2e9b94af64292419f7862936bca2ca"
    }
  ],
  "item_count": 2,
  "page_count": 1
}

Last updated