framesjs / frames.js

The fastest way to make Frames
https://framesjs.org
MIT License
349 stars 97 forks source link

Inconsistent Cast Hash Format Between Local and Prod for validateMessage #501

Open kaushalmeena opened 4 days ago

kaushalmeena commented 4 days ago

Hello,

While validating a frame message via the local debugger's hub endpoint (e.g., http://localhost:3010/hub/v1/validateMessage), the response returns the cast hash in base64 format.

Response:

{
  "data": {
    "type": "MESSAGE_TYPE_FRAME_ACTION",
    "fid": 289309,
    "timestamp": 118494389,
    "network": "FARCASTER_NETWORK_MAINNET",
    "frameActionBody": {
      "url": "aHR0cDovL2xvY2FsaG9zdDozMDAwL21jYS9hY3Rpb24=",
      "buttonIndex": 1,
      "castId": {
        "fid": 16904,
        "hash": "t3mIjAxGlazXdgaZpcJ117ZvEPg="  // Cast hash is base64 encoded
      },
      "inputText": "",
      "state": "",
      "transactionId": "",
      "address": ""
    }
  }
}

However, when using the production hub endpoint (e.g., https://hub-api.neynar.com/v1/validateMessage), the response returns the cast hash as a hexadecimal string.

Response:

{
  "data": {
    "type": "MESSAGE_TYPE_FRAME_ACTION",
    "fid": 8408,
    "timestamp": 100285861,
    "network": "FARCASTER_NETWORK_MAINNET",
    "frameActionBody": {
      "url": "aHR0cDovL2ZyYW1lcy5haXJzdGFjay54eXovYWk=",
      "buttonIndex": 1,
      "castId": {
        "fid": 8408,
        "hash": "0x0000000000000000000000000000000000000001"  // Cast hash is in hex string
      },
      "inputText": "",
      "state": "",
      "transactionId": ""
    }
  }
}

This inconsistency between the local and production endpoints (base64 vs. hexadecimal) causes issues in using cast hash. Could you please clarify if this difference is intentional.

Thank you!

stephancill commented 4 days ago

Hi @kaushalmeena thanks for flagging this. I believe I have seen this issue elsewhere before (https://warpcast.com/stephancill/0xad807ec7), will look into it here