Show the pDEX response TxID when calling extractpdeinstsfrombeaconblock

Hello. I will like to purpose a little change in the extractpdeinstsfrombeaconblock RPC: That it also returns the TxID of the responses it returns. Right now, the only TxID that it return is RequestedTxID.

For example, in the next response, the TxID is e0d3c978d90523c2bd3fbc7e62c025ac003ce13331d61006247c50fb85486f9b, but that information is not there.

{
  "PDEContributions": [],
  "PDETrades": [],
  "PDEWithdrawals": [],
  "PDEAcceptedTradesV2": [
    {
      "TraderAddressStr": "12RrUXxv5ZfsYmnT8YW8xZo7VfpxdTNq6DJxwxjdJ7Wym7qtoNrR8uybcdYK1TaZ3tCDKzkVtDkvZ8jFYf4BCuz3c9GFYub6nwBSmPQ",
      "ShardID": 0,
      "RequestedTxID": "985fb8e83e4eef3dc594d269680c7acb41332f145e8e137776ba84124301a2c0",
      "Status": "accepted",
      "BeaconHeight": 1112804,
      "TradePaths": [
        {
          "TokenIDToBuyStr": "0000000000000000000000000000000000000000000000000000000000000004",
          "ReceiveAmount": 28974493526,
          "SellAmount": 87038010,
          "Token1IDStr": "0000000000000000000000000000000000000000000000000000000000000004",
          "Token2IDStr": "1ff2da446abfebea3ba30385e2ca99b0f0bbeda5c6371f4c23c939672b429a42"
        },
        {
          "TokenIDToBuyStr": "3f89c75324b46f13c7b036871060e641d996a24c09b3065835cb1d38b799d6c1",
          "ReceiveAmount": 87054716060,
          "SellAmount": 28974493526,
          "Token1IDStr": "0000000000000000000000000000000000000000000000000000000000000004",
          "Token2IDStr": "3f89c75324b46f13c7b036871060e641d996a24c09b3065835cb1d38b799d6c1"
        }
      ]
    }
  ],
  "PDERefundedTradesV2": [],
  "BeaconTimeStamp": 1617252520
}
1 Like

Hello @J053,

This is out of scope of the RPC, this one is to extract trades’ info from beacon block’s instructions.
Basically, after the beacon block is included in beacon chain, the shard chains would receive the beacon block and then create response txs for trades. So if you want to map a trade request tx to a trade response tx, you would need to implement something like a background job that pull beacon & shard blocks, compute needed information (i.e., a map between request & response trade txs) and then store into your own database (instead of using fullnode database). In this way, you will be able to extract information you wanted in a http request.

3 Likes