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: notify about needed account re import #1452

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

mateuszjasiuk
Copy link
Collaborator

@mateuszjasiuk mateuszjasiuk commented Dec 30, 2024

Resolves #1440
Figma https://www.figma.com/design/NFyHbLZXBSl3aUsMxtffvV/Namada-End-User-Interface-V1.0-%2F-Phase-1%3A-Block-Party?node-id=9363-2665&t=x241erdmP130E13G-1

Testing

  • paste this script in extension console window to clear pseudoExtendedKeys <3 chatgpt :)
// Open the IndexedDB
const dbRequest = indexedDB.open("Namada::IndexedDB");

// Handle database open success
dbRequest.onsuccess = function (event) {
    const db = event.target.result;

    // Begin a transaction on the "vault" store
    const transaction = db.transaction(["Namada::IndexedDB"], "readwrite");
    const store = transaction.objectStore("Namada::IndexedDB");

    // Get the current data from the "vault" store
    const getRequest = store.get("vault");

    getRequest.onsuccess = function () {
        let data = getRequest.result;

        if (data && data.data && data.data.data && data.data.data["key-store"]) {
            // Iterate over the array and set "pseudoExtendedKey" to undefined in the "public" field
            data.data.data["key-store"] = data.data.data["key-store"].map(item => {
                if (item.public && item.public.hasOwnProperty("pseudoExtendedKey")) {
                    item.public["pseudoExtendedKey"] = undefined;
                }
                return item;
            });

            // Save the updated data back to IndexedDB
            const updateRequest = store.put(data); // No separate key provided here

            updateRequest.onsuccess = function () {
                console.log("Data successfully updated.");
            };

            updateRequest.onerror = function (err) {
                console.error("Error updating data:", err);
            };
        } else {
            console.error("Expected structure not found in 'vault'.");
        }
    };

    getRequest.onerror = function (err) {
        console.error("Error fetching data from IndexedDB:", err);
    };
};
  • next time you open the extension you should see popup window
  • close popup window - you should see warning icons next to affected accounts
  • remove one of your accounts, check if you still see popup
  • add new account - there should be no icon next to newly added account
  • try to connect ledger device - it should always be up to date for now

.filter((account) => account.parentId)
.map((account) => {
const outdated =
account.type !== AccountType.Ledger &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We ignore ledger for now

}}
/>
))}
<>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here I only wrapped everything in fragment to add Outlet

Copy link
Collaborator

Choose a reason for hiding this comment

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

don't need to excuse in advanced, we can see it if we hide the whitespaces 😁

Screenshot 2024-12-30 at 16 43 58

"p-5 pt-10"
)}
>
<div
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Some of this was copied from namadillo's ModalContainer 😛

@mateuszjasiuk mateuszjasiuk force-pushed the feat/notify-about-needed-account-update branch 2 times, most recently from 9222c5d to 3a7dbe6 Compare December 30, 2024 12:01
@mateuszjasiuk mateuszjasiuk force-pushed the feat/notify-about-needed-account-update branch from 3a7dbe6 to 753529f Compare December 30, 2024 13:03
@mateuszjasiuk mateuszjasiuk requested review from pedrorezende and euharrison and removed request for pedrorezende December 30, 2024 13:03
@mateuszjasiuk mateuszjasiuk marked this pull request as ready for review December 30, 2024 13:03
{alias}
</label>
<DropdownMenu
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did not change that, just wrapped in Stack

Copy link
Collaborator

@euharrison euharrison left a comment

Choose a reason for hiding this comment

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

Nice!

To test, I downloaded the release version 0.3.6 and installed locally, on the same folder that the project builds /apps/extensions/build/chrome/, then imported the key

After that, I switched to this branch, built the chrome extension, and run it. Then I was able to see the new flow

}}
/>
))}
<>
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't need to excuse in advanced, we can see it if we hide the whitespaces 😁

Screenshot 2024-12-30 at 16 43 58

@euharrison
Copy link
Collaborator

closes #1430

@mateuszjasiuk mateuszjasiuk merged commit f27adef into main Jan 3, 2025
10 checks passed
@mateuszjasiuk mateuszjasiuk deleted the feat/notify-about-needed-account-update branch January 3, 2025 18:56
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.

Notify users about outdated accounts information in the keychain
2 participants