API added: expiring-delegations

in witness-category •  4 months ago 

image.png

API expiring-delegations added, now you can use:

curl -s "https://api.justyy.workers.dev/api/steemit/expiring-delegations/?cached&id=justyy"

[
  {
    "id": 14543680,
    "delegator": "justyy",
    "vesting_shares": 296459748.408969,
    "expiration": "2024-08-21T08:00:09",
    "sp": 173784.16767793059
  },
  {
    "id": 14544169,
    "delegator": "justyy",
    "vesting_shares": 25905305.416771,
    "expiration": "2024-08-22T14:00:09",
    "sp": 15185.64312510202
  },
  {
    "id": 14544207,
    "delegator": "justyy",
    "vesting_shares": 69199641.724364,
    "expiration": "2024-08-22T15:00:09",
    "sp": 40564.70466975466
  }
]

Parameters:

Required id: the steem account name
Optional limit: default to 100
Optional start: default to current timestamp "YYYY-MM-DDT00:11:22" for example "2023-01-02T01:02:03"

Error cases:

If the limit is invalid

{
  "name": "RPCError",
  "code": -32003,
  "data": {
    "code": 10,
    "name": "assert_exception",
    "message": "Assert Exception",
    "stack": [
      {
        "context": {
          "level": "error",
          "file": "database_api.cpp",
          "line": 821,
          "method": "list_vesting_delegation_expirations",
          "hostname": "",
          "timestamp": "2024-08-19T07:24:27"
        },
        "format": "args.limit <= DATABASE_API_SINGLE_QUERY_LIMIT: ",
        "data": {}
      }
    ]
  }
}

If the account is invalid: it returns null.
If the account is not found or no expiring delegations are found, it will return empty array [].
If the start parameter is invalid: it will return "Invalid Time Stamp"

Steem to the Moon🚀!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!