Search code examples
httphttprequestblockchain

Value having double equal signs in Get Request?


I know a similar question has been asked before but I wanted to know if this is a valid GET request?

https://somenet-tx-rest.mydomainx.io/cosmos/tx/v1beta1/txs?events=message.sender=Tx19mlsjsh948d6xzyllgt990hshv455ravfdj2r7

I tried sending this and I got the following response:

{
    "code": 3,
    "message": "\nparse error near equal (line 1 symbol 16 - line 1 symbol 17):\n\"=\"\n: invalid request",
    "details": []
}

To provide more information, if I submit the same GET request without the =Tx19mlsjsh948d6xzyllgt990hshv455ravfdj2r7 :

https://somenet-tx-rest.mydomainx.io/cosmos/tx/v1beta1/txs?events=message.sender

The response is:

{
    "code": 3,
    "message": "rpc error: code = InvalidArgument desc = invalid event; event message.sender should be of the format: {eventType}.{eventAttribute}={value}: invalid request",
    "details": []
}

I'm not sure how to provide the value for message.sender as message.sender seems to be needed for the event key?

I'm trying to use the following endpoint: https://functionx.github.io/fx-core/swagger-ui/#/Service/GetTxsEvent with an address argument for the events parameter


Solution

  • I needed to update my Perl code for new RPC endpoint. My old code looked as follows:

      "$lcd_address/txs?message.sender=$delegator&message.module=staking&delegate.validator=$validator"
    

    and I changed it to:

      "$lcd_address/cosmos/tx/v1beta1/txs?events=message.sender='$delegator'&events=message.module='staking'&events=delegate.validator='$validator'"
    

    Please be aware that JSON payload changed between the endpoints.