bitcat365 / oasisscan-backend

oasisscan.com backend
3 stars 4 forks source link

API: wrong data about burn transactions #5

Closed csillag closed 2 years ago

csillag commented 2 years ago

Hi, I see something that might be a bug in the API implementation.

Please pardon me if this is the wrong forum to report this; I couldn't find an obvious link on either the OasisScan.com website or in the README of this repo.

See this transaction: https://testnet.oasisscan.com/transactions/5e1b8a01043505741014213a8fd19996eb68621881eb5aceac24f28a5c2820ab

As you can see, this is a burn, and the content is described as:

 {
  "tx_hash": "5e1b8a01043505741014213a8fd19996eb68621881eb5aceac24f28a5c2820ab",
  "method": "staking.Burn",
  "fee": {
    "gas": 1235
  },
  "body": {
    "amount": "1000000000"
  },
  "nonce": 0,
  "signature": {
    "signature": "S0IiWGwa/WgvHxOpoYjhCKfmstx0u5ZHvBHXhRjQSs76MRm47VnOQ+p2FvqZjqUxB1LmPeiffVV7m01sG6mlAw==",
    "public_key": "9aBykPfe7o9BWtdjwWmQh0lnaiQmBG/58vhYPROFIDo=",
    "address": "oasis1qqurxkgavtcjjytneumeclx59ds3avjaqg7ftqph"
  },
  "height": 11753025,
  "timestamp": 1663855390,
  "time": "2022-09-22T14:03:10Z",
  "error": {
    "code": 0
  },

Notice the amount.

Now if I get this transaction (along with another one), via the API

curl --silent "https://api.oasisscan.com/testnet/chain/transactions?size=20&address=oasis1qqurxkgavtcjjytneumeclx59ds3avjaqg7ftqph&runtime=true"

Then I get this data:

{
   "code" : 0,
   "data" : {
      "list" : [
         {
            "add" : true,
            "amount" : null,
            "fee" : "0",
            "from" : "oasis1qqurxkgavtcjjytneumeclx59ds3avjaqg7ftqph",
            "height" : 11753025,
            "method" : "staking.Burn",
            "shares" : null,
            "status" : true,
            "time" : 5065,
            "timestamp" : 1663855390,
            "to" : null,
            "txHash" : "5e1b8a01043505741014213a8fd19996eb68621881eb5aceac24f28a5c2820ab"
         },
         {
            "add" : true,
            "amount" : "10.00",
            "fee" : "0",
            "from" : "oasis1qzna6nq9kuktjmxx2s84z38eysqyts84jc9lgdg2",
            "height" : 11751888,
            "method" : "staking.Transfer",
            "shares" : null,
            "status" : true,
            "time" : 11412,
            "timestamp" : 1663849043,
            "to" : "oasis1qqurxkgavtcjjytneumeclx59ds3avjaqg7ftqph",
            "txHash" : "2ea41a6b2c8d05d67e73543d0d1045c63fe553901a6dd430af4c6e6d22680588"
         }
      ],
      "maxPage" : 1,
      "page" : 1,
      "size" : 20,
      "totalSize" : 2
   }
}

Here, from the two returned transaction, we are looking at the first one, the burn. Please note that both the amount and the fee is returned as null and zero, contrary to what was listed directly on the web site.

Am I missing something here, or is this a bug? Thank you for looking into this.

romever commented 2 years ago

Thanks for pointing out this issue.I have fixed the amount field. 33bdb4f The fee field currently only supports fee amount, not gas.

csillag commented 2 years ago

Great, thanks! I see that now it's returning all the correct values. Closing the issue.