add aave and tokenAllowance passthroughs#4130
Open
tmcollins4 wants to merge 2 commits intobitpay:masterfrom
Open
add aave and tokenAllowance passthroughs#4130tmcollins4 wants to merge 2 commits intobitpay:masterfrom
tmcollins4 wants to merge 2 commits intobitpay:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds new Bitcore Wallet Service (BWS) passthrough endpoints to expose Aave data and ERC20 token allowance via the existing BWS → V8 pattern, along with corresponding WalletService/V8 plumbing and tests.
Changes:
- Added
AaveRouterand mounted new/v1/service/aave/*POST routes. - Added
/v1/token/allowancePOST route plus aWalletService.getTokenAllowancepassthrough. - Added V8 explorer methods for Aave endpoints and unit tests for the new routes/methods.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bitcore-wallet-service/src/lib/routes/aave.ts | Introduces AaveRouter implementing the new Aave passthrough endpoints. |
| packages/bitcore-wallet-service/src/lib/expressapp.ts | Wires up AaveRouter and adds the /v1/token/allowance route. |
| packages/bitcore-wallet-service/src/lib/server.ts | Adds WalletService passthrough methods for Aave and token allowance. |
| packages/bitcore-wallet-service/src/lib/blockchainexplorers/v8.ts | Adds V8 client methods to call V8 Aave endpoints. |
| packages/bitcore-wallet-service/test/v8.test.ts | Adds unit tests for the new V8 methods (including token allowance). |
| packages/bitcore-wallet-service/test/expressapp.test.ts | Adds route tests for Aave endpoints and /v1/token/allowance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kajoseph
reviewed
Mar 23, 2026
Collaborator
kajoseph
left a comment
There was a problem hiding this comment.
We should
- in server.ts, add some types and/or JSDocs as well as input validation
- add methods to BWC to further improve ergonomics
| } | ||
|
|
||
| getTokenAllowance(opts) { | ||
| const bc = this._getBlockchainExplorer(opts.chain || Defaults.EVM_CHAIN, opts.network); |
Collaborator
There was a problem hiding this comment.
Should add some validation to opts, and maybe a param type or at least JSDoc to this fn as well. Something like
if (!checkRequired(opts, ['chain', 'network', 'tokenAddress', 'ownerAddress', 'spenderAddress'])) {
throw new Error('Missing required parameters');
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added BWS passthrough routes for Aave endpoints and token allowance, following the existing BWS → V8 → BCN pattern. These allow the app/client to access Aave data and token allowance checks through BWS (via BWC).
Changelog
AaveRouterinpackages/bitcore-wallet-service/src/lib/routes/aave.tsfollowing theTssRouterpattern for route organization.POST /bws/api/v1/service/aave/userAccountData— returns Aave user health factor, collateral, debt data, etc.POST /bws/api/v1/service/aave/reserveData— returns Aave reserve data (variable borrow rate, etc.).POST /bws/api/v1/service/aave/reserveTokensAddresses— returns Aave reserve token addresses (aToken, variableDebtToken, etc.).POST /bws/api/v1/token/allowance— returns ERC20 token allowance for a given owner/spender pair.getAaveUserAccountData,getAaveReserveData,getAaveReserveTokensAddressesinv8.ts.getAaveUserAccountData,getAaveReserveData,getAaveReserveTokensAddresses,getTokenAllowanceinserver.ts.getServerWithAuthconsistent with existing passthrough endpoints like/v1/token/info.v8.test.tscovering all new V8 methods.expressapp.test.tscovering all new routes.Testing Notes
Checklist