Skip to content

Add Aave endpoint to get user account data#4107

Open
tmcollins4 wants to merge 5 commits intobitpay:masterfrom
tmcollins4:addGetAaveUserDataEndpoint
Open

Add Aave endpoint to get user account data#4107
tmcollins4 wants to merge 5 commits intobitpay:masterfrom
tmcollins4:addGetAaveUserDataEndpoint

Conversation

@tmcollins4
Copy link

Description

Added an endpoint to get user account data from Aave.

Changelog

  • Added Aave Pool V2/V3 ABIs under packages/bitcore-node/src/providers/chain-state/evm/abi/.
  • Added Aave pool address mapping and lookup helper in packages/bitcore-node/src/providers/chain-state/evm/api/aave.ts.
  • Added /api/:chain/:network/aave/account/:address endpoint; now implemented via CSP and returns BigInt values as strings.
  • Added CSP method getAaveUserAccountData to centralize the Aave RPC call.

Testing Notes

I made a script to call the endpoint with a wallet address


Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.
  • I have added the appropriate package tag(s) (e.g. BWC if modifying the bitcore-wallet-client package, CLI if modifying the bitcore-cli package, etc.)
  • I have verified that this is not an existing PR (open or closed)

@kajoseph kajoseph added the BCN This pull request modifies the bitcore-node package label Feb 16, 2026
Copy link
Collaborator

@kajoseph kajoseph left a comment

Choose a reason for hiding this comment

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

Because we're just passing through the Web3 response and there are other systems that depend on this response, let's add a test case for the CSP method to ensure it returns the fields we expect. That way we aren't waiting to see if something breaks if we upgrade web3 and the response changes or something.

…addresses, Added jsdoc for contract address sourcing
sandbox.restore();
});

it('should return expected fields for Aave v3 account data', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These unit tests are fine for testing that the code isn't just flat out broken, but I was hoping for an actual web3 call instead of a stub. Perhaps I should have specified we should add an integration test. I'm not sure if adding an ETH.sepolia config to the test config would break anything similar to how we have a BASE.sepolia test config pointed to a public RPC endpoint.

Copy link
Author

Choose a reason for hiding this comment

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

Added integration tests for Aave v2 and v3 following the same pattern as evm.test.ts

async getAaveUserAccountData(params: { network: string; address: string; version: 'v2' | 'v3' }): Promise<any> {
const { network, address, version } = params;
const poolAddress = getAavePoolAddress(this.chain, network, version);
if (!poolAddress) {
Copy link
Contributor

@leolambo leolambo Feb 18, 2026

Choose a reason for hiding this comment

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

when true this check will throw a 500 in routes when it was actually a 400. either do this check in routes or properly catch this error in routes and send a 400 response

res.status(400).send('Unsupported Aave version');
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to do some address validation here

e.g :

     if (!Web3.utils.isAddress(address)) {
        res.status(400).send('Invalid address');
        return;
      }

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

Labels

BCN This pull request modifies the bitcore-node package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments