vacuumlabs / adalite-backend-service

Icarus, a reference implementation for a lightweight wallet developed by the IOHK Engineering Team.
Apache License 2.0
2 stars 7 forks source link

distinguish between normal tx and delegation tx #96

Open roccomuso opened 4 years ago

roccomuso commented 4 years ago

How to distinguish between a normal tx and a delegation tx from the results returned by /api/v2/txs/history or api/bulk/addresses/summary ?

This is supposed to be a delegation tx but there's nothing marking it as such:

{
  "hash": "ebb0ccd31254e38bc4e04157fc679e9b4b5acda25287d0ffc63d3de547cbb7a1",
  "inputs_address": [
      "addr1q8zk0a8p0darg2m4whzve5fry595tmahqd6jgzt9chr2ay79vl6wz7m6xs4h2awyengjxfgtghhmwqm4ysykt3wx46fs2wwd4g"
  ],
  "inputs_amount": [
      "4564859"
  ],
  "outputs_address": [
      "addr1q8zk0a8p0darg2m4whzve5fry595tmahqd6jgzt9chr2ay79vl6wz7m6xs4h2awyengjxfgtghhmwqm4ysykt3wx46fs2wwd4g",
      "addr1q8zk0a8p0darg2m4whzve5fry595tmahqd6jgzt9chr2ay79vl6wz7m6xs4h2awyengjxfgtghhmwqm4ysykt3wx46fs2wwd4g"
  ],
  "outputs_amount": [
      "1000000",
      "1369531"
  ],
  "block_num": "4589062",
  "block_hash": "be1b5786b38c9f4aec5d7479680fbe90cd1fb5021a45381b71bb1b08e03326a2",
  "time": "2020-08-21T21:14:51.000Z",
  "tx_state": "Successful",
  "last_update": "2020-08-21T21:14:51.000Z",
  "tx_ordinal": 0,
  "inputs": [
      {
          "address": "addr1q8zk0a8p0darg2m4whzve5fry595tmahqd6jgzt9chr2ay79vl6wz7m6xs4h2awyengjxfgtghhmwqm4ysykt3wx46fs2wwd4g",
          "amount": "4564859",
          "id": "0253da6953b10a77a5a42da4b263d54f6412a4e175125d8e4cadb7d069f5b24b0",
          "index": 0,
          "txHash": "0253da6953b10a77a5a42da4b263d54f6412a4e175125d8e4cadb7d069f5b24b"
      }
  ],
  "best_block_num": "4605104"
}
xdzurman commented 4 years ago

It currently doesn't have a mark. From the databases standpoint, delegation and a normal transaction are the same. We'll be adding a rewards/delegation/withdrawal history component to adalite, please check staking-history branch in this repo.

roccomuso commented 4 years ago

That would be a lot useful, thanks

xdzurman commented 4 years ago

Right now its working, the rewards are not pushed to cardano-db-sync by IOHK yet. So you can checkout to that branch if you need it ASAP. /delegationHistory and /withdrawalHistory should be functioning. When rewards are pushed by db-sync, /rewardHistory will also work