Skip to content

Conversation

@dskloetc
Copy link
Contributor

@dskloetc dskloetc commented Oct 27, 2025

OPDATA-4861

Description

The solana-functions EA already supported reading account data with a buffer layout, but so far it was only used in the sanctum-infinity endpoint.
This PR makes the functionality available directly in a buffer-layout endpoint.

NOTE: I copied the sanctum-infinite endpoint, transport and tests in a separate commit, to make it easier to ignore boilerplate while reviewing.

Changes

  1. Add buffer-layout endpoint which uses the shared buffer-layout reading support to read fields from programs with a supported buffer layout.
  2. Added the result of
ACCOUNT="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

curl -X POST https://rpcs.cldev.sh/solana/mainnet -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getAccountInfo",
  "params": [
    "'$ACCOUNT'",
    {
      "encoding": "base64"
    }
  ]
}' | jq

as packages/sources/solana-functions/test/fixtures/usdc-minter-account-data-2025-10-27.json to be used as test fixture.

Steps to Test

  1. Unit and integration tests added.
  2. Tested manually to read the supply of USDC:
curl --silent -S -X POST http://localhost:8080 -H 'Content-Type: application/json' -d '{
    "data": {
  "endpoint": "buffer-layout",
  "stateAccountAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "field": "supply"
}
  }'
{
  "data": {
    "result": "10123912051543186"
  },
  "statusCode": 200,
  "result": "10123912051543186",
  "timestamps": {
    "providerDataRequestedUnixMs": 1761563502565,
    "providerDataReceivedUnixMs": 1761563502979
  },
  "meta": {
    "adapterName": "SOLANA_FUNCTIONS",
    "metrics": {
      "feedId": "{\"stateAccountAddress\":\"epjfwdd5aufqssqem2qn1xzybapc8g4weggkzwytdt1v\",\"field\":\"supply\"}"
    }
  }
}

Quality Assurance

  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant infra-k8s configuration file.
  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant adapter-secrets configuration file or update the soak testing blacklist.
  • If a new adapter was made, or a new endpoint was added, update the test-payload.json file with relevant requests.
  • The branch naming follows git flow (feature/x, chore/x, release/x, hotfix/x, fix/x) or is created from Jira.
  • This is related to a maximum of one Jira story or GitHub issue.
  • Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types).
  • All code changes have 100% unit and integration test coverage. If testing is not applicable or too difficult to justify doing, the reasoning should be documented explicitly in the PR.

@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2025

🦋 Changeset detected

Latest commit: f8245de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chainlink/solana-functions-adapter Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dskloetc dskloetc marked this pull request as ready for review October 27, 2025 11:17
@dskloetc dskloetc requested a review from a team October 27, 2025 11:21
@dskloetc dskloetc merged commit 8d4db8a into main Oct 27, 2025
17 checks passed
@dskloetc dskloetc deleted the kloet/solana-mint-supply branch October 27, 2025 14:23
@github-actions github-actions bot mentioned this pull request Oct 27, 2025
Subarna-Singh pushed a commit that referenced this pull request Oct 29, 2025
* Copy sanctum-infinity

* Add buffer-layout endpoint to solana-functions

* changeset
Subarna-Singh pushed a commit that referenced this pull request Oct 29, 2025
* Copy sanctum-infinity

* Add buffer-layout endpoint to solana-functions

* changeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants