Skip to content

Commit e1ad7da

Browse files
committed
Dashboard: Remove Moralis, Alchemy API usage, Split UI improvements, Fix thirdweb/insight import (#7774)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR primarily focuses on refactoring the wallet NFT handling and related functionalities, transitioning from using `Moralis` and `Alchemy` to utilizing `thirdweb`'s `insight`. It also includes the removal of deprecated code and updates to the types used for NFTs. ### Detailed summary - Deleted multiple files related to `Moralis` and `Alchemy`. - Updated the `package.json` to fix TypeScript errors for `thirdweb/insight`. - Refactored `NFTDetails.tsx` to map `displayableNFTs` with new properties. - Removed the `MORALIS_API_KEY` from the environment and codebase. - Changed `useWalletNFTs` to `useOwnedNFTsInsight` for fetching NFTs. - Updated `NFTCards.tsx` to accept a new type `OwnedNFT`. - Modified `useSplit.ts` to fetch owned tokens using `thirdweb` instead of `Moralis`. - Adjusted `CreateListingsForm` to use `OwnedNFT` type and updated logic accordingly. - Updated `ContractSplitPage` to utilize `useOwnedTokenBalances` for fetching balances. - Removed legacy handling for unsupported chains and adjusted UI components accordingly. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Unified token balance retrieval now uses Thirdweb's insight API, providing both native and ERC-20 token balances in a single view. * Account and contract split pages display balances in a streamlined table format, improving clarity and consistency. * **Improvements** * Enhanced error handling and more informative notifications during balance distribution actions. * Updated logic for filtering and displaying balances, ensuring more accurate and reliable information. * Simplified chain support checks to rely solely on Insight API, removing Moralis and Alchemy fallbacks. * NFT ownership fetching now exclusively uses the Insight API with fallback to RPC data, improving reliability and simplifying support. * **Bug Fixes** * Resolved inconsistencies in balance display and distribution eligibility. * **Chores** * Removed deprecated Moralis and Alchemy NFT and token balance integrations. * Updated internal type configurations to support new balance retrieval methods. * Cleaned up environment variable usage by removing obsolete API keys. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 6ad015e commit e1ad7da

File tree

22 files changed

+284
-943
lines changed

22 files changed

+284
-943
lines changed

.changeset/thin-days-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix `thirdweb/insight` import typescript error

apps/dashboard/.env.example

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ DASHBOARD_SECRET_KEY="<replace_me_with_your_secret_key>"
5353
# Client id for api routes
5454
API_ROUTES_CLIENT_ID=
5555

56-
# <moralis.io API key (used for api routes for token balances and wallet NFTs)
57-
# - not required to build (unless using wallet NFTs and token balances)>
58-
MORALIS_API_KEY=
59-
60-
# alchemy.com API key (used for wallet NFTS)
61-
# - cannot be restricted to IP/domain because vercel has no stable IPs and it happens during build & runtime api route call
62-
# - not required to build (unless testing wallet NFTs)>
63-
SSR_ALCHEMY_KEY=
6456

6557

6658
# Hubspot Access Token (used for contact us form)

apps/dashboard/src/@/actions/getBalancesFromMoralis.ts

Lines changed: 0 additions & 89 deletions
This file was deleted.

apps/dashboard/src/@/actions/getWalletNFTs.ts

Lines changed: 0 additions & 210 deletions
This file was deleted.

apps/dashboard/src/@/constants/server-envs.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ if (isProd && INSIGHT_SERVICE_API_KEY) {
5858
);
5959
}
6060

61-
export const MORALIS_API_KEY = process.env.MORALIS_API_KEY || "";
62-
63-
if (MORALIS_API_KEY) {
64-
experimental_taintUniqueValue(
65-
"Do not pass MORALIS_API_KEY to the client",
66-
process,
67-
MORALIS_API_KEY,
68-
);
69-
}
70-
7161
export const ANALYTICS_SERVICE_URL = process.env.ANALYTICS_SERVICE_URL || "";
7262

7363
export const STRIPE_SECRET_KEY = process.env.STRIPE_SECRET_KEY || "";

0 commit comments

Comments
 (0)