Skip to content

Conversation

@ulissesferreira
Copy link
Contributor

@ulissesferreira ulissesferreira commented Oct 30, 2025

Explanation

We have stopped using derivation paths for account creation, only using the field groupIndex. We had made this change on the Snap side but we didn't really change the TronProvider to match.

References

NWNT-646

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Switch Tron account creation to index-based flow and wire discovery via KeyringClient, updating tests accordingly.

  • TrxAccountProvider:
    • Replace derivation-path-based creation with index-based createAccounts, passing addressType: Eoa and scope: Mainnet.
    • Remove manual entropy injection; validate via assertIsBip44Account.
    • discoverAccounts now calls KeyringClient.discoverAccounts and then invokes createAccounts with groupIndex.
  • Tests (TrxAccountProvider.test.ts):
    • Update mock keyring createAccount to accept { index } and ensure idempotency by groupIndex.
    • Add discoverAccounts mock and route keyring_discoverAccounts through SnapController:handleRequest.
    • Adjust discovery tests to use the new mock and verify creation/return of existing accounts; minor comment fixes.

Written by Cursor Bugbot for commit 5415155. This will update automatically on new commits. Configure here.

@ulissesferreira ulissesferreira requested a review from a team as a code owner October 30, 2025 15:15
cursor[bot]

This comment was marked as outdated.

@ulissesferreira ulissesferreira force-pushed the NWNT-646-tron-addresses-are-not-generated-for-all-accounts branch from 571281b to 804dfda Compare October 30, 2025 15:52
@ulissesferreira ulissesferreira force-pushed the NWNT-646-tron-addresses-are-not-generated-for-all-accounts branch from 804dfda to 567927b Compare October 30, 2025 16:19
import type { EntropySourceId, KeyringAccount } from '@metamask/keyring-api';
import { TrxAccountType, TrxScope } from '@metamask/keyring-api';
import { KeyringAccountEntropyTypeOption } from '@metamask/keyring-api';
// import { KeyringAccountEntropyTypeOption } from '@metamask/keyring-api';
Copy link
Contributor

Choose a reason for hiding this comment

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

this 🧹

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol i have it locally and didn't push

@ulissesferreira ulissesferreira force-pushed the NWNT-646-tron-addresses-are-not-generated-for-all-accounts branch from fbe9b1b to 5415155 Compare October 30, 2025 16:45
Copy link
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

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

LGTM! That looks really better now, thanks 💪

@ccharly ccharly changed the title fix: Tron addresses not being generated for all BIP44 accounts fix(multichain-account-service): fix Tron addresses not being generated for all BIP44 accounts Oct 31, 2025
@ulissesferreira ulissesferreira merged commit 602b01b into main Oct 31, 2025
258 of 259 checks passed
@ulissesferreira ulissesferreira deleted the NWNT-646-tron-addresses-are-not-generated-for-all-accounts branch October 31, 2025 10:53
@ccharly
Copy link
Contributor

ccharly commented Oct 31, 2025

We forgot the changelog (I thought this was enforced by the CI, I'm a bit confused by that 😅)

Anyway, @ulissesferreira can you please make another PR for this?

ccharly pushed a commit that referenced this pull request Oct 31, 2025
## Explanation

Forgotten changelog

## References

#7010 

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Update `packages/multichain-account-service/CHANGELOG.md` to note a
fix: TRX account creation now uses `groupIndex` instead of
`derivationPath`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
94ccbb1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

4 participants