Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add importTime to the accounts controller metadata #4135

Closed
owencraston opened this issue Apr 8, 2024 · 2 comments · Fixed by #4193
Closed

feat: add importTime to the accounts controller metadata #4135

owencraston opened this issue Apr 8, 2024 · 2 comments · Fixed by #4193
Assignees

Comments

@owencraston
Copy link
Contributor

owencraston commented Apr 8, 2024

On mobile we are relying on the import time of an account to perform certain U.I logic. This is data we are getting from the the metadata within the identities object of the preferences controller.

Example

Preferences controller identities

{
  "0x4A29682b2636147F608CF7554F47bd9877117bDd": {
    "address": "0x4A29682b2636147F608CF7554F47bd9877117bDd",
    "name": "Account 1",
    "importTime": 1712527955387
  },
  "0x769ddE14f7D7D48eD431d727801620F46d7aE29e": {
    "address": "0x769ddE14f7D7D48eD431d727801620F46d7aE29e",
    "name": "Account 2",
    "importTime": 1712528157517
  },
  "0x9351164ED35aCe26F345F749B9Cb85b5C699E2b7": {
    "address": "0x9351164ED35aCe26F345F749B9Cb85b5C699E2b7",
    "name": "Account 3",
    "importTime": 1712528160433
  }

Equivalent accounts controller data

{
  "accounts": {
    "6ffaed06-b348-4fc1-a227-972de373effd": {
      "id": "6ffaed06-b348-4fc1-a227-972de373effd",
      "address": "0x4a29682b2636147f608cf7554f47bd9877117bdd",
      "options": {},
      "methods": [
        "personal_sign",
        "eth_sign",
        "eth_signTransaction",
        "eth_signTypedData_v1",
        "eth_signTypedData_v3",
        "eth_signTypedData_v4"
      ],
      "type": "eip155:eoa",
      "metadata": {
        "name": "Account 1",
        "keyring": {
          "type": "HD Key Tree"
        },
        "lastSelected": 1712528808432
      }
    },
    "59e23a68-b6b7-43a8-90f8-7236f748fe00": {
      "id": "59e23a68-b6b7-43a8-90f8-7236f748fe00",
      "address": "0x769dde14f7d7d48ed431d727801620f46d7ae29e",
      "options": {},
      "methods": [
        "personal_sign",
        "eth_sign",
        "eth_signTransaction",
        "eth_signTypedData_v1",
        "eth_signTypedData_v3",
        "eth_signTypedData_v4"
      ],
      "type": "eip155:eoa",
      "metadata": {
        "name": "Account 2",
        "keyring": {
          "type": "HD Key Tree"
        },
        "lastSelected": 1712528808551
      }
    },
    "04cc2134-f9f6-4a42-b07b-3ebc40078f4f": {
      "id": "04cc2134-f9f6-4a42-b07b-3ebc40078f4f",
      "address": "0x9351164ed35ace26f345f749b9cb85b5c699e2b7",
      "options": {},
      "methods": [
        "personal_sign",
        "eth_sign",
        "eth_signTransaction",
        "eth_signTypedData_v1",
        "eth_signTypedData_v3",
        "eth_signTypedData_v4"
      ],
      "type": "eip155:eoa",
      "metadata": {
        "name": "Account 3",
        "keyring": {
          "type": "HD Key Tree"
        },
        "lastSelected": 1712528808747
      }
    }
  },
  "selectedAccount": "04cc2134-f9f6-4a42-b07b-3ebc40078f4f"
}

In order to completely migrate all accounts data we will need this data.

cc @montelaidev

@montelaidev
Copy link
Contributor

montelaidev commented Apr 15, 2024

Blocked by new release of keyring api to add importTime to InternalAccounts and updating of Snap Keyring

@montelaidev
Copy link
Contributor

Change in keyring api has been merged and a new release has been published.

montelaidev added a commit that referenced this issue Apr 19, 2024
…keyring to 4.0.0 and snap dependencies (#4193)

## Explanation

This PR bumps the `@metamask/keyring-api`, `@metamask/eth-snap-keyring`
and snap dependencies in the `AccountsController`

## References

Resolves: [4135](#4135)

## Changelog

### `@metamask/accounts-controller`

- **CHANGED**: Bump dependency `@metamask/keyring-api` to `^6.0.0`
- **CHANGED**: Bump dependency `@metamask/eth-snap-keyring` to `^4.0.0`
- **CHANGED**: Bump dev dependency `@metamask/snaps-controller` to
`^7.0.1`
- **CHANGED**: Bump dependency `@metamask/snaps-sdk` to `^4.0.1`
- **CHANGED**: Bump dependency `@metamask/snaps-utils` to `^7.1.0`

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants