stacks-blockchain-api icon indicating copy to clipboard operation
stacks-blockchain-api copied to clipboard

TransactionsApi.getFilteredEvents mapping /tx/events returns empty results

Open beguene opened this issue 3 years ago • 0 comments

Describe the bug Using the clientApi TransactionsApi.getFilteredEvents the json response has an empty results, event2

but the request correctly returns limit, offset and events event1

To Reproduce Steps to reproduce the behavior:

  1. just call TransactionsApi.getFilteredEvents

Expected behavior The response should have the events in results instead of events

Additional context This was for this feature https://github.com/hirosystems/explorer/issues/866, but I ended up using the /tx endpoint and using the params event_offset and event_limit for 2 reasons

  1. to actually get the events in json which I could not get with the api client
  2. the format of the events is more meaningful event from /tx endpoint
{
      "event_index": 0,
      "event_type": "fungible_token_asset",
      "tx_id": "0xffe51f5fddceb61b2b2f36e72ce8370a0dbcdfdfc96dd784327fcaf9d2367eac",
      "asset": {
        "asset_event_type": "mint",
        "asset_id": "SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.spaghetti::SPAGHETTI",
        "sender": "",
        "recipient": "SPQ2HN9TYF8ZYY9D3G45NGYA9GHA6QZHQ8AXF5QM",
        "amount": "130977757"
      }
    },

from the tx/events endpoint

{
      "event_index": 206,
      "event_type": "smart_contract_log",
      "tx_id": "0xffe51f5fddceb61b2b2f36e72ce8370a0dbcdfdfc96dd784327fcaf9d2367eac",
      "contract_log": {
        "contract_id": "SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-staking",
        "topic": "print",
        "value": {
          "hex": "0x0c0000000306616374696f6e0d000000057374616b650f636f6c6c656374696f6e2d706f6f6c0a0c000000030e706f696e74732d62616c616e636501000000000000000000000000016519190a7374616b652d74696d650100000000000000000000000000012ad310746f74616c2d6d756c7469706c69657201000000000000000000000000000b98c0067374616b65720c000000020b636f6c6c656374696f6e730b000000050616a6a7a70f41adbe8eae708ed7ec2cbf41a27218201762797a616e74696f6e2d626974636f696e2d62756c6c730616a6a7a70f41adbe8eae708ed7ec2cbf41a27218201762797a616e74696f6e2d626974636f696e2d62656172730616a6a7a70f41adbe8eae708ed7ec2cbf41a27218200e626974636f696e2d7768616c6573061658299803d439284eda17c7ce45405628633465100d626974636f696e2d676f617473061658299803d439284eda17c7ce45405628633465100b7468652d636176616c72790f6c69666574696d652d706f696e747301000000000000000000000006cfede4b4",
          "repr": "(tuple (action \"stake\") (collection-pool (some (tuple (points-balance u23402777) (stake-time u76499) (total-multiplier u760000)))) (staker (tuple (collections (list 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-bitcoin-bulls 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-bitcoin-bears 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.bitcoin-whales 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-goats 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.the-cavalry)) (lifetime-points u29258278068))))"
        }
      }
    },

Note that this issue is not a blocker because this new paginated event feature of the explorer works fine with /tx endpoint https://github.com/hirosystems/explorer/issues/866

beguene avatar Oct 07 '22 10:10 beguene