Compare commits

..
Author SHA1 Message Date
Joaquim Vergesandgithub-actions[bot] 8abf3cc777 Version Packages (#7231)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-31 03:55:10 -07:00
Joaquim Verges f10fbc8383 [SDK] Optimize fiat conversion query (#7242) 2025-05-31 03:14:45 -07:00
Joaquim Verges 38627d352b [SDK] Handle smart account detection for inApp and ecosystem wallets (#7241) 2025-05-31 02:39:26 -07:00
Joaquim Verges ad8cc9a1d2 [SDK] Add Bridge.tokens() function to retrieve supported tokens (#7240) 2025-05-31 02:29:12 -07:00
Manan Tank 4e935392fa SDK: Fallback to insight response if RPC request fails in getNFTs extensions (#7234) 2025-05-30 23:54:24 -07:00
MananTank f44d6ba282 [TOOL-4648] Dashboard: Fix timestamp in sponsored transactions table (#7236)
<!--

## 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 focuses on refactoring the rendering logic of the `SponsoredTransactionsTableUI` component to improve clarity and functionality, particularly around handling timestamps and the rendering of table rows.

### Detailed summary
- Changed the way `transaction.timestamp` is handled to ensure it always ends with "Z".
- Simplified the mapping of `props.sponsoredTransactions` to use a block body for clarity.
- Added `client` prop to `ProjectCell`.
- Enhanced readability of the table structure by removing unnecessary code.

> ✨ 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

- **Bug Fixes**
	- Improved accuracy of transaction timestamps by ensuring all are treated as UTC.
	- Enhanced consistency in date and time display for sponsored transactions.

- **New Features**
	- Added support for passing client information to project, chain, and wallet address displays in the transactions table.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 23:41:53 +00:00
MananTank 3678054931 Dashboard: Fix TS errors (#7235)
<!--

## 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 focuses on updating the `clientId` prop being passed to the `PayEmbedFTUX` component in the `PayAnalytics.tsx` file.

### Detailed summary
- Changed the `clientId` prop from `props.clientId` to `props.projectClientId` in the return statement of the `PayEmbedFTUX` component when both `hasVolume` and `hasWallet` are false.

> ✨ 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

- **Bug Fixes**
  - Corrected an issue where the wrong client ID was passed to the PayEmbedFTUX component, ensuring accurate display and functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 21:25:13 +00:00
greg 196cb54ae9 [Dashboard] Feature: Adds PostHog tracking to bridge page (#7232) 2025-05-30 13:23:12 -07:00
greg ed2d64197d [Dashboard] add empty state for Pay analytics (#7206) 2025-05-30 13:08:28 -07:00
Manan Tank e141e11ff3 Dashboard import paths cleanup (#7229) 2025-05-30 13:07:39 -07:00
MananTank 6ae54ddd98 Dashboard: Remove useThirdwebClient hook (#7228)
<!--

## 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 focuses on integrating the `ThirdwebClient` into various components and functions across the application, enhancing the client functionality for better interaction with smart contracts and improving the overall architecture.

### Detailed summary
- Added `client` prop to multiple components for better contract interactions.
- Updated functions to utilize the `contract.client` instead of a generic client.
- Removed redundant imports of `useThirdwebClient`.
- Enhanced several UI components to accept and use the `client` prop.
- Modified API calls to pass the `client` where necessary for fetching data.
- Improved handling of ENS queries by passing the `client` directly.

> The following files were skipped due to too many changes: `apps/dashboard/src/components/contract-components/hooks.ts`, `apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/connect/account-abstraction/factories/page.tsx`, `apps/dashboard/src/components/embedded-wallets/Configure/index.tsx`, `apps/dashboard/src/components/contract-components/contract-publish-form/index.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/custom-contract.tsx`

> ✨ 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**
  - Many components now accept a client instance as a prop, enabling more explicit and flexible client management throughout the dashboard.
- **Refactor**
  - Shifted from internal client initialization to explicit client prop injection across the app, affecting forms, tables, media components, contract publishing, and wallet settings.
  - Updated hooks and utility functions to require a client parameter instead of relying on internal context.
- **Chores**
  - Removed unused files and internal hooks related to client management.
- **Bug Fixes**
  - Improved consistency and reliability when handling authentication and client context in user flows.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 18:51:17 +00:00
greg 8245c06b3e [SDK] Fix: Token price cache to use proper address (#7230) 2025-05-30 11:48:33 -07:00
MananTank 1c11f84481 Dashboard: Reduce useThirdwebClient hook usage #4 (#7227)
<!--

## 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 focuses on enhancing the `TransactionButton` component across various files by adding a `client` prop and other relevant properties to improve transaction handling and user interactions.

### Detailed summary
- Added `client` prop to `TransactionButton` in multiple components for transaction management.
- Included `isLoggedIn`, `txChainID`, and `transactionCount` props where applicable.
- Enhanced user experience by managing loading states and enabling/disabling buttons based on conditions.

> ✨ 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**
  - All transaction-related buttons and components now require and receive an explicit client instance, improving reliability and consistency across the dashboard.
- **Refactor**
  - Updated component interfaces to accept a client prop instead of relying on internal hooks.
  - Standardized the way client instances are passed through component hierarchies, including in forms, modals, and tables.
  - Renamed certain props for clarity (e.g., `clientId` to `projectClientId`).
- **Style**
  - No user-facing visual changes.
- **Chores**
  - Improved code maintainability by removing internal hook usage for client access.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 18:35:01 +00:00
MananTank b84db126d7 Dashboard: Reduce useThirdwebClient hook usage #3 (#7226)
<!--

## 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 updating the usage of the `client` prop throughout various components in the application, replacing instances of `useThirdwebClient` with a more consistent approach using `getClientThirdwebClient`.

### Detailed summary
- Added `client` prop to multiple components including `AccountPage`, `DeployedContractsPage`, and `FaucetButton`.
- Replaced `useThirdwebClient` with `getClientThirdwebClient` in various files.
- Ensured consistency in passing the `client` prop across components.
- Updated the `ProfileHeader`, `PayModalButton`, and `SendTestTransaction` to accept `client` as a prop.
- Modified forms and sections to utilize the `client` prop for better integration with Thirdweb services.

> ✨ 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

- **Refactor**
  - Updated various components to receive a client instance as a prop instead of obtaining it internally, improving consistency and making client usage more explicit throughout the app.
  - Enhanced component interfaces to require a client prop where necessary, ensuring proper client context is passed across the dashboard.
  - Adjusted authentication and layout flows to support explicit client instantiation and propagation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 18:35:01 +00:00
MananTank a4406214c6 Dashboard: Reduce useThirdwebClient hook usage #2 (#7224)
<!--

## 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 focuses on enhancing the functionality of various components by integrating a `client` prop of type `ThirdwebClient` into multiple files. This change improves the interaction with the Thirdweb SDK across the application.

### Detailed summary
- Added `client` prop to components like `IconUpload`, `SolidityInput`, and `CustomConnectWallet`.
- Updated hooks and functions to accept `client` for better SDK integration.
- Modified forms to utilize the `client` for storage uploads and contract deployments.
- Enhanced `AddChainToWallet` and `EcosystemHeader` to support `client`.
- Updated various fieldsets to include `client`, improving data handling and validation.

> ✨ 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**
  - Components and forms now consistently accept and require a `client` prop, providing improved client context across wallet connection, contract deployment, network configuration, and NFT interactions.

- **Refactor**
  - Updated numerous components and hooks to require explicit passing of the `client` instance, replacing previous internal retrieval methods.
  - Prop types and interfaces were extended to include the new `client` property, ensuring consistent usage throughout the app.

- **Bug Fixes**
  - Addressed missing `client` props in several components to prevent potential issues with client-dependent functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 18:35:01 +00:00
MananTank 02627631b6 Dashboard: Reduce useThirdwebClient hook usage (#7223)
<!--

## 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 adding a `client` prop to various components across the dashboard application, enhancing their functionality and ensuring consistent access to the `ThirdwebClient`.

### Detailed summary
- Added `client` prop to `BatchMetadata`, `Royalty`, `Mintable`, `Transferable`, `Claimable`, and other components.
- Updated `WalletAddress` component to accept `client` prop in multiple instances.
- Enhanced various tables and UI components to utilize the `client` prop for improved data handling.
- Refactored existing components to ensure compatibility with the new `client` prop, ensuring consistent client access throughout the application.

> ✨ 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**
  - Enhanced all WalletAddress displays across the dashboard to accept and utilize a new client context for improved integration and consistency.
- **Refactor**
  - Updated multiple components and their props to require and pass a client instance, ensuring unified client handling throughout tables, modals, and analytics views.
  - Replaced static table column definitions with dynamic, memoized columns that respond to client changes.
  - Standardized prop names related to client identification for clarity and maintainability.
- **Bug Fixes**
  - Ensured client context is consistently propagated to all relevant child components, preventing potential rendering or data issues.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 18:35:00 +00:00
Joaquim Vergesandgithub-actions[bot] 913b243147 Version Packages (#7217)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-30 10:16:10 -07:00
gregandcoderabbitai[bot] 3edbe2898c [Dashboard] Fix: Purchase Data (#7225)
Signed-off-by: greg <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-05-30 09:45:34 -07:00
pinkhoodie 926dad4556 Update ChatBar.tsx to allow for copy/paste and drag/drop file uploads (#7153)
<!--

## 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 enhances the `ChatBar` component by adding image upload validation, drag-and-drop functionality, and user feedback through toast notifications. It improves user experience by ensuring only valid images are uploaded and prompts users to sign in if they attempt to upload without permission.

### Detailed summary
- Added `showSigninToUploadImagesToast` function for user notifications.
- Introduced `isDragOver` state for drag-and-drop feedback.
- Updated `handleImageUpload` to validate file types and sizes.
- Implemented drag-and-drop event handlers for image uploads.
- Added clipboard paste support for image uploads.
- Modified `ImageUploadButton` to use validated files directly.

> ✨ 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**
  - Added support for image uploads via drag-and-drop and clipboard paste in the chat bar.
  - Enhanced visual feedback during drag-and-drop image uploads.
  - Added prompts for users to sign in when attempting image uploads without authorization.

- **Bug Fixes**
  - Improved validation for image uploads, including file size and total image count limits.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 13:46:07 +00:00
Yash094 0639d0d9ea siwa updates and new article (#7197)
<!--

## 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 focuses on enhancing the chat functionality within the application by adding a feedback system, updating icons, and improving the knowledge base content related to ERC20 token transfers.

### Detailed summary
- Added a new knowledge base entry for "Transfer Amount Exceeds Allowance".
- Updated `Header` and `Hero` components to replace `BotIcon` with `MessageCircleIcon`.
- Introduced `sendFeedback` function to handle user feedback on chat messages.
- Modified `Chat` component to include feedback buttons (thumbs up/down) for messages.

> ✨ 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**
	- Introduced feedback buttons (thumbs up/down) for assistant messages in the AI chat, allowing users to rate responses.
	- Added a new "Ask AI" button on the main page, providing quick access to the chat assistant.
	- Added a new knowledge base article explaining the "ERC20: transfer amount exceeds allowance" error and its resolution.
- **Improvements**
	- Enhanced chat message payloads with source identifiers for better context.
	- Updated sidebar navigation with a new troubleshooting entry for ERC20 transfer allowance issues.
	- Updated chat and header icons to use a consistent message circle icon for AI-related features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 07:58:58 +00:00
Joaquim Verges 4fed9f4593 [SDK] Update token price APIs to query from insight directly (#7220) 2025-05-29 22:48:48 -07:00
arcoraven f2e8b9ecab feat: add Engine Cloud analytics to project overview (#7195)
# [Dashboard] Feature: Add Engine Cloud Analytics Charts

Example screenshot:

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/vKjRiOG6EUjD7XH4cppU/73d7e2b9-23bd-46b5-8cae-5564a3630770.png)

## Notes for the reviewer
This PR adds Engine Cloud analytics to the dashboard, displaying request data in a bar chart visualization. The implementation includes:

1. A new API endpoint to fetch Engine Cloud method usage data
2. New UI components for displaying Engine Cloud analytics:
   - `EngineCloudBarChartCardUI` - Shows Engine Cloud requests by pathname
   - `EngineCloudChartCardUI` - Shows Engine Cloud methods usage with percentage breakdown
3. Integration of the new chart into the project analytics page

## How to test
- View the Storybook component at "Analytics/EngineCloudBarChartCard"
- Navigate to a project dashboard to see the Engine Cloud analytics chart
- Verify data is properly fetched and displayed in the chart

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new feature to track and visualize `EngineCloud` statistics in the dashboard, enhancing analytics capabilities with new components and API integrations.

### Detailed summary
- Added `EngineCloudStats` interface in `analytics.ts`.
- Implemented `getEngineCloudMethodUsage` API function.
- Created `EngineCloudChartCard` component for displaying cloud stats.
- Developed `EngineCloudBarChartCardUI` for rendering bar charts.
- Added storybook entries for `EngineCloudBarChartCardUI`.
- Enhanced existing analytics with new data visualizations.

> ✨ 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**
  - Introduced a stacked bar chart visualization for engine cloud request statistics in the analytics dashboard.
  - Added a chart card displaying engine cloud method usage data with loading state support.
  - Enhanced analytics with time series data for multiple API pathnames.
  - Included engine cloud method usage data in the project analytics view.

- **Chores**
  - Updated `.gitignore` to exclude the `.pnpm-store/` directory from version control.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 01:34:51 +00:00
AmineAfia 523412437b Replace Select with Popover in webhook signature selection UI (#7219)
## [Dashboard] Feature: Replace Select with Popover for Event and Function Signature Selection

## Notes for the reviewer
This PR replaces the Select component with a Popover component for both event and function signature selection in the webhook filter details step. The change improves the user experience by providing a more customizable dropdown interface.

Key changes:
- Replaced Select/SelectContent/SelectItem with Popover/PopoverContent/PopoverTrigger
- Added state hooks to manage popover open states
- Improved styling and layout of signature selection options
- Maintained existing functionality for selecting signatures and updating form values

## How to test
Test the webhook creation flow, specifically when selecting event or function signatures. Verify that:
1. The popover opens and closes correctly
2. Selecting a signature properly updates the form
3. The selected signature displays correctly in the trigger button
4. The signature details (name, hash/selector) are properly displayed

<!-- start pr-codex -->

---

## PR-Codex overview
This PR refactors the `FilterDetailsStep` component to replace the `Select` dropdowns with a new `SignatureDropdown` component, enhancing the UI interaction by using a `Popover` for selecting event and function signatures.

### Detailed summary
- Removed `Select` dropdowns for event and function signatures.
- Introduced `SignatureDropdown` component for better UI/UX.
- Integrated `Popover` for displaying signature options.
- Updated state management for selected signatures and ABIs.
- Added new props for `SignatureDropdown` to handle selection and display.

> ✨ 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**
  - Introduced a new dropdown for selecting event and function signatures, offering a clearer and more interactive selection experience.

- **Style**
  - Updated the signature selection interface to use a popover-based dropdown for improved usability and consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 01:19:05 +00:00
arcoraven ac4ade6262 chore: remove Team from confirmEmail response (#7200)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on removing references to `Team` in various components related to email verification and onboarding, simplifying the data structure passed around.

### Detailed summary
- Removed `teamStub` import and related references in `VerifyEmail.stories.tsx`.
- Eliminated `Team` type imports in `useApi.ts`, `VerifyEmail.tsx`, and `account-onboarding-ui.tsx`.
- Updated `onEmailConfirmed` and `verifyEmail` props to only handle `account` in `VerifyEmail.tsx` and `account-onboarding-ui.tsx`.
- Adjusted the `onComplete` prop in `AccountOnboardingProps` to reflect the removal of `team`.

> ✨ 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

- **Refactor**
  - Simplified onboarding and email verification flows by removing the requirement for team-related data. All relevant callbacks and functions now operate solely with account information.
- **Type Updates**
  - Updated type signatures for onboarding and verification handlers to exclude the team property, streamlining integration for end-users and developers.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 01:03:44 +00:00
Jonas Daniels 819ce86c61 [thirdweb] Update dev script to use nodenext module format (#7218) 2025-05-29 18:02:25 -07:00
Jonas Daniels 86fd445276 [service-utils] Add platform, SMS, and pay capabilities to TeamCapabilities type (#7210) 2025-05-29 18:01:54 -07:00
joaquim-verges 55fba51dab [Dashboard] Unhide Engine Cloud service (#7215)
<!--

## 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 focuses on updating service descriptions and modifying hidden services in the codebase.

### Detailed summary
- Updated the description of the `insight` service to "Indexed data for any EVM chain."
- Changed the title of the `engineCloud` service from "Server wallets" to "Engine Cloud."
- Updated the description of the `engineCloud` service to "Transaction API and Server wallets with high transaction throughput and low latency."
- Removed `engineCloud` from the `HIDDEN_SERVICES` array.

> ✨ 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

- **Chores**
  - Updated service descriptions for improved clarity.
  - Refined metadata for select services.
- **Refactor**
  - Adjusted visibility of certain services in API key settings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 00:33:15 +00:00
jnsdls 7c95211b98 [Dashboard] update pricing plans and UI components (#7208)
# Update Pricing Plans and UI

This PR updates our pricing plans and UI to better align with our new pricing strategy:

- Replaced "Accelerate" plan with "Pro" plan
- Updated pricing: Starter ($5), Growth ($99), Scale ($499), Pro ($1499)
- Added "Starting at" label for Pro plan
- Updated feature lists across all plans
- Changed pricing card UI to use `DollarSignIcon` instead of `CircleDollarSignIcon`
- Added locale formatting for price display
- Updated team onboarding flow to show Growth, Scale and Pro plans
- Removed Cloud Hosted Engine section from Engine Footer Card
- Removed standalone Pro Card from pricing page

These changes ensure our pricing structure is more intuitive and better reflects the value of each tier.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating billing plans and their associated features in the application. It introduces a new `pro` plan, modifies existing plans, and adjusts the UI components to reflect these changes.

### Detailed summary
- Added `"plan:pro"` to billing plans.
- Updated comments from "accelerate" to "growth" for clarity.
- Replaced `CheckIcon` with `DollarSignIcon` in pricing components.
- Adjusted pricing for `starter` (from $9 to $5) and `growth` (from $79 to $99).
- Renamed `accelerate` plan to `scale` with a new price of $499.
- Introduced `pro` plan priced at $1499 with specific features.
- Adjusted invite permissions to restrict `starter` plan.
- Updated billing plan checks throughout components to include new plan logic.
- Removed deprecated `CloudHostedEngineSection` component.

> ✨ 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**
  - Introduced a new "pro" billing plan with updated pricing, features, and dedicated account executive support.
  - Added "scale" plan as a replacement for the previous "accelerate" plan, featuring expanded infrastructure and support options.

- **Enhancements**
  - Improved pricing display formatting for better readability.
  - Updated plan descriptions and feature lists for clarity and consistency across all plans.
  - Refined plan selection and upgrade prompts to reflect the new plan structure.

- **Bug Fixes**
  - Corrected plan requirement messaging for editing SMS countries to accurately reference the "growth" plan.

- **Removals**
  - Removed the "accelerate" and "starter" plans from UI and plan selection.
  - Eliminated the ProCard component and legacy usage credit mentions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-30 00:16:27 +00:00
Joaquim Vergesandgithub-actions[bot] 3bb1fe0e1f Version Packages (#7214)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-29 17:02:32 -07:00
MananTank a1aba2989e Dashboard: Various Asset page updates (#7212)
<!--

## 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 focuses on enhancing tracking functionality and improving the UI components for better user feedback during token operations in the dashboard application.

### Detailed summary
- Updated `ProjectSidebarLayout.tsx` to simplify the `label` for the Engine section.
- Refactored date formatting in `RecentTransfers.tsx` for improved readability.
- Enhanced error handling and tracking in `launch-token.tsx`, `create-token-page-impl.tsx`, and `tracking.ts`.
- Improved tracking data structure by consolidating parameters in functions.
- Added success and error tracking in `ClaimTokenCardUI` for better user feedback during transactions.

> ✨ 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**
  - Added a success screen after purchasing tokens, displaying confirmation details and options to view the transaction or buy more.
  - Enhanced analytics tracking for token purchase and deployment flows, capturing more detailed error information and contextual metadata.

- **Bug Fixes**
  - Improved timestamp handling for recent transfers to ensure consistent display of relative times.

- **Style**
  - Updated the sidebar to remove the "New" badge from the "Engine" link.

- **Refactor**
  - Streamlined analytics tracking functions to use structured parameter objects and improved error message handling.

- **Chores**
  - Minor cleanup, including removal of unnecessary console logs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 23:43:42 +00:00
AmineAfia deeca886a4 Add support for chain filtering in webhook creation (#7209)
## [Dashboard] Feature: Add Chain Filtering for Webhooks

## Notes for the reviewer
This PR adds support for filtering available chains in the webhook creation flow. It fetches supported chains from the Insight API and restricts the chain selection in the UI to only those chains that are supported for webhooks.

## How to test
1. Navigate to the webhooks page for a project
2. Verify that the chain selector in the webhook creation modal only shows supported chains
3. Confirm that the API call to fetch supported chains works correctly

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added support for dynamically fetching and displaying supported blockchain networks when creating or managing webhooks.
  - The network selector now only shows networks that are currently supported for webhooks.
  - Users are notified if no supported blockchain networks are available for webhooks.

- **Bug Fixes**
  - Improved error handling and messaging when no supported blockchain networks are available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `NetworkSelectors` and webhook components by adding support for multiple chain IDs, improving the data handling for webhooks, and integrating the fetching of supported chains from an API.

### Detailed summary
- Added `chainIds` prop to `NetworkSelectors` and filtered `allChains` based on it.
- Updated `CreateWebhookModal` to accept `supportedChainIds`.
- Modified `WebhooksTable` to include `supportedChainIds`.
- Introduced `getSupportedWebhookChains` API call to fetch supported chains.
- Updated `FilterDetailsStep` to utilize `supportedChainIds`.
- Adjusted `WebhooksPage` to manage `supportedChainIds` and handle API responses.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2025-05-29 23:32:31 +00:00
Joaquim Verges 31c4bb22fc [SDK] Add account deletion support when unlinking profiles (#7211) 2025-05-29 16:31:53 -07:00
MananTank 3b1e16c8b7 [TOOL-4621] New ERC20 public contract page (#7177)
<!--

## 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 enhancing the dashboard's functionality and user interface by updating environment variable usage, improving component layouts, and refining analytics features. It also introduces new components and modifies existing ones for better data handling and presentation.

### Detailed summary
- Added `NEXT_PUBLIC_DASHBOARD_CLIENT_ID` to `public-envs.ts`.
- Updated `CreateTokenAssetPage` to pass `teamSlug` and `projectSlug`.
- Changed `projectSlug` to use `project.slug` in `marketplace` page.
- Enhanced `EmptyChartState` to accept a `type` prop.
- Updated `getTokenStepTrackingData` to include "deploy" action.
- Introduced `LoadingDots` component for loading states.
- Refactored multiple layout components to include `TeamHeader`.
- Added new public page handling logic in various components.
- Updated analytics functions to utilize the new client ID.
- Improved error handling and response management in analytics API calls.
- Added `DecimalInput` component to replace standard input in `token-sale.tsx`.

> The following files were skipped due to too many changes: `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/shared-layout.tsx`, `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.stories.tsx`, `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/erc20.tsx`, `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx`, `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/RecentTransfers.tsx`, `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx`, `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/PriceChart.tsx`, `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/claim-tokens/claim-tokens-ui.tsx`

> ✨ 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**
  - Added new layout components with team headers for various dashboard sections.
  - Introduced `LoadingDots` component for animated loading indicators.
  - Added `PublicPageConnectButton` and `PageHeader` components for public pages.
  - Implemented public ERC-20 token page with price charts, token stats, recent transfers, and buy token embed.
  - Added token claim card UI with transaction step feedback for purchasing tokens.
  - Added hooks for fetching token price data and token transfers.
  - Added utility to fetch currency metadata for tokens.
  - Added comprehensive contract analytics overview component.
  - Introduced `DecimalInput` component for validated decimal input handling.
  - Added new social media brand icons for Discord and Telegram.

- **Improvements**
  - Enhanced area and bar charts with customizable styles, tooltip formatting, and explicit empty state types.
  - Improved empty chart state visuals with new area chart gradients and replaced spinner with animated dots.
  - Unified environment variable usage for client IDs across API calls and client initializations.
  - Updated contract overview to display call-to-action banner linking to public asset pages for ERC-20 tokens.
  - Enhanced contract table to conditionally show contract address or asset page links based on context.
  - Improved primary dashboard button to link to asset pages when applicable.
  - Added redirects to public landing pages for unsupported contract views lacking project metadata.
  - Wrapped existing layouts with conditional team headers for consistent UI in public/private views.
  - Added pagination and detailed tables for recent token transfers.
  - Updated project slug usage in marketplace listings for accuracy.
  - Introduced dynamic time precision handling in analytics charts and tooltips.
  - Added optional balance check control to transaction and mismatch buttons.
  - Replaced local decimal input component with shared validated decimal input component.
  - Added optional target attribute for call-to-action links in upsell banners.
  - Refined accessibility and sizing of icon components.

- **Bug Fixes**
  - Fixed environment variable naming for client IDs to ensure consistent API integration.

- **Refactor**
  - Standardized header and layout components for a unified dashboard experience.
  - Replaced spinner with animated dots in loading states for smoother UX.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 23:03:08 +00:00
jnsdls 1f42ad2a2d [Dashboard] migrate SelectOption to shadcn (#7194)
Migrated the `SelectOption` component in the dashboard batch upload flow to use shadcn/ui primitives and Tailwind classes.

- Replaced Chakra `Tooltip`, `Flex`, and `Radio` usage with `ToolTipLabel` and Tailwind markup
- Switched to shadcn/ui `Card`
- Removed dependency on Chakra typography components
- Updated component props to extend HTML attributes

Fixes migration step towards removing Chakra.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `SelectOption` component to improve its structure and styling. It replaces the `Tooltip` from `@chakra-ui/react` with a custom `ToolTipLabel`, modifies the layout and styling, and enhances the handling of props.

### Detailed summary
- Changed `SelectOptionProps` to extend `React.HTMLAttributes<HTMLDivElement>`.
- Replaced `Tooltip` with `ToolTipLabel`.
- Updated the card styling and structure.
- Modified the layout for `Radio` to a custom implementation.
- Adjusted class names for better styling consistency.
- Changed the rendering of `name` and `description` to use HTML elements directly.

> ✨ 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

- **Refactor**
  - Updated the selection option component with custom UI elements and Tailwind CSS styling, removing dependencies on Chakra UI and previous component libraries.
  - Improved accessibility and styling for tooltips, cards, and selection indicators.
  - Maintained original functionality and interactions with a refreshed look and feel.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-05-29 21:25:21 +00:00
456 changed files with 10947 additions and 6401 deletions
+1
View File
@@ -16,6 +16,7 @@ yalc.lock
./build/
playwright-report/
.env/
.pnpm-store/
# codecov binary
codecov
@@ -12,7 +12,7 @@ import type { WalletNFT } from "lib/wallet/nfts/types";
import { getVercelEnv } from "../../lib/vercel-utils";
import { isAlchemySupported } from "../../lib/wallet/nfts/isAlchemySupported";
import { isMoralisSupported } from "../../lib/wallet/nfts/isMoralisSupported";
import { NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID } from "../constants/public-envs";
import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "../constants/public-envs";
import { MORALIS_API_KEY } from "../constants/server-envs";
type WalletNFTApiReturn =
@@ -149,7 +149,7 @@ async function getWalletNFTsFromInsight(params: {
const response = await fetch(url, {
headers: {
"x-client-id": NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
"x-client-id": NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
},
});
+23 -1
View File
@@ -3,6 +3,7 @@ import "server-only";
import type {
AnalyticsQueryParams,
EcosystemWalletStats,
EngineCloudStats,
InAppWalletStats,
RpcMethodStats,
TransactionStats,
@@ -425,9 +426,30 @@ export async function getUniversalBridgeWalletUsage(args: {
console.error(
`Failed to fetch universal bridge wallet stats: ${res?.status} - ${res.statusText} - ${reason}`,
);
return null;
return [];
}
const json = await res.json();
return json.data as UniversalBridgeWalletStats[];
}
export async function getEngineCloudMethodUsage(
params: AnalyticsQueryParams,
): Promise<EngineCloudStats[]> {
const searchParams = buildSearchParams(params);
const res = await fetchAnalytics(
`v2/engine-cloud/requests?${searchParams.toString()}`,
{
method: "GET",
headers: { "Content-Type": "application/json" },
},
);
if (res?.status !== 200) {
console.error("Failed to fetch Engine Cloud method usage");
return [];
}
const json = await res.json();
return json.data as EngineCloudStats[];
}
@@ -67,6 +67,10 @@ interface TestWebhookResponse {
error?: string;
}
type SupportedWebhookChainsResponse =
| { chains: Array<number> }
| { error: string };
export async function createWebhook(
payload: CreateWebhookPayload,
clientId: string,
@@ -205,3 +209,31 @@ export async function testWebhook(
};
}
}
export async function getSupportedWebhookChains(): Promise<SupportedWebhookChainsResponse> {
try {
const response = await fetch(
`https://${THIRDWEB_INSIGHT_API_DOMAIN}/service/chains`,
{
method: "GET",
headers: {
"x-service-api-key": process.env.INSIGHT_SERVICE_API_KEY || "",
},
},
);
if (!response.ok) {
const errorText = await response.json();
return { error: `Failed to fetch supported chains: ${errorText.error}` };
}
const data = await response.json();
if (Array.isArray(data.data)) {
return { chains: data.data };
}
return { error: "Unexpected response format" };
} catch (error) {
console.error("Error fetching supported chains:", error);
return { error: `Failed to fetch supported chains: ${error}` };
}
}
@@ -15,7 +15,7 @@ type PaymentLink = {
chainId: number;
};
amount: bigint | undefined;
purchaseData: unknown;
purchaseData: Record<string, unknown> | undefined;
};
export async function getPaymentLink(props: {
@@ -3,10 +3,10 @@
import { MultiSelect } from "@/components/blocks/multi-select";
import { SelectWithSearch } from "@/components/blocks/select-with-search";
import { Badge } from "@/components/ui/badge";
import { ChainIconClient } from "components/icons/ChainIcon";
import { useAllChainsData } from "hooks/chains/allChains";
import { useCallback, useMemo } from "react";
import type { ThirdwebClient } from "thirdweb";
import { ChainIconClient } from "../../../components/icons/ChainIcon";
import { useAllChainsData } from "../../../hooks/chains/allChains";
function cleanChainName(chainName: string) {
return chainName.replace("Mainnet", "");
@@ -27,8 +27,15 @@ export function MultiNetworkSelector(props: {
side?: "left" | "right" | "top" | "bottom";
showSelectedValuesInModal?: boolean;
client: ThirdwebClient;
chainIds?: number[];
}) {
const { allChains, idToChain } = useAllChainsData();
let { allChains, idToChain } = useAllChainsData();
if (props.chainIds && props.chainIds.length > 0) {
allChains = allChains.filter((chain) =>
props.chainIds?.includes(chain.chainId),
);
}
const options = useMemo(() => {
let sortedChains = allChains;
@@ -1,3 +1,5 @@
import { useAllChainsData } from "hooks/chains/allChains";
import { useTokensData } from "hooks/tokens/tokens";
import { useCallback, useMemo } from "react";
import {
NATIVE_TOKEN_ADDRESS,
@@ -5,8 +7,6 @@ import {
getAddress,
} from "thirdweb";
import { shortenAddress } from "thirdweb/utils";
import { useAllChainsData } from "../../../hooks/chains/allChains";
import { useTokensData } from "../../../hooks/tokens/tokens";
import { replaceIpfsUrl } from "../../../lib/sdk";
import { fallbackChainIcon } from "../../../utils/chain-icons";
import type { TokenMetadata } from "../../api/universal-bridge/tokens";
@@ -41,6 +41,7 @@ type UpsellBannerCardProps = {
cta: {
text: React.ReactNode;
icon?: React.ReactNode;
target?: "_blank";
link: string;
};
trackingCategory: string;
@@ -55,7 +56,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
return (
<div
className={cn(
"relative overflow-hidden rounded-lg border bg-gradient-to-r p-5",
"relative overflow-hidden rounded-lg border bg-gradient-to-r p-4 lg:p-6",
color.border,
color.bgFrom,
)}
@@ -73,7 +74,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
{props.icon ? (
<div
className={cn(
"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-full",
"mt-0.5 hidden h-9 w-9 shrink-0 items-center justify-center rounded-full lg:flex",
color.iconBg,
)}
>
@@ -90,9 +91,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
>
{props.title}
</h3>
<p className={cn("mt-0.5 text-sm", color.desc)}>
{props.description}
</p>
<p className={cn("text-sm", color.desc)}>{props.description}</p>
</div>
</div>
@@ -108,6 +107,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
href={props.cta.link}
category={props.trackingCategory}
label={props.trackingLabel}
target={props.cta.target}
>
{props.cta.text}
{props.cta.icon && <span className="ml-2">{props.cta.icon}</span>}
@@ -15,14 +15,14 @@ import {
ChartTooltip,
ChartTooltipContent,
} from "@/components/ui/chart";
import { formatDate } from "date-fns";
import { useMemo } from "react";
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
import { cn } from "@/lib/utils";
import {
EmptyChartState,
LoadingChartState,
} from "../../../../components/analytics/empty-chart-state";
import { cn } from "../../../lib/utils";
} from "components/analytics/empty-chart-state";
import { formatDate } from "date-fns";
import { useMemo } from "react";
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
header?: {
@@ -46,8 +46,12 @@ type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
// chart className
chartClassName?: string;
isPending: boolean;
className?: string;
cardContentClassName?: string;
hideLabel?: boolean;
toolTipLabelFormatter?: (label: string, payload: unknown) => React.ReactNode;
toolTipValueFormatter?: (value: unknown) => React.ReactNode;
emptyChartState?: React.ReactElement;
};
export function ThirdwebAreaChart<TConfig extends ChartConfig>(
@@ -56,7 +60,7 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
const configKeys = useMemo(() => Object.keys(props.config), [props.config]);
return (
<Card>
<Card className={props.className}>
{props.header && (
<CardHeader>
<CardTitle className={cn("mb-2", props.header.titleClassName)}>
@@ -70,12 +74,16 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
{props.customHeader && props.customHeader}
<CardContent className={cn(!props.header && "pt-6")}>
<CardContent
className={cn(!props.header && "pt-6", props.cardContentClassName)}
>
<ChartContainer config={props.config} className={props.chartClassName}>
{props.isPending ? (
<LoadingChartState />
) : props.data.length === 0 ? (
<EmptyChartState />
<EmptyChartState type="area">
{props.emptyChartState}
</EmptyChartState>
) : (
<AreaChart accessibilityLayer data={props.data}>
<CartesianGrid vertical={false} />
@@ -100,6 +108,7 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
props.hideLabel !== undefined ? props.hideLabel : true
}
labelFormatter={props.toolTipLabelFormatter}
valueFormatter={props.toolTipValueFormatter}
/>
}
/>
@@ -17,13 +17,13 @@ import {
ChartTooltip,
ChartTooltipContent,
} from "@/components/ui/chart";
import { formatDate } from "date-fns";
import { useMemo } from "react";
import { cn } from "@/lib/utils";
import {
EmptyChartState,
LoadingChartState,
} from "../../../../components/analytics/empty-chart-state";
import { cn } from "../../../lib/utils";
} from "components/analytics/empty-chart-state";
import { formatDate } from "date-fns";
import { useMemo } from "react";
type ThirdwebBarChartProps<TConfig extends ChartConfig> = {
// metadata
@@ -75,7 +75,9 @@ export function ThirdwebBarChart<TConfig extends ChartConfig>(
{props.isPending ? (
<LoadingChartState />
) : props.data.length === 0 ? (
<EmptyChartState>{props.emptyChartState}</EmptyChartState>
<EmptyChartState type="bar">
{props.emptyChartState}
</EmptyChartState>
) : (
<BarChart accessibilityLayer data={props.data}>
<CartesianGrid vertical={false} />
@@ -1,7 +1,7 @@
"use client";
import { useLocalStorage } from "hooks/useLocalStorage";
import { XIcon } from "lucide-react";
import { useLocalStorage } from "../../../hooks/useLocalStorage";
import { Button } from "../ui/button";
export function DismissibleAlert(props: {
@@ -4,13 +4,13 @@ import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import { CheckIcon, CircleDollarSignIcon } from "lucide-react";
import { RenewSubscriptionButton } from "components/settings/Account/Billing/renew-subscription/renew-subscription-button";
import { useTrack } from "hooks/analytics/useTrack";
import { CheckIcon, DollarSignIcon } from "lucide-react";
import Link from "next/link";
import type React from "react";
import { remainingDays } from "utils/date-utils";
import { TEAM_PLANS } from "utils/pricing";
import { RenewSubscriptionButton } from "../../../components/settings/Account/Billing/renew-subscription/renew-subscription-button";
import { useTrack } from "../../../hooks/analytics/useTrack";
import { remainingDays } from "../../../utils/date-utils";
import type { ProductSKU } from "../../lib/billing";
import { CheckoutButton } from "../billing";
@@ -105,9 +105,12 @@ export const PricingCard: React.FC<PricingCardProps> = ({
{/* Price */}
<div className="flex flex-col gap-0.5">
{plan.isStartingPriceOnly && (
<span className="text-muted-foreground text-xs">Starting at</span>
)}
<div className="flex items-center gap-2">
<span className="font-semibold text-2xl text-foreground tracking-tight">
${plan.price}
${plan.price.toLocaleString()}
</span>
{!isCustomPrice && (
@@ -183,10 +186,10 @@ const billingPlanToSkuMap: Record<Team["billingPlan"], ProductSKU | undefined> =
{
starter: "plan:starter",
growth: "plan:growth",
accelerate: "plan:accelerate",
scale: "plan:scale",
pro: "plan:pro",
// we can't render checkout buttons for these plans:
pro: undefined,
accelerate: undefined,
free: undefined,
growth_legacy: undefined,
starter_legacy: undefined,
@@ -201,16 +204,19 @@ function FeatureItem({ text }: FeatureItemProps) {
return (
<div className="flex items-center gap-2 text-sm">
<CheckIcon className="size-4 shrink-0 text-green-500" />
{Array.isArray(text) ? (
<ToolTipLabel label={text[1]}>
<DollarSignIcon className="size-4 shrink-0 text-green-500" />
</ToolTipLabel>
) : (
<CheckIcon className="size-4 shrink-0 text-green-500" />
)}
{Array.isArray(text) ? (
<div className="flex items-center gap-2">
<p className="text-muted-foreground">
{titleStr}{" "}
<span className="text-muted-foreground md:hidden">{text[1]}</span>
</p>
<ToolTipLabel label={text[1]}>
<CircleDollarSignIcon className="hidden size-4 text-muted-foreground md:block" />
</ToolTipLabel>
</div>
) : (
<p className="text-muted-foreground">{titleStr}</p>
@@ -5,7 +5,6 @@ import {
HoverCardContent,
HoverCardTrigger,
} from "@/components/ui/hover-card";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
import { useClipboard } from "hooks/useClipboard";
import { CheckIcon, CopyIcon, XIcon } from "lucide-react";
@@ -24,8 +23,8 @@ export function WalletAddress(props: {
shortenAddress?: boolean;
className?: string;
iconClassName?: string;
client: ThirdwebClient;
}) {
const thirdwebClient = useThirdwebClient();
// default back to zero address if no address provided
const address = useMemo(() => props.address || ZERO_ADDRESS, [props.address]);
@@ -40,7 +39,7 @@ export function WalletAddress(props: {
const profiles = useSocialProfiles({
address: address,
client: thirdwebClient,
client: props.client,
});
const { onCopy, hasCopied } = useClipboard(address, 2000);
@@ -78,7 +77,7 @@ export function WalletAddress(props: {
<WalletAvatar
address={address}
profiles={profiles.data || []}
thirdwebClient={thirdwebClient}
thirdwebClient={props.client}
iconClassName={props.iconClassName}
/>
)}
@@ -122,7 +121,7 @@ export function WalletAddress(props: {
) : (
profiles.data?.map((profile) => {
const walletAvatarLink = resolveSchemeWithErrorHandler({
client: thirdwebClient,
client: props.client,
uri: profile.avatar,
});
@@ -0,0 +1,10 @@
export function LoadingDots() {
return (
<div className="fade-in-0 flex animate-in gap-2 duration-300">
<span className="sr-only">Loading...</span>
<div className="size-4 animate-bounce rounded-full bg-foreground [animation-delay:-0.3s]" />
<div className="size-4 animate-bounce rounded-full bg-foreground [animation-delay:-0.15s]" />
<div className="size-4 animate-bounce rounded-full bg-foreground" />
</div>
);
}
@@ -1,9 +1,9 @@
"use client";
import { cn } from "@/lib/utils";
import { useTrack } from "hooks/analytics/useTrack";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useTrack } from "../../../hooks/analytics/useTrack";
export type NavButtonProps = {
className?: string;
@@ -6,13 +6,17 @@ export type CodeProps = {
code: string;
lang: BundledLanguage;
className?: string;
ignoreFormattingErrors?: boolean;
};
export const CodeServer: React.FC<CodeProps> = async ({
code,
lang,
className,
ignoreFormattingErrors,
}) => {
const { html, formattedCode } = await getCodeHtml(code, lang);
const { html, formattedCode } = await getCodeHtml(code, lang, {
ignoreFormattingErrors,
});
return <RenderCode code={formattedCode} html={html} className={className} />;
};
@@ -0,0 +1,35 @@
import { Input } from "./input";
export function DecimalInput(props: {
value: string;
onChange: (value: string) => void;
maxValue?: number;
id?: string;
className?: string;
}) {
return (
<Input
id={props.id}
type="text"
value={props.value}
className={props.className}
inputMode="decimal"
onChange={(e) => {
const number = Number(e.target.value);
// ignore if string becomes invalid number
if (Number.isNaN(number)) {
return;
}
if (props.maxValue && number > props.maxValue) {
return;
}
// replace leading multiple zeros with single zero
let cleanedValue = e.target.value.replace(/^0+/, "0");
// replace leading zero before decimal point
if (!cleanedValue.includes(".")) {
cleanedValue = cleanedValue.replace(/^0+/, "");
}
props.onChange(cleanedValue || "0");
}}
/>
);
}
@@ -1,4 +1,4 @@
export const NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID =
export const NEXT_PUBLIC_DASHBOARD_CLIENT_ID =
process.env.NEXT_PUBLIC_DASHBOARD_CLIENT_ID || "";
export const NEXT_PUBLIC_NEBULA_APP_CLIENT_ID =
@@ -1,51 +0,0 @@
import { useQuery } from "@tanstack/react-query";
import { useMemo } from "react";
import { useActiveAccount } from "thirdweb/react";
import type { GetAuthTokenResponse } from "../../app/(app)/api/auth/get-auth-token/route";
import { LAST_USED_TEAM_ID } from "../../constants/cookies";
import { getCookie } from "../../lib/cookie";
import { getClientThirdwebClient } from "./thirdweb-client.client";
// returns a thirdweb client with optional JWT passed i
export function useThirdwebClient(jwt?: string) {
const account = useActiveAccount();
const lastUsedTeamId = getCookie(LAST_USED_TEAM_ID);
const query = useQuery({
queryKey: ["jwt", account?.address],
// only enable the query if there is an account and no JWT is passed in directly
enabled: !!account && !jwt,
retry: false,
queryFn: async () => {
if (!account) {
throw new Error("No account");
}
const res = await fetch(
`/api/auth/get-auth-token?address=${account.address}`,
);
if (!res.ok) {
throw new Error("Failed to get auth token");
}
const json = (await res.json()) as GetAuthTokenResponse;
if (!json.jwt) {
throw new Error("No JWT in response");
}
return json.jwt;
},
});
return useMemo(
// prefer jwt from props over the one from the token query if it exists
() =>
getClientThirdwebClient({
jwt: jwt || query.data,
teamId: lastUsedTeamId,
}),
[jwt, query.data, lastUsedTeamId],
);
}
/**
* DO NOT ADD ANYTHING TO THIS FILE IF YOU ARE NOT ABSOLUTELY SURE IT IS OK
*/
@@ -1,5 +1,5 @@
import {
NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
NEXT_PUBLIC_IPFS_GATEWAY_URL,
} from "@/constants/public-envs";
import {
@@ -76,7 +76,7 @@ export function getConfiguredThirdwebClient(options: {
return createThirdwebClient({
teamId: options.teamId,
secretKey: options.secretKey,
clientId: NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
clientId: NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
config: {
storage: {
gatewayUrl: NEXT_PUBLIC_IPFS_GATEWAY_URL,
+1
View File
@@ -5,6 +5,7 @@ export type ProductSKU =
| "plan:custom"
| "plan:accelerate"
| "plan:scale"
| "plan:pro"
| "product:ecosystem_wallets"
| "product:engine_standard"
| "product:engine_premium"
+2 -2
View File
@@ -1,9 +1,9 @@
import { differenceInCalendarDays } from "date-fns";
import {
type DurationId,
type Range,
getLastNDaysRange,
} from "../../components/analytics/date-range-selector";
} from "components/analytics/date-range-selector";
import { differenceInCalendarDays } from "date-fns";
export function normalizeTime(date: Date) {
const newDate = new Date(date);
@@ -1,18 +1,19 @@
"use client";
import { Button } from "@/components/ui/button";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { useStore } from "@/lib/reactive";
import { getSDKTheme } from "app/(app)/components/sdk-component-theme";
import { LazyConfigureNetworkModal } from "components/configure-networks/LazyConfigureNetworkModal";
import { CustomChainRenderer } from "components/selects/CustomChainRenderer";
import { mapV4ChainToV5Chain } from "contexts/map-chains";
import { useTrack } from "hooks/analytics/useTrack";
import { useAllChainsData } from "hooks/chains/allChains";
import { useTheme } from "next-themes";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useCallback, useMemo, useState } from "react";
import type { Chain } from "thirdweb";
import type { Chain, ThirdwebClient } from "thirdweb";
import {
ConnectButton,
type NetworkSelectorProps,
@@ -21,8 +22,6 @@ import {
} from "thirdweb/react";
import { useFavoriteChainIds } from "../../../../app/(app)/(dashboard)/(chain)/components/client/star-button";
import { doLogout } from "../../../../app/(app)/login/auth-actions";
import { LazyConfigureNetworkModal } from "../../../../components/configure-networks/LazyConfigureNetworkModal";
import { useAllChainsData } from "../../../../hooks/chains/allChains";
import {
type StoredChain,
addRecentlyUsedChainId,
@@ -36,9 +35,11 @@ export const CustomConnectWallet = (props: {
signInLinkButtonClassName?: string;
detailsButtonClassName?: string;
chain?: Chain;
client: ThirdwebClient;
isLoggedIn: boolean;
}) => {
const thirdwebClient = useThirdwebClient();
const client = props.client;
const loginRequired =
props.loginRequired === undefined ? true : props.loginRequired;
@@ -140,7 +141,7 @@ export const CustomConnectWallet = (props: {
<>
<ConnectButton
theme={getSDKTheme(t)}
client={thirdwebClient}
client={client}
connectModal={{
privacyPolicyUrl: "/privacy-policy",
termsOfServiceUrl: "/terms",
@@ -175,7 +176,7 @@ export const CustomConnectWallet = (props: {
renderChain(props) {
return (
<CustomChainRenderer
client={thirdwebClient}
client={client}
{...props}
openEditChainModal={(c) => {
setIsNetworkConfigModalOpen(true);
@@ -197,6 +198,7 @@ export const CustomConnectWallet = (props: {
open={isNetworkConfigModalOpen}
onOpenChange={setIsNetworkConfigModalOpen}
editChain={editChain}
client={client}
/>
</>
);
@@ -276,12 +278,11 @@ function ConnectWalletWelcomeScreen(props: {
export function useCustomConnectModal() {
const { connect } = useConnectModal();
const { theme } = useTheme();
const thirdwebClient = useThirdwebClient();
return useCallback(
(options?: { chain?: Chain }) => {
(options: { chain?: Chain; client: ThirdwebClient }) => {
return connect({
client: thirdwebClient,
client: options.client,
appMetadata: {
name: "thirdweb",
logoUrl: "https://thirdweb.com/favicon.ico",
@@ -299,7 +300,7 @@ export function useCustomConnectModal() {
theme: getSDKTheme(theme === "light" ? "light" : "dark"),
});
},
[connect, theme, thirdwebClient],
[connect, theme],
);
}
@@ -1,6 +1,5 @@
import { apiServerProxy } from "@/actions/proxies";
import type { Project } from "@/api/projects";
import type { Team } from "@/api/team";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useActiveAccount } from "thirdweb/react";
import { accountKeys, authorizedWallets } from "../cache-keys";
@@ -188,7 +187,7 @@ export function useUpdateNotifications() {
export const verifyEmailClient = async (input: ConfirmEmailInput) => {
type Result = {
error?: { message: string };
data: { team: Team; account: Account };
data: { account: Account };
};
const res = await apiServerProxy<Result>({
@@ -1,18 +1,17 @@
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { useMutation } from "@tanstack/react-query";
import type { ThirdwebClient } from "thirdweb";
import { upload } from "thirdweb/storage";
type DashboardUploadOptions = {
uploadWithoutDirectory?: boolean;
metadata?: Record<string, string>;
client: ThirdwebClient;
};
export function useDashboardStorageUpload(options?: DashboardUploadOptions) {
const thirdwebClient = useThirdwebClient();
export function useDashboardStorageUpload(options: DashboardUploadOptions) {
return useMutation({
mutationFn: async (files: Array<File | string>): Promise<string[]> => {
const uris = await upload({
client: thirdwebClient,
files,
...options,
});
@@ -0,0 +1,16 @@
import { TeamHeader } from "../../team/components/TeamHeader/team-header";
export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<div className="flex grow flex-col">
<div className="border-border border-b bg-card">
<TeamHeader />
</div>
{children}
</div>
);
}
@@ -1,8 +1,8 @@
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
import { defineChain } from "thirdweb";
import { getChainMetadata } from "thirdweb/chains";
import { serverThirdwebClient } from "../../../../../../../@/constants/thirdweb-client.server";
type RouteListCardProps = {
originChainId: number;
@@ -23,7 +23,6 @@ import {
NEXT_PUBLIC_THIRDWEB_ENGINE_FAUCET_WALLET,
NEXT_PUBLIC_TURNSTILE_SITE_KEY,
} from "@/constants/public-envs";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { CustomConnectWallet } from "@3rdweb-sdk/react/components/connect-wallet";
import { zodResolver } from "@hookform/resolvers/zod";
import { Turnstile } from "@marsidev/react-turnstile";
@@ -77,13 +76,14 @@ export function FaucetButton({
chain,
amount,
isLoggedIn,
client,
}: {
chain: ChainMetadata;
amount: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const pathname = usePathname();
const client = useThirdwebClient();
const address = useActiveAccount()?.address;
const chainId = chain.chainId;
// do not include local overrides for chain pages
@@ -407,6 +407,7 @@ function SendFundsToFaucetModalContent(props: {
isLoggedIn={props.isLoggedIn}
connectButtonClassName="!w-full"
detailsButtonClassName="!w-full"
client={props.client}
/>
)}
@@ -1,16 +1,19 @@
"use client";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { useTrack } from "hooks/analytics/useTrack";
import { defineDashboardChain } from "lib/defineDashboardChain";
import { useTheme } from "next-themes";
import type { ThirdwebClient } from "thirdweb";
import { PayEmbed } from "thirdweb/react";
import { getSDKTheme } from "../../../../../../components/sdk-component-theme";
export function PayModalButton(props: { chainId: number; label: string }) {
export function PayModalButton(props: {
chainId: number;
label: string;
client: ThirdwebClient;
}) {
const { theme } = useTheme();
const client = useThirdwebClient();
const trackEvent = useTrack();
return (
<Dialog>
@@ -35,7 +38,7 @@ export function PayModalButton(props: { chainId: number; label: string }) {
dialogCloseClassName="focus:ring-0"
>
<PayEmbed
client={client}
client={props.client}
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
className="!w-auto"
payOptions={{
@@ -6,7 +6,7 @@ import { ToolTipLabel } from "@/components/ui/tooltip";
import { useCustomConnectModal } from "@3rdweb-sdk/react/components/connect-wallet";
import { useMutation } from "@tanstack/react-query";
import { toast } from "sonner";
import type { Chain } from "thirdweb";
import type { Chain, ThirdwebClient } from "thirdweb";
import {
useActiveAccount,
useActiveWalletChain,
@@ -16,6 +16,7 @@ import { useDebounce } from "use-debounce";
type AddChainToWalletProps = {
chain: Chain;
client: ThirdwebClient;
};
export const AddChainToWallet: React.FC<AddChainToWalletProps> = (props) => {
@@ -49,7 +50,10 @@ export const AddChainToWallet: React.FC<AddChainToWalletProps> = (props) => {
onClick={() => {
// Connect directly to this chain
if (!account) {
return customConnectModal({ chain: props.chain });
return customConnectModal({
chain: props.chain,
client: props.client,
});
}
// switch to this chain
@@ -4,7 +4,7 @@ import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { Skeleton } from "@/components/ui/skeleton";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { isProd } from "@/constants/env-utils";
import { NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID } from "@/constants/public-envs";
import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "@/constants/public-envs";
import { useQuery } from "@tanstack/react-query";
import { CircleCheckIcon, XIcon } from "lucide-react";
import { hostnameEndsWith } from "utils/url";
@@ -14,7 +14,7 @@ function useChainStatswithRPC(_rpcUrl: string) {
let rpcUrl = _rpcUrl.replace(
// eslint-disable-next-line no-template-curly-in-string
"${THIRDWEB_API_KEY}",
NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
);
// based on the environment hit dev or production
@@ -1,5 +1,6 @@
import { ExternalLinkIcon } from "lucide-react";
import Link from "next/link";
import type { ThirdwebClient } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { ChainIcon } from "../../../../components/server/chain-icon";
import { PayModalButton } from "../client/PayModal";
@@ -8,6 +9,7 @@ import { SectionTitle } from "./SectionTitle";
export function BuyFundsSection(props: {
chain: ChainMetadata;
client: ThirdwebClient;
}) {
const sanitizedChainName = props.chain.name.replace("Mainnet", "").trim();
@@ -45,6 +47,7 @@ export function BuyFundsSection(props: {
<PayModalButton
chainId={props.chain.chainId}
label={`Bridge to ${sanitizedChainName}`}
client={props.client}
/>
<div className="h-4" />
@@ -1,3 +1,4 @@
import type { ThirdwebClient } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { getFaucetClaimAmount } from "../../../../../../api/testnet-faucet/claim/claim-amount";
import { ChainIcon } from "../../../../components/server/chain-icon";
@@ -8,8 +9,9 @@ import { SectionTitle } from "./SectionTitle";
export async function FaucetSection(props: {
chain: ChainMetadata;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const { chain, isLoggedIn } = props;
const { chain, isLoggedIn, client } = props;
// Check eligibility.
const sanitizedChainName = chain.name.replace("Mainnet", "").trim();
@@ -44,6 +46,7 @@ export async function FaucetSection(props: {
<div className="h-8" />
<FaucetButton
client={client}
chain={chain}
amount={amountToGive}
isLoggedIn={isLoggedIn}
@@ -1,6 +1,7 @@
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import Link from "next/link";
import type { ThirdwebClient } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { mapV4ChainToV5Chain } from "../../../../../../../../contexts/map-chains";
import { ChainIcon } from "../../../../components/server/chain-icon";
@@ -10,6 +11,7 @@ type ChainHeaderProps = {
headerImageUrl?: string;
logoUrl?: string;
chain: ChainMetadata;
client: ThirdwebClient;
};
// TODO: improve the behavior when clicking "Get started with thirdweb", currently just redirects to the dashboard
@@ -51,6 +53,7 @@ export function ChainHeader(props: ChainHeaderProps) {
{/* Desktop only */}
<div className="hidden flex-row gap-2 lg:flex">
<AddChainToWallet
client={props.client}
chain={
// Do not include chain overrides for chain pages
// eslint-disable-next-line no-restricted-syntax
@@ -24,6 +24,7 @@ import {
getAuthToken,
getAuthTokenWalletAddress,
} from "../../../../api/lib/getAuthToken";
import { TeamHeader } from "../../../../team/components/TeamHeader/team-header";
import { StarButton } from "../../components/client/star-button";
import { getChain, getChainMetadata } from "../../utils";
import { AddChainToWallet } from "./components/client/add-chain-to-wallet";
@@ -95,7 +96,10 @@ The following is the user's message:
}
return (
<>
<div className="flex grow flex-col">
<div className="border-border border-b bg-card">
<TeamHeader />
</div>
<NebulaChatButton
isLoggedIn={!!authToken}
networks={chain.testnet ? "testnet" : "mainnet"}
@@ -160,6 +164,7 @@ The following is the user's message:
headerImageUrl={chainMetadata?.headerImgUrl}
logoUrl={chain.icon?.url}
chain={chain}
client={client}
/>
<div className="h-4 md:h-8" />
@@ -206,6 +211,7 @@ The following is the user's message:
<div className="w-full sm:hidden">
<div className="grid grid-cols-2 gap-2">
<AddChainToWallet
client={client}
chain={
// Do not include chain overrides for chain pages
// eslint-disable-next-line no-restricted-syntax
@@ -225,7 +231,7 @@ The following is the user's message:
{children}
</div>
</div>
</>
</div>
);
}
@@ -1,7 +1,7 @@
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
import { ImageResponse } from "next/og";
import { download } from "thirdweb/storage";
import { fetchChain } from "utils/fetchChain";
import { serverThirdwebClient } from "../../../../../../@/constants/thirdweb-client.server";
// Route segment config
export const runtime = "edge";
@@ -1,3 +1,4 @@
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { CircleAlertIcon } from "lucide-react";
import { getRawAccount } from "../../../../account/settings/getAccount";
import { getChain, getChainMetadata } from "../../utils";
@@ -16,6 +17,7 @@ export default async function Page(props: {
const params = await props.params;
const chain = await getChain(params.chain_id);
const chainMetadata = await getChainMetadata(chain.chainId);
const client = getClientThirdwebClient();
const isDeprecated = chain.status === "deprecated";
const account = await getRawAccount();
@@ -42,9 +44,9 @@ export default async function Page(props: {
{/* Faucet / Buy Funds */}
{chain.testnet ? (
<FaucetSection chain={chain} isLoggedIn={!!account} />
<FaucetSection chain={chain} isLoggedIn={!!account} client={client} />
) : chain.services.find((c) => c.service === "pay" && c.enabled) ? (
<BuyFundsSection chain={chain} />
<BuyFundsSection chain={chain} client={client} />
) : null}
{/* Chain Overview */}
@@ -30,6 +30,7 @@ export const CancelTab: React.FC<CancelTabProps> = ({
return (
<div className="flex flex-col gap-3 pt-3">
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -485,6 +485,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
>
<FormLabel>Contract address</FormLabel>
<SolidityInput
client={contract.client}
solidityType="address"
formContext={form}
{...form.register("selected.contractAddress", {
@@ -558,6 +559,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
width="140px"
height="140px"
requireInteraction
client={contract.client}
/>
</Box>
</Tooltip>
@@ -658,6 +660,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
Cancel
</Button>
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
isPending={isFormLoading}
@@ -51,6 +51,7 @@ export const ListingDrawer: React.FC<NFTDrawerProps> = ({
<div className="flex flex-row gap-6">
<NFTMediaWithEmptyState
metadata={renderData.asset.metadata}
client={contract.client}
requireInteraction
width="150px"
height="150px"
@@ -92,7 +93,10 @@ export const ListingDrawer: React.FC<NFTDrawerProps> = ({
<p className="font-bold">Seller</p>
</GridItem>
<GridItem colSpan={9}>
<WalletAddress address={renderData.creatorAddress} />
<WalletAddress
address={renderData.creatorAddress}
client={contract.client}
/>
</GridItem>
<GridItem colSpan={3}>
<p className="font-bold">Listing ID</p>
@@ -40,49 +40,6 @@ import { min } from "thirdweb/utils";
import { ListingDrawer } from "./listing-drawer";
import { LISTING_STATUS } from "./types";
const tableColumns: Column<DirectListing | EnglishAuction>[] = [
{
Header: "Listing Id",
accessor: (row) => row.id.toString(),
},
{
Header: "Media",
accessor: (row) => row.asset.metadata,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: (cell: any) => <MediaCell cell={cell} />,
},
{
Header: "Name",
accessor: (row) => row.asset.metadata.name ?? "N/A",
},
{
Header: "Creator",
accessor: (row) => row.creatorAddress,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: ({ cell }: { cell: Cell<any, string> }) => (
<WalletAddress address={cell.value} />
),
},
{
Header: "Price",
accessor: (row) =>
(row as DirectListing)?.currencyValuePerToken ||
(row as EnglishAuction)?.buyoutCurrencyValue,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: ({ cell }: { cell: Cell<any, any> }) => {
return (
<p className="whitespace-nowrap text-muted-foreground">
{cell.value.displayValue} {cell.value.symbol}
</p>
);
},
},
{
Header: "Status",
accessor: (row) => LISTING_STATUS[row.status],
},
];
interface MarketplaceTableProps {
contract: ThirdwebContract;
getAllQueryResult: UseQueryResult<DirectListing[] | EnglishAuction[]>;
@@ -132,6 +89,51 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
return getValidQueryResult?.data || prevData;
}, [getAllQueryResult, getValidQueryResult, listingsToShow, prevData]);
const tableColumns: Column<DirectListing | EnglishAuction>[] = useMemo(() => {
return [
{
Header: "Listing Id",
accessor: (row) => row.id.toString(),
},
{
Header: "Media",
accessor: (row) => row.asset.metadata,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: (cell: any) => <MediaCell cell={cell} client={contract.client} />,
},
{
Header: "Name",
accessor: (row) => row.asset.metadata.name ?? "N/A",
},
{
Header: "Creator",
accessor: (row) => row.creatorAddress,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: ({ cell }: { cell: Cell<any, string> }) => (
<WalletAddress address={cell.value} client={contract.client} />
),
},
{
Header: "Price",
accessor: (row) =>
(row as DirectListing)?.currencyValuePerToken ||
(row as EnglishAuction)?.buyoutCurrencyValue,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: ({ cell }: { cell: Cell<any, any> }) => {
return (
<p className="whitespace-nowrap text-muted-foreground">
{cell.value.displayValue} {cell.value.symbol}
</p>
);
},
},
{
Header: "Status",
accessor: (row) => LISTING_STATUS[row.status],
},
];
}, [contract.client]);
const {
getTableProps,
getTableBodyProps,
@@ -235,7 +237,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
</Th>
))}
{/* // Need to add an empty header for the drawer button */}
<Th border="none" />
<Th border="none" key="drawer" />
</Tr>
))}
</Thead>
@@ -1,7 +1,7 @@
import { SkeletonContainer } from "@/components/ui/skeleton";
import { TrackedLinkTW } from "@/components/ui/tracked-link";
import { useMemo } from "react";
import { type NFT, ZERO_ADDRESS } from "thirdweb";
import { type NFT, type ThirdwebClient, ZERO_ADDRESS } from "thirdweb";
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { buildContractPagePath } from "../_utils/contract-page-path";
@@ -32,6 +32,7 @@ interface NFTCardsProps {
isPending: boolean;
allNfts?: boolean;
projectMeta: ProjectMeta | undefined;
client: ThirdwebClient;
}
export const NFTCards: React.FC<NFTCardsProps> = ({
@@ -40,6 +41,7 @@ export const NFTCards: React.FC<NFTCardsProps> = ({
isPending,
allNfts,
projectMeta,
client,
}) => {
const dummyData = useMemo(() => {
return Array.from({
@@ -73,6 +75,7 @@ export const NFTCards: React.FC<NFTCardsProps> = ({
requireInteraction
width="100%"
height="100%"
client={client}
/>
);
}}
@@ -528,6 +528,7 @@ export const ClaimConditionsForm: React.FC<ClaimConditionsFormProps> = ({
form.setValue(`phases.${index}.snapshot`, snapshot)
}
isDisabled={!canEditForm}
client={contract.client}
/>
<ClaimsConditionFormContext.Provider
@@ -658,6 +659,7 @@ export const ClaimConditionsForm: React.FC<ClaimConditionsFormProps> = ({
hasRemovedPhases ||
!isMultiPhase ? (
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -94,6 +94,7 @@ export const ResetClaimEligibility: React.FC<ResetClaimEligibilityProps> = ({
return (
<AdminOnly contract={contract} fallback={<div className="pb-5" />}>
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
transactionCount={1}
type="button"
@@ -14,7 +14,7 @@ import { useCsvUpload } from "hooks/useCsvUpload";
import { CircleAlertIcon, DownloadIcon, UploadIcon } from "lucide-react";
import { useRef } from "react";
import type { Column } from "react-table";
import { ZERO_ADDRESS } from "thirdweb";
import { type ThirdwebClient, ZERO_ADDRESS } from "thirdweb";
import { CsvDataTable } from "../csv-data-table";
interface SnapshotAddressInput {
@@ -30,6 +30,7 @@ interface SnapshotUploadProps {
isDisabled: boolean;
value?: SnapshotAddressInput[] | undefined;
onClose: () => void;
client: ThirdwebClient;
}
const csvParser = (items: SnapshotAddressInput[]): SnapshotAddressInput[] => {
@@ -49,6 +50,7 @@ const SnapshotViewerSheetContent: React.FC<SnapshotUploadProps> = ({
isDisabled,
value,
onClose,
client,
}) => {
const {
normalizeQuery,
@@ -59,7 +61,11 @@ const SnapshotViewerSheetContent: React.FC<SnapshotUploadProps> = ({
noCsv,
reset,
removeInvalid,
} = useCsvUpload<SnapshotAddressInput>({ csvParser, defaultRawData: value });
} = useCsvUpload<SnapshotAddressInput>({
csvParser,
defaultRawData: value,
client,
});
const paginationPortalRef = useRef<HTMLDivElement>(null);
const normalizeData = normalizeQuery.data;
@@ -6,9 +6,11 @@ import { ConfigureNetworks } from "components/configure-networks/ConfigureNetwor
import { CheckIcon, CircleAlertIcon, RotateCcwIcon } from "lucide-react";
import { useState } from "react";
import { addChainOverrides } from "stores/chainStores";
import type { ThirdwebClient } from "thirdweb";
export function ConfigureCustomChain(props: {
chainSlug: string;
client: ThirdwebClient;
}) {
const { chainSlug } = props;
const isSlugNumber = Number.isInteger(Number(chainSlug));
@@ -61,6 +63,7 @@ export function ConfigureCustomChain(props: {
}
}}
editChain={undefined}
client={props.client}
/>
</div>
</div>
@@ -43,7 +43,6 @@ export async function getContractMetadataHeaderData(
fetchDashboardContractMetadata(contract),
fetchPublishedContractsFromDeploy({
contract,
client: contract.client,
}),
]);
@@ -82,21 +82,19 @@ export const MetadataHeader: React.FC<MetadataHeaderProps> = ({
</h1>
)}
{chain && (
<Link
href={`/${chain.slug}`}
className="flex w-fit shrink-0 items-center gap-2 rounded-3xl border border-border bg-card px-2.5 py-1.5 hover:bg-accent"
>
<ChainIconClient
src={chain.icon?.url}
client={client}
className="size-4"
/>
{cleanedChainName && (
<span className="text-xs">{cleanedChainName}</span>
)}
</Link>
)}
<Link
href={`/${chain.slug}`}
className="flex w-fit shrink-0 items-center gap-2 rounded-3xl border border-border bg-card px-2.5 py-1.5 hover:bg-accent"
>
<ChainIconClient
src={chain.icon?.url}
client={client}
className="size-4"
/>
{cleanedChainName && (
<span className="text-xs">{cleanedChainName}</span>
)}
</Link>
</div>
)}
@@ -115,7 +113,7 @@ export const MetadataHeader: React.FC<MetadataHeaderProps> = ({
<CopyAddressButton
address={address}
copyIconPosition="left"
className="bg-card text-xs"
className="bg-card px-2.5 py-1.5 text-xs"
variant="outline"
/>
@@ -81,7 +81,17 @@ export const PrimaryDashboardButton: React.FC<AddToDashboardCardProps> = ({
// if user is on a project page
if (projectMeta) {
return null;
return (
<Button variant="default" asChild>
<Link
href={`/${contractInfo.chainSlug}/${contractAddress}`}
target="_blank"
className="gap-2"
>
View Asset Page <ExternalLinkIcon className="size-3.5" />
</Link>
</Button>
);
}
return (
@@ -0,0 +1,31 @@
import { resolveFunctionSelectors } from "lib/selectors";
import type { ThirdwebContract } from "thirdweb";
import { isERC20 } from "thirdweb/extensions/erc20";
export type NewPublicPageType = "erc20";
export async function shouldRenderNewPublicPage(
contract: ThirdwebContract,
): Promise<false | { type: NewPublicPageType }> {
try {
const functionSelectors = await resolveFunctionSelectors(contract).catch(
() => undefined,
);
if (!functionSelectors) {
return false;
}
const isERC20Contract = isERC20(functionSelectors);
if (isERC20Contract) {
return {
type: "erc20",
};
}
return false;
} catch {
return false;
}
}
@@ -3,6 +3,7 @@ import { Badge } from "@/components/ui/badge";
import { Flex, SimpleGrid, useBreakpointValue } from "@chakra-ui/react";
import { formatDistance } from "date-fns/formatDistance";
import { useAllChainsData } from "hooks/chains/allChains";
import type { ThirdwebClient } from "thirdweb";
import { useActiveAccount } from "thirdweb/react";
import { Card, Heading, Text } from "tw-components";
@@ -16,11 +17,13 @@ export type AccountSignerType = {
interface AccountSignerProps {
item: AccountSignerType;
contractChainId: number;
client: ThirdwebClient;
}
export const AccountSigner: React.FC<AccountSignerProps> = ({
item,
contractChainId,
client,
}) => {
const address = useActiveAccount()?.address;
const { idToChain } = useAllChainsData();
@@ -43,7 +46,11 @@ export const AccountSigner: React.FC<AccountSignerProps> = ({
flexDir={{ base: "column", lg: "row" }}
>
<Heading size="label.lg">
<WalletAddress shortenAddress={isMobile} address={signer} />
<WalletAddress
shortenAddress={isMobile}
address={signer}
client={client}
/>
</Heading>
<div className="flex flex-row gap-2">
{isAdmin ? <Badge>Admin Key</Badge> : <Badge>Scoped key</Badge>}
@@ -40,6 +40,7 @@ export const AccountSigners: React.FC<AccountSignersProps> = ({ contract }) => {
<AccountSigner
key={item.signer}
item={item}
client={contract.client}
contractChainId={contract.chain.id}
/>
))}
@@ -41,6 +41,7 @@ export const AccountPage: React.FC<AccountPageProps> = ({
address={contract.address}
symbol={symbol}
chain={chainMetadata}
client={contract.client}
/>
)}
@@ -1,12 +1,11 @@
"use client";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { Input } from "@chakra-ui/react";
import { TransactionButton } from "components/buttons/TransactionButton";
import { useV5DashboardChain } from "lib/v5-adapter";
import { type ChangeEvent, useState } from "react";
import type { StoredChain } from "stores/chainStores";
import { prepareTransaction, toWei } from "thirdweb";
import { type ThirdwebClient, prepareTransaction, toWei } from "thirdweb";
import { useSendAndConfirmTransaction } from "thirdweb/react";
import { Card } from "tw-components";
@@ -15,6 +14,7 @@ interface DepositNativeProps {
symbol: string;
chain: StoredChain;
isLoggedIn: boolean;
client: ThirdwebClient;
}
export const DepositNative: React.FC<DepositNativeProps> = ({
@@ -22,8 +22,8 @@ export const DepositNative: React.FC<DepositNativeProps> = ({
symbol,
chain,
isLoggedIn,
client,
}) => {
const client = useThirdwebClient();
const { mutate: transfer, isPending } = useSendAndConfirmTransaction();
const [amount, setAmount] = useState("");
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
@@ -48,6 +48,7 @@ export const DepositNative: React.FC<DepositNativeProps> = ({
value={amount}
/>
<TransactionButton
client={client}
isLoggedIn={isLoggedIn}
txChainID={v5Chain.id}
transactionCount={1}
@@ -27,6 +27,7 @@ export const NftsOwned: React.FC<NftsOwnedProps> = ({
return nfts.length !== 0 ? (
<NFTCards
client={contract.client}
projectMeta={projectMeta}
nfts={nfts.map((nft) => ({
id: BigInt(nft.id),
@@ -61,6 +61,7 @@ export const CreateAccountButton: React.FC<CreateAccountButtonProps> = ({
return (
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
onClick={() => {
@@ -5,6 +5,7 @@ import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
import { ContractAnalyticsPage } from "./ContractAnalyticsPage";
export async function SharedAnalyticsPage(props: {
@@ -22,6 +23,18 @@ export async function SharedAnalyticsPage(props: {
notFound();
}
// new public page can't show /analytics page
if (!props.projectMeta) {
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
if (shouldHide) {
redirectToContractLandingPage({
contractAddress: props.contractAddress,
chainIdOrSlug: props.chainIdOrSlug,
projectMeta: props.projectMeta,
});
}
}
const [
{ eventSelectorToName, writeFnSelectorToName },
{ isInsightSupported },
@@ -4,6 +4,7 @@ import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[
import { ClaimConditions } from "../_components/claim-conditions/claim-conditions";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
import { ClaimConditionsClient } from "./ClaimConditions.client";
export async function SharedClaimConditionsPage(props: {
@@ -22,6 +23,18 @@ export async function SharedClaimConditionsPage(props: {
notFound();
}
// new public page can't show /claim-conditions page
if (!props.projectMeta) {
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
if (shouldHide) {
redirectToContractLandingPage({
contractAddress: props.contractAddress,
chainIdOrSlug: props.chainIdOrSlug,
projectMeta: props.projectMeta,
});
}
}
const { clientContract, serverContract, isLocalhostChain } = info;
if (isLocalhostChain) {
@@ -1,7 +1,9 @@
import { notFound } from "next/navigation";
import { resolveContractAbi } from "thirdweb/contract";
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
import { ContractCodePage } from "./contract-code-page";
import { ContractCodePageClient } from "./contract-code-page.client";
@@ -20,6 +22,18 @@ export async function SharedCodePage(props: {
notFound();
}
// new public page can't show /code page
if (!props.projectMeta) {
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
if (shouldHide) {
redirectToContractLandingPage({
contractAddress: props.contractAddress,
chainIdOrSlug: props.chainIdOrSlug,
projectMeta: props.projectMeta,
});
}
}
const { clientContract, serverContract, chainMetadata, isLocalhostChain } =
info;
@@ -20,8 +20,10 @@ import { eth_getCode, getRpcClient } from "thirdweb/rpc";
import type { TransactionReceipt } from "thirdweb/transaction";
import { type AbiFunction, decodeFunctionData } from "thirdweb/utils";
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
import { DataTable } from "./data-table";
import { NoCrossChainPrompt } from "./no-crosschain-prompt";
@@ -48,6 +50,18 @@ export async function SharedCrossChainPage(props: {
notFound();
}
// new public page can't show /cross-chain page
if (!props.projectMeta) {
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
if (shouldHide) {
redirectToContractLandingPage({
contractAddress: props.contractAddress,
chainIdOrSlug: props.chainIdOrSlug,
projectMeta: props.projectMeta,
});
}
}
const { clientContract, serverContract } = info;
const isModularCore = (await getContractPageMetadata(serverContract))
@@ -169,7 +183,6 @@ export async function SharedCrossChainPage(props: {
coreMetadata = (
await fetchPublishedContractsFromDeploy({
contract: serverContract,
client: serverContract.client,
})
).at(-1) as FetchDeployMetadataResult;
} catch {}
@@ -242,7 +255,6 @@ export async function SharedCrossChainPage(props: {
client: serverContract.client,
address: m,
}),
client: serverContract.client,
})
).at(-1),
),
@@ -1,6 +1,8 @@
import { notFound } from "next/navigation";
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
import { EventsFeed } from "./events-feed";
export async function SharedEventsPage(props: {
@@ -18,6 +20,18 @@ export async function SharedEventsPage(props: {
notFound();
}
// new public page can't show /events page
if (!props.projectMeta) {
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
if (shouldHide) {
redirectToContractLandingPage({
contractAddress: props.contractAddress,
chainIdOrSlug: props.chainIdOrSlug,
projectMeta: props.projectMeta,
});
}
}
return (
<EventsFeed
contract={info.clientContract}
@@ -1,7 +1,9 @@
import { notFound } from "next/navigation";
import { resolveContractAbi } from "thirdweb/contract";
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
import { ContractExplorerPage } from "./ContractExplorerPage";
import { ContractExplorerPageClient } from "./ContractExplorerPage.client";
@@ -21,6 +23,18 @@ export async function SharedExplorerPage(props: {
notFound();
}
// new public page can't show /explorer page
if (!props.projectMeta) {
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
if (shouldHide) {
redirectToContractLandingPage({
contractAddress: props.contractAddress,
chainIdOrSlug: props.chainIdOrSlug,
projectMeta: props.projectMeta,
});
}
}
const { clientContract, serverContract, chainMetadata, isLocalhostChain } =
info;
@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import { getAuthToken } from "../../../../api/lib/getAuthToken";
import {
SharedContractLayout,
generateContractLayoutMetadata,
@@ -11,12 +12,13 @@ export default async function Layout(props: {
}>;
children: React.ReactNode;
}) {
const params = await props.params;
const [params, authToken] = await Promise.all([props.params, getAuthToken()]);
return (
<SharedContractLayout
contractAddress={params.contractAddress}
chainIdOrSlug={params.chain_id}
projectMeta={undefined}
authToken={authToken}
>
{props.children}
</SharedContractLayout>
@@ -23,7 +23,7 @@ import { useTxNotifications } from "hooks/useTxNotifications";
import { CircleAlertIcon } from "lucide-react";
import { useCallback } from "react";
import { useForm } from "react-hook-form";
import { sendAndConfirmTransaction } from "thirdweb";
import { type ThirdwebClient, sendAndConfirmTransaction } from "thirdweb";
import { BatchMetadataERC721, BatchMetadataERC1155 } from "thirdweb/modules";
import { parseAttributes } from "utils/parseAttributes";
import { z } from "zod";
@@ -94,6 +94,7 @@ function BatchMetadataModule(props: ModuleInstanceProps) {
uploadMetadata={uploadMetadata}
isOwnerAccount={!!ownerAccount}
contractChainId={contract.chain.id}
client={contract.client}
/>
);
}
@@ -104,6 +105,7 @@ export function BatchMetadataModuleUI(
uploadMetadata: (values: UploadMetadataFormValues) => Promise<void>;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
},
) {
return (
@@ -121,6 +123,7 @@ export function BatchMetadataModuleUI(
isLoggedIn={props.isLoggedIn}
uploadMetadata={props.uploadMetadata}
contractChainId={props.contractChainId}
client={props.client}
/>
)}
{!props.isOwnerAccount && (
@@ -163,6 +166,7 @@ function UploadMetadataNFTSection(props: {
uploadMetadata: (values: UploadMetadataFormValues) => Promise<void>;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<UploadMetadataFormValues>({
resolver: zodResolver(uploadMetadataFormSchema),
@@ -261,6 +265,7 @@ function UploadMetadataNFTSection(props: {
<div className="flex justify-end">
<TransactionButton
client={props.client}
isLoggedIn={props.isLoggedIn}
size="sm"
className="min-w-24"
@@ -41,6 +41,7 @@ import { useFieldArray, useForm } from "react-hook-form";
import {
NATIVE_TOKEN_ADDRESS,
type PreparedTransaction,
type ThirdwebClient,
ZERO_ADDRESS,
getContract,
sendAndConfirmTransaction,
@@ -271,6 +272,7 @@ function ClaimableModule(props: ModuleInstanceProps) {
return (
<ClaimableModuleUI
{...props}
client={props.contract.client}
primarySaleRecipientSection={{
data: primarySaleRecipientQuery.data
? { primarySaleRecipient: primarySaleRecipientQuery.data }
@@ -342,6 +344,7 @@ export function ClaimableModuleUI(
isLoading: boolean;
};
isLoggedIn: boolean;
client: ThirdwebClient;
},
) {
return (
@@ -357,6 +360,7 @@ export function ClaimableModuleUI(
</AccordionTrigger>
<AccordionContent className="px-1">
<MintNFTSection
client={props.client}
mint={props.mintSection.mint}
name={props.name}
contractChainId={props.contractChainId}
@@ -389,6 +393,7 @@ export function ClaimableModuleUI(
{props.name !== "ClaimableERC1155" || props.isValidTokenId ? (
props.claimConditionSection.data ? (
<ClaimConditionSection
client={props.client}
isLoggedIn={props.isLoggedIn}
isOwnerAccount={props.isOwnerAccount}
claimCondition={
@@ -423,6 +428,7 @@ export function ClaimableModuleUI(
<AccordionContent className="px-1">
{props.primarySaleRecipientSection.data ? (
<PrimarySaleRecipientSection
client={props.client}
isLoggedIn={props.isLoggedIn}
isOwnerAccount={props.isOwnerAccount}
primarySaleRecipient={
@@ -489,6 +495,7 @@ function ClaimConditionSection(props: {
tokenId: string;
noClaimConditionSet: boolean;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const { idToChain } = useAllChainsData();
const chain = idToChain.get(props.chainId);
@@ -740,6 +747,7 @@ function ClaimConditionSection(props: {
<div className="flex justify-end">
<TransactionButton
client={props.client}
isLoggedIn={props.isLoggedIn}
size="sm"
className="min-w-24"
@@ -774,6 +782,7 @@ function PrimarySaleRecipientSection(props: {
isOwnerAccount: boolean;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<PrimarySaleRecipientFormValues>({
resolver: zodResolver(primarySaleRecipientFormSchema),
@@ -822,6 +831,7 @@ function PrimarySaleRecipientSection(props: {
<div className="flex justify-end">
<TransactionButton
client={props.client}
isLoggedIn={props.isLoggedIn}
size="sm"
className="min-w-24 gap-2"
@@ -858,6 +868,7 @@ function MintNFTSection(props: {
name: string;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<MintFormValues>({
resolver: zodResolver(mintFormSchema),
@@ -939,6 +950,7 @@ function MintNFTSection(props: {
<div className="flex justify-end">
<TransactionButton
client={props.client}
size="sm"
className="min-w-24 gap-2"
disabled={mintMutation.isPending}
@@ -27,7 +27,11 @@ import { useTxNotifications } from "hooks/useTxNotifications";
import { CircleAlertIcon } from "lucide-react";
import { useCallback } from "react";
import { useForm } from "react-hook-form";
import { type PreparedTransaction, sendAndConfirmTransaction } from "thirdweb";
import {
type PreparedTransaction,
type ThirdwebClient,
sendAndConfirmTransaction,
} from "thirdweb";
import {
MintableERC20,
MintableERC721,
@@ -177,6 +181,7 @@ function MintableModule(props: ModuleInstanceProps) {
name={props.contractInfo.name}
isBatchMetadataInstalled={isBatchMetadataInstalled}
contractChainId={contract.chain.id}
client={contract.client}
/>
);
}
@@ -192,6 +197,7 @@ export function MintableModuleUI(
isBatchMetadataInstalled: boolean;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
},
) {
return (
@@ -215,6 +221,7 @@ export function MintableModuleUI(
name={props.name}
isBatchMetadataInstalled={props.isBatchMetadataInstalled}
contractChainId={props.contractChainId}
client={props.client}
/>
)}
{!props.isOwnerAccount && (
@@ -242,6 +249,7 @@ export function MintableModuleUI(
update={props.updatePrimaryRecipient}
contractChainId={props.contractChainId}
isLoggedIn={props.isLoggedIn}
client={props.client}
/>
</AccordionContent>
</AccordionItem>
@@ -262,6 +270,7 @@ function PrimarySalesSection(props: {
isOwnerAccount: boolean;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<UpdateFormValues>({
resolver: zodResolver(primarySaleRecipientFormSchema),
@@ -311,6 +320,7 @@ function PrimarySalesSection(props: {
<div className="mt-4 flex justify-end">
<TransactionButton
client={props.client}
isLoggedIn={props.isLoggedIn}
size="sm"
className="min-w-24"
@@ -340,6 +350,7 @@ function MintNFTSection(props: {
isBatchMetadataInstalled: boolean;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<MintFormValues>({
resolver: zodResolver(mintFormSchema),
@@ -523,6 +534,7 @@ function MintNFTSection(props: {
<div className="flex justify-end">
<TransactionButton
client={props.client}
isLoggedIn={props.isLoggedIn}
size="sm"
className="min-w-24"
@@ -1,7 +1,6 @@
"use client";
import { Spinner } from "@/components/ui/Spinner/Spinner";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { FormControl, Input, Select, Skeleton, Spacer } from "@chakra-ui/react";
import { useMutation, useQuery } from "@tanstack/react-query";
import { TransactionButton } from "components/buttons/TransactionButton";
@@ -60,7 +59,6 @@ type InstallModuleFormProps = {
export type InstallModuleForm = UseFormReturn<FormData>;
export const InstallModuleForm = (props: InstallModuleFormProps) => {
const client = useThirdwebClient();
const form = useForm<FormData>({
defaultValues: {
publisherAddress: "0xdd99b75f095d0c4d5112aCe938e4e6ed962fb024", // thirdweb publisher address
@@ -71,9 +69,10 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
const { contract, account } = props;
const { errors } = formState;
const { data, isPending, isFetching } = usePublishedContractsQuery(
watch("publisherAddress"),
);
const { data, isPending, isFetching } = usePublishedContractsQuery({
client: contract.client,
address: watch("publisherAddress"),
});
// filter out all the contracts that AREN'T modules
const modulesOnly = useMemo(() => {
@@ -90,6 +89,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
const allVersions = useAllVersions(
watch("publisherAddress"),
watch("moduleContract"),
contract.client,
);
const installMutation = useMutation({
@@ -182,7 +182,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
moduleAddress.map(async (address) => {
const result = await resolveImplementation(
getContract({
client,
client: contract.client,
address,
chain: contract.chain,
}),
@@ -231,7 +231,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
moduleInfo: {
bytecodeUri: selectedModule.metadata.bytecodeUri,
},
client,
client: contract.client,
});
},
retry: false,
@@ -255,6 +255,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
const moduleInstallParams = useModuleInstallParams({
module: selectedModuleMeta,
isQueryEnabled: !!selectedModule && !!isModuleCompatibleQuery.data,
client: contract.client,
});
return (
@@ -387,6 +388,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
{/* Submit */}
<div className="flex justify-end">
<TransactionButton
client={contract.client}
isLoggedIn={props.isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -23,7 +23,7 @@ import { useTxNotifications } from "hooks/useTxNotifications";
import { CircleAlertIcon } from "lucide-react";
import { useCallback } from "react";
import { useForm } from "react-hook-form";
import { sendAndConfirmTransaction } from "thirdweb";
import { type ThirdwebClient, sendAndConfirmTransaction } from "thirdweb";
import { OpenEditionMetadataERC721 } from "thirdweb/modules";
import { z } from "zod";
import { ModuleCardUI, type ModuleCardUIProps } from "./module-card";
@@ -73,6 +73,7 @@ function OpenEditionMetadataModule(props: ModuleInstanceProps) {
setSharedMetadata={setSharedMetadata}
isOwnerAccount={!!props.ownerAccount}
contractChainId={props.contract.chain.id}
client={props.contract.client}
/>
);
}
@@ -99,6 +100,7 @@ export function OpenEditionMetadataModuleUI(
setSharedMetadata={props.setSharedMetadata}
contractChainId={props.contractChainId}
isLoggedIn={props.isLoggedIn}
client={props.client}
/>
)}
{!props.isOwnerAccount && (
@@ -121,6 +123,7 @@ function SetSharedMetadataSection(props: {
setSharedMetadata: (values: SetSharedMetadataFormValues) => Promise<void>;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<SetSharedMetadataFormValues>({
resolver: zodResolver(setSharedMetadataFormSchema),
@@ -212,6 +215,7 @@ function SetSharedMetadataSection(props: {
<div className="flex justify-end">
<TransactionButton
size="sm"
client={props.client}
className="min-w-24"
disabled={setSharedMetadataMutation.isPending}
type="submit"
@@ -23,7 +23,7 @@ import { useTxNotifications } from "hooks/useTxNotifications";
import { CircleAlertIcon } from "lucide-react";
import { useCallback } from "react";
import { useForm } from "react-hook-form";
import { sendAndConfirmTransaction } from "thirdweb";
import { type ThirdwebClient, sendAndConfirmTransaction } from "thirdweb";
import { RoyaltyERC721, RoyaltyERC1155 } from "thirdweb/modules";
import { useReadContract } from "thirdweb/react";
import { z } from "zod";
@@ -150,6 +150,7 @@ function RoyaltyModule(props: ModuleInstanceProps) {
setRoyaltyInfoForToken={setRoyaltyInfoForToken}
isOwnerAccount={!!ownerAccount}
contractChainId={props.contract.chain.id}
client={props.contract.client}
/>
);
}
@@ -186,6 +187,7 @@ export function RoyaltyModuleUI(
setRoyaltyInfoForToken={props.setRoyaltyInfoForToken}
contractChainId={props.contractChainId}
isLoggedIn={props.isLoggedIn}
client={props.client}
/>
) : (
<Alert variant="info">
@@ -209,6 +211,7 @@ export function RoyaltyModuleUI(
defaultRoyaltyInfo={props.defaultRoyaltyInfo}
contractChainId={props.contractChainId}
isLoggedIn={props.isLoggedIn}
client={props.client}
/>
) : (
<Alert variant="info">
@@ -232,6 +235,7 @@ export function RoyaltyModuleUI(
transferValidator={props.transferValidator}
contractChainId={props.contractChainId}
isLoggedIn={props.isLoggedIn}
client={props.client}
/>
) : (
<Alert variant="info">
@@ -269,6 +273,7 @@ function RoyaltyInfoPerTokenSection(props: {
setRoyaltyInfoForToken: (values: RoyaltyInfoFormValues) => Promise<void>;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<RoyaltyInfoFormValues>({
resolver: zodResolver(royaltyInfoFormSchema),
@@ -348,6 +353,7 @@ function RoyaltyInfoPerTokenSection(props: {
<div className="mt-4 flex justify-end">
<TransactionButton
client={props.client}
isLoggedIn={props.isLoggedIn}
size="sm"
className="min-w-24"
@@ -383,6 +389,7 @@ function DefaultRoyaltyInfoSection(props: {
update: (values: DefaultRoyaltyFormValues) => Promise<void>;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const [defaultRoyaltyRecipient, defaultRoyaltyPercentage] =
props.defaultRoyaltyInfo || [];
@@ -452,6 +459,7 @@ function DefaultRoyaltyInfoSection(props: {
<div className="mt-4 flex justify-end">
<TransactionButton
client={props.client}
size="sm"
className="min-w-24"
disabled={updateMutation.isPending}
@@ -483,6 +491,7 @@ function TransferValidatorSection(props: {
update: (values: TransferValidatorFormValues) => Promise<void>;
contractChainId: number;
isLoggedIn: boolean;
client: ThirdwebClient;
}) {
const form = useForm<TransferValidatorFormValues>({
resolver: zodResolver(transferValidatorFormSchema),
@@ -530,6 +539,7 @@ function TransferValidatorSection(props: {
<div className="mt-4 flex justify-end">
<TransactionButton
client={props.client}
isLoggedIn={props.isLoggedIn}
size="sm"
className="min-w-24 gap-2"
@@ -123,6 +123,7 @@ function TransferableModule(props: ModuleInstanceProps) {
update={update}
isOwnerAccount={!!props.ownerAccount}
contractChainId={props.contract.chain.id}
client={props.contract.client}
/>
);
}
@@ -184,6 +185,7 @@ export function TransferableModuleUI(
updateButton={() => {
return (
<TransactionButton
client={props.client}
size="sm"
className="min-w-24 gap-2"
type="submit"
@@ -87,6 +87,7 @@ function Component() {
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
uploadMetadata={uploadMetadataStub}
client={storybookThirdwebClient}
uninstallButton={{
onClick: async () => removeMutation.mutateAsync(),
isPending: removeMutation.isPending,
@@ -147,6 +147,7 @@ function Component() {
</div>
<ClaimableModuleUI
client={storybookThirdwebClient}
isLoggedIn={true}
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
@@ -1,7 +1,7 @@
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { FormControl } from "@chakra-ui/react";
import { useQuery } from "@tanstack/react-query";
import { SolidityInput } from "contract-ui/components/solidity-inputs";
import type { ThirdwebClient } from "thirdweb";
import invariant from "tiny-invariant";
import { FormErrorMessage, FormLabel } from "tw-components";
import type { InstallModuleForm } from "./ModuleForm";
@@ -20,9 +20,9 @@ export type ModuleMeta = {
export function useModuleInstallParams(props: {
module?: ModuleMeta;
isQueryEnabled: boolean;
client: ThirdwebClient;
}) {
const client = useThirdwebClient();
const { module, isQueryEnabled } = props;
const { module, isQueryEnabled, client } = props;
return useQuery({
queryKey: ["useModuleInstallParams", module],
queryFn: async () => {
@@ -106,6 +106,7 @@ function Component() {
<BadgeContainer label="Empty Primary Sale Recipient">
<MintableModuleUI
client={storybookThirdwebClient}
isLoggedIn={true}
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
@@ -126,6 +127,7 @@ function Component() {
<BadgeContainer label="Filled Primary Sale Recipient">
<MintableModuleUI
client={storybookThirdwebClient}
isLoggedIn={true}
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
@@ -146,6 +148,7 @@ function Component() {
<BadgeContainer label="Pending">
<MintableModuleUI
client={storybookThirdwebClient}
isLoggedIn={true}
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
@@ -2,7 +2,7 @@ import { Checkbox } from "@/components/ui/checkbox";
import type { Meta, StoryObj } from "@storybook/react";
import { useMutation } from "@tanstack/react-query";
import { useState } from "react";
import { BadgeContainer } from "stories/utils";
import { BadgeContainer, storybookThirdwebClient } from "stories/utils";
import { ThirdwebProvider } from "thirdweb/react";
import { ModuleCardUI } from "./module-card";
@@ -64,11 +64,12 @@ function Component() {
<ModuleCardUI
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
client={storybookThirdwebClient}
isOwnerAccount={isOwner}
uninstallButton={{
onClick: () => removeMutation.mutateAsync(),
isPending: removeMutation.isPending,
}}
isOwnerAccount={isOwner}
/>
</BadgeContainer>
@@ -76,6 +77,7 @@ function Component() {
<ModuleCardUI
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
client={storybookThirdwebClient}
uninstallButton={{
onClick: () => removeMutation.mutateAsync(),
isPending: removeMutation.isPending,
@@ -93,6 +95,7 @@ function Component() {
<ModuleCardUI
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
client={storybookThirdwebClient}
uninstallButton={{
onClick: () => removeMutation.mutateAsync(),
isPending: removeMutation.isPending,
@@ -22,6 +22,7 @@ import { Suspense, useEffect, useState } from "react";
import { ErrorBoundary, type FallbackProps } from "react-error-boundary";
import { toast } from "sonner";
import {
type ThirdwebClient,
type ThirdwebContract,
getContract,
sendTransaction,
@@ -160,6 +161,7 @@ export function ModuleCard(props: ModuleCardProps) {
</Button>
<TransactionButton
client={contract.client}
isLoggedIn={props.isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -180,6 +182,7 @@ export function ModuleCard(props: ModuleCardProps) {
export type ModuleCardUIProps = {
children?: React.ReactNode;
client: ThirdwebClient;
contractInfo: {
name: string;
description?: string;
@@ -249,7 +252,10 @@ export function ModuleCardUI(props: ModuleCardUIProps) {
<p className="text-muted-foreground text-sm">
Published By
</p>
<WalletAddress address={props.contractInfo.publisher} />
<WalletAddress
address={props.contractInfo.publisher}
client={props.client}
/>
</div>
)}
@@ -14,7 +14,7 @@ const OpenEditionMetadataModule = lazy(() => import("./OpenEditionMetadata"));
export type ModuleInstanceProps = Omit<
ModuleCardUIProps,
"children" | "updateButton" | "isOwnerAccount"
"children" | "updateButton" | "isOwnerAccount" | "client"
> & {
contract: ThirdwebContract;
ownerAccount: Account | undefined;
@@ -52,5 +52,11 @@ export function ModuleInstance(props: ModuleInstanceProps) {
return <OpenEditionMetadataModule {...props} />;
}
return <ModuleCardUI {...props} isOwnerAccount={!!props.ownerAccount} />;
return (
<ModuleCardUI
{...props}
isOwnerAccount={!!props.ownerAccount}
client={props.contract.client}
/>
);
}
@@ -84,6 +84,7 @@ function Component() {
isPending: removeMutation.isPending,
}}
isOwnerAccount={isOwner}
client={storybookThirdwebClient}
contractChainId={1}
isLoggedIn={true}
/>
@@ -83,6 +83,7 @@ function Component() {
<BadgeContainer label="Empty Transfer Validator & Default Royalty Info">
<RoyaltyModuleUI
client={storybookThirdwebClient}
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
isPending={false}
@@ -115,11 +116,13 @@ function Component() {
isOwnerAccount={isOwner}
contractChainId={1}
isLoggedIn={true}
client={storybookThirdwebClient}
/>
</BadgeContainer>
<BadgeContainer label="Non-Empty Transfer Validator & Empty Default Royalty Info">
<RoyaltyModuleUI
client={storybookThirdwebClient}
contractInfo={contractInfo}
moduleAddress="0x0000000000000000000000000000000000000000"
isPending={false}
@@ -154,6 +157,7 @@ function Component() {
isOwnerAccount={isOwner}
contractChainId={1}
isLoggedIn={true}
client={storybookThirdwebClient}
/>
</BadgeContainer>
</div>
@@ -79,6 +79,7 @@ function Component() {
<BadgeContainer label="Empty AllowList, Not Restricted">
<TransferableModuleUI
contractInfo={contractInfo}
client={storybookThirdwebClient}
moduleAddress="0x0000000000000000000000000000000000000000"
isPending={false}
isRestricted={false}
@@ -97,6 +98,7 @@ function Component() {
<BadgeContainer label="Empty AllowList, Restricted">
<TransferableModuleUI
contractInfo={contractInfo}
client={storybookThirdwebClient}
moduleAddress="0x0000000000000000000000000000000000000000"
isPending={false}
isRestricted={true}
@@ -126,6 +128,7 @@ function Component() {
}}
isOwnerAccount={isOwner}
contractChainId={1}
client={storybookThirdwebClient}
isLoggedIn={true}
/>
</BadgeContainer>
@@ -135,6 +135,7 @@ const AirdropTab: React.FC<AirdropTabProps> = ({
</SheetTitle>
</SheetHeader>
<AirdropUpload
client={contract.client}
onClose={() => setOpen(false)}
setAirdrop={(value) =>
setValue("addresses", value, { shouldDirty: true })
@@ -162,6 +163,7 @@ const AirdropTab: React.FC<AirdropTabProps> = ({
more, please do it in multiple transactions.
</p>
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -130,6 +130,7 @@ const BurnTab: React.FC<BurnTabProps> = ({ contract, tokenId, isLoggedIn }) => {
</Text>
)}
<TransactionButton
client={contract.client}
transactionCount={1}
isPending={isPending}
disabled={checking1155 || checking721 || isPending || !account}
@@ -124,6 +124,7 @@ const ClaimTabERC1155: React.FC<ClaimTabProps> = ({
</Flex>
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -126,6 +126,7 @@ const MintSupplyTab: React.FC<MintSupplyTabProps> = ({
/>
<TransactionButton
client={contract.client}
txChainID={contract.chain.id}
transactionCount={1}
isPending={sendAndConfirmTx.isPending}
@@ -103,6 +103,7 @@ const TransferTab: React.FC<TransferTabProps> = ({
<FormControl isRequired isInvalid={!!form.formState.errors.to}>
<FormLabel>To Address</FormLabel>
<SolidityInput
client={contract.client}
solidityType="address"
formContext={form}
placeholder={ZERO_ADDRESS}
@@ -130,6 +131,7 @@ const TransferTab: React.FC<TransferTabProps> = ({
)}
</div>
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -252,6 +252,7 @@ export const UpdateNftMetadata: React.FC<UpdateNftMetadataForm> = ({
<div className="flex flex-row flex-wrap gap-3">
{nft?.metadata && !mediaFileUrl && (
<NFTMediaWithEmptyState
client={contract.client}
metadata={{
name: nft.metadata.name,
animation_url:
@@ -407,6 +408,7 @@ export const UpdateNftMetadata: React.FC<UpdateNftMetadataForm> = ({
Cancel
</Button>
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -16,7 +16,6 @@ import { Button } from "@/components/ui/button";
import { CodeClient } from "@/components/ui/code/code.client";
import { TabButtons } from "@/components/ui/tabs";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
import { useChainSlug } from "hooks/chains/chainSlug";
import { ExternalLinkIcon } from "lucide-react";
@@ -78,8 +77,6 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
accountAddress,
});
const client = useThirdwebClient();
const { data: nft, isPending } = useReadContract(
isErc721 ? getErc721NFT : getErc1155NFT,
{
@@ -129,7 +126,11 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
{/* border */}
<div className="absolute inset-0 z-0 rounded-lg border" />
{/* media */}
<NFTMediaWithEmptyState metadata={nftMetadata} className="z-10" />
<NFTMediaWithEmptyState
metadata={nftMetadata}
className="z-10"
client={contract.client}
/>
</div>
<div className="flex w-full flex-col gap-6">
@@ -175,7 +176,9 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
/>
{/* tab contents */}
{tab === "Details" && <NFTDetailsTab nft={nft} client={client} />}
{tab === "Details" && (
<NFTDetailsTab nft={nft} client={contract.client} />
)}
{tabs.map((tb) => {
return (
@@ -225,6 +228,7 @@ function NFTDetailsTab(props: {
<div>
<p className="mb-1 text-muted-foreground text-sm">Owner</p>
<WalletAddress
client={client}
address={nft.owner}
className="h-auto rounded-full border bg-card px-2 py-1 pr-4 text-foreground text-sm"
/>
@@ -68,6 +68,7 @@ export const BatchLazyMintButton: React.FC<BatchLazyMintButtonProps> = ({
</SheetHeader>
<BatchLazyMint
isLoggedIn={isLoggedIn}
client={contract.client}
chainId={contract.chain.id}
onSubmit={async ({ revealType, data }) => {
// nice, we can set up everything the same for both the only thing that changes is the action string
@@ -107,6 +107,7 @@ export const NFTClaimButton: React.FC<NFTClaimButtonProps> = ({
</form>
<div className="mt-4 flex justify-end">
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -341,6 +341,7 @@ export const LazyMintNftForm: React.FC<LazyMintNftFormParams> = ({
Cancel
</Button>
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -365,6 +365,7 @@ export const NFTMintForm: React.FC<NFTMintForm> = ({
</Button>
<TransactionButton
txChainID={contract.chain.id}
client={contract.client}
transactionCount={1}
isPending={sendAndConfirmTx.isPending}
form={MINT_FORM_ID}
@@ -153,6 +153,7 @@ export const NFTRevealButton: React.FC<NFTRevealButtonProps> = ({
</form>
<div className="mt-4 flex justify-end">
<TransactionButton
client={contract.client}
isLoggedIn={isLoggedIn}
txChainID={contract.chain.id}
transactionCount={1}
@@ -290,6 +290,7 @@ export const SharedMetadataForm: React.FC<{
Cancel
</Button>
<TransactionButton
client={contract.client}
txChainID={contract.chain.id}
transactionCount={1}
isPending={sendAndConfirmTx.isPending}
@@ -75,7 +75,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
Header: "Media",
accessor: (row) => row.metadata,
Cell: (cell: CellProps<NFT, NFT["metadata"]>) => (
<MediaCell cell={cell} />
<MediaCell cell={cell} client={contract.client} />
),
},
{
@@ -133,7 +133,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
Header: "Owner",
accessor: (row) => row.owner,
Cell: (cell: CellProps<NFT, string>) => (
<WalletAddress address={cell.value} />
<WalletAddress address={cell.value} client={contract.client} />
),
});
}
@@ -153,7 +153,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
});
}
return cols;
}, [isErc721, isErc1155]);
}, [isErc721, isErc1155, contract.client]);
const [queryParams, setQueryParams] = useState({ count: 50, start: 0 });
@@ -278,7 +278,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
</Th>
))}
{/* Need to add an empty header for the drawer button */}
<Th border="none" />
<Th border="none" key="drawer" />
</Tr>
))}
</Thead>
@@ -1,3 +1,5 @@
import { UpsellBannerCard } from "@/components/blocks/UpsellBannerCard";
import { ExternalLinkIcon } from "lucide-react";
import type { ThirdwebContract } from "thirdweb";
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { TokenDetailsCard } from "../tokens/components/supply";
@@ -43,6 +45,22 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
return (
<div className="flex flex-col gap-10 lg:flex-row lg:gap-8">
<div className="flex grow flex-col gap-10 overflow-hidden">
{isErc20 && (
<UpsellBannerCard
title="Public asset page available"
description="A public page is available for this contract for anyone to buy this asset"
cta={{
text: "View asset page",
icon: <ExternalLinkIcon className="size-4" />,
target: "_blank",
link: `/${chainSlug}/${contract.address}`,
}}
trackingCategory="erc20-contract"
trackingLabel="view-asset-page"
accentColor="blue"
/>
)}
<ContractChecklist
isErc721={isErc721}
isErc1155={isErc1155}
@@ -7,6 +7,7 @@ import {
useContractTransactionAnalytics,
useContractUniqueWalletAnalytics,
} from "data/analytics/hooks";
import { differenceInCalendarDays, formatDate } from "date-fns";
import { useTrack } from "hooks/analytics/useTrack";
import { ArrowRightIcon } from "lucide-react";
import Link from "next/link";
@@ -14,8 +15,14 @@ import { useMemo, useState } from "react";
import type { ProjectMeta } from "../../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { buildContractPagePath } from "../../_utils/contract-page-path";
function getDayKey(date: Date) {
return date.toISOString().split("T")[0];
function getDateKey(date: Date, precision: "day" | "hour") {
const dayKey = date.toISOString().split("T")[0];
if (precision === "day") {
return dayKey;
}
const hourKey = date.getHours();
return `${dayKey}-${hourKey}`;
}
export function ContractAnalyticsOverviewCard(props: {
@@ -34,60 +41,13 @@ export function ContractAnalyticsOverviewCard(props: {
})(),
);
const [endDate] = useState(new Date());
const wallets = useContractUniqueWalletAnalytics({
const { data, precision, isPending } = useContractAnalyticsOverview({
chainId: props.chainId,
contractAddress: props.contractAddress,
startDate,
endDate,
});
const transactions = useContractTransactionAnalytics({
chainId: props.chainId,
contractAddress: props.contractAddress,
startDate,
endDate,
});
const events = useContractEventAnalytics({
chainId: props.chainId,
contractAddress: props.contractAddress,
startDate,
endDate,
});
const isPending =
wallets.isPending || transactions.isPending || events.isPending;
const mergedData = useMemo(() => {
if (isPending) {
return undefined;
}
const time = (wallets.data || transactions.data || events.data || []).map(
(wallet) => wallet.time,
);
return time.map((time) => {
const wallet = wallets.data?.find(
(wallet) => getDayKey(wallet.time) === getDayKey(time),
);
const transaction = transactions.data?.find(
(transaction) => getDayKey(transaction.time) === getDayKey(time),
);
const event = events.data?.find((event) => {
return getDayKey(event.time) === getDayKey(time);
});
return {
time,
wallets: wallet?.count || 0,
transactions: transaction?.count || 0,
events: event?.count || 0,
};
});
}, [wallets.data, transactions.data, events.data, isPending]);
const analyticsPath = buildContractPagePath({
projectMeta: props.projectMeta,
chainIdOrSlug: props.chainSlug,
@@ -111,10 +71,11 @@ export function ContractAnalyticsOverviewCard(props: {
color: "hsl(var(--chart-3))",
},
}}
data={mergedData || []}
data={data || []}
isPending={isPending}
showLegend
chartClassName="aspect-[1.5] lg:aspect-[3]"
toolTipLabelFormatter={toolTipLabelFormatterWithPrecision(precision)}
customHeader={
<div className="flex items-center justify-between gap-4 border-b p-6 py-4">
<h2 className="font-semibold text-xl tracking-tight">Analytics</h2>
@@ -141,3 +102,109 @@ export function ContractAnalyticsOverviewCard(props: {
/>
);
}
export function useContractAnalyticsOverview(props: {
chainId: number;
contractAddress: string;
startDate: Date;
endDate: Date;
}) {
const { chainId, contractAddress, startDate, endDate } = props;
const wallets = useContractUniqueWalletAnalytics({
chainId: chainId,
contractAddress: contractAddress,
startDate,
endDate,
});
const transactions = useContractTransactionAnalytics({
chainId: chainId,
contractAddress: contractAddress,
startDate,
endDate,
});
const events = useContractEventAnalytics({
chainId: chainId,
contractAddress: contractAddress,
startDate,
endDate,
});
const isPending =
wallets.isPending || transactions.isPending || events.isPending;
const { data, precision } = useMemo(() => {
if (isPending) {
return {
data: undefined,
precision: "day" as const,
};
}
const time = (wallets.data || transactions.data || events.data || []).map(
(wallet) => wallet.time,
);
// if the time difference between the first and last time is less than 3 days - use hour precision
const firstTime = time[0];
const lastTime = time[time.length - 1];
const timeDiff =
firstTime && lastTime
? differenceInCalendarDays(lastTime, firstTime)
: undefined;
const precision: "day" | "hour" = !timeDiff
? "hour"
: timeDiff < 3
? "hour"
: "day";
return {
data: time.map((time) => {
const wallet = wallets.data?.find(
(wallet) =>
getDateKey(wallet.time, precision) === getDateKey(time, precision),
);
const transaction = transactions.data?.find(
(transaction) =>
getDateKey(transaction.time, precision) ===
getDateKey(time, precision),
);
const event = events.data?.find((event) => {
return (
getDateKey(event.time, precision) === getDateKey(time, precision)
);
});
return {
time,
wallets: wallet?.count || 0,
transactions: transaction?.count || 0,
events: event?.count || 0,
};
}),
precision,
};
}, [wallets.data, transactions.data, events.data, isPending]);
return {
data,
precision,
isPending,
};
}
export function toolTipLabelFormatterWithPrecision(precision: "day" | "hour") {
return function toolTipLabelFormatter(_v: string, item: unknown) {
if (Array.isArray(item)) {
const time = item[0].payload.time as number;
return formatDate(
new Date(time),
precision === "day" ? "MMM d, yyyy" : "MMM d, yyyy hh:mm a",
);
}
return undefined;
};
}
@@ -7,7 +7,11 @@ import { SkeletonContainer } from "@/components/ui/skeleton";
import { TrackedLinkTW } from "@/components/ui/tracked-link";
import { ArrowRightIcon } from "lucide-react";
import { useMemo } from "react";
import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
import {
type ThirdwebClient,
type ThirdwebContract,
ZERO_ADDRESS,
} from "thirdweb";
import {
type DirectListing,
type EnglishAuction,
@@ -120,6 +124,7 @@ const DirectListingCards: React.FC<ListingCardsSectionProps> = ({
chainSlug={chainSlug}
contractAddress={contract.address}
projectMeta={projectMeta}
client={contract.client}
/>
</div>
</div>
@@ -193,6 +198,7 @@ const EnglishAuctionCards: React.FC<ListingCardsSectionProps> = ({
</div>
<div className="p-6">
<ListingCards
client={contract.client}
listings={auctions}
isPending={auctionsQuery.isPending}
trackingCategory={trackingCategory}
@@ -293,6 +299,7 @@ interface ListingCardsProps {
chainSlug: string;
contractAddress: string;
projectMeta: ProjectMeta | undefined;
client: ThirdwebClient;
}
const ListingCards: React.FC<ListingCardsProps> = ({
listings,
@@ -302,6 +309,7 @@ const ListingCards: React.FC<ListingCardsProps> = ({
chainSlug,
contractAddress,
projectMeta,
client,
}) => {
const contractLayout = buildContractPagePath({
projectMeta,
@@ -336,6 +344,7 @@ const ListingCards: React.FC<ListingCardsProps> = ({
render={(v) => {
return (
<NFTMediaWithEmptyState
client={client}
metadata={v}
requireInteraction
width="100%"
@@ -394,6 +403,7 @@ const ListingCards: React.FC<ListingCardsProps> = ({
<WalletAddress
className="relative z-[1] self-start text-xs"
address={v}
client={client}
/>
</div>
)}
@@ -67,6 +67,7 @@ export function NFTDetails({
{/* cards */}
<div className="p-6">
<NFTCards
client={contract.client}
projectMeta={projectMeta}
nfts={displayableNFTs.map((t) => ({
...t,
@@ -17,7 +17,11 @@ import { TrackedLinkTW } from "@/components/ui/tracked-link";
import { getAllRoleMembers } from "contract-ui/hooks/permissions";
import { ArrowRightIcon } from "lucide-react";
import { useMemo } from "react";
import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
import {
type ThirdwebClient,
type ThirdwebContract,
ZERO_ADDRESS,
} from "thirdweb";
import { useReadContract } from "thirdweb/react";
import type { ProjectMeta } from "../../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
import { buildContractPagePath } from "../../_utils/contract-page-path";
@@ -65,6 +69,7 @@ export function PermissionsTable(props: {
isPending={allRoleMembers.isPending}
viewMoreLink={permissionsHref}
trackingCategory={props.trackingCategory}
client={props.contract.client}
/>
);
}
@@ -74,6 +79,7 @@ export function PermissionsTableUI(props: {
trackingCategory: string;
members: { member: string; roles: string[] }[];
isPending: boolean;
client: ThirdwebClient;
}) {
return (
<div className="rounded-lg border bg-card">
@@ -106,7 +112,7 @@ export function PermissionsTableUI(props: {
{props.members.map((data) => (
<TableRow key={data.member}>
<TableCell>
<WalletAddress address={data.member} />
<WalletAddress address={data.member} client={props.client} />
</TableCell>
<TableCell>
<div className="flex w-max flex-wrap gap-2">
@@ -2,7 +2,7 @@ import { fetchPublishedContractsFromDeploy } from "components/contract-component
import { ContractCard } from "components/explore/contract-card";
import { THIRDWEB_DEPLOYER_ADDRESS } from "constants/addresses";
import { resolveEns } from "lib/ens";
import type { ThirdwebClient, ThirdwebContract } from "thirdweb";
import type { ThirdwebContract } from "thirdweb";
import { polygon } from "thirdweb/chains";
import { getBytecode, getContract } from "thirdweb/contract";
import { getPublishedUriFromCompilerUri } from "thirdweb/extensions/thirdweb";
@@ -20,13 +20,11 @@ type ModuleMetadataPickedKeys = {
export async function getPublishedByCardProps(params: {
address: string | null;
contract: ThirdwebContract;
client: ThirdwebClient;
}) {
const { address, contract, client } = params;
const { address, contract } = params;
const publishedContractsFromDeploy = await fetchPublishedContractsFromDeploy({
contract,
client,
});
const reversedPublishedContractsFromDeploy = [
@@ -54,7 +52,10 @@ export async function getPublishedByCardProps(params: {
let publisherAddressOrEns = publishedContractToShow.publisher;
if (!isValidENSName(publishedContractToShow.publisher)) {
try {
const res = await resolveEns(publishedContractToShow.publisher, client);
const res = await resolveEns(
publishedContractToShow.publisher,
contract.client,
);
if (res.ensName) {
publisherAddressOrEns = res.ensName;
}

Some files were not shown because too many files have changed in this diff Show More