Skip to content

Conversation

@dskloetc
Copy link
Contributor

https://smartcontract-it.atlassian.net/browse/OPDATA-3674

Description

We need to be able to get Solana balances for a PoR feed.

There is an existing solana endpoint. This can query balances of tokens on the Solana network.
But we need balances of the native Solana token on the same network so the new solana-balance endpoint queries just the native token.
This uses a different method on the the same SOLANA_RPC_URL endpoint.

Note: I copied some files for xrp in a separate commit to make it easier to see the difference between the two endpoints.

Changes

Add solana-balance endpoint which given a list of addresses returns the balance for each individual address.

Steps to Test

  1. Unit/integration tests added.
  2. Tested manually together with proof-of-reserves in another branch with a supporting change to proof-of-reserves.
curl --silent -S -X POST http://localhost:8080 -H 'Content-Type: application/json' -d '{
  "data": {
  "endpoint": "solana-balance",
  "addresses": [
    {
      "address": "7d73NFxuWQ2F248NA4XwxE95oFfbWZrc1sg4wcDJjzTq"
    }
  ]
}
}'
{
  "data": {
    "result": [
      {
        "address": "7d73NFxuWQ2F248NA4XwxE95oFfbWZrc1sg4wcDJjzTq",
        "balance": "8630400"
      }
    ],
    "decimals": 9
  },
  "statusCode": 200,
  "result": null,
  "timestamps": {
    "providerDataRequestedUnixMs": 1757956600397,
    "providerDataReceivedUnixMs": 1757956602611
  },
  "meta": {
    "adapterName": "TOKEN_BALANCE",
    "metrics": {
      "feedId": "{\"addresses\":[{\"address\":\"7d73nfxuwq2f248na4xwxe95offbwzrc1sg4wcdjjztq\"}]}"
    }
  }
}

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 Sep 15, 2025

🦋 Changeset detected

Latest commit: 56a0366

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

This PR includes changesets to release 3 packages
Name Type
@chainlink/token-balance-adapter Minor
@chainlink/proof-of-reserves-adapter Patch
@chainlink/renvm-address-set-adapter Patch

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 changed the title Add s Add solana-balance endpoint to token-balance EA Sep 15, 2025
@dskloetc dskloetc marked this pull request as ready for review September 15, 2025 17:20
mxiao-cll
mxiao-cll previously approved these changes Sep 15, 2025
@dskloetc dskloetc requested a review from mxiao-cll September 15, 2025 17:58
@dskloetc dskloetc enabled auto-merge (squash) September 17, 2025 07:03
@dskloetc dskloetc merged commit 2f9d34f into main Sep 17, 2025
17 checks passed
@dskloetc dskloetc deleted the kloet/solana-balance branch September 17, 2025 07:10
@github-actions github-actions bot mentioned this pull request Sep 17, 2025
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