chore: narrow findByIds and fetchNewTransactionsForAccount types#251
Merged
Conversation
This was referenced Mar 23, 2026
27c13b9 to
2622103
Compare
ulissesferreira
added a commit
that referenced
this pull request
Mar 23, 2026
## Summary - Add optional `limit` to `TrongridApiClient.getTransactionInfoByAddress` (passed as query param). - Add `TransactionsService.checkAddressActivity(scope, address)` — uses `limit: 1` to detect any history without downloading full pages. - `discoverAccounts` uses `checkAddressActivity` instead of `fetchNewTransactionsForAccount`. ## Motivation Account discovery only needs to know if an address has ever been used; a single-transaction probe is cheaper than a full incremental fetch. ## Dependencies **Merge after** [`chore/narrow-findByIds...`](#251) (this branch is based on that commit). Rebase onto `main` after PR 251 lands if needed. ## Changelog Updates `packages/snap/CHANGELOG.md` under **[Unreleased] → Changed**. ## Test plan - [x] `yarn test` — includes `checkAddressActivity` true / false / error propagation - [x] `keyring` `discoverAccounts` tests mock `checkAddressActivity` - [x] `yarn build:prod`
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.
Summary
AccountsRepository.findByIds/AccountsService.findByIdsnow returnTronKeyringAccount[](nevernull); missing IDs are simply omitted from the result.TransactionsService.fetchNewTransactionsForAccountacceptsTronKeyringAccountinstead of genericKeyringAccount; remove redundant cast when mapping transactions.CronHandler: useaccounts.length === 0/accounts.length > 0instead of falsy checks onfindByIdsresults.ethAddress→hexAddresswherecomputeAddressoutput is converted for Tron.Motivation
The previous
| nullreturn type was misleading (filteralways produced an array). Narrowing types reduces impossible states and simplifies callers.Test plan
yarn lint:fixyarn testyarn build:prodNo user-facing behavior change.