* This should be used instead of directly calling PreferencesController.setAccountLabel or AccountsController.setAccountName in order to keep the names in sync * We are currently incrementally migrating the accounts data to the AccountsController so we must keep these values * in sync until th
(address: string, label: string)
| 1659 | * in sync until the migration is complete. |
| 1660 | */ |
| 1661 | setAccountLabel(address: string, label: string) { |
| 1662 | const { AccountsController, PreferencesController } = this.context; |
| 1663 | const accountToBeNamed = AccountsController.getAccountByAddress(address); |
| 1664 | if (accountToBeNamed === undefined) { |
| 1665 | throw new Error(`No account found for address: ${address}`); |
| 1666 | } |
| 1667 | AccountsController.setAccountName(accountToBeNamed.id, label); |
| 1668 | PreferencesController.setAccountLabel(address, label); |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | /** |
no outgoing calls
no test coverage detected