Skip to content

Conversation

@sahar-fehri
Copy link
Contributor

Explanation

PR to highlight external usage of assets-controllers state

References

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

| **`transaction-pay-controller`** | `TokenBalancesController`, `AccountTrackerController`, `TokensController`, `TokenRatesController`, `CurrencyRateController` | Pay gas fees with alternative tokens - needs balances, metadata, and rates |
| **`bridge-controller`** | `CurrencyRateController`, `TokenRatesController`, `MultichainAssetsRatesController` | Cross-chain bridging - needs exchange rates for EVM + non-EVM assets for quote calculations |
| **`subscription-controller`** | `MultichainBalancesController` | Crypto subscription payments - needs multi-chain balances to offer payment options |
| **`core-backend`** | `TokenBalancesController` | Real-time balance coordination - adjusts polling based on WebSocket connection state |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

core-backend will be part of the new unified logic; just here to highlight that this is something outside of our assets-controllers package using the tokenBalancesController

| Current Controller | Current State Property | Target Property |
|-------------------|----------------------|-----------------|
| `TokenBalancesController` | `tokenBalances[account][chainId][token]` | `assetsBalance[accountId][assetId]` |
| `AccountTrackerController` | `accountsByChainId[chainId][account].balance` | `assetsBalance[accountId][assetId]` (native) |
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an example or an exhaustive list?

If it's meant to be exhaustive, it is missing MultichainBalancesController.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unless we want to do it separately for evm and non-evm.

```

**Checklist before removal:**
- [ ] 100% reads from new state for 4+ weeks
Copy link
Contributor

Choose a reason for hiding this comment

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

does the ETA here include both UI as well ( Mobile and extension ) ?

└─► parseRequiredTokens() // in required-tokens.ts
└─► getTokenBalance() // in token.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

TransactionPayController currently expects balances and addresses in hex format, whereas we plan to provide them in CAIP-19 and numeric formats. Do you think it would be better to expose a helper function that converts to the expected format, or should we ask the Confirmations team to migrate to the new CAIP-19 standard ?

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