From 0f8d909d248d434266d0702abbc39dda8718aacc Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Thu, 17 Oct 2024 13:56:07 -0700 Subject: [PATCH] refactor: extract protected newToCrypto array deprecate wallets-check.yml workflow --- .github/CODEOWNERS | 1 + .github/workflows/wallets-check.yml | 32 ----------------------------- src/data/wallets/new-to-crypto.ts | 9 ++++++++ src/data/wallets/wallet-data.ts | 21 +++++++++++-------- 4 files changed, 22 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/wallets-check.yml create mode 100644 src/data/wallets/new-to-crypto.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7e2178aaab4..e6e91520ad5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -9,3 +9,4 @@ # Owners of specific files /src/data/consensus-bounty-hunters.json @djrtwo @asanso @fredriksvantes +/src/data/wallets/new-to-crypto.ts @konopkja @minimalsm \ No newline at end of file diff --git a/.github/workflows/wallets-check.yml b/.github/workflows/wallets-check.yml deleted file mode 100644 index 952b398a887..00000000000 --- a/.github/workflows/wallets-check.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Check Wallet Data for new_to_crypto - -on: - pull_request: - paths: - - "src/data/wallets/wallet-data.ts" - -jobs: - check_new_to_crypto: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Check for new_to_crypto - id: check_new_to_crypto - run: | - if git diff --name-only HEAD^ | grep -q "data/wallets/wallet-data.ts"; then - if git diff -U0 HEAD^ HEAD data/wallets/wallet-data.ts | grep -q "+.*new_to_crypto: true"; then - echo "New wallet added with 'new_to_crypto: true'" - echo "new_to_crypto_found=true" >> $GITHUB_OUTPUT - else - echo "new_to_crypto_found=false" >> $GITHUB_OUTPUT - fi - fi - - - name: Comment on PR if new_to_crypto is added - if: steps.check_new_to_crypto.outputs.new_to_crypto_found == 'true' - uses: actions-ecosystem/action-add-comment@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - body: "A wallet has been added with 'new_to_crypto: true'. Please ensure this meets our guidelines." diff --git a/src/data/wallets/new-to-crypto.ts b/src/data/wallets/new-to-crypto.ts new file mode 100644 index 00000000000..f046e914c47 --- /dev/null +++ b/src/data/wallets/new-to-crypto.ts @@ -0,0 +1,9 @@ +import type { WalletName } from "./wallet-data" + +export const newToCrypto: WalletName[] = [ + "Coinbase Wallet", + "Rainbow", + "MEW wallet", + "Zerion Wallet", + "OneKey", +] diff --git a/src/data/wallets/wallet-data.ts b/src/data/wallets/wallet-data.ts index ea870c92917..c49b4edc612 100644 --- a/src/data/wallets/wallet-data.ts +++ b/src/data/wallets/wallet-data.ts @@ -1,5 +1,7 @@ import { WalletData } from "@/lib/types" +import { newToCrypto } from "./new-to-crypto" + import OneInchWalletImage from "@/public/images/wallets/1inch.png" import AlphaWalletImage from "@/public/images/wallets/alpha.png" import AmbireImage from "@/public/images/wallets/ambire.png" @@ -39,7 +41,7 @@ import UnstoppableWalletImage from "@/public/images/wallets/unstoppable.png" import XDEFIImage from "@/public/images/wallets/xdefi.png" import ZerionImage from "@/public/images/wallets/zerion.png" -export const walletsData: WalletData[] = [ +const walletsData = [ { last_updated: "2022-06-22", name: "Keystone", @@ -229,7 +231,6 @@ export const walletsData: WalletData[] = [ social_recovery: false, onboard_documentation: "https://www.coinbase.com/wallet/tutorials", documentation: "", - new_to_crypto: true, // note: "Community contribution, let's follow up with Coinbase", }, { @@ -764,7 +765,6 @@ export const walletsData: WalletData[] = [ social_recovery: false, onboard_documentation: "https://www.mewtopia.com/", documentation: "https://help.myetherwallet.com/en/", - new_to_crypto: true, }, { last_updated: "2022-06-24", @@ -1061,7 +1061,6 @@ export const walletsData: WalletData[] = [ social_recovery: false, onboard_documentation: "https://learn.rainbow.me/", documentation: "", - new_to_crypto: true, }, { last_updated: "2024-09-01", @@ -1311,7 +1310,6 @@ export const walletsData: WalletData[] = [ social_recovery: false, onboard_documentation: "", documentation: "", - new_to_crypto: false, }, { last_updated: "2024-09-26", @@ -1371,7 +1369,6 @@ export const walletsData: WalletData[] = [ onboard_documentation: "https://help.zerion.io/en/collections/5525626-zerion-wallet", documentation: "https://help.zerion.io/en/", - new_to_crypto: true, }, { last_updated: "2022-08-31", @@ -1613,7 +1610,6 @@ export const walletsData: WalletData[] = [ social_recovery: false, onboard_documentation: "https://help.onekey.so/hc/en-us", documentation: "https://developer.onekey.so/guide/introduction", - new_to_crypto: true, }, { last_updated: "2023-04-21", @@ -2008,6 +2004,13 @@ export const walletsData: WalletData[] = [ onboard_documentation: "https://docs.gemwallet.com/", documentation: "https://docs.gemwallet.com/", }, -] +] as const satisfies Omit[] + +export type WalletName = (typeof walletsData)[number]["name"] + +const allWalletData = walletsData.map((wallet) => ({ + ...wallet, + new_to_crypto: newToCrypto.includes(wallet.name), +})) as WalletData[] -export default walletsData +export default allWalletData