Skip to content

Conversation

@dskloetc
Copy link
Contributor

@dskloetc dskloetc commented Nov 21, 2025

OPDATA-5064

Description

token-balance has a solana endpoint which can fetch balances from wallets for a specific token on Solana and convert them with a give price oracle. But this endpoint takes addresses from a simple string address list.

There is also the solvJlp endpoint which takes addresses from a multi-chain address list (such as this one) and filters specifically on JLP addresses and uses 2 price oracles to convert to USD and then to BTC.

In this PR we add the solanaMulti endpoint which, like the solana endpoint can fetch balance from any Solana token, but like the solvJlp endpoint takes addresses from a multi-chain address list.

Changes

  1. Copied files from the solana endpoint to make reviewing easier.
  2. Change input params to match the multi-chain address list.
  3. Make the price oracle optional for tokens that are (or 1:1 represent) the token we want.
  4. Implement the endpoint.

Steps to Test

  1. Adjusted copied unit and integration tests.
  2. curl --silent -S -X POST http://localhost:8082 -H 'Content-Type: application/json' -d '{
        "data": {
      "endpoint": "multiReserves",
      "input": [
        {
          "abiName": "SolvSolanaMultiAddressList",
          "contractAddress": "0x1Ce4cF759BD9594f17f4F241773A4201879b402d",
          "contractAddressNetwork": "bsc",
          "description": "cbbtc token balance",
          "disableDuplicateAddressFiltering": true,
          "indexer": "token_balance",
          "indexerEndpoint": "solanaMulti",
          "indexerParams": {
            "token": "cbbtc"
          },
          "protocol": "por_address_list",
          "protocolEndpoint": "multichainAddress"
        },
        {
          "abiName": "SolvSolanaMultiAddressList",
          "contractAddress": "0x1Ce4cF759BD9594f17f4F241773A4201879b402d",
          "contractAddressNetwork": "bsc",
          "description": "WBTC token balance",
          "disableDuplicateAddressFiltering": true,
          "indexer": "token_balance",
          "indexerEndpoint": "solanaMulti",
          "indexerParams": {
            "token": "WBTC",
            "priceOracle": {
              "contractAddress": "0xfdFD9C85aD200c506Cf9e21F1FD8dd01932FBB23",
              "network": "ethereum"
            }
          },
          "protocol": "por_address_list",
          "protocolEndpoint": "multichainAddress"
        }
      ]
    }
      }'
    {
      "jobRunID": "1",
      "result": "9568915130000000000",
      "statusCode": 200,
      "data": {
        "result": "9568915130000000000",
        "details": "{\"result\":\"9568915130000000000\",\"statusCode\":200,\"decimals\":18,\"description\":\"cbbtc token balance\"},{\"result\":\"0\",\"statusCode\":200,\"decimals\":18,\"description\":\"WBTC token balance\"}",
        "statusCode": 200,
        "decimals": 18,
        "timestamps": {
          "providerDataRequestedUnixMs": 1763742095984,
          "providerDataReceivedUnixMs": 1763742096741
        }
      },
      "meta": {
        "adapterName": "PROOF_OF_RESERVES"
      },
      "metricsMeta": {
        "feedId": "53f49a03e0bef2fa73671c509498c41e"
      }
    }
    

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.
  • 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 Nov 21, 2025

🦋 Changeset detected

Latest commit: 2ceb42e

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

This PR includes changesets to release 1 package
Name Type
@chainlink/token-balance-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 November 21, 2025 16:22
@dskloetc dskloetc requested a review from a team November 21, 2025 16:22
@dskloetc dskloetc enabled auto-merge (squash) November 21, 2025 16:23
this.getTokenPrice(priceOracle),
])

const maxTokenDecimals = tokenResponse.result.reduce(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just scale everything to 18

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