Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC API getSignaturesForAddress sends undocumented field "confirmationStatus" #27569

Closed
serejke opened this issue Sep 2, 2022 · 3 comments · Fixed by #27964 or #28555
Closed

RPC API getSignaturesForAddress sends undocumented field "confirmationStatus" #27569

serejke opened this issue Sep 2, 2022 · 3 comments · Fixed by #27964 or #28555
Labels
community Community contribution

Comments

@serejke
Copy link

serejke commented Sep 2, 2022

Problem

getSignaturesForAddress RPC API responds with undocumented confirmationStatus, for example, given an RPC request:

curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getSignaturesForAddress",
    "params": [
      "pxymi438mp6UpMjgXs4oRJGEwfF94vbnNkyEWLbWKbR",
      {
        "limit": 1
      }
    ]
  }
'

the response:

{
  "jsonrpc": "2.0",
  "result": [
    {
      "blockTime": 1662094092,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "5F8XLZ5hghz77GQP93BLwEYt8AU2pSw5qTdKevR8g1BEPkQ9aH53CothbLaHbUvjgA2n431kZNpDtjd8DYm657Ta",
      "slot": 148749545
    }
  ],
  "id": 1
}

The field confirmationStatus is not documented in the RPC response although it is very useful. I've encountered this problem during development of an on-chain game http://solana-place.com/ where I need to show changes history. Without that field I would need to make additional getSignatureStatus calls to get the finality of transactions.

I'm wondering whether I can rely on its presence in RPC responses. Unfortunately, that field is not present in the solana-web3's ConfirmedSignatureInfo so I need to do an unchecked cast like

const confirmedSignatureInfoAny: any = confirmedSignatureInfo
const confirmationStatus: "confirmed" | "finalized" = confirmedSignatureInfoAny['confirmationStatus']

Proposed Solution

Document the confirmationStatus field if it is a de-facto part of the RPC response.

@serejke serejke added the community Community contribution label Sep 2, 2022
@CriesofCarrots
Copy link
Contributor

A pull request updating the docs would be very welcome

@serejke
Copy link
Author

serejke commented Sep 2, 2022

@CriesofCarrots I'll be glad to make a PR. Just wanted to reassure that the mentioned field is mandatory of the RPC response. At least on Mainnet API & Alchemy & Quicknode this is true.

@CriesofCarrots
Copy link
Contributor

I'll be glad to make a PR. Just wanted to reassure that the mentioned field is mandatory of the RPC response. At least on Mainnet API & Alchemy & Quicknode this is true.

Thanks. I'm not sure "mandatory" is the right word, but that response field has been in the code for 17 months so it definitely should be in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
2 participants