From f205ac708886ec289b6c486e53be702dfc2e4e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Fri, 20 Oct 2023 08:54:12 +0200 Subject: [PATCH 01/11] Retrieve avatar to wallet --- src/redux-state/thunks/wallet.ts | 7 ++-- src/shared/utils/ens.ts | 5 ++- src/shared/utils/names.ts | 34 +++++++++++-------- .../LeaderboardList/LeaderboardItem.tsx | 10 +++--- 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/redux-state/thunks/wallet.ts b/src/redux-state/thunks/wallet.ts index 336d3dc85..27891349f 100644 --- a/src/redux-state/thunks/wallet.ts +++ b/src/redux-state/thunks/wallet.ts @@ -1,4 +1,4 @@ -import { resolveAddressToName } from "shared/utils" +import { resolveAddressToWalletData } from "shared/utils" import { updateBalances, updateConnectedWallet, @@ -22,13 +22,16 @@ export const fetchWalletName = createDappAsyncThunk( claim: { useConnectedWallet }, } = getState() - const resolvedName = await resolveAddressToName(address) + const [resolvedName, resolvedAvatar] = await resolveAddressToWalletData( + address + ) if (resolvedName) { dispatch( updateConnectedWallet({ address, name: resolvedName, + avatar: resolvedAvatar || undefined, }) ) diff --git a/src/shared/utils/ens.ts b/src/shared/utils/ens.ts index 691311d95..9241ae9df 100644 --- a/src/shared/utils/ens.ts +++ b/src/shared/utils/ens.ts @@ -11,8 +11,11 @@ export const resolveENS = (name: string) => { export const resolveAddressToENS = async (address: string) => { const name = await ethereumProvider.lookupAddress(address) + const avatar = await ethereumProvider.getAvatar(address) + if (!name) { throw Error("Invalid ENS domain name") } - return name + + return { name, avatar } } diff --git a/src/shared/utils/names.ts b/src/shared/utils/names.ts index d19f686ef..d73fe302f 100644 --- a/src/shared/utils/names.ts +++ b/src/shared/utils/names.ts @@ -4,6 +4,7 @@ import { isValidUNSDomainName, resolveAddressToUNS, resolveUNS } from "./uns" type NameWithProvider = { name: string + avatar?: string address: string type: "ens" | "uns" } @@ -11,7 +12,7 @@ const NAMES_CACHE_STRORAGE_KEY = "taho.cachedNames" const MAX_CACHE_AGE = 1000 * 60 * 60 * 24 * 7 // 1 week const resolveAddressPromiseCache: { - [address: string]: Promise + [address: string]: Promise<(string | null)[]> } = {} const getCachedNames = () => { @@ -21,7 +22,7 @@ const getCachedNames = () => { return JSON.parse(cachedNamesUnparsed) } -const addCachedName = ({ name, address, type }: NameWithProvider) => { +const addCachedName = ({ name, avatar, address, type }: NameWithProvider) => { const cachedNames = getCachedNames() const normalizedAddress = normalizeAddress(address) @@ -29,7 +30,7 @@ const addCachedName = ({ name, address, type }: NameWithProvider) => { ...cachedNames, [normalizedAddress]: { ...(cachedNames[normalizedAddress] ?? {}), - [type]: name, + [type]: [name, avatar], lastUpdate: Date.now(), }, }) @@ -37,9 +38,9 @@ const addCachedName = ({ name, address, type }: NameWithProvider) => { } const resolveENSPromise = (address: string) => - resolveAddressToENS(address).then((name): string => { - addCachedName({ type: "ens", address, name }) - return name + resolveAddressToENS(address).then(({ name, avatar }): (string | null)[] => { + addCachedName({ type: "ens", address, name, avatar: avatar || "" }) + return [name, avatar] }) const resolveUNSPromise = (address: string) => @@ -53,25 +54,27 @@ const resolveUnknownNamePromise = () => setTimeout(() => resolve(null), 15000) }) -const resolveAddressToNameWithoutCache = async (address: string) => { +const resolveAddressToWalletDataWithoutCache = async (address: string) => { const normalizedAddress = normalizeAddress(address) if (resolveAddressPromiseCache[normalizedAddress] === undefined) { - resolveAddressPromiseCache[normalizedAddress] = Promise.any([ + resolveAddressPromiseCache[normalizedAddress] = Promise.any([ resolveENSPromise(normalizedAddress), resolveUNSPromise(normalizedAddress), resolveUnknownNamePromise(), - ]) + ]) as Promise<(string | null)[]> } - const resolvedName = await resolveAddressPromiseCache[normalizedAddress] + const [resolvedName, resolvedAddress] = await resolveAddressPromiseCache[ + normalizedAddress + ] - return resolvedName + return [resolvedName, resolvedAddress] } -export const resolveAddressToName = async ( +export const resolveAddressToWalletData = async ( address: string -): Promise => { +): Promise<(string | null)[]> => { const cachedNames = getCachedNames() const normalizedAddress = normalizeAddress(address) @@ -81,9 +84,10 @@ export const resolveAddressToName = async ( return cachedItem.ens ?? cachedItem.uns } - const name = await resolveAddressToNameWithoutCache(normalizedAddress) + const [resolvedName, resolvedAddress] = + await resolveAddressToWalletDataWithoutCache(normalizedAddress) - return name + return [resolvedName, resolvedAddress] } export const resolveNameToAddress = async (addressOrName: string) => { diff --git a/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx b/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx index 869fdbf8f..082d2a38c 100644 --- a/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx +++ b/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx @@ -1,10 +1,10 @@ -import React, { useCallback, useEffect, useState } from "react" +import React, { useEffect, useState } from "react" import Icon from "shared/components/Icon" import crossIcon from "shared/assets/icons/plus.svg" import classNames from "classnames" import { isSameAddress, - resolveAddressToName, + resolveAddressToWalletData, separateThousandsByComma, truncateAddress, } from "shared/utils" @@ -27,10 +27,8 @@ export default function LeaderboardItem({ useEffect(() => { const getName = async () => { - const name = await resolveAddressToName(address) - if (name) { - setUsername(name) - } + const [name] = await resolveAddressToWalletData(address) + if (name) setUsername(name) } getName() }, [address]) From 81ad61796b435b7f5351a1747efbb9d147864a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Fri, 20 Oct 2023 11:01:04 +0200 Subject: [PATCH 02/11] Refactor wallet data resolving --- src/redux-state/thunks/wallet.ts | 14 +++---- src/shared/utils/ens.ts | 16 +++++--- src/shared/utils/names.ts | 41 ++++++++++++------- .../LeaderboardList/LeaderboardItem.tsx | 2 +- 4 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/redux-state/thunks/wallet.ts b/src/redux-state/thunks/wallet.ts index 27891349f..085b127b1 100644 --- a/src/redux-state/thunks/wallet.ts +++ b/src/redux-state/thunks/wallet.ts @@ -22,25 +22,23 @@ export const fetchWalletName = createDappAsyncThunk( claim: { useConnectedWallet }, } = getState() - const [resolvedName, resolvedAvatar] = await resolveAddressToWalletData( - address - ) + const { name, avatar } = await resolveAddressToWalletData(address) - if (resolvedName) { + if (name) { dispatch( updateConnectedWallet({ address, - name: resolvedName, - avatar: resolvedAvatar || undefined, + name, + avatar, }) ) if (useConnectedWallet) { - dispatch(setClaimingUser({ name: resolvedName, address })) + dispatch(setClaimingUser({ name, address })) } } - return resolvedName + return name } ) diff --git a/src/shared/utils/ens.ts b/src/shared/utils/ens.ts index 9241ae9df..441da0f70 100644 --- a/src/shared/utils/ens.ts +++ b/src/shared/utils/ens.ts @@ -10,12 +10,16 @@ export const resolveENS = (name: string) => { } export const resolveAddressToENS = async (address: string) => { - const name = await ethereumProvider.lookupAddress(address) - const avatar = await ethereumProvider.getAvatar(address) + try { + const name = await ethereumProvider.lookupAddress(address) + const avatar = await ethereumProvider.getAvatar(address) - if (!name) { - throw Error("Invalid ENS domain name") - } + if (!name) { + throw Error("Invalid ENS domain name") + } - return { name, avatar } + return { name, avatar } + } catch { + return { name: null, avatar: null } + } } diff --git a/src/shared/utils/names.ts b/src/shared/utils/names.ts index d73fe302f..26cedd5ad 100644 --- a/src/shared/utils/names.ts +++ b/src/shared/utils/names.ts @@ -2,17 +2,21 @@ import { isProbablyEVMAddress, normalizeAddress } from "./address" import { isValidENSDomainName, resolveENS, resolveAddressToENS } from "./ens" import { isValidUNSDomainName, resolveAddressToUNS, resolveUNS } from "./uns" -type NameWithProvider = { +type WalletData = { name: string avatar?: string +} + +type NameWithProvider = WalletData & { address: string type: "ens" | "uns" } + const NAMES_CACHE_STRORAGE_KEY = "taho.cachedNames" const MAX_CACHE_AGE = 1000 * 60 * 60 * 24 * 7 // 1 week const resolveAddressPromiseCache: { - [address: string]: Promise<(string | null)[]> + [address: string]: Promise } = {} const getCachedNames = () => { @@ -30,17 +34,25 @@ const addCachedName = ({ name, avatar, address, type }: NameWithProvider) => { ...cachedNames, [normalizedAddress]: { ...(cachedNames[normalizedAddress] ?? {}), - [type]: [name, avatar], + [type]: { name, avatar }, lastUpdate: Date.now(), }, }) + localStorage.setItem(NAMES_CACHE_STRORAGE_KEY, newCache) } const resolveENSPromise = (address: string) => - resolveAddressToENS(address).then(({ name, avatar }): (string | null)[] => { - addCachedName({ type: "ens", address, name, avatar: avatar || "" }) - return [name, avatar] + resolveAddressToENS(address).then(({ name, avatar }): WalletData => { + const cachedData = { name: name || "", avatar: avatar || "" } + + addCachedName({ + type: "ens", + address, + ...cachedData, + }) + + return cachedData }) const resolveUNSPromise = (address: string) => @@ -62,19 +74,17 @@ const resolveAddressToWalletDataWithoutCache = async (address: string) => { resolveENSPromise(normalizedAddress), resolveUNSPromise(normalizedAddress), resolveUnknownNamePromise(), - ]) as Promise<(string | null)[]> + ]) as Promise } - const [resolvedName, resolvedAddress] = await resolveAddressPromiseCache[ - normalizedAddress - ] + const { name, avatar } = await resolveAddressPromiseCache[normalizedAddress] - return [resolvedName, resolvedAddress] + return { name, avatar } } export const resolveAddressToWalletData = async ( address: string -): Promise<(string | null)[]> => { +): Promise => { const cachedNames = getCachedNames() const normalizedAddress = normalizeAddress(address) @@ -84,10 +94,11 @@ export const resolveAddressToWalletData = async ( return cachedItem.ens ?? cachedItem.uns } - const [resolvedName, resolvedAddress] = - await resolveAddressToWalletDataWithoutCache(normalizedAddress) + const { name, avatar } = await resolveAddressToWalletDataWithoutCache( + normalizedAddress + ) - return [resolvedName, resolvedAddress] + return { name, avatar } } export const resolveNameToAddress = async (addressOrName: string) => { diff --git a/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx b/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx index 082d2a38c..0f13acb7a 100644 --- a/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx +++ b/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx @@ -27,7 +27,7 @@ export default function LeaderboardItem({ useEffect(() => { const getName = async () => { - const [name] = await resolveAddressToWalletData(address) + const { name } = await resolveAddressToWalletData(address) if (name) setUsername(name) } getName() From bf111bebea5a2645aa7ecc43300626852f9c485f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Fri, 20 Oct 2023 13:56:09 +0200 Subject: [PATCH 03/11] Refactor avatar fetching --- src/shared/utils/ens.ts | 7 +++---- src/shared/utils/names.ts | 18 ++++++++---------- .../LeaderboardList/LeaderboardItem.tsx | 10 ++++++++-- src/ui/MobileScreen/index.tsx | 1 + src/ui/Nav/AccountInfo.tsx | 4 ++++ src/ui/Nav/index.tsx | 1 + 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/shared/utils/ens.ts b/src/shared/utils/ens.ts index 441da0f70..c26dc0704 100644 --- a/src/shared/utils/ens.ts +++ b/src/shared/utils/ens.ts @@ -14,12 +14,11 @@ export const resolveAddressToENS = async (address: string) => { const name = await ethereumProvider.lookupAddress(address) const avatar = await ethereumProvider.getAvatar(address) - if (!name) { - throw Error("Invalid ENS domain name") - } + if (!name) throw Error("Invalid ENS domain name") + if (!avatar) return { name } return { name, avatar } } catch { - return { name: null, avatar: null } + return null } } diff --git a/src/shared/utils/names.ts b/src/shared/utils/names.ts index 26cedd5ad..34f4c54b0 100644 --- a/src/shared/utils/names.ts +++ b/src/shared/utils/names.ts @@ -3,7 +3,7 @@ import { isValidENSDomainName, resolveENS, resolveAddressToENS } from "./ens" import { isValidUNSDomainName, resolveAddressToUNS, resolveUNS } from "./uns" type WalletData = { - name: string + name?: string avatar?: string } @@ -43,16 +43,14 @@ const addCachedName = ({ name, avatar, address, type }: NameWithProvider) => { } const resolveENSPromise = (address: string) => - resolveAddressToENS(address).then(({ name, avatar }): WalletData => { - const cachedData = { name: name || "", avatar: avatar || "" } - - addCachedName({ - type: "ens", - address, - ...cachedData, - }) + resolveAddressToENS(address).then((data): WalletData | null => { + if (!data) { + addCachedName({ type: "ens", address }) + return null + } - return cachedData + addCachedName({ type: "ens", address, ...data }) + return data }) const resolveUNSPromise = (address: string) => diff --git a/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx b/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx index 0f13acb7a..53382f74a 100644 --- a/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx +++ b/src/ui/Island/RealmDetails/LeaderboardList/LeaderboardItem.tsx @@ -23,12 +23,18 @@ export default function LeaderboardItem({ const { beneficiary: address, amount } = item const isCurrentUser = isSameAddress(address, currentUser) const avatar = useDappSelector(selectWalletAvatar) + const [username, setUsername] = useState("") + const [walletAvatar, setWalletAvatar] = useState(avatar) useEffect(() => { const getName = async () => { - const { name } = await resolveAddressToWalletData(address) + const { name, avatar: userAvatar } = await resolveAddressToWalletData( + address + ) + if (name) setUsername(name) + if (userAvatar) setWalletAvatar(userAvatar) } getName() }, [address]) @@ -50,7 +56,7 @@ export default function LeaderboardItem({ {isCurrentUser && ( diff --git a/src/ui/MobileScreen/index.tsx b/src/ui/MobileScreen/index.tsx index a64dc0b34..81b32e5e0 100644 --- a/src/ui/MobileScreen/index.tsx +++ b/src/ui/MobileScreen/index.tsx @@ -147,6 +147,7 @@ export default function MobileScreen() { .rhs_container { margin-left: auto; align-items: center; + height: 40px; } @media (max-height: 520px) { .nav_container { diff --git a/src/ui/Nav/AccountInfo.tsx b/src/ui/Nav/AccountInfo.tsx index 2d64278a6..35869b939 100644 --- a/src/ui/Nav/AccountInfo.tsx +++ b/src/ui/Nav/AccountInfo.tsx @@ -5,6 +5,7 @@ import { selectWalletName, selectStakingRealmId, selectRealmById, + selectHasLoadedBalances, } from "redux-state" import RealmIcon from "shared/components/RealmIcon" import { getRealmColor } from "shared/constants" @@ -19,6 +20,9 @@ export default function AccountInfo() { const realmId = useDappSelector(selectStakingRealmId) const realm = useDappSelector((state) => selectRealmById(state, realmId)) const color = realmId && getRealmColor(realmId) + const hasBalances = useDappSelector(selectHasLoadedBalances) + + if (!hasBalances) return null return (
diff --git a/src/ui/Nav/index.tsx b/src/ui/Nav/index.tsx index 90ea0d996..347c43d38 100644 --- a/src/ui/Nav/index.tsx +++ b/src/ui/Nav/index.tsx @@ -176,6 +176,7 @@ export default function Nav(): JSX.Element { .rhs_container { margin-left: auto; align-items: center; + height: 40px; } .connect_wallet_btn { From a24fd1deaed3f9510efcf571025319bb0b9dda04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Fri, 20 Oct 2023 16:02:40 +0200 Subject: [PATCH 04/11] Fix UX issues --- src/ui/Nav/AccountInfo.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/ui/Nav/AccountInfo.tsx b/src/ui/Nav/AccountInfo.tsx index 35869b939..2d64278a6 100644 --- a/src/ui/Nav/AccountInfo.tsx +++ b/src/ui/Nav/AccountInfo.tsx @@ -5,7 +5,6 @@ import { selectWalletName, selectStakingRealmId, selectRealmById, - selectHasLoadedBalances, } from "redux-state" import RealmIcon from "shared/components/RealmIcon" import { getRealmColor } from "shared/constants" @@ -20,9 +19,6 @@ export default function AccountInfo() { const realmId = useDappSelector(selectStakingRealmId) const realm = useDappSelector((state) => selectRealmById(state, realmId)) const color = realmId && getRealmColor(realmId) - const hasBalances = useDappSelector(selectHasLoadedBalances) - - if (!hasBalances) return null return (
From 3ef95dfa522cf30d82c30271613fee2fb3799ee4 Mon Sep 17 00:00:00 2001 From: Michalina Date: Mon, 23 Oct 2023 17:48:38 +0200 Subject: [PATCH 05/11] Add links to affected environments in the descriptions of deployment PRs We add links to the affected environments in the description of PRs updating our testing/production environments. --- .github/workflows/update-environments.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-environments.yml b/.github/workflows/update-environments.yml index 1ecda5919..6f2dffe17 100644 --- a/.github/workflows/update-environments.yml +++ b/.github/workflows/update-environments.yml @@ -23,7 +23,13 @@ jobs: FROM_BRANCH: "main" TO_BRANCH: "stage-live" PULL_REQUEST_TITLE: "🪄 [QA] Update stage environments" - PULL_REQUEST_BODY: "This is a pull request that upon merging will update stage environments with recent `main` changes." + PULL_REQUEST_BODY: | + This is a pull request that upon merging will update stage environments with recent `main` changes. + The environments that will be updated: + * Stage live: https://stage-live--taho-development.netlify.app/ + * Stage fork: https://stage-fork--taho-development.netlify.app/ + + Read more: [Deployment to Production Flow](https://github.com/tahowallet/dapp/blob/main/docs/testing-env.md) REVIEWERS: '["andreachapman"]' - uses: studroid/label-pr-or-issue-action@ff48a93f6e1a8d8a6befdae900f54da173b17215 # v1.0.1 with: @@ -58,7 +64,12 @@ jobs: FROM_BRANCH: "stage-live" TO_BRANCH: "release" PULL_REQUEST_TITLE: "🚀 [QA] Update release environment" - PULL_REQUEST_BODY: "This is a pull request that upon merging will update production environment with recent `stage-live` changes." + PULL_REQUEST_BODY: | + This is a pull request that upon merging will update production environment with recent `stage-live` changes. + The environment that will be updated: + * Production: https://taho-development.netlify.app/ (aka https://app.taho.xyz/) + + Read more: [Deployment to Production Flow](https://github.com/tahowallet/dapp/blob/main/docs/testing-env.md) REVIEWERS: '["andreachapman"]' - uses: studroid/label-pr-or-issue-action@ff48a93f6e1a8d8a6befdae900f54da173b17215 # v1.0.1 with: From 3212b41c1366c0ac8de75108ac4c294de5c351e9 Mon Sep 17 00:00:00 2001 From: Michalina Date: Mon, 23 Oct 2023 18:22:46 +0200 Subject: [PATCH 06/11] Add workflow commenting release PRs with the tests list The commit introduces a GH ACtions workflow which adds a comment with tests list to the PRs with the release candidates (PRs that want to merge `stage-live` branch to the `release` branch). The test list should be specified in the `./.github/workflows/test-list/release-test-list.md` file. The comment will be added only once, right after the PR gets created. --- .github/workflows/test-list.yml | 25 +++++++ .../workflows/test-list/release-test-list.md | 75 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/test-list.yml create mode 100644 .github/workflows/test-list/release-test-list.md diff --git a/.github/workflows/test-list.yml b/.github/workflows/test-list.yml new file mode 100644 index 000000000..4918486f1 --- /dev/null +++ b/.github/workflows/test-list.yml @@ -0,0 +1,25 @@ +# This workflow adds a comment with tests list to the PRs with the release +# candidates (PRs that want to merge `release-*` branches to `main`). The test +# list is specified in the `./.github/workflows/test-list/release-test-list.md` +# file. The comment is added only once, right after the PR gets created. + +name: Add test list to release PRs + +on: + pull_request: + types: + - opened + branches: + - release + +jobs: + add-release-test-list: + runs-on: ubuntu-latest + if: github.head_ref == 'refs/heads/stage-live' + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v3 + - uses: mshick/add-pr-comment@v2 + with: + message-path: ./.github/workflows/test-list/release-test-list.md \ No newline at end of file diff --git a/.github/workflows/test-list/release-test-list.md b/.github/workflows/test-list/release-test-list.md new file mode 100644 index 000000000..a9399bd5b --- /dev/null +++ b/.github/workflows/test-list/release-test-list.md @@ -0,0 +1,75 @@ +# Release checklist + +This release checklist should be performed before release is published. + +- if something is not working please create an issue and link it here. Checkbox + should be checked only if everything was fine +- in case of serious issues or doubts you should ask the team first + +**Approve the PR when the checklist is finished ✅** + +**Merge the PR when it is approved and we want to update the production +environment 🚀** + +## Manual tests + +1. Connect to wallet with $TAHO + - [ ] you see the Portal is Open message + - [ ] you can see the map after entering + - [ ] you see your address connected + +2. Connect to wallet that previously staked + - [ ] you see your address connected + - [ ] you see the name of your realm + - [ ] you can navigate to other realms but not stake in them + - [ ] you can stake more TAHO in that realm if you're not fully staked + - [ ] you can unstake + +3. Connect to wallet that hasn't staked but has $TAHO + - [ ] you see your address connected + - [ ] you don't see a realm name beside that + - [ ] you can explore realms and stake into one + +4. Connect to wallet that has NO $TAHO (& no $VETAHO) + - [ ] you see the portal is closed message and the wait list button + - [ ] wait list redirect works as expected + - [ ] you can't see the map + +5. Switch connected wallet in the extension + - [ ] dapp reloads and shows the portal screen + - [ ] reloads with Connect Wallet button if you go to a wallet that's not + connected + - [ ] reloads with that address connected if that's a connected website for + the address: if it's an eligible address, you see Access Granted & + Enter the portal + - [ ] reloads with that address connected if that's a connected website for + the address: if it's an inelligible address, you see the portal is + closed message and wait list button + +6. Helper Tool (note: this might be hard to test since with new releases, the + cache will always be fresh and these results may not be true) + - [ ] doesn't pop up automatically for users who have visited before and + closed it + - [ ] doesn't pop up automatically for staked users + - [ ] does come up with the correct message when you click it (standard + "hope you're enjoying...") + - [ ] does come up properly for a user connecting for the first time and + running through onboarding + +7. Population + - [ ] shows on each realm (how we test that it's accurate, not sure but it + should show) + - [ ] shows on the bottom bar + +8. Quests/Questline + - [ ] shows on each realm as expected + +9. Disconnect from dapp + - [ ] click disconnect on address drop down and it disconnects and shows the + portal screen + +10. Connect Wallet + - [ ] with Taho installed and default wallet + - [ ] with Taho installed and not default + - [ ] with Taho not installed and no other + - [ ] with Taho not installed and MM installed From 0a0a061106aab911b54abcbec109c0c4ab3b5f65 Mon Sep 17 00:00:00 2001 From: Piotr Kacprzyk Date: Mon, 23 Oct 2023 18:36:30 +0200 Subject: [PATCH 07/11] Let users connect wallet and join a waitlist if they don't have Taho --- src/ui/Onboarding/JoinWaitlist.tsx | 9 ++++++--- src/ui/Onboarding/index.tsx | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/ui/Onboarding/JoinWaitlist.tsx b/src/ui/Onboarding/JoinWaitlist.tsx index 8e94a1930..f84b11815 100644 --- a/src/ui/Onboarding/JoinWaitlist.tsx +++ b/src/ui/Onboarding/JoinWaitlist.tsx @@ -4,7 +4,11 @@ import Icon from "shared/components/Icon" import newTab from "shared/assets/icons/m/new-tab.svg" import { LINKS } from "shared/constants" -export default function JoinWaitlist() { +export default function JoinWaitlist({ + children, +}: { + children: React.ReactNode +}) { return ( window.open(LINKS.WAITLIST)} > - The portal -
is closed at the
moment. + {children}
) } diff --git a/src/ui/Onboarding/index.tsx b/src/ui/Onboarding/index.tsx index ef6758aa8..bbe882dcc 100644 --- a/src/ui/Onboarding/index.tsx +++ b/src/ui/Onboarding/index.tsx @@ -13,7 +13,6 @@ import ConnectWallet from "./ConnectWallet" import JoinWaitlist from "./JoinWaitlist" import EnterPortal from "./EnterPortal" import OnboardingModalLoader from "./Loader" -import Teaser from "./Teaser" function OnboardingModal() { const { isConnected } = useConnect() @@ -21,7 +20,13 @@ function OnboardingModal() { const hasRelevantTokens = useDappSelector(selectHasRelevantTokens) if (process.env.IS_COMING_SOON === "true") { - return + return ( + + Portal opens +
+ soon +
+ ) } if (!isConnected) { @@ -36,7 +41,12 @@ function OnboardingModal() { return } - return + return ( + + The portal +
is closed at the
moment. +
+ ) } export default function Onboarding() { From e2d5f5cf9efd59ded4eae5358ffa3ce3effa2b71 Mon Sep 17 00:00:00 2001 From: Piotr Kacprzyk Date: Mon, 23 Oct 2023 19:13:00 +0200 Subject: [PATCH 08/11] Removing Teaser component --- src/ui/Onboarding/Teaser.tsx | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/ui/Onboarding/Teaser.tsx diff --git a/src/ui/Onboarding/Teaser.tsx b/src/ui/Onboarding/Teaser.tsx deleted file mode 100644 index 466bd737b..000000000 --- a/src/ui/Onboarding/Teaser.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from "react" -import OnboardingModal from "shared/components/Modals/OnboardingModal" - -export default function Teaser() { - return ( - - Portal opens -
- soon -
- ) -} From f2c3145044cb131c30345497c53281ef6b873927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Tue, 24 Oct 2023 09:28:09 +0200 Subject: [PATCH 09/11] Remove unnecessary data being stored in `localStorage` --- src/shared/utils/names.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/utils/names.ts b/src/shared/utils/names.ts index 34f4c54b0..f23b12f92 100644 --- a/src/shared/utils/names.ts +++ b/src/shared/utils/names.ts @@ -29,12 +29,13 @@ const getCachedNames = () => { const addCachedName = ({ name, avatar, address, type }: NameWithProvider) => { const cachedNames = getCachedNames() const normalizedAddress = normalizeAddress(address) + const newCachedData = name ? { [type]: { name, avatar } } : {} const newCache = JSON.stringify({ ...cachedNames, [normalizedAddress]: { ...(cachedNames[normalizedAddress] ?? {}), - [type]: { name, avatar }, + ...newCachedData, lastUpdate: Date.now(), }, }) From 1047c4bd358a3618ecfa6c777fbff5695e8e6a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Tue, 24 Oct 2023 09:58:21 +0200 Subject: [PATCH 10/11] Prevent caching addresses without ens or uns data --- src/shared/utils/names.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/shared/utils/names.ts b/src/shared/utils/names.ts index f23b12f92..ec21305d3 100644 --- a/src/shared/utils/names.ts +++ b/src/shared/utils/names.ts @@ -29,13 +29,13 @@ const getCachedNames = () => { const addCachedName = ({ name, avatar, address, type }: NameWithProvider) => { const cachedNames = getCachedNames() const normalizedAddress = normalizeAddress(address) - const newCachedData = name ? { [type]: { name, avatar } } : {} + const newData = name ? { [type]: { name, avatar } } : {} const newCache = JSON.stringify({ ...cachedNames, [normalizedAddress]: { ...(cachedNames[normalizedAddress] ?? {}), - ...newCachedData, + ...newData, lastUpdate: Date.now(), }, }) @@ -45,10 +45,7 @@ const addCachedName = ({ name, avatar, address, type }: NameWithProvider) => { const resolveENSPromise = (address: string) => resolveAddressToENS(address).then((data): WalletData | null => { - if (!data) { - addCachedName({ type: "ens", address }) - return null - } + if (!data) return null addCachedName({ type: "ens", address, ...data }) return data From 00a90d41257fd0e23b8809e43c82f35086d43e93 Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Tue, 24 Oct 2023 11:15:05 +0200 Subject: [PATCH 11/11] Remove mocked xp files --- src/data/xp/4/leaderboard.json | 29 ----------------------------- src/data/xp/4/xp_4_1.json | 29 ----------------------------- 2 files changed, 58 deletions(-) delete mode 100644 src/data/xp/4/leaderboard.json delete mode 100644 src/data/xp/4/xp_4_1.json diff --git a/src/data/xp/4/leaderboard.json b/src/data/xp/4/leaderboard.json deleted file mode 100644 index 18eb73844..000000000 --- a/src/data/xp/4/leaderboard.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "totalAmount": "0xbe8c", - "merkleRoot": "0xac7e1eeac7c8c79f4227ba21175f53d1b315d4ec0d3f63747caa806f8d4d5240", - "claims": { - "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc": { - "index": "0x0", - "amount": "0x5f46", - "proof": [ - "0x77d5949906c9d3f280b53e8f9ce4619cc3601e006a614e6e6b8efdb670851608" - ] - }, - "0x70997970c51812dc3a010c7d01b50e0d17dc79c8": { - "index": "0x1", - "amount": "0x3f84", - "proof": [ - "0x97d8034159ddd4aca63b7acfc7eee591e27cd83a6d690eac3ddb905ce99955b0", - "0xf955766c3e34d6d153fe72738c1b04f22d734532e735c48c7cbd61ea721b615a" - ] - }, - "0x6e80164ea60673d64d5d6228beb684a1274bb017": { - "index": "0x2", - "amount": "0x1fc2", - "proof": [ - "0x236261838f3f8aec57fe81caecc3216475c0a17841efddc10d879c609f7d430c", - "0xf955766c3e34d6d153fe72738c1b04f22d734532e735c48c7cbd61ea721b615a" - ] - } - } -} \ No newline at end of file diff --git a/src/data/xp/4/xp_4_1.json b/src/data/xp/4/xp_4_1.json deleted file mode 100644 index 18eb73844..000000000 --- a/src/data/xp/4/xp_4_1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "totalAmount": "0xbe8c", - "merkleRoot": "0xac7e1eeac7c8c79f4227ba21175f53d1b315d4ec0d3f63747caa806f8d4d5240", - "claims": { - "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc": { - "index": "0x0", - "amount": "0x5f46", - "proof": [ - "0x77d5949906c9d3f280b53e8f9ce4619cc3601e006a614e6e6b8efdb670851608" - ] - }, - "0x70997970c51812dc3a010c7d01b50e0d17dc79c8": { - "index": "0x1", - "amount": "0x3f84", - "proof": [ - "0x97d8034159ddd4aca63b7acfc7eee591e27cd83a6d690eac3ddb905ce99955b0", - "0xf955766c3e34d6d153fe72738c1b04f22d734532e735c48c7cbd61ea721b615a" - ] - }, - "0x6e80164ea60673d64d5d6228beb684a1274bb017": { - "index": "0x2", - "amount": "0x1fc2", - "proof": [ - "0x236261838f3f8aec57fe81caecc3216475c0a17841efddc10d879c609f7d430c", - "0xf955766c3e34d6d153fe72738c1b04f22d734532e735c48c7cbd61ea721b615a" - ] - } - } -} \ No newline at end of file