Compare commits

..
Author SHA1 Message Date
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
be803185aa Version Packages (#7754)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-29 16:43:35 -07:00
Joaquim VergesandGitHub ea247dbd4c [Dashboard] Add FTUX completion tracking for Engine checklist (#7758) 2025-07-29 16:30:47 -07:00
MananTank e8470fcce1 Log SIWA escalation failure error message (#7740)
<!--

## 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 error handling in the `createSupportTicket` function within the `support.ts` file. It ensures that even if the feedback submission fails, the ticket creation process continues without interruption.

### Detailed summary
- Changed the variable `res` to store the result of the `fetch` call to the SIWA URL.
- Added an error handling block to log an error message if the `fetch` response is not OK, without failing the ticket creation process.

> ✨ 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 error handling for support ticket escalation, ensuring errors are logged if escalation fails without interrupting ticket creation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-29 23:02:35 +00:00
MananTank a6483f4a80 Playground: Rename account-abstraction page slugs (#7756)
<!--

## 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 routing paths in the application to reflect new endpoints for account abstraction features. It changes the hrefs for specific wallet routes and adds new rewrite rules in the configuration.

### Detailed summary
- Updated `href` for the `sponsor` route to `/wallets/account-abstraction/eip-4337`.
- Updated `href` for the `7702` route to `/wallets/account-abstraction/eip-7702`.
- Updated `href` for the `5792` route to `/wallets/account-abstraction/eip-5792`.
- Added new rewrite rules in `next.config.mjs` for the updated routes.

> ✨ 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**
  * Updated sidebar links for account abstraction wallets to use explicit EIP-prefixed paths for improved clarity.

* **Chores**
  * Added redirects to ensure legacy account abstraction wallet URLs automatically forward to the new EIP-prefixed paths.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-29 19:50:26 +00:00
MananTank 2e901123c4 Dashboard: Completely remove Chakra UI (#7755)
<!--

## 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 removing the `@chakra-ui/react` library and its related components from the project, transitioning to a custom UI implementation.

### Detailed summary
- Deleted multiple `chakra` components and utility files.
- Removed `ChakraProviderSetup` usage from various components.
- Updated styles and layout in the `ContractPageLayout` and `ContractSplitPage`.
- Modified ESLint rules to disable chakra-specific restrictions.
- Updated `package.json` and `pnpm-lock.yaml` to remove `@chakra-ui` dependencies.

> The following files were skipped due to too many changes: `pnpm-lock.yaml`

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

<!-- end pr-codex -->
2025-07-29 18:16:01 +00:00
MananTank 5c5b910570 Dashboard: migrate sponsorship policies from chakra to tailwind (#7753)
<!--

## 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 `AccountAbstractionSettingsPage` component to improve its structure and replace Chakra UI components with custom UI components, enhancing maintainability and consistency.

### Detailed summary
- Removed `ChakraProviderSetup` wrapper.
- Replaced Chakra UI components with custom components (e.g., `Button`, `Form`, `Input`, `Textarea`, `Select`, `Switch`).
- Introduced `DynamicHeight` for responsive form sections.
- Updated form handling to use custom `FormField` component for better organization.
- Enhanced the layout and styling of sponsorship policies and admin accounts sections.

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

<!-- end pr-codex -->
2025-07-29 18:16:00 +00:00
MananTank 6b9f29d43c Dashboard: Migrate contract/settings page from chakra to tailwind (#7752)
<!--

## 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 `ContractSettingsPage` and its components to improve code structure and readability. It introduces a new UI library for forms and enhances the user experience with better layout and error handling.

### Detailed summary
- Refactored `ContractSettingsPage` to use `div` and `cn` for layout instead of `Flex` and `GridItem`.
- Updated `ContractSettingsPageInner` to accept props directly instead of using an interface.
- Replaced `Card` and `Flex` components with `div` and new UI components for a cleaner look.
- Introduced new form components (`Form`, `FormControl`, etc.) for better organization and handling.
- Enhanced error handling for form submissions with toast notifications.
- Updated styling for a more modern UI approach across all settings components.
- Simplified the logic for rendering settings components based on their support status.

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

<!-- end pr-codex -->
2025-07-29 18:16:00 +00:00
MananTank fad7cb92b7 Dashboard: migrate contract/proposals from chakra to tailwind (#7751)
<!--

## 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 `DelegateButton` and `ProposalButton` components in a proposal management interface. It improves error handling, updates UI components, and modifies the structure of the `ContractProposalsPage` to enhance user experience and maintainability.

### Detailed summary
- Added `parseError` utility for improved error handling.
- Updated `DelegateButton` to show success/error messages using `toast`.
- Refactored `ContractProposalsPage` to use a cleaner layout with improved proposal handling.
- Enhanced `ProposalButton` with a new form structure and error messages.
- Updated `Proposal` component to use new UI elements like `Badge` and `CardContent`.
- Improved voting feedback by displaying vote counts and statuses more clearly.

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

<!-- end pr-codex -->
2025-07-29 18:16:00 +00:00
MananTank 03617047e2 Dashboard: Migrate contract/permissions page from chakra to tailwind, UI improvements (#7750)
<!--

## 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 `Permissions` component and related files by improving UI elements, restructuring code for clarity, and integrating better user feedback mechanisms such as alerts and toast notifications.

### Detailed summary
- Updated the `Permissions` component's return structure to include headings and descriptions.
- Refined the `alertVariants` in `alert.tsx` for better styling.
- Replaced `ButtonGroup` with a `div` for layout adjustments in the `Permissions` component.
- Enhanced error handling with toast notifications in `permissions-editor.tsx`.
- Improved form handling and cleaned up values before submission.
- Replaced `DelayedDisplay` with an `Alert` component in `permissions-editor.tsx`.
- Updated the `ContractPermission` component to utilize `Select` for role management instead of traditional dropdowns.
- Added conditional rendering for alerts based on role states in `ContractPermission`.
- Adjusted button styles and behavior for better user experience across components.

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

<!-- end pr-codex -->
2025-07-29 18:16:00 +00:00
MananTank 04c7243994 Dashboard: Migrate various components from chakra to tailwind #2 (#7749)
<!--

## 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 components for better structure and performance, particularly in the forms and tables related to NFTs. It also removes unused components and improves the user experience with updated UI elements and error handling.

### Detailed summary
- Removed `FormHelperText` and `FormErrorMessage` from `chakra/form`.
- Refactored `NFTSharedMetadataButton` to use a function component instead of a React.FC.
- Updated `ContractPermissionsPage` to use a function component and improved prop handling.
- Replaced `FormControl` and `FormErrorMessage` with a new form structure in `NFTRevealButton`.
- Refactored `SharedMetadataForm` to enhance form handling and error messaging.
- Updated `NFTGetAllTable` to streamline pagination and data fetching logic.
- Removed unused imports and components to clean up the codebase.

> ✨ 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 multiple NFT dashboard components to use a new custom UI library, replacing Chakra UI and simplifying form and table logic.
  * Improved form validation and error handling with integrated schema validation and toast notifications.
  * Streamlined table rendering and pagination for NFT listings with a more explicit and user-friendly approach.
  * Simplified permission and metadata management pages for improved clarity and consistency.

* **Chores**
  * Removed deprecated Chakra UI-based components and helper utilities, including custom link and button components no longer in use.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-29 18:15:59 +00:00
MananTank 66cba857dc Dashboard: Migrate various components from chakra to tailwind (#7743)
<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring and enhancing forms in various components by replacing `@chakra-ui/react` form elements with a custom UI form system. It also introduces new validation schemas using `zod` for improved form handling and user feedback.

### Detailed summary
- Replaced `FormControl`, `FormLabel`, and related components from `@chakra-ui/react` with custom UI components in multiple files.
- Introduced `FormFieldSetup` and `FormField` components for better form structure.
- Added `zod` validation schemas for form data validation in `ClaimTab` and `NFTClaimButton`.
- Updated form submission logic to use the new form handling approach.
- Enhanced user feedback through improved error handling and notifications.

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

<!-- end pr-codex -->
2025-07-29 17:36:26 +00:00
MananTank 0426fe5c6e Dashboard: Migrate contract/events from chakra to tailwind (#7742)
<!--

## 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 refactors the `EventsFeed` component in `events-feed.tsx`, updating its structure and styling while changing the imported UI components to a custom design system. It enhances the user interface and maintains the same functionality.

### Detailed summary
- Replaced Chakra UI components with custom components from the UI library.
- Modified the `EventsFeed` component to use `function` syntax instead of `React.FC`.
- Updated the layout from `Flex` and `SimpleGrid` to `div` with Tailwind CSS classes.
- Changed event selection handling to use `Select` from the custom library.
- Refined the `EventsFeedItem` component structure and styling.
- Updated the way transaction data is displayed with `CopyTextButton`.
- Adjusted the accordion implementation to use custom `Accordion` components.
- Removed unused imports and props for cleaner code.

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

<!-- end pr-codex -->
2025-07-29 17:36:26 +00:00
MananTank 542360cc69 Dashboard: Migrate contract/account from chakra to tailwind (#7741)
<!--

## 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 UI and refactoring components in the dashboard, specifically in the `account` section. It improves the display of error messages, balances, and NFT ownership, while also updating component structures for better readability and maintainability.

### Detailed summary
- Updated error messages in `nfts-owned.tsx` with improved styling.
- Refactored `AccountBalance` to use props directly and changed layout to a grid.
- Simplified the `AccountPage` component, enhancing readability and structure.
- Refactored `DepositNative` to streamline props and improve input handling.
- Enhanced `AccountSigner` layout for better visual presentation and clarity.

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

<!-- end pr-codex -->
2025-07-29 17:36:25 +00:00
MananTank 5e883ac550 Dashboard: Migrate contract/accounts page from chakra to tailwind (#7739)
<!--

## 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 components in the `accounts` section of the dashboard, enhancing code structure and UI elements while removing deprecated features.

### Detailed summary
- Deleted the `accounts-count.tsx` file.
- Removed `Legacy_CopyButton` and its usage.
- Updated `AccountsPage` to use `UnderlineLink` and improved layout.
- Refactored `CreateAccountButton` to streamline props handling.
- Replaced `TWTable` with custom table components in `AccountsTable`.
- Added pagination functionality and improved loading states.

> ✨ 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 the Accounts page layout and styling by switching from Chakra UI to Tailwind CSS.
  * Streamlined the AccountsTable with a new table design, fixed page size, and updated pagination controls.
  * Updated Create Account button with unified styling, improved labeling, and a new icon.
  * Removed the accounts count display from the page.
  * Updated external documentation link and link styling for clarity.
  * Removed legacy copy button component and related clipboard functionality.

* **Style**
  * Improved visual consistency with updated button and table styles.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-29 17:36:25 +00:00
gregandGitHub c717eaadae [SDK] Feature: Faster payment widget quote generation (#7745) 2025-07-29 10:07:01 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
691b7e1454 Version Packages (#7747)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-28 20:46:34 -07:00
Joaquim VergesandGitHub 243749b08c [Docs] Update README with comprehensive SDK package information (#7738) 2025-07-28 20:46:21 -07:00
Joaquim VergesandGitHub 4f38198ae1 [SDK] Improve WalletConnect connection and auto-connection flow (#7746) 2025-07-28 20:31:36 -07:00
MananTank b371bf9630 Dashboard: Published Contract page UI improvements, Fix audit link (#7735)
<!--

## 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 improving the handling of IPFS URLs, enhancing the user interface, and refactoring components for better readability and maintainability. It includes updates to various components and functions to streamline the codebase and improve functionality.

### Detailed summary
- Changed `shortenString` default parameter from `true` to `false`.
- Updated `SelectTrigger` to have a `w-fit` class.
- Replaced `replaceIpfsUrl` with `publicIPFSGateway` and `resolveSchemeWithErrorHandler` in multiple components.
- Modified `ContractFunctionsOverview` to remove `onlyFunctions` prop.
- Updated UI elements for consistency and better spacing.
- Refactored `PublisherHeader` to `PublisherLink` for clarity.
- Enhanced `PublishedContract` component layout and structure.
- Added account address handling in multiple components.
- Improved error handling and logging in IPFS URL resolution.

> ✨ 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 an "Edit" button to contract headers, visible only to the publisher when viewing their own contract.
  * Publisher information is now displayed with a more compact and streamlined UI.

* **UI Improvements**
  * Enhanced styling for contract headings, buttons, and function panels for better readability and consistency.
  * Updated publisher and contract layouts for improved clarity and usability.
  * Improved tab logic and feedback in contract function panels, including clearer "No inputs required" messaging.
  * Adjusted layout widths and border styles for published contract pages.
  * Refined link styling and layout in platform fee information sections.
  * Modified version selector width behavior for better fit.

* **Bug Fixes**
  * Updated IPFS URL handling for images and links, ensuring more reliable and consistent resolution.

* **Refactor**
  * Simplified and consolidated publisher and contract components for maintainability.
  * Replaced or removed deprecated utility functions for URL resolution.
  * Streamlined function panel logic and removed unnecessary props.
  * Refactored publisher header component to a more compact link-based design.

* **Chores**
  * Updated internal utility defaults (e.g., string shortening behavior) to improve display consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-28 18:49:17 +00:00
Joaquim VergesandGitHub cf401bee84 [Dashboard] Add thirdweb API option alongside Engine API (#7734) 2025-07-27 21:08:03 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
c178d3ab2b Version Packages (#7733)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-27 18:53:00 -07:00
Joaquim VergesandGitHub e92d8f921a Update insight, add contract filtering (#7710) 2025-07-27 18:43:42 -07:00
Joaquim VergesandGitHub 1cbbbc3c12 [SDK] Add EIP-5792 support to Coinbase and refactor wallet capabilities (#7732) 2025-07-27 18:27:22 -07:00
Joaquim VergesandGitHub 58dbe90b93 [SDK] Fallback to onchain nonce in 7702 execution (#7729) 2025-07-27 17:47:38 -07:00
MananTank 0c6d75dfc6 Dashboard: Migrate Claim condition components from chakra to tailwind, UI improvements (#7731)
<!--

## 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 user interface and functionality of the claim conditions forms in the dashboard application. It includes updates to component structures, styling improvements, and the introduction of new features for better user experience.

### Detailed summary
- Removed unused CSV files from the assets.
- Updated `variant` prop in `tx-button` to include "outline".
- Adjusted styles in `drop-zone` for improved layout.
- Enhanced text styles in `price-preview` and `claim-conditions` components.
- Replaced `CustomFormControl` with `FormFieldSetup` for better form handling.
- Added new components for displaying and managing claim conditions.
- Improved error handling and user feedback in various input components.
- Refactored `ClaimPriceInput` and other input components to streamline functionality.
- Introduced a new `SnapshotDataTable` for better display of CSV data.
- Enhanced snapshot upload functionality with clearer requirements and examples.

> ✨ 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 an "outline" button style variant in transaction buttons.

* **Refactor**
  * Replaced Chakra UI components with a custom UI library and Tailwind CSS across claim conditions forms and related components.
  * Simplified and reorganized the layout of claim conditions phases, downloadable code blocks, and snapshot upload views for improved clarity and usability.
  * Updated CSV upload and data table experience with enhanced error display and a new code example download feature.

* **Style**
  * Improved spacing, typography, and overall visual consistency throughout claim conditions and related dashboard components.

* **Chores**
  * Removed unused or redundant components and files related to previous form controls and CSV tables.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-28 00:06:30 +00:00
MananTank 11d9f3e513 Dashboard: Migrate marketplace contract pages from chakra to tailwind (#7730)
<!--

## 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 improving the UI components and their functionality in the dashboard application, particularly around NFT listings, by enhancing type safety, optimizing rendering, and updating UI elements for better usability.

### Detailed summary
- Made `image_url` optional in `getWalletNFTs.ts`.
- Updated button styles and sizes in `list-button.tsx`.
- Enhanced `CurrencySelector` component with better class management.
- Refactored `ContractDirectListingsPage` and `ContractEnglishAuctionsPage` to use `props`.
- Improved `ListingDrawer` layout and added table components for better data presentation.
- Refined `MarketplaceTable` to handle pagination and data fetching more efficiently.
- Updated listing forms to use new UI components and improved validation.
- Enhanced error handling and loading states across various components.

> ✨ 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 currency selector with an icon-based back button and improved styling flexibility.

* **Refactor**
  * Migrated marketplace listing forms and tables to a new custom UI component library for a more consistent and modern interface.
  * Simplified and streamlined marketplace table and drawer components, removing legacy dependencies and improving layout.
  * Updated listing and auction pages to delegate call-to-action buttons for better composability.
  * Improved listing details drawer with a structured table layout and clearer asset information.

* **Bug Fixes**
  * Improved handling of missing NFT images to prevent errors when image URLs are unavailable.

* **Style**
  * Updated button and icon styles for a more polished user experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-27 22:56:58 +00:00
MananTank c7fab9f5dd Dashboard: Migrate Published Contract page from chakra to tailwind, UI improvements (#7728)
<!--

## 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 improving the UI components and structure of the published contract pages in the dashboard. It enhances layouts, updates component props, and modifies styles for better user experience and consistency.

### Detailed summary
- Updated `version-selector` styles.
- Modified `PublishedContractBreadcrumbs` to accept `className` prop.
- Simplified `PublishedContractLayout` by returning only `props.children`.
- Refactored `DeployFormForUri` to remove `ChakraProviderSetup`.
- Enhanced `ExplorePage` layout and styles.
- Changed icons in `PublishedActions` and updated button structure.
- Improved `DeployContractInfo` layout and styles.
- Updated `MarkdownRenderer` styles for better spacing and alignment.
- Refactored `PublishedContract` to use `className` prop for styling.
- Added `PublishedContractBreadcrumbs` to multiple pages for better navigation.
- Improved `PublisherHeader` layout and styling.
- Removed unused imports and cleaned up 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

* **New Features**
  * Added breadcrumb navigation to published contract and deploy pages for improved navigation clarity.

* **Refactor**
  * Replaced Chakra UI components with Tailwind CSS for more consistent styling and layout across published contract pages.
  * Simplified and reorganized contract detail and publisher header layouts for better readability and usability.
  * Updated contract info display to use an enhanced image component with fallback support.

* **Style**
  * Adjusted spacing, borders, and typography for headings, lists, and paragraphs in Markdown rendering.
  * Refined button and icon styles for contract actions and links.
  * Improved overall page structure and container consistency.

* **Bug Fixes**
  * Enhanced fallback behavior for contract images when unavailable.

* **Chores**
  * Removed unused sharing utility and related "Share" button from contract actions.
  * Cleaned up unused Chakra UI imports and wrappers.

* **Documentation**
  * No user-facing documentation changes included.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-27 19:27:11 +00:00
MananTank 882ed8348b Dashboard: Migrate engine/relayers page from chakra to tailwind, remove chakra provider from engine layout (#7724)
<!--

## 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 components related to relayers in a blockchain dashboard application, improving the user interface and functionality of forms, modals, and data handling for adding, editing, and removing relayers.

### Detailed summary
- Removed `preventOpenOnFocus` prop from several components.
- Updated `WalletAddress` component to streamline address handling.
- Refactored `AddRelayerButton` and `EditModal` to use new dialog components.
- Enhanced form validation using `zod` for relayer forms.
- Improved UI with consistent styling and layout adjustments.
- Updated `RelayersTable` to use new UI components and improved address display.
- Added error handling and success notifications for relayer actions.

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

<!-- end pr-codex -->
2025-07-27 12:22:30 +00:00
MananTank 0386638cbd Dashboard: Migrate engine/overview from chakra to tailwind (#7723)
<!--

## 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 UI components and improving the user experience in the wallet management section of a dashboard application. It includes updates to modals, button components, and form handling while ensuring better accessibility and responsiveness.

### Detailed summary
- Updated `create-backend-wallet-button.tsx` to modify button styles and add `tabIndex` for accessibility.
- Enhanced tooltip functionality in `tooltip.tsx`.
- Added `react-qrcode-logo` dependency for QR code generation.
- Refactored `transaction-timeline.tsx` to improve transaction display and interaction.
- Converted Chakra UI modals to custom dialog components for consistency.
- Updated `transactions-table.tsx` to streamline transaction details display and manage state more effectively.
- Refined backend wallet management in `backend-wallets-table.tsx`, replacing Chakra components with custom UI elements.
- Improved form handling using `react-hook-form` and validation with `zod` in wallet-related modals.
- Enhanced user feedback through toast notifications for actions like sending funds and deleting wallets.

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

<!-- end pr-codex -->
2025-07-27 12:22:29 +00:00
MananTank a00b7fa425 Dashboard: Migrate engine/metrics from chakra to tailwind (#7722)
<!--

## 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 improving the layout and user interface of the `Healthcheck` and `EngineSystemMetrics` components in the dashboard. It enhances responsiveness and readability, while also introducing new loading states and alert messages.

### Detailed summary
- Changed layout from row to column in `engine-contract-subscription.tsx`.
- Added `tracking-tight` class to the `h2` header for better text spacing.
- Refactored `Healthcheck` component to use a new loading indicator.
- Updated `EngineSystemMetrics` to use `GenericLoadingPage` instead of `Spinner`.
- Introduced `Alert` component for error messaging in `EngineSystemMetrics`.
- Replaced `Card` components with divs for layout consistency.
- Created a new `MetricRow` component for displaying metrics in a structured format.

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

<!-- end pr-codex -->
2025-07-27 17:40:35 +05:30
Joaquim VergesandGitHub b33073875f [Docs] Remove POST method from MCP server URL (#7727) 2025-07-27 00:13:05 -07:00
Joaquim VergesandGitHub 8ddf37861c [Docs] Update MCP authentication from headers to query parameters (#7726) 2025-07-27 16:31:22 +12:00
Joaquim VergesandGitHub 34067c05d0 [Docs] Update MCP server URLs and reorder usage sections (#7725) 2025-07-26 15:46:34 -07:00
MananTank 67abd0db5b Dashboard: Migrate engine/contract-submissions from chakra to tailwind (#7721)
<!--

## 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 `EngineContractSubscriptions` and `ContractSubscriptionTable` components to improve their structure, style, and functionality. It also enhances the user experience by updating UI elements and integrating new components.

### Detailed summary
- Updated `className` in the `input` component to use `selection:bg-inverted`.
- Refactored `EngineContractSubscriptions` to use `div` instead of `Flex` for layout.
- Integrated `UnderlineLink` for better link styling.
- Changed `Switch` component's props from `isChecked` to `checked` and `onChange` to `onCheckedChange`.
- Replaced `Flex` with `div` for various elements to improve layout consistency.
- Enhanced `ContractSubscriptionTable` with new styling and improved event handling.
- Updated modal components to use `Dialog` instead of `Modal`.
- Improved error handling and user notifications using `toast` for actions like adding and removing subscriptions.
- Refactored form handling with `react-hook-form` and `zod` for validation.
- Updated `FilterSelector` to use `MultiSelect` for better user interaction.

> ✨ 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**
  * Improved contract subscription management with a redesigned multi-step form, enhanced validation, and more user-friendly filtering controls.
  * Updated contract subscriptions table with improved modals and tooltips for better usability.

* **Refactor**
  * Replaced Chakra UI components with a custom UI library for dialogs, forms, tables, tooltips, and switches.
  * Enhanced visual styling using Tailwind CSS classes.
  * Streamlined error notifications and form validation for a more consistent user experience.

* **Style**
  * Updated selection styling for input fields to improve appearance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-26 19:15:41 +00:00
gregandGitHub 6e2f535bfa [Dashboard] Payment Links Page (#7706) 2025-07-25 15:42:04 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
430115cf2b Version Packages (#7719)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-25 13:33:10 -07:00
Jonas DanielsandGitHub 80c6b6a793 Add gateway team capabilities (#7718) 2025-07-25 13:26:17 -07:00
MananTank eb2d49c4e6 Dashboard: Migrate engine/webhooks page from chakra to tailwind (#7717)
<!--

## 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 webhook components in the dashboard application. It improves the code structure, updates UI components, and enhances the form handling for creating and managing webhooks.

### Detailed summary
- Changed `CreateWebhookInput` type definition.
- Refactored `EngineWebhooks` component to simplify props handling.
- Updated UI components in `EngineWebhooks` for better styling.
- Replaced Chakra UI modal with custom dialog components in `AddWebhookButton`.
- Enhanced form validation using `zod` in `AddWebhookButton`.
- Refactored `WebhooksTable` component for improved UI and functionality.
- Replaced modals with dialogs for delete and test webhook actions.
- Improved error handling and user notifications with `toast`.
- Updated event type selection and input handling in forms.

> ✨ 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 webhooks-related components to use a custom UI library instead of Chakra UI, resulting in a more consistent interface.
  * Improved form validation and inline error messages when adding webhooks.
  * Enhanced dialog and modal interactions for adding, deleting, and testing webhooks with better state management.
  * Updated table and tooltip styling for better readability and user experience.
  * Adjusted button states and feedback to clearly indicate loading and error conditions.
  * Improved external links with enhanced security attributes and streamlined layout for webhook management.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-26 00:54:59 +05:30
jnsdls 2996121187 Update credit purchase terminology in billing section (#7705)
# Update Credit Balance Section UI

This PR updates the UI text in the credit balance section to improve clarity:

- Changed "Top Up Credits" to "Credits" in the section header
- Updated tooltip text from "Only team owners can top up credits" to "Only team owners can purchase credits"
- Changed button text from "Top Up With Crypto" to "Buy Credits"

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

## Summary by CodeRabbit

* **Style**
  * Updated text labels in the credit balance section for improved clarity, including changes to headings, tooltips, and button text.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the terminology related to credit purchases in the `CreditBalanceSection` component, making it clearer for users. The changes enhance the user experience by refining the language used in the interface.

### Detailed summary
- Changed heading from `Top Up Credits` to `Credits`.
- Updated tooltip message from `Only team owners can top up credits.` to `Only team owners can purchase credits.`.
- Renamed button text from `Top Up With Crypto` to `Buy Credits`.
- Modified summary label from `Top-up amount:` to `Added credits:` in multiple places.

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

<!-- end pr-codex -->
2025-07-25 18:36:10 +00:00
MananTank cd6fd9a75d Dashboard: Migrate engine/configuration page from chakra to tailwind, UI improvements (#7716)
<!--

## 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 and improving the UI of various configuration components for the Engine dashboard, enhancing layout, styling, and user experience while updating some logic related to wallet configurations.

### Detailed summary
- Updated layout classes for `local-config.tsx`, `engine-configuration.tsx`, and `system.tsx`.
- Added `UnderlineLink` component for links in `engine-wallet-config.tsx`, `circle-config.tsx`, and others.
- Improved styling for alerts and forms in various components.
- Enhanced error handling and user feedback with toast notifications in `cors.tsx`, `ip-allowlist.tsx`, and wallet config components.
- Refactored props handling in `EngineWalletConfig`, `EngineCorsConfig`, and `EngineIpAllowlistConfig` to use inline type definitions.
- Added `SaveIcon` and `Spinner` components for better loading and saving indicators in forms.

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

<!-- end pr-codex -->
2025-07-25 18:22:38 +00:00
MananTank 12c42c0311 Dashboard: Migrate engine/admins page from chakra to tailwind (#7715)
<!--

## 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 `EngineAdmins` and `AddAdminButton` components, enhancing their structure and UI by replacing Chakra UI components with custom UI components, and improving form handling using `react-hook-form` and `zod` for validation.

### Detailed summary
- Replaced Chakra UI components with custom UI components (`UnderlineLink`, `Dialog`, `Form`, etc.).
- Refactored `EngineAdmins` to use a simpler function signature.
- Updated the layout and styling of the `EngineAdmins` component.
- Enhanced `AddAdminButton` to use `react-hook-form` for form handling and validation.
- Introduced `zod` for schema validation in `AddAdminButton`.
- Refactored modal dialogs to use the new `Dialog` component.
- Updated `AdminsTable` to manage state for editing and removing admins more effectively.
- Improved error handling and notifications using `toast` for admin actions.

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

<!-- end pr-codex -->
2025-07-25 18:22:38 +00:00
MananTank 5e11d63e11 Dashboard: Migrate engine/access-tokens page from chakra to tailwind (#7714)
<!--

## 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 components in the `Engine` section of the dashboard, enhancing UI elements, and improving error handling for access tokens and keypairs management.

### Detailed summary
- Replaced `Modal` components with `Dialog` components for improved UI consistency.
- Enhanced error handling using `toast` notifications.
- Updated button components for better visual consistency.
- Refactored `AddAccessTokenButton`, `KeypairsTable`, and `AccessTokensTable` components for cleaner code.
- Simplified state management for modal visibility.
- Improved accessibility and user experience in forms and alerts.
- Updated various imports to use new UI components from the design system.

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

<!-- end pr-codex -->
2025-07-25 18:22:38 +00:00
MananTank 1d6e98dafd Dashboard: Migrate publish contract components from chakra to tailwind (#7713)
<!--

## 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 code in the `dashboard` application to improve UI components by replacing `chakra-react-select` with a custom select component, updating various forms, and enhancing the layout and styling for better usability.

### Detailed summary
- Replaced `chakra-react-select` with a custom `Select` component.
- Updated imports for UI components to use a unified path.
- Refactored `RefInputImplFieldset` to destructure props.
- Enhanced `ExternalLinksFieldset` styling and functionality.
- Improved layout and styling in `FactoryFieldset` and `NetworksFieldset`.
- Updated `AbiSelector` to use the new `Select` component.
- Modified `CustomFactory` and `LandingFieldset` for better UI consistency.
- Changed form handling and submission logic in `ContractPublishForm`.

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

<!-- end pr-codex -->
2025-07-25 18:22:37 +00:00
MananTank c077f78e3a Dashboard: Migrate contract deployment UI from chakra to tailwind (#7712)
<!--

## 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 button components and form controls in the dashboard application, improving the UI consistency and structure by replacing `FormControl` with a custom `FormFieldSetup` component and adjusting button properties.

### Detailed summary
- Changed the export of `ButtonProps` in `apps/dashboard/src/chakra/button.tsx` to remove the `export` keyword.
- Updated button imports in `apps/dashboard/src/@/components/solidity-inputs/button.tsx` to use the new path.
- Modified the `IpfsUploadButton` to use `variant="secondary"` and added a `disabled` state.
- Replaced `FormControl` with `FormFieldSetup` in multiple components for better structure and error handling.
- Adjusted the props passed to `FormFieldSetup` for improved clarity and functionality.

> ✨ 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**
  * Unified form field presentation by replacing direct Chakra UI form controls with a custom, reusable form field component across contract deployment and module configuration forms.
  * Simplified error handling, labels, and helper text management for a more consistent user experience.

* **Style**
  * Updated button styling and icon placement for IPFS upload actions, improving visual consistency and feedback during upload operations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-25 18:11:53 +00:00
MananTank 6b7983f47c Dashboard: Update outdated Portal links, Portal redirect cleanup (#7699)
<!--

## 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 various links throughout the application to direct users to the new `wallets` and `payments` sections instead of the old `connect` endpoints, improving navigation consistency.

### Detailed summary
- Updated `href` links in multiple files to point to new `wallets` and `payments` URLs.
- Changed labels for links to reflect updated navigation terminology.
- Removed deprecated links related to the old `connect` structure.
- Ensured all changes maintain the same functionality while improving user experience.

> ✨ 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**
  * Updated multiple documentation and help URLs throughout the dashboard to point to new or consolidated destinations for wallets, payments, and account abstraction features.
  * Adjusted footer and header links, as well as empty state and help links, to reflect the latest documentation structure.
  * Removed or replaced outdated links and labels for improved clarity and navigation.

* **Chores**
  * Refined and unified redirect mappings to consolidate legacy documentation paths, ensuring users are directed to the most relevant and up-to-date wallet and payment resources.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-25 12:12:19 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
859290f6c7 Version Packages (#7709)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-25 04:40:24 -07:00
Joaquim VergesandGitHub adec6be844 [SDK] Fix showQrModal option not respected on desktop web (#7711) 2025-07-25 04:34:04 -07:00
c80eed3552 [Docs] Add search and pagination to wallet list (#7703)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-25 03:50:50 -07:00
Joaquim VergesandGitHub 0c7051b999 [Docs] Update API endpoints and add frontend/backend examples (#7692) 2025-07-24 19:09:42 -07:00
Joaquim VergesandGitHub 3c8e444fe6 [SDK] Fix ecosystem wallet connection with default chains (#7708) 2025-07-24 19:02:00 -07:00
MananTank 367a25ca5a Dashboard: Migrate Explorer components from chakra to tailwind (#7707)
<!--

## 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 improving the UI components and functionality of the `ContractExplorerPage` and related components in the dashboard by refining layout, enhancing accessibility, and optimizing code structure.

### Detailed summary
- Updated layout for `ContractExplorerPage` to enhance UI consistency.
- Improved header elements for better accessibility.
- Refined tab structure in `ContractFunctionsOverview` for better navigation.
- Enhanced styling of buttons and inputs for a more modern look.
- Replaced `Card` components with simpler layouts where applicable.
- Introduced new utility functions for class name management.
- Optimized the handling of function inputs and outputs in `InteractiveAbiFunction`.
- Adjusted the rendering of function and event lists for improved clarity.

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

<!-- end pr-codex -->
2025-07-25 01:13:51 +00:00
MananTank c0ffa1c871 Dashboard: Migrate Published contract > code tab from chakra to tailwind (#7704)
<!--

## 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 improving the `CodeOverview` and `CodeSegment` components by enhancing their layouts, functionality, and structure. It introduces new sections, components, and props to better handle user interactions and display relevant information.

### Detailed summary
- Updated `className` in `CodeSegment` for better styling.
- Added `scrollableContainerClassName` prop in `CodeSegment`.
- Refactored `CodeOverview` to use props instead of interface.
- Introduced `AccentButtonListContainer` and `AccentButton` components for button lists.
- Created `AccountFactorySection` for account integration guidance.
- Enhanced tab handling and layout in `CodeOverview`.
- Improved user messaging and conditional rendering for SDK installation instructions.

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

<!-- end pr-codex -->
2025-07-25 01:13:51 +00:00
MananTank 36731096b9 Dashboard: Migrate /tokens contract page from chakra to tailwind (#7695)
<!--

## 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 improving the functionality and user experience of token management features in a dashboard application, including enhancements to file downloads, airdrop processes, and form validations.

### Detailed summary
- Removed unused `supportedERCs` from `ContractTokensPage`.
- Added redirects for unsupported ERC20 tokens.
- Improved the `LazyMintNftForm` with validation on image uploads.
- Introduced `DownloadableCode` component for code downloads.
- Added `AirdropCSVTable` for better CSV data handling.
- Enhanced `TokenAirdropForm` with improved transaction handling and notifications.
- Refactored various token management buttons to use consistent form structures and validation.
- Updated airdrop upload process to handle CSV files more effectively with user feedback.

> ✨ 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 DownloadableCode component for displaying and downloading code examples.
  * Added a paginated CSV table for airdrop address and quantity previews.

* **Refactor**
  * Simplified and unified token action forms (airdrop, burn, claim, mint, transfer) with improved validation, streamlined UI, and consistent notifications.
  * Replaced custom code example components with the new DownloadableCode component across relevant views.
  * Updated CSV upload experience with clearer instructions and reusable components.
  * Improved conditional navigation for unsupported token standards.

* **Bug Fixes**
  * Enhanced form validation and error handling for token-related actions.

* **Chores**
  * Updated import paths for consistency and maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-25 01:13:51 +00:00
gregandGitHub 1607229b21 [Dashboard] Feature: New Payments Overview UI (#7702) 2025-07-24 15:22:44 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
75bf09126f Version Packages (#7701)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-24 13:40:52 -07:00
Jonas DanielsandGitHub 9d8c7f1f7d Add gateway to possible usage sources (#7700) 2025-07-24 13:39:12 -07:00
MananTank 9dc8f5a637 [TOOL-5111] Playground: Update slugs, add redirects (#7698)
<!--

## 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 renaming and restructuring routes from `/connect` to `/wallets`, alongside adjustments in documentation links and component imports to streamline the application.

### Detailed summary
- Updated redirect paths from `/connect/...` to `/wallets/...`
- Changed documentation links accordingly
- Refactored component imports to match new route structure
- Adjusted breadcrumb links and sidebar navigation items
- Renamed files and folders to reflect the new `/wallets` hierarchy

> ✨ 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**
  * Expanded and reorganized URL redirects for improved navigation, including new paths for wallets, payments, and transactions sections.

* **Refactor**
  * Updated navigation links and internal references to use new URL structures for wallets, payments, and transactions.
  * Simplified import paths and component structures for improved code clarity and maintainability.

* **Documentation**
  * Updated documentation links throughout the app to reflect new URLs and more relevant resources.

* **Style**
  * Minor formatting improvements for code consistency and readability.

* **Chores**
  * Enhanced code comments to clarify the use of array index as React list keys.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-24 20:20:12 +00:00
Jonas DanielsandGitHub 48361f92b7 Add custom amount input to credit balance section (#7697) 2025-07-24 12:46:25 -07:00
MananTank 1659ae3754 Dashboard: Migrate Various forms in contract pages from chakra to tailwind (#7690)
<!--

## 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 form components in the dashboard's NFT management system to improve structure and usability. It replaces Chakra UI components with custom UI components, enhancing consistency and maintainability.

### Detailed summary
- Refactored `PropertiesFormControl` to utilize custom form components.
- Removed unused imports and consolidated imports from `@chakra-ui/react`.
- Updated form handling to use `FormField`, `FormItem`, and `FormDescription`.
- Enhanced error handling by integrating `FormMessage` for displaying validation messages.
- Replaced `Flex`, `FormControl`, and other Chakra UI components with custom equivalents.
- Updated `LazyMintNftForm`, `NFTMintForm`, and `UpdateNftMetadata` forms to use new structure and components.
- Improved user experience by refining button and input styles and behavior.

> ✨ 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**
  * Migrated all NFT-related form components from Chakra UI to a custom UI library, updating form controls, buttons, accordions, and input elements.
  * Updated error handling and helper text display to use new form components.
  * Simplified and modernized form structures for minting, lazy minting, metadata updates, and property controls.
  * Removed file upload support and reset functionality from the properties form.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-24 18:49:38 +00:00
MananTank 88d44aff50 Dashboard: Migrate Batch Upload NFTs from chakra to tailwind, UI improvements (#7689)
<!--

## 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 and enhancing the `FilePreview` component, improving the upload process for NFTs, and updating various components to utilize the new structure. Several files related to example CSVs were deleted, and new features were added for better file handling.

### Detailed summary
- Deleted example CSV files.
- Added `FilePreview` import in multiple components.
- Enhanced `FilePreview` styling and functionality.
- Updated `DownloadFileButton` to accept additional props.
- Refactored `BatchTable` to improve pagination and display logic.
- Improved `UploadStep` for better user experience during file uploads.
- Introduced `DelayedRevealConfiguration` and `SelectReveal` components for managing NFT reveal types.

> ✨ 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**
  * Replaced Chakra UI and third-party libraries with a custom UI system across batch upload components for a more unified look and feel.
  * Simplified and restyled batch minting forms, tables, upload steps, and reveal configuration.
  * Updated drag-and-drop functionality to use a dedicated DropZone component.
  * Streamlined table rendering and pagination with manual state management and local UI components.
  * Improved layout, styling, and accessibility for option selection, shuffle toggle, and modal dialogs.
  * Enhanced media preview styling and standardized file preview imports for improved consistency.
  * Added tabbed format selection and enriched instructional content with downloadable CSV/JSON examples in the upload step.
  * Improved submit button placement and added help links for user guidance during batch minting.
* **New Features**
  * Added customizable button variants and styling options to the file download button for better UI flexibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-24 18:17:47 +00:00
gregandGitHub c63b3497bd Feature: New Payments Overview Page (#7691) 2025-07-24 11:16:42 -07:00
74a21635e4 [Portal] Fix: Broken /connect Links (#7679)
Co-authored-by: Manan Tank <[email protected]>
2025-07-24 11:02:50 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
66b9bf3c6b Version Packages (#7694)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-24 02:00:52 -07:00
Joaquim VergesandGitHub cf22c23b45 [SDK] Optimize 4337 signature performance (#7693) 2025-07-24 00:47:45 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
170b020e17 Version Packages (#7682)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-23 19:25:46 -07:00
Joaquim VergesandGitHub 8260af3a92 [Dashboard] Replace modular contracts with Arbitrum Stylus contracts in explore page (#7685) 2025-07-22 19:15:42 -07:00
Joaquim VergesandGitHub b9154cc9e7 [API] Init API wrapper package (#7684) 2025-07-22 18:46:02 -07:00
Joaquim VergesandGitHub 08955f1588 [SDK] Expose getAuthToken from inApp and ecosystem wallets (#7683) 2025-07-22 18:26:46 -07:00
gregandGitHub 756295241a [SDK] Feature: Adds optional transactionId parameter to Bridge.status (#7681) 2025-07-22 15:11:04 -07:00
Joaquim VergesandGitHub 249679481e [Docs] Update redirects for wallets and payments paths (#7680) 2025-07-22 15:09:00 -07:00
Joaquim VergesandGitHub a491de4d7c [Docs] Refactor Contract and Tokens docs (#7676) 2025-07-22 17:20:00 +12:00
gregandGitHub 898efc56a9 [Portal] Fix: Test Jam Feedback (#7677) 2025-07-21 21:32:26 -07:00
c0e7ae95de Add external wallet filter and display (#7669)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-21 20:39:26 -07:00
Joaquim VergesandGitHub 1e8190a1f9 [Docs] Add frontend/backend tabs for transaction sending examples (#7670) 2025-07-21 19:36:18 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
aac187a76c Version Packages (#7662)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-21 16:35:51 -07:00
Manan TankandGitHub 03390c1e25 Portal: homepage UI improvements (#7667) 2025-07-21 16:35:29 -07:00
8d3b9c6a33 [Portal] Fix: update sidebar overflow behavior in DocLayout component (#7653)
Co-authored-by: Joaquim Verges <[email protected]>
2025-07-21 14:47:24 -07:00
MananTank ddef88866f [PRO-249] Portal: Update OG images (#7664)
<!--

## 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 metadata and image attributes across various pages in the `thirdweb` portal, particularly in the payments and vault sections. It modifies titles, icons, and descriptions to enhance clarity and consistency.

### Detailed summary
- Changed `metadata` for payments to use "payments" icon and updated titles.
- Updated vault metadata to include a new image with the "vault" icon.
- Modified various page descriptions for clarity and consistency.
- Added a new script for formatting in `package.json`.
- Removed unused code in `api/og/route.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 and updated metadata images and titles across several pages, including "Contracts", "Vault", and various "Payments" pages for improved visual representation.
  * Introduced support for a new "vault" icon in metadata image options.

* **Style**
  * Improved formatting and removed extraneous blank lines in code examples and UI components for better readability.
  * Cleaned up whitespace in multiple example code snippets.

* **Chores**
  * Added a new formatting script for consistent code style across the project.

* **Refactor**
  * Simplified Open Graph image layouts by removing certain UI elements.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-21 20:42:32 +00:00
Manan TankandGitHub 8133fab9e4 [TOOL-5083] Portal: Fix header on mobile viewport (#7661) 2025-07-21 13:41:30 -07:00
Joaquim VergesandGitHub 37414eb54a [SDK] Fix native token fallback when insight query fails (#7666) 2025-07-21 13:39:29 -07:00
MananTank 22bf68a6f0 [TOOL-5075] SDK: Fix various alignment issues in components (#7657)
<!--

## 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 fixing various alignment issues in React components within the `thirdweb` package, enhancing hover states and visual consistency across different UI elements.

### Detailed summary
- Updated hover styles in several components to improve visual feedback.
- Adjusted `all` property to "unset" for better styling control.
- Modified colors and borders in `OTPLoginUI.tsx`, `ReceiveFunds.tsx`, `DepositScreen.tsx`, and others for consistency.
- Enhanced button styles in `MenuButton.tsx`, `WalletEntryButton.tsx`, and `NetworkSelector.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

* **Bug Fixes**
  * Resolved various alignment issues in React components to improve visual consistency across the interface.

* **Chores**
  * Updated internal documentation to reflect the latest patch addressing alignment fixes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-21 17:58:07 +00:00
EimanandGitHub 68dd4dc17e fixed playground import (#7660) 2025-07-21 10:46:58 -07:00
saminacodes ecf6dbf2aa Update portal label to TypeScript SDK (#7658)
```
<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

[Portal] Fix: Update SDK title for TypeScript reference pages

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Updates the SDK title displayed on TypeScript reference pages from "Connect SDK" to "TypeScript SDK" for improved clarity and accuracy.

## How to test

Navigate to any `/references/typescript/v*/` page (e.g., `/references/typescript/v5/`). Verify the header displays "TypeScript SDK".

-->
```

---

**Open Background Agent:**
[Web](https://www.cursor.com/agents?id=bc-2dec36af-4b62-431c-b277-891c1b46bb48) · [Cursor](https://cursor.com/background-agent?bcId=bc-2dec36af-4b62-431c-b277-891c1b46bb48)

[Slack Thread](https://thirdwebdev.slack.com/archives/C04DYC3G5NZ/p1753110978408999?thread_ts=1753110978.408999&cid=C04DYC3G5NZ)

Learn more about [Background Agents](https://docs.cursor.com/background-agents)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on renaming references from `Connect SDK` to `TypeScript SDK` and `thirdweb SDK` across multiple files in the project, enhancing clarity and consistency in the documentation and codebase.

### Detailed summary
- Updated `label` from `Connect SDKs` to `thirdweb SDKs`.
- Changed `name` from `Connect SDK` to `TypeScript SDK`.
- Modified `sdkTitle` from `Connect SDK` to `TypeScript SDK`.
- Adjusted example descriptions and titles to reflect `TypeScript SDK`.
- Updated installation instructions to refer to `TypeScript SDK`.
- Revised descriptions related to wallet support to mention `thirdweb SDKs`.
- Changed references in guides and documentation from `Connect SDK` to `TypeScript SDK`.

> ✨ 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**
  * Updated SDK naming from "Connect SDK" to "TypeScript SDK" and "thirdweb SDK" across documentation, guides, UI labels, and sidebar links for improved clarity and consistency.

* **Chores**
  * Removed the "Engine" API link from the main navigation header.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-21 16:52:47 +00:00
Phillip HoandGitHub 01daaceb21 only one file (#7659) 2025-07-21 23:23:18 +08:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
a5345808ec Version Packages (#7640)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-21 02:22:54 -07:00
Joaquim VergesandGitHub bfa0a42219 [SDK] Fix TransactionWidget when wallet has enough currency (#7656) 2025-07-21 02:13:17 -07:00
426bb8bbb2 [SDK] Fix: fixes auto-connect on native <ConnectEmbed /> component (#7650)
Co-authored-by: Joaquim Verges <[email protected]>
2025-07-20 18:09:51 -07:00
823af013ae [SDK] Fix: update hooks to use core transaction types (#7647)
Co-authored-by: Joaquim Verges <[email protected]>
2025-07-20 18:02:09 -07:00
gregandGitHub 98aea1e0b9 [Portal] Payments Docs (#7651) 2025-07-20 17:46:20 -07:00
Joaquim VergesandGitHub 620e294f8c [Engine] Update server wallet config types for EOA and EIP-7702 execution (#7652) 2025-07-20 17:43:13 -07:00
Joaquim VergesandGitHub 84eaded152 [Dashboard] Show EOA server wallets by default (#7645) 2025-07-20 16:26:55 -07:00
MananTank 31d7173432 Dashboard: Show upsell card on support page for free plan (#7648)
<!--

## 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 support functionality within the dashboard, particularly for teams on a free billing plan. It adds checks for the billing plan, modifies the `SupportHeader`, and integrates upsell content to encourage users to upgrade their plans.

### Detailed summary
- `SupportHeader` now accepts `isFreePlan` prop to conditionally render buttons.
- Redirects free plan users from creating support cases.
- Displays upsell content for free plan users in the support page.
- Added functionality to show/hide support forms based on billing plan.
- Updated `CreateSupportCase` component to handle dialog state for support case creation.

> ✨ 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**
  * Free plan users now see an upsell prompt encouraging upgrade to access the Support Center, with a clear list of benefits.
  * The Support Center title has been updated for improved clarity.
  * Support case creation is disabled for free plan users, showing an informative message with a billing link instead.
  * Conditional support action buttons are shown only for paid plans, adapting to the user's context.

* **Improvements**
  * Enhanced visual styling and layout for benefit descriptions in upsell prompts.
  * Error messages in the Support Center now display detailed information for easier troubleshooting.
  * Dialogs for creating support cases now open and close with explicit user control for better interaction.
  * The chat button is hidden on the Support Center page to reduce UI clutter.

* **Bug Fixes**
  * Free plan users are prevented from accessing the support case creation page.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-18 21:17:54 +00:00
Yash094 a48329b697 [dashboard] - support in dashboard (#7608)
<!--

## 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 restructuring the support ticketing system by moving components and modifying links to streamline support interactions within the application.

### Detailed summary
- Deleted multiple support-related files and components.
- Changed `getTeamById` function to remove the `export` keyword.
- Updated support links to point to `/team/~/~/support`.
- Added new support ticket types and forms.
- Introduced new components for handling support tickets.
- Implemented ticket status handling and filtering.
- Enhanced the support case list display with filtering options.
- Created API endpoints for support ticket management.
- Integrated dynamic imports for various support forms.

> The following files were skipped due to too many changes: `apps/dashboard/src/@/components/chat/CustomChatContent.tsx`, `apps/dashboard/src/@/components/chat/CustomChats.tsx`, `apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/SupportCaseDetails.tsx`, `apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/_components/CreateSupportCase.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**
  * Unified support ticket system integrated into team dashboards with AI chat assistant and dynamic product-specific support forms.
  * Support ticket listing with status filtering, search, detailed conversation views, and reply functionality.
  * Added "Support" link in team sidebar footer; updated support headers, layouts, and navigation flows.
  * Introduced monochrome mode for mini logo and refined chat UI elements.

* **Bug Fixes / Improvements**
  * Enhanced chat component styling and user experience.
  * Removed obsolete "Support" links from navigation menus and headers.
  * Updated button labels, including changing "Ask AI Assistant" to "Get Help".

* **Chores**
  * Removed legacy support ticket creation pages, components, and client/server logic to consolidate support workflows.
  * Cleaned deprecated components, imports, redirects, and updated error messages to point to the new support section.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-18 19:09:16 +00:00
Joaquim VergesandGitHub 6e62a3aa5c [Docs] Add Ecosystem Wallet to sidebar and update documentation (#7643) 2025-07-18 16:47:56 +12:00
Jonas DanielsandGitHub 746b0c9d8b Add mcp to team capabilities (#7636) 2025-07-17 17:46:55 -07:00
gregandGitHub 0f38a1287a [SDK] Feature: Hide the TransactionWidget contract label if unknown (#7642) 2025-07-17 16:32:05 -07:00
gregandGitHub 61bfebf5d8 Chore: Use /search route for routes page (#7639) 2025-07-17 13:40:29 -07:00
170c377445 Handle token balance retrieval failures (#7600)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-17 13:40:15 -07:00
Yash094 4cbf67181d Add etherlink chain (#7634)
<!--

## 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 introduces new blockchain definitions for the Etherlink mainnet and testnet, enhancing the `thirdweb` package with additional chain support.

### Detailed summary
- Added `etherlink` mainnet definition in `packages/thirdweb/src/chains/chain-definitions/etherlink.ts`.
- Added `etherlinkTestnet` definition in `packages/thirdweb/src/chains/chain-definitions/etherlink-testnet.ts`.
- Exported `etherlink` and `etherlinkTestnet` in `packages/thirdweb/src/exports/chains.ts`.

> ✨ 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 the Etherlink mainnet and Etherlink testnet blockchain networks.
  * Users can now interact with these new chains within the platform.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-17 19:24:21 +00:00
arcoraven 6bf6108beb chore: webhooks docs (#7604)
<!--

## 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 introduces a new `Webhooks` section in the application, providing a sidebar navigation item, a dedicated layout, and detailed documentation on webhooks, including their configuration, management, and security practices.

### Detailed summary
- Added `sidebar` configuration for `Webhooks` in `sidebar.tsx`.
- Introduced `SDKCard` for `Webhooks` in `page.tsx`.
- Renamed `BAST_URL` to `BASE_URL` in `metadata.ts`.
- Created a new `Layout` component for `Webhooks` in `layout.tsx`.
- Defined metadata for `Webhooks` in `layout.tsx`.
- Added comprehensive documentation for webhooks in `page.mdx`, covering setup, management, event handling, and security.

> ✨ 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 "Webhooks" section in the backend APIs grid, accessible from the main portal.
  * Added comprehensive documentation for thirdweb Webhooks, including setup, management, security, and troubleshooting guides.
  * Implemented a dedicated sidebar and layout for the Webhooks documentation page for easier navigation.

* **Documentation**
  * Provided detailed instructions and code examples for implementing and verifying webhook integrations.

* **Bug Fixes**
  * Corrected a typo in the base URL constant used for metadata generation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-17 19:12:38 +00:00
Phillip HoandGitHub ce85be3346 chore: accordion, rename insight topic, test webhook endpoint (#7635) 2025-07-17 20:57:22 +08:00
MananTank e125e743a3 Dashboard: Temporarily remove gas sponsorship option in token creation (#7631)
<!--

## 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 temporarily disabling the gasless feature in two components: `launch-token.tsx` and `launch-nft.tsx`. The condition for enabling gasless functionality has been commented out and replaced with a static `false` value.

### Detailed summary
- In `launch-token.tsx`:
  - `canEnableGasless` is set to `false` with a comment about enabling it later.
  - `showGaslessSection` is set to `false`.

- In `launch-nft.tsx`:
  - `canEnableGasless` is set to `false` with a comment about enabling it later.
  - `showGaslessSection` is set to `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

* **New Features**
  * The gasless transaction feature and related UI have been temporarily disabled for both NFT and token launch flows.

* **Chores**
  * Updated internal logic to prevent access to the gasless sponsorship section until further notice.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-16 17:35:01 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
05da842b7a Version Packages (#7616)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-16 10:14:03 -07:00
MananTank 216b70475e Dashboard, Portal, Playground: Rename leftover usage of 'Universal Bridge' to 'Payments' in UI (#7611)
<!--

## 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 renaming references from `Universal Bridge` to `Payments` across various files in the codebase, reflecting a rebranding initiative.

### Detailed summary
- Changed `name` and `title` from `Universal Bridge` to `Payments` in multiple files.
- Updated labels and descriptions in UI components to reflect the new branding.
- Modified sidebar links and metadata to align with the new `Payments` terminology.
- Adjusted documentation references to `Payments` from `Universal Bridge`.

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

* **Style**
  * Updated all user-facing references of "Universal Bridge" to "Payments" across banners, page titles, headings, navigation links, sidebars, and documentation content for a consistent branding experience.

* **Documentation**
  * Revised documentation text, metadata, and quickstart guides to reflect the new "Payments" terminology and branding.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-16 16:20:48 +00:00
iuwqyir 9d259d0836 add insight filter selection to webhook creation and update (#7598)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on enhancing the webhook configuration components by introducing optional support for `ThirdwebClient` and `supportedChainIds`. It improves error handling and validation, particularly in the context of filtering for event and transaction webhooks.

### Detailed summary
- Made `thirdwebClient` optional in `useAbiProcessing` hook.
- Updated `CreateWebhookConfigModal`, `EditWebhookConfigModal`, `WebhooksOverview` to accept `client` and `supportedChainIds`.
- Enhanced error handling in `useQuery` for missing `thirdwebClient`.
- Introduced separate forms for event and transaction filters in `TopicSelectorModal`.
- Improved validation and fetching of ABIs in the filter forms.
- Added support for displaying ABI fetch status and results.
- Enhanced UI elements to accommodate new filter configurations.

> ✨ 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 webhook topic selection with advanced, form-driven filtering for contract webhook topics, including multi-network and ABI-based options.
  * Added support for passing client and supported chain information throughout the webhooks dashboard for improved filtering and configuration.

* **Improvements**
  * Increased dialog width for filter configuration to improve usability.
  * Streamlined handling of webhook topic filters for consistency and flexibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-16 13:17:01 +00:00
Phillip HoandGitHub ca52cdd3bf chore: /token and /vault landing pages (#7633) 2025-07-16 20:26:13 +08:00
Joaquim VergesandGitHub cf68002922 [Docs] Update page.mdx (#7632)
Signed-off-by: Joaquim Verges <[email protected]>
2025-07-16 02:08:40 -07:00
MananTank 495c7f925d [TOOL-5047] Dashboard: Fix client object missing teamId on contract publish page (#7628)
<!--

## 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 `PublishContractPage` component to utilize the `getUserThirdwebClient` function for client initialization, enhancing user authentication handling during contract publishing.

### Detailed summary
- Added import for `getUserThirdwebClient` from `@/api/auth-token`.
- Removed import for `getClientThirdwebClient` from `@/constants/thirdweb-client.client`.
- Replaced the client initialization in `ContractPublishForm` with `userThirdwebClient` from `getUserThirdwebClient`.

> ✨ 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 way the client is obtained for the contract publish form, improving consistency in client retrieval. No visible changes to user experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-15 20:09:58 +00:00
iuwqyir 32add5f602 Display webhook secret in dashboard (#7610)
```
<!--

## title your PR with this format: "[Dashboard] Feature: Display and Mask Webhook Secret in Contracts Webhooks List"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
INFRA-1524

## Notes for the reviewer

This PR introduces a new column to the Contracts Webhooks table to display the `webhook_secret`.

Key points:
- The secret is masked for security, showing `**********` followed by the last 3 characters (e.g., `**********xyz`).
- The full secret can be copied to the clipboard using the adjacent copy button.
- No backend changes were required as the `webhook_secret` is already available in the `WebhookResponse`.

## How to test

1. Navigate to a project's webhooks page on the dashboard (`/dashboard/[team_slug]/[project_slug]/webhooks`).
2. Observe the new "Webhook Secret" column in the table.
3. Verify that the secrets are displayed in the masked format (`**********xyz`).
4. Click the copy icon next to a masked secret and confirm that the full secret is copied to your clipboard.

-->
```

---

[Slack Thread](https://thirdwebdev.slack.com/archives/C085X0VQCF3/p1752487882125419?thread_ts=1752487882.125419&cid=C085X0VQCF3)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new function to mask webhook secrets for improved security and updates the `WebhooksTable` component to display the masked secret while allowing users to copy the original secret.

### Detailed summary
- Added `maskWebhookSecret` function to mask webhook secrets.
- Updated `WebhooksTable` to include a new column for "Webhook Secret."
- Displayed masked secret in the table with an option to copy the original secret.

> ✨ 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 new "Webhook Secret" column to the webhooks table, displaying masked webhook secrets for improved privacy.
  * Included a copy button to easily copy the full unmasked webhook secret to the clipboard.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-15 19:59:09 +00:00
gregandGitHub 5f74b3ca3e Chore: Update UB jsdocs to include types (#7629) 2025-07-15 11:50:42 -07:00
GiselleNessi 761cde6a32 [portal] add new support article (#7595)
<!--

## 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 `knowledge-base` section by adding new assets and a comprehensive guide for bulk updating NFT metadata, specifically for ERC-721A contracts.

### Detailed summary
- Added multiple image assets to the `knowledge-base`.
- Introduced a new guide in `page.mdx` for bulk updating NFT metadata.
- Explained concepts of batch and base URI in the context of NFTs.
- Provided step-by-step instructions for updating NFT metadata efficiently.

> ✨ 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 new sidebar entry for "Bulk update NFT metadata" under the "Contracts" section in the Troubleshoot category.
  * Introduced a comprehensive step-by-step guide on how to update metadata for multiple NFTs in bulk, including instructions, images, and helpful resources.

* **Documentation**
  * Expanded the knowledge base with detailed troubleshooting documentation for bulk updating NFT metadata.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-15 16:55:09 +00:00
Joaquim VergesandGitHub 9546b927d9 [Docs] Redesign sidebar and update wallet documentation (#7602) 2025-07-15 01:26:32 -07:00
jnsdls f82f885dad Update nebula rateLimit type to include perSecond and perMinute (#7614)
# Update Nebula Rate Limit Type

This PR updates the Nebula rate limit type to provide more granular control by replacing the single `rateLimit` number with an object containing `perSecond` and `perMinute` properties. The change affects:

- The `TeamCapabilities` type in the service-utils package
- Corresponding mock data and stubs in the dashboard app
- Added a changeset to document this patch update
2025-07-15 00:12:41 +00:00
jnsdls 34d2fddf49 Update error response URL for project settings (#7613)
# Update error response URL in service-utils

This PR updates the error response URLs in the service-utils package to point to the project-specific settings page instead of the generic API key creation page. The new URLs follow the format `https://thirdweb.com/${team.slug}/${project.slug}/settings`, providing users with a direct link to manage restrictions for their specific project.

The changes affect error messages for:
- Unauthorized domains
- Unauthorized bundle IDs
- Unauthorized services
- Unauthorized service actions

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

## Summary by CodeRabbit

* **Bug Fixes**
  * Updated error messages for unauthorized access to provide project-specific URLs, directing users to the relevant project settings page for more accurate guidance.

* **Chores**
  * Added documentation to track the patch update related to error response URLs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-15 00:12:41 +00:00
a7544f75ce [Portal] Add next button to inner page footers (#7605)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-14 15:46:21 -07:00
gregandGitHub bd3d645be6 [SDK] Fix: Adds BuyWidget fallback when native isn't supported (#7601) 2025-07-14 12:06:18 -07:00
MananTank 5fedc2c040 [TOOL-5037] Dashboard: Remove autoConnect on /login page (#7609)
<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring import paths for better organization and consistency across the codebase, as well as enhancing the login and onboarding components, including UI adjustments and functionality updates.

### Detailed summary
- Updated import paths to use absolute imports instead of relative paths.
- Modified the `DashboardLayout` to enable auto-connect.
- Enhanced the `LoginPage` with a new footer message regarding phone login support.
- Adjusted the `Toaster` component to simplify its usage.
- Improved onboarding UI components for better user experience.

> ✨ 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 an option to enable automatic wallet connection in the app layout.

* **Refactor**
  * Standardized import paths across the dashboard for improved maintainability and clarity.
  * Updated usage of the notification component to a local version with simplified theming.
  * Improved layout and messaging on the login page, moving phone login deprecation notice to a dedicated footer and refining spacing.

* **Documentation**
  * Enhanced SEO and social sharing metadata on the login page.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-14 18:36:51 +00:00
Yash094 6c8a7cf2ba fix playground payments widget (#7607)
<!--

## 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 `CodeGen` component in the `playground-web` application by renaming a prop for consistency and clarity.

### Detailed summary
- Changed the prop name from `token` to `tokenAddress` in the `CodeGen` component.
- Maintained existing conditional rendering for other props such as `seller`, `title`, `image`, `description`, `paymentMethods`, and `currency`.

> ✨ 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 generated code output to use the prop name `tokenAddress` instead of `token` when displaying the token address in the code example. This change does not affect any other visible functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-14 18:01:58 +00:00
Phillip HoandGitHub 4f02f6eeb7 chore: add webhook secret to table, fix api error (#7606) 2025-07-14 15:55:21 +08:00
72f75ea40b Update converter SDK reference (#7603)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-14 12:53:52 +08:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
8b6a953933 Version Packages (#7594)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-13 10:27:06 +12:00
Joaquim VergesandGitHub 33b0b6dcb4 [Dashboard] Add server-wallet signAuthorization capability to wallet access token (#7530) 2025-07-12 02:53:53 -07:00
MananTank cdc7d95db2 [TOOL-4959] Dashboard: Asset page UI improvements (#7599)
<!--

## 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 refining the UI components and enhancing the functionality of the `ERC20` public page. It includes improvements in layout, styling, and the introduction of new features related to token price data and analytics.

### Detailed summary
- Deleted unused files: `useTokenPriceData.ts` and `ContractCreatorBadge.tsx`.
- Updated `PageHeader` to change border style.
- Added `tooltip` prop in `CopyAddressButton`.
- Changed API key usage in `fetchTokenInfoFromBridge`.
- Enhanced `ThirdwebAreaChart` with better props handling.
- Introduced `GridPattern` component for background.
- Improved `RecentTransfers` UI and pagination buttons.
- Updated `PriceChart` and `TokenStats` to directly use passed props for token price data.
- Refactored `ContractHeaderUI` to improve layout and social link handling.

> ✨ 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 customizable grid background pattern component for enhanced visual design.
  * Added support for displaying token price data and analytics on ERC20 public pages, including conditional rendering of token statistics.
  * Enabled tooltip customization for the copy address button.

* **Bug Fixes**
  * The contract creator badge icon is now visible, and spacing between elements has been improved.

* **Refactor**
  * Simplified and unified chart headers and analytics section layouts.
  * Streamlined fetching and handling of token price data with a new asynchronous function and removed the previous hook.
  * Improved layout and container styling across ERC20 and NFT public pages, including card backgrounds, borders, and spacing.
  * Adjusted component structures for better visual separation and consistency.
  * Removed the contract creator badge component and replaced it with a simpler contract owner link.

* **Style**
  * Updated card and header styles for better visual hierarchy and clarity.
  * Enhanced recent transfers and contract header sections with improved padding, borders, and rounded corners.
  * Removed small shadow effects from cards and refined header background and border styles.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-12 05:50:29 +05:30
Manan TankandGitHub 592bf6f1fd [TOOL-5021] SDK: Fix theme in ConnectButton Details Modal Buy screen (#7589) 2025-07-12 09:21:50 +12:00
MananTank 8973174ad5 Dashboard: Fix erc20 asset page crash when number of tokens claimed is a fraction (#7597)
<!--

## 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 `SupplyClaimedProgress` component to use `claimedSupplyTokens` and `totalSupplyTokens` as `number` types instead of `bigint`, along with minor adjustments in related components and UI elements.

### Detailed summary
- Changed `enable-background` to `enableBackground` in `DiscordIcon.tsx`.
- Updated `SupplyClaimedProgress` props from `claimedSupply` and `totalSupply` (bigint) to `claimedSupplyTokens` and `totalSupplyTokens` (number).
- Adjusted calculations and conditions in `SupplyClaimedProgress` for new props.
- Modified test cases in stories to reflect new prop types.
- Updated UI elements to display supply values correctly based on the new number type.

> ✨ 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 supply progress components and related usage to use number types instead of bigints, with new prop names for clarity.
  * Improved handling and display of "unlimited" supply scenarios in supply progress components.
  * Adjusted percentage calculation and formatting for claimed supply progress.

* **Style**
  * Corrected SVG attribute naming in the Discord icon to ensure proper rendering.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-11 20:38:47 +00:00
Phillip HoandGitHub c160e91c08 chore: redirect /universal-bridge -> /payments (#7593) 2025-07-12 04:20:58 +08:00
gregandGitHub f33e31ad6e [SDK] Fix: only require missing token amount for transaction widget (#7591) 2025-07-11 02:01:57 -07:00
Joaquim VergesandGitHub 4111d0e638 [Dashboard] Add error handling and refactor vault account rotation (#7592) 2025-07-10 19:59:42 -07:00
joaquim-verges ffb7b6487b [Dashboard] use BuyWidget on /bridge (#7590)
Fixes TOOL-5023

<!--

## 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 updates the `UniversalBridgeEmbed` component to replace the `PayEmbed` with `BuyWidget` from the `thirdweb` library, modifying how payment options are handled and improving the integration with the `thirdweb` SDK.

### Detailed summary
- Replaced `PayEmbed` component with `BuyWidget`.
- Removed `payOptions` prop and its nested properties.
- Added `amount`, `chain`, and `tokenAddress` props to `BuyWidget`.
- Updated the theme handling to use `getSDKTheme`.

> ✨ 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**
  * Updated the embedded widget in the dashboard to use a new buy widget, offering a simplified and more direct interface for purchasing tokens.

* **Refactor**
  * Streamlined the widget’s input options for a more straightforward user experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-10 23:09:34 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
77063e5c85 Version Packages (#7588)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-10 15:51:49 -07:00
Joaquim VergesandGitHub 585eac2a6f [Dashboard] Replace vault access token with project secret key for authentication (#7570) 2025-07-10 15:32:36 -07:00
MananTank c54db522b3 Dashboard: Fix webhooks posthog feature flag conditional rendering (#7585)
<!--

## 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 introduces a centralized webhooks feature, enhancing the sidebar layout and analytics for webhooks. It adds loading states, integrates feature flags, and modifies the handling of webhooks in various components.

### Detailed summary
- Added `Loading` components using `GenericLoadingPage` in multiple webhook pages.
- Updated `ProjectSidebarLayout` to include `isCentralizedWebhooksFeatureFlagEnabled`.
- Enhanced `ProjectLayout` to fetch and utilize the centralized webhooks feature flag.
- Modified `WebhooksAnalyticsPage` to check for the centralized webhooks feature flag before redirecting.
- Adjusted `WebhooksLayout` to conditionally render links based on the centralized webhooks feature flag.
- Refactored `isFeatureFlagEnabled` function for improved feature flag handling.
- Updated `WebhooksPage` to include centralized webhooks feature flag checks and redirection logic.
- Cleaned up imports and ensured consistent use of `params` across various components.

> ✨ 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 multiple loading indicators across webhooks analytics, contracts, universal bridge, and sidebar routes for smoother user experience.
  * Sidebar and tab navigation dynamically update based on the centralized webhooks feature flag.

* **Bug Fixes**
  * Enhanced error handling with 404 responses for missing accounts, projects, or authentication on webhooks pages.
  * Redirects implemented when the centralized webhooks feature flag is disabled.

* **Refactor**
  * Updated feature flag checks to a new cached API accepting structured parameters.
  * Streamlined parameter handling and navigation logic for webhooks pages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-10 20:15:27 +00:00
Joaquim VergesandGitHub d62e9971ee [SDK] Fix inapp wallets showing up in all wallets list (#7586) 2025-07-10 13:14:57 -07:00
MananTank 7d796f5aa5 Dashboard: Fix theme for BuyWidget in chain page (#7583)
<!--

## 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 `BuyFundsSection` component by integrating theme support for the `BuyWidget` using the `useTheme` hook from `next-themes`. It adjusts the widget's theme based on the current application theme.

### Detailed summary
- Added `useTheme` hook to access the current theme.
- Imported `getSDKTheme` utility for theme handling.
- Passed the correct theme to the `BuyWidget` based on whether the theme is "dark" or "light".

> ✨ 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**
  * The Buy Funds section now adapts its appearance based on your selected theme (light or dark), providing a more consistent and personalized user experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-10 19:57:29 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
a5bb36141d Version Packages (#7584)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-10 12:50:16 -07:00
Prithvish BaidyaandGitHub f3234c3c41 [thirdweb/server-wallet] fix address used for simulation for ERC4337 (#7581) 2025-07-10 11:55:04 -07:00
91e3781e83 [Dashboard] Improve user filtering functionality (#7572)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-10 11:53:41 -07:00
arcoraven 86e3aa8c04 feat: webhooks list in dashboard (#7505)
# [Dashboard] Feature: Add Webhook Management UI

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/vKjRiOG6EUjD7XH4cppU/38dbe90b-2bd9-47b6-b190-3c257e99d2fe.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/vKjRiOG6EUjD7XH4cppU/d0a40295-c1c7-45c5-9b23-224a2a631b83.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/vKjRiOG6EUjD7XH4cppU/42d5337d-fcfe-4ef7-a349-1f596013e003.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/vKjRiOG6EUjD7XH4cppU/b7b89fe6-a5f7-4961-b927-bfc754c6665f.png)

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/vKjRiOG6EUjD7XH4cppU/88916c15-a501-4ceb-9267-a23290f683b9.png)

## Notes for the reviewer
This PR adds a new webhook management UI to the dashboard, allowing users to create, edit, delete, and monitor webhooks. The implementation includes:

- A new overview page for webhooks with a table to display all configured webhooks
- Create/edit webhook modals with form validation
- Topic selector for webhook event subscriptions
- Delete confirmation with activity warning
- Webhook metrics display showing request counts and error rates
- API integration for webhook configuration management

## How to test
Navigate to the webhooks section in a project to view the new UI. Create a new webhook, edit its configuration, and test the delete functionality. Verify that metrics are displayed correctly for existing webhooks.

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

* **New Features**
  * Introduced a comprehensive webhooks management interface, including creation, editing, deletion, and topic selection with optional JSON filters.
  * Added analytics dashboards for webhooks, featuring charts for request status codes and latency percentiles, with filtering by webhook and date range.
  * Implemented feature flag-based tab navigation for "Overview" and "Analytics" in the webhooks section.
  * Provided detailed webhook metrics, including recent activity and error rates.

* **Bug Fixes**
  * Improved error handling and user feedback for webhook configuration and analytics operations.

* **Chores**
  * Added PostHog server-side analytics integration.
  * Updated environment variable naming for analytics configuration.
  * Added new dependency for analytics support.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces webhook analytics features and enhances the webhook management system, including new types for webhook statistics, UI components for creating and editing webhooks, and improvements in data fetching and handling.

### Detailed summary
- Added `posthog-node` dependency for server-side analytics.
- Updated environment variable from `NEXT_PUBLIC_POSTHOG_API_KEY` to `NEXT_PUBLIC_POSTHOG_KEY`.
- Introduced interfaces for `WebhookRequestStats`, `WebhookLatencyStats`, and `WebhookSummaryStats`.
- Created `CreateWebhookConfigModal` and `EditWebhookConfigModal` components for managing webhooks.
- Implemented `WebhooksAnalytics` and `WebhookAnalyticsServer` components for displaying analytics data.
- Enhanced `WebhookMetrics` to show metrics and error rates.
- Added `isFeatureFlagEnabled` function for feature flag checks.
- Implemented data fetching functions for webhook metrics in `analytics.ts`.
- Updated the webhook configuration management with new API endpoints and improved error handling.
- Created `TopicSelectorModal` for selecting topics with optional filters.
- Improved UI components for better user experience in managing webhooks.

> The following files were skipped due to too many changes: `pnpm-lock.yaml`

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

<!-- end pr-codex -->
2025-07-10 17:21:02 +00:00
MananTank aa1035d16c [TOOL-4988] Dashboard, SDK: Add gas sponsorship option for asset creation for in-app wallets (#7566)
<!--

## 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 handling of gasless transactions across various components in the `thirdweb` dashboard, specifically for NFT and token creation processes. It introduces new parameters and logic to support gas sponsorship features.

### Detailed summary
- Added `useAuthToken` option in `bundler.ts` fetch requests.
- Enhanced `fetch.ts` to include authentication headers for bundler requests.
- Updated `CreateTokenFunctions` and `CreateNFTCollectionFunctions` to accept `gasless` parameter.
- Modified multiple functions in the NFT and token creation pages to support gasless transactions.
- Implemented UI elements for enabling gas sponsorship in the `LaunchNFT` and `LaunchTokenStatus` components.
- Adjusted error handling for unsupported gas sponsorship on certain chains.

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

Here are the updated release notes based on the provided summary:

* **New Features**
  * Added support for gasless transactions when launching NFT collections and tokens, available for eligible team plans and in-app wallets.
  * Introduced a toggle in the launch UI to enable or disable gasless mode for NFT and token creation.
  * Updated UI labels and dialogs for launching NFT collections.

* **Refactor**
  * Standardized function signatures for NFT and token creation to accept a unified parameter object, including a new gasless flag.
  * Centralized account and contract retrieval logic for improved maintainability and consistency.
  * Improved error logging in the token creation workflow.

* **Bug Fixes**
  * Enhanced error handling during token launch to detect unsupported gas sponsorship and provide user-friendly retry options.

* **Chores**
  * Updated request headers logic to properly handle authorization tokens and additional headers for bundler URLs.
  * Enabled authentication token usage in bundler request configurations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-10 15:18:10 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
bd395a3cff Version Packages (#7579)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-10 00:51:14 -07:00
Joaquim VergesandGitHub 446a69b1d1 [SDK] update wallet definitions (#7580) 2025-07-09 21:51:41 -07:00
Manan TankandGitHub 826d9c80a8 Dashboard: Remove OP superchain banner, CTAs, credits (#7569) 2025-07-09 20:10:50 -07:00
Joaquim VergesandGitHub 772eb0cc53 [SDK] Handle different fiat currencies in payment widgets (#7578) 2025-07-09 19:59:35 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
5c6dd874e0 Version Packages (#7577)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-09 16:55:48 -07:00
a9e47e4759 Replace PayEmbed with BuyWidget code (#7574)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-09 15:47:29 -07:00
bfd728a9d1 Add branding hide prop to widgets (#7575)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-09 15:46:29 -07:00
saminacodes 381a2823d7 [Docs] Remove Nebula from portal navigation (#7576)
```
<!--

## title your PR with this format: "[Portal] Feature: Remove Nebula from portal navigation"

## Notes for the reviewer

This PR removes all user-facing references to Nebula from the portal navigation and homepage, as requested.

-   **Key point:** All Nebula pages and underlying content remain untouched; only navigation links and homepage sections were removed.
-   Removed Nebula from the main header navigation and the APIs dropdown.
-   Removed Nebula sections from the homepage (API Reference and Learning Resources).
-   Updated the Vault section icon on the homepage from `NebulaIcon` (which was removed) to `ConnectIcon`.

## How to test

1.  Run the portal locally.
2.  Verify "Nebula" is no longer present in the main navigation bar or the "APIs" dropdown.
3.  On the homepage (`/`), confirm that the "Nebula" cards are removed from the "API Reference" and "Learning Resources" sections.
4.  Confirm that the "Vault" card in the "Learning Resources" section now uses the `ConnectIcon`.
5.  Run `npm run portal:build` to ensure the project builds successfully.

-->
```

---

[Slack Thread](https://thirdwebdev.slack.com/archives/C04DYC3G5NZ/p1752094214240499?thread_ts=1752094214.240499&cid=C04DYC3G5NZ)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on removing references to `Nebula` from the application, including links and UI components, while retaining and emphasizing `Insight` and `Vault`.

### Detailed summary
- Removed `Nebula` link from `connectLinks` in `Header.tsx`.
- Deleted `Nebula` API reference card from `ReferenceSection` in `page.tsx`.
- Eliminated `Nebula` card from `LearningResourcesSection` in `page.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**
  * None.

* **Bug Fixes**
  * None.

* **Refactor**
  * Removed all references to the "Nebula" feature from navigation menus and resource sections.
  * Updated the icon for the "Vault" article card.

* **Chores**
  * Cleaned up unused imports related to "Nebula".

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-09 21:53:40 +00:00
saminacodes 2111b8b12c Rename Universal Bridge to Payments (#7571)
```
<!--

## title your PR with this format: "[Dashboard] Feature: Rename Universal Bridge to Payments"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

This PR renames all instances of "Universal Bridge" to "Payments" across the projects dashboard. This is a branding update and does not change any underlying functionality or URLs.

Changes include:
- Sidebar navigation label
- Page titles and descriptions
- Callouts and sub-text (e.g., analytics, FTUX)
- Webhooks section (tab name and heading)

## How to test

1. Navigate to any project dashboard.
2. Verify the sidebar now shows "Payments" instead of "Universal Bridge".
3. Click on "Payments" in the sidebar and confirm the page title and description are updated.
4. Check the "Analytics" page to ensure "Universal Bridge" references are updated to "Payments".
5. Go to "Webhooks" and then the "Payments" tab to confirm the heading and tab name are correct.
6. Verify the FTUX section also reflects "Payments".

-->
```

---

[Slack Thread](https://thirdwebdev.slack.com/archives/C08GEMP858V/p1752037029611589?thread_ts=1752037029.611589&cid=C08GEMP858V)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on renaming references from "Universal Bridge" to "Payments" throughout the codebase, reflecting a change in terminology for a feature that facilitates payments.

### Detailed summary
- Updated `name` in `layout.tsx` from "Universal Bridge" to "Payments".
- Changed `label` in `ProjectSidebarLayout.tsx` from "Universal Bridge" to "Payments".
- Modified `title` in `ProjectFTUX.tsx` from "Universal Bridge" to "Payments".
- Changed heading in `page.tsx` from "Universal Bridge Webhooks" to "Payments Webhooks".
- Updated description in `analytics/page.tsx` from "Universal Bridge" to "Payments".
- Changed description in `sidebar/page.tsx` from "Universal Bridge" to "Payments".
- Updated heading in `universal-bridge/page.tsx` from "Get Started with Universal Bridge" to "Get Started with Payments".
- Changed heading in `universal-bridge/layout.tsx` from "Universal Bridge" to "Payments".
- Updated description in `universal-bridge/layout.tsx` to reflect "Payments" instead of "Universal Bridge".

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

<!-- end pr-codex -->
2025-07-09 05:13:22 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1665e4d534 Version Packages (#7568)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-08 17:18:24 -07:00
Manan TankandGitHub 692cedf921 [TOOL-4987] SDK: Restore CSS resets, remove biome rules for sorting attributes and properties (#7567) 2025-07-08 15:47:22 -07:00
e1f4901b80 [SDK] Remove page and set up redirect (#7565)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-08 12:06:36 -07:00
MananTank 028f871d40 [TOOL-4972] Dashboard: Add field to configure admins in NFT asset creation (#7542)
<!--

## 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 NFT creation process by adding the ability to set admin addresses and refining various components for better user experience and validation.

### Detailed summary
- Added `"set-admins"` step to the NFT asset type.
- Introduced `AdminAddressesFieldset` for managing admin addresses.
- Updated forms to include admin validation.
- Improved UI components with consistent styling.
- Enhanced error handling during admin setting.

> ✨ 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 the ability to specify multiple admin wallet addresses when creating an NFT collection, with dynamic form fields and validation.
  * NFT launch workflow now includes a step to assign admin roles to specified addresses.
  * NFT collection info and launch dialogs now display the list of assigned admins.

* **Improvements**
  * The NFT and token creation forms now automatically set the default blockchain network based on the active wallet chain.
  * NFT upload form includes default values for price and supply fields.
  * Visual spacing adjustments in social URL and token launch dialogs for improved UI consistency.

* **Bug Fixes**
  * Ensured at least one admin address is required when creating an NFT collection.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-08 15:37:47 +00:00
2821b4eeb7 Make contract webhook addresses mandatory (#7544)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-08 15:20:49 +02:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
adfa56b2a2 Version Packages (#7555)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-07 18:54:19 -07:00
YashandGitHub 415ad90986 feat: add T-Rex testnet chain (#7540) 2025-07-07 18:17:02 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
afcb7bba84 chore(deps): bump zod from 3.25.71 to 3.25.75 (#7552)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-07 18:15:59 -07:00
Joaquim VergesandGitHub 10c3b6f27f [SDK] Respect fee payer in token payment selection quotes (#7556) 2025-07-07 18:14:50 -07:00
Joaquim VergesandGitHub c64446306e [SDK] Use new BuyWidget in wallet details modal (#7551) 2025-07-07 17:18:28 -07:00
saminaandGitHub 2136c7ba4a [Docs] Wallets Overview (#7543) 2025-07-07 16:21:33 -07:00
MananTank 67c3d861fe [TOOL-4986] Dashboard: Fix ERC20 asset page crash (#7541)
<!--

## 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 improving error handling by adding `try-catch` blocks around asynchronous calls in the `getContractCreator` function. This change ensures that if an error occurs during the execution of `owner` or `getRoleMember`, the function will return `null` instead of throwing an unhandled error.

### Detailed summary
- Wrapped the calls to `owner` and `getRoleMember` in a `try-catch` block.
- Changed the calls to `owner` and `getRoleMember` to use `await` for proper asynchronous handling.
- Ensured that if an error occurs, the function returns `null` instead of failing silently.

> ✨ 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 error handling when retrieving contract creator information, ensuring failures no longer cause crashes and instead return a safe null value.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-07 14:15:01 +00:00
d2c12cc6ef Create session key guide and update sidebar (#7538)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-07 03:30:38 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
c1b2e10f34 Version Packages (#7539)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-07 03:29:31 -07:00
Joaquim VergesandGitHub f48d8006bc [SDK] Optimize payment token fetching in payment widgets (#7536) 2025-07-07 02:50:25 -07:00
Joaquim VergesandGitHub 20e323d666 [Dashboard] Fix smart account options validation for non-EIP4337 execution modes (#7537) 2025-07-07 01:20:11 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
0ec6142bf8 Version Packages (#7535)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-06 19:21:21 -07:00
0ea25bb9ae [SDK] Update walletconnect provider to universal (#7532)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-06 16:39:46 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
67293fc269 Version Packages (#7534)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-06 01:17:37 -07:00
Joaquim VergesandGitHub cb77544a46 [SDK] Respect feePayer property in Payment widgets (#7533) 2025-07-06 01:08:46 -07:00
770e7b24da Enhance transaction details with decoded tab (#7531)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-06 00:58:14 -07:00
ff9df497c9 Update branding from Engine Cloud to Transactions (#7516)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-05 13:37:17 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2d6c245b5e Version Packages (#7511)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-06 07:21:32 +12:00
37b3d7fa07 Add activity log section to transaction page (#7529)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-05 01:01:24 -07:00
YashandGitHub 8def4f33f6 Stylus CLI updates (#7502) 2025-07-05 07:47:29 +12:00
saminaandGitHub d92ab6fabe [Docs] Portal Images (#7526) 2025-07-03 21:39:03 -07:00
Joaquim VergesandGitHub 198cfd0f95 [Playground] Add TokenSelector component to Pay embed configuration (#7527) 2025-07-03 21:38:44 -07:00
jnsdls 9fba016cff Remove Plausible analytics integration (#7525)
# Remove Plausible Analytics Integration

This PR removes the Plausible Analytics integration from our applications:

- Removed `next-plausible` dependency from the dashboard app
- Removed Plausible script tags from dashboard, playground-web, and portal layouts
- Removed the Plausible proxy configuration from the Next.js config
- Updated the webpack configuration to work without the Plausible proxy wrapper

<!-- start pr-codex -->

---

## PR-Codex overview
This PR removes the usage of `next-plausible` from various files and updates dependencies accordingly. It also cleans up the code by removing unnecessary `<head>` elements and script imports across multiple layout files.

### Detailed summary
- Removed `next-plausible` dependency from `apps/dashboard/package.json`.
- Deleted `<Script>` components related to Plausible from `layout.tsx` files in `apps/playground-web`, `apps/dashboard`, and `apps/portal`.
- Cleaned up `next.config.ts` by removing `withPlausibleProxy`.
- Updated `pnpm-lock.yaml` to reflect the removal of `next-plausible`.

> ✨ 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**
  * Removed Plausible analytics integration and related dependencies from the dashboard.
  * Removed external script loading from the layouts of the playground-web and portal apps.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-04 02:35:21 +00:00
Jonas DanielsandGitHub 4b8badba2e upgrade dependencies (#7524) 2025-07-03 19:22:27 -07:00
Joaquim VergesandGitHub 341325f844 [SDK] Show all tokens in payment selection regardless of balance (#7523) 2025-07-03 19:16:17 -07:00
7500d8723f [Dashboard] Fix validation for smart account options (#7522)
Co-authored-by: Cursor Agent <[email protected]>
2025-07-03 18:35:31 -07:00
Jonas DanielsandGitHub fa45dea07d upgrade biome to 2.0.6 (#7517) 2025-07-03 18:32:04 -07:00
Joaquim VergesandGitHub f94226ad7e [SDK] update wallets, add sh.frame (#7521) 2025-07-03 17:43:39 -07:00
Jonas DanielsandGitHub 0e159f776c [Dashboard] Add chain infrastructure deployment and management (#7456) 2025-07-03 17:32:14 -07:00
jnsdls f1a965b046 Enable engineCloud service in project creation modal (#7520)
### TL;DR

Enabled Engine Cloud service in the project creation modal.

### What changed?

Removed the filter that was excluding the "engineCloud" service from the list of available project services in the create project modal. This change allows users to select Engine Cloud when creating a new project.

### How to test?

1. Open the dashboard application
2. Click on "Create Project" button
3. Verify that Engine Cloud appears as an available service option in the project creation modal

### Why make this change?

The Engine Cloud service was previously excluded with a TODO comment indicating it should be enabled once the API server was ready. This change suggests that the API server is now available, so Engine Cloud can be offered as a service option during project creation.

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

## Summary by CodeRabbit

* **Bug Fixes**
  * Updated project service selection to allow "engineCloud" as an available option.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-03 23:04:16 +00:00
MananTank 9f88b5c2be [TOOL-4951] Dashboard: Show Plan upsell on storage error in asset creation modal (#7512)
<!--

## 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 introduces the `teamPlan` property to various components related to NFT and token creation, allowing the application to handle billing plans effectively. It also adds a new component for handling storage limit errors and integrates upsell reporting for plan upgrades.

### Detailed summary
- Added `teamPlan` prop to components: `CreateNFTPage`, `CreateTokenAssetPage`, `CreateNFTPageUI`, `CreateTokenAssetPageUI`, `LaunchNFT`, `LaunchTokenStatus`.
- Introduced `StorageErrorPlanUpsell` component for storage limit handling.
- Implemented upsell reporting functions: `reportUpsellShown`, `reportUpsellClicked`.
- Updated `MultiStepStatus` to use a render function for error messages.
- Changed error message type from `React.ReactNode` to `string` in `MultiStepStatus`.

> ✨ 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 tailored upsell experience when users on a free plan hit the storage limit during token or NFT creation, including a new prompt to upgrade and real-time detection of plan changes.
  * Added analytics tracking for upsell prompts and upgrade link clicks.

* **Enhancements**
  * Error messages in multi-step workflows can now be customized, allowing for more informative and actionable error displays.
  * Components involved in token and NFT creation now accept and utilize the team's billing plan to enable conditional UI and logic.

* **Storybook**
  * Updated stories to reflect storage limit scenarios and demonstrate the new upsell flow for free plan users.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 20:39:36 +00:00
MananTank 7e73c344f5 Dashboard: asset page header: hide zero-address, fix icon (#7514)
<!--

## 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 improving the handling of wallet addresses and token fetching in the application. It enhances the rendering of wallet address components and modifies the fetching logic for token information, including error handling.

### Detailed summary
- Updated rendering of the wallet address in `apps/dashboard/src/@/components/blocks/wallet-address.tsx` and `apps/nebula/src/@/components/blocks/wallet-address.tsx` to include `props.className` and added a `text-xs` class in the latter.
- Enhanced the fetch request in `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_utils/fetch-coin-info.ts` by moving `clientId` to headers and added error logging for failed requests.
- Modified the condition for rendering contract creator in `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx` to check if `contractCreator` is not equal to `ZERO_ADDRESS`.

> ✨ 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**
  * Improved wallet address display to support external styling and smaller text size for the zero address.

* **Bug Fixes**
  * Updated contract header to ensure the contract creator badge is not shown for zero addresses.
  * Enhanced error logging for token info fetching to aid in troubleshooting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 20:15:47 +00:00
iuwqyir 4bd4efce4b add rpc tab with analytics (#7489)
# [Dashboard] Feature: Add RPC Edge analytics page

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the RPC (Remote Procedure Call) analytics feature in the dashboard. It introduces new components, updates existing ones, and adds functionality for fetching and displaying RPC usage data and statistics.

### Detailed summary
- Added `RpcMethodStats` and `RpcUsageTypeStats` interfaces in `analytics.ts`.
- Introduced `getRpcUsageByType` function to fetch RPC usage data.
- Updated `RpcMethodBarChartCardUI` to use new data structure.
- Added new `RPC` link in `ProjectSidebarLayout`.
- Created `RpcAnalyticsFilter` for filtering RPC analytics.
- Implemented `RequestsGraph` to visualize RPC requests over time.
- Developed `TopRPCMethodsTable` to display top EVM methods called.
- Added `RpcFTUX` component for user onboarding in RPC section.
- Updated layout files to integrate new components and improve styling.

> ✨ 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 dedicated "RPC" section in the project sidebar for easy access to RPC analytics.
  * Added a comprehensive RPC analytics dashboard, including:
    * Interactive requests graph and top RPC methods table.
    * Date range and interval filtering for analytics.
    * First-time user experience (FTUX) with ready-to-use code examples and documentation links.
  * Enhanced layout and navigation for the new RPC analytics section.

* **Style**
  * Improved UI spacing, sizing, and visual consistency for analytics components and placeholders.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 19:58:55 +00:00
MananTank 84f80437c1 [TOOL-4908] Dashboard: Fix 'Owner only' claim condition phase type condition (#7506)
<!--

## 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 adding a condition to check if the `maxClaimablePerWallet` is `"0"` and enhancing the validation of the `phase.snapshot` property within the `claim-conditions-form` component.

### Detailed summary
- Added a condition to check if `phase.maxClaimablePerWallet` is `"0"`.
- Ensured `phase.price` is `"0"`.
- Checked that `phase.snapshot` is not a string and has a length of 1.

> ✨ 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 claim condition handling to more accurately identify "creator" claim types based on updated criteria.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 19:11:32 +00:00
iuwqyir ac48b2409b add analytics to insight page (#7488)
<!-- start pr-codex -->

## PR-Codex overview
This PR introduces enhancements to the `Insight` feature in the application, including new analytics components, improved data fetching, and user interface updates for better user experience.

### Detailed summary
- Added `limit` parameter to analytics type definitions.
- Refactored imports in `insight-ftux.tsx`.
- Introduced `InsightAnalyticsFilter` component for filtering analytics data.
- Created `Layout` component with project validation and redirection.
- Added `InsightFooter` for footer links.
- Implemented `TopInsightChainsTable` and `TopInsightEndpointsTable` for displaying analytics data.
- Added `getInsightChainUsage`, `getInsightStatusCodeUsage`, and `getInsightEndpointUsage` API functions for fetching analytics.
- Enhanced `RequestsByStatusGraph` for visualizing status code requests.
- Updated `Page` component to handle authentication and data fetching more efficiently.

> ✨ 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 comprehensive analytics dashboard for project insights, including interactive charts and tables for usage, errors, top endpoints, and top chains.
  * Added filters for date range and interval selection, with preferences saved for future visits.
  * Enhanced visualization with a stacked bar chart for HTTP status codes and detailed tables for endpoints and chains.
  * Included a streamlined layout with improved navigation, footer resources, and a "Get Started with Insight" call-to-action.
  * Added new analytics data fetching capabilities covering usage by chain, status code, endpoint, and overall metrics.

* **Refactor**
  * Simplified the insights page by removing redundant logic and focusing on authenticated analytics display.

* **Bug Fixes**
  * Improved error handling during data fetching to ensure UI stability when analytics data is unavailable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 19:01:44 +00:00
jnsdls bde53fcf34 Remove "starter" plan checks from team invitation logic (#7513)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on refining the invitation feature within the onboarding and settings sections of the application. It simplifies the conditions for inviting team members based on the billing plan.

### Detailed summary
- Removed `"Invite Team Members"` from the pricing options in `pricing.tsx`.
- Updated the conditional rendering for the custom CTA in `InviteTeamMembers.tsx` to check only for the `"free"` billing plan.
- Simplified the `inviteEnabled` condition in `InviteSection.tsx` to exclude the `"starter"` plan.
- Adjusted the conditional check for displaying the bottom section in `InviteSection.tsx` to only check for the `"free"` plan.

> ✨ 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**
  * Updated team plan features by removing "Invite Team Members" from the "growth" plan feature list.

* **Bug Fixes**
  * Adjusted upgrade prompts and invite functionality so that upgrade options and invite restrictions now apply only to teams on the "free" plan, rather than both "free" and "starter" plans.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 18:51:42 +00:00
FirekeeperandGitHub 7437289140 Update import path in createSessionKey example (#7510) 2025-07-02 11:12:23 -07:00
Jonas DanielsandGitHub ca1fb84eba Properly type purchaseData as Record<string, unknown> (#7508) 2025-07-02 11:12:06 -07:00
jnsdls 087c29efdd [Dashboard] Rename RPC Edge to RPC and add redirect (#7509)
# Rename `/rpc-edge` to `/rpc`

This PR renames the `/rpc-edge` route to `/rpc` in the dashboard:

- Updates the route in `framer-rewrites.js`
- Adds a redirect from `/rpc-edge` to `/rpc` to maintain backward compatibility

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

## Summary by CodeRabbit

* **New Features**
  * Added a redirect from /rpc-edge to /rpc for dashboard requests.

* **Chores**
  * Updated references from /rpc-edge to /rpc in the scale category configuration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 17:58:07 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
9c2b0f7111 Version Packages (#7501)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-02 09:56:04 -07:00
FirekeeperandGitHub fd967ce8e3 Pass purchaseData prop to payment components (#7507) 2025-07-02 09:49:24 -07:00
Joaquim VergesandGitHub 7ab8808b50 [SDK] Handle very large numbers in BuyWidget component (#7503) 2025-07-02 04:18:20 -07:00
Yash094 ec75d9502c feat(chains): add Core testnet and mainnet chains (#7486)
<!--

## 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 introduces two new chain definitions for `Core` and `Core Testnet` to the `thirdweb` package, enhancing its blockchain support.

### Detailed summary
- Added `coreMainnet` definition in `core-mainnet.ts` with block explorer and native currency details.
- Added `coreTestnet` definition in `core-testnet.ts` with block explorer, native currency details, and testnet flag.
- Exported both `coreMainnet` and `coreTestnet` in `chains.ts`.

> ✨ 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 the Core mainnet and Core testnet blockchain networks.
  * Users can now interact with these new chains, including viewing block explorer links and using native currency details.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-02 11:03:11 +00:00
85c4ef10ce Added Somnia Testnet (#7474)
Co-authored-by: Joaquim Verges <[email protected]>
2025-07-02 03:20:23 -07:00
Manan TankandGitHub 50e01ce067 SDK: Restore border on embed components (#7487) 2025-07-02 03:19:22 -07:00
Joaquim VergesandGitHub f15f62feec [Porta] fix llm.txt generation (#7500) 2025-07-01 22:45:00 -07:00
Joaquim VergesandGitHub 2d1549bb8b [Portal] Remove unused import from sign-in methods page (#7499) 2025-07-01 22:17:58 -07:00
saminaandGitHub effe60b48f [Docs] Broken Engine Links (#7498)
Signed-off-by: samina <[email protected]>
2025-07-01 21:49:39 -07:00
Joaquim VergesandGitHub 2029869d9c [Dashboard] Add status filter to transactions table (#7497) 2025-07-01 16:03:08 -07:00
jnsdls 02f6f87d08 [Dashboard] Move RPC Edge to scale category and remove redirect (#7495)
### TL;DR

Reorganized navigation structure by adding a "scale category" and removing the RPC Edge redirect.

### What changed?

- Created a new "scale category" in the framer-rewrites.js file that includes:
  - `/rpc-edge`
  - `/insight`
  - `/storage`
- Moved `/storage` from its own category into the new "scale category"
- Moved `/insight` from its own category into the new "scale category"
- Removed the redirect from `/rpc-edge` to the portal URL in redirects.js

### How to test?

1. Verify that the `/rpc-edge`, `/insight`, and `/storage` routes are properly grouped under the "scale category"
2. Confirm that navigating to `/rpc-edge` no longer redirects to the portal URL
3. Check that the other redirects still function as expected

### Why make this change?

This change improves the organization of related services under a logical "scale category" grouping, making the navigation structure more intuitive. It also enables direct access to the RPC Edge page rather than redirecting users to the portal, providing a more seamless user experience.

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

## Summary by CodeRabbit

* **Refactor**
  * Reorganized and regrouped certain dashboard paths under a new "scale category" for improved clarity.

* **Chores**
  * Removed a redirect rule for the /rpc-edge path.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-01 20:38:46 +00:00
MananTank 1305527822 [TOOL-4900] Dashboard: Add ERC20 token page links in /routes (#7493)
<!--

## 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 components in the `routes-table`, `routelist-card`, and `routelist-row` files to improve structure and readability, while introducing new components like `TokenName` and `TokenInfo` for better token representation.

### Detailed summary
- Replaced `TableContainer` with a simpler structure in `routes-table.tsx`.
- Changed table header structure to improve readability.
- Refactored `routelist-card.tsx` to use `TokenName` for token display.
- Introduced `TokenInfo` component in `routelist-row.tsx` for consistent token representation.
- Removed inline token display logic in favor of new components.

> ✨ 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 clickable links to ERC20 token pages for improved navigation and clarity in token displays.
  * Introduced new helper components for consistent token information display.

* **Refactor**
  * Updated token display layouts to use flexbox for better alignment and readability.
  * Consolidated repeated token rendering logic into reusable components.

* **Style**
  * Simplified and removed custom styling from tables and cards for a cleaner appearance.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-01 20:15:55 +00:00
MananTank b882ad7807 Playground: Fix in-app-wallet ConnectEmbed prebuilt ui code snippet (#7492)
<!--

## 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 updates the `page.tsx` file in the `in-app-wallet` directory to improve the formatting of the `wallets` configuration and the `App` function, ensuring consistent indentation and structure.

### Detailed summary
- Reformatted the `wallets` array for improved readability.
- Changed the indentation of the `auth` and `executionMode` properties.
- Updated the `App` function to have consistent spacing around the return statement.

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

* **Style**
  * Improved formatting and readability of code examples and component structure in the in-app wallet integration page. No changes to functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-01 20:10:18 +00:00
MananTank 030c522816 Dashboard: Add missing asset creation successs tracking for nft (#7494)
<!--

## 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 NFT launch functionality by adding a successful asset creation report feature. It imports a new reporting function and invokes it upon successful NFT launch, improving analytics tracking.

### Detailed summary
- Added import for `reportAssetCreationSuccessful` from `@/analytics/report`.
- Called `reportAssetCreationSuccessful` with parameters indicating asset type and contract type upon successful NFT launch.

> ✨ 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 reporting step after completing the NFT launch process, providing improved feedback for successful NFT creation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-07-01 20:00:45 +00:00
MananTank c356813852 Dashboard: Remove chakra provider from team/settings/notifications page (#7479)
<!--

## 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 notifications settings page by renaming components, updating the layout, and improving the user interface for managing notifications.

### Detailed summary
- Deleted `SettingsNotificationsPage` and replaced it with `Notifications`.
- Updated the main page layout to include a header and description for notifications.
- Enhanced the `Notifications` component with a new background and border styling.
- Added a separator line in the `Notifications` component.
- Removed unnecessary wrapper from `SettingSwitch` layout.

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

<!-- end pr-codex -->
2025-06-30 16:14:58 +00:00
MananTank 1c638edd80 Dashboard: Charts style tweaks, Remove unused chart component (#7478)
<!--

## 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 modifying the styling and layout of various components within the dashboard, enhancing user interface elements, and removing unused files.

### Detailed summary
- Deleted `CombinedStatBreakdownCard.tsx` and `CombinedStatBreakdownCard.stories.tsx`.
- Updated class names for better styling on `Link` and `Card` components.
- Removed `max-md:border-r-0` and `max-md:border-l-0` classes from several components.
- Adjusted `min-h` properties for `Card` components.
- Centered text in `EmptyStateContent`.
- Streamlined layout in various components for improved spacing.

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

<!-- end pr-codex -->
2025-06-30 16:14:58 +00:00
MananTank 2fd5b84505 [PRO-213] Dashboard: Empty chart state copy changes (#7477)
<!--

## 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 `EmptyStateCard` component across various files, including changes to its props, styling, and the metrics displayed. It simplifies the component's usage and modifies the metrics for clarity and relevance.

### Detailed summary
- Updated `EmptyStateCard` to remove unnecessary props in `RpcMethodBarChartCardUI.tsx`.
- Modified metric and link props in `EngineCloudBarChartCardUI.tsx`.
- Changed `EmptyStateCard` metrics in `EmptyStateCard.stories.tsx` and other files to be more relevant.
- Made `metric` prop optional in `EmptyStateCard.tsx`.
- Enhanced styling for `EmptyStateContent` in `EmptyStateCard.tsx`.
- Adjusted rendering logic for `EmptyStateContent` to improve clarity and user experience.

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

<!-- end pr-codex -->
2025-06-30 16:14:58 +00:00
MananTank 2bfc9b2eb2 [PRO-211, PRO-210] Dashboard: Copy changes (#7476)
<!--

## 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 making minor adjustments to text labels and descriptions in the application, enhancing consistency in naming and improving grammatical accuracy.

### Detailed summary
- In `apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/layout.tsx`, changed `name` from "Contract" to "Contracts".
- In `apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/page.tsx`, updated the phrase from "Create and Manage tokens for your project" to "Create and manage tokens for your project".

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

* **Style**
  * Corrected capitalization in the Assets section header for improved readability.
  * Updated a navigation tab label from "Contract" to "Contracts" for clarity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-30 16:14:57 +00:00
MananTank e9dc2190a1 [PRO-218] Dashboard: Add product rebrand banner (#7475)
<!--

## 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 updates the `AnnouncementBanner` component to reflect a rebranding message and a new link to a blog post, replacing the previous announcement about the Nebula App.

### Detailed summary
- Updated `href` to point to "https://blog.thirdweb.com/the-fastest-way-to-build-web3-applications/"
- Changed `label` to "We have re-branded our Engine, Universal Bridge, and Connect products. Please read the full blog post for details on changes"
- Updated `trackingLabel` to "product-rebrand"

> ✨ 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**
  * Updated the announcement banner to highlight the rebranding of Engine, Universal Bridge, and Connect products, with a link to a detailed blog post.

* **Style**
  * Refreshed banner text and link to reflect the latest product updates.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-30 15:47:03 +00:00
Phillip HoandGitHub d0fa1b1e66 chore: Enable telegram support channel, add join link button (#7472) 2025-06-30 18:23:43 +08:00
Joaquim VergesandGitHub 85a5037f50 [Playground] Update product details from hoodie to concert ticket (#7473) 2025-06-29 18:59:11 -07:00
Joaquim VergesandGitHub fd67c5db58 [Dashboard] Add client ID header to embedded wallets fetch request (#7471) 2025-06-29 02:40:26 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ca65b43566 Version Packages (#7467)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-28 23:57:39 -07:00
Corey RiceandGitHub 1f72396d7f docs: Update imports in react v5 adaptor examples (#7469) 2025-06-29 10:25:27 +12:00
MananTank 08834f6385 Dashboard: Update team layout (#7464)
<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring and updating the billing and settings-related components in the dashboard application, changing URLs from `/settings` to `/billing`, and enhancing the user interface for better clarity and usability.

### Detailed summary
- Deleted several unused files related to settings and credits.
- Updated links in various components to redirect from `/settings` to `/billing`.
- Refactored `useActiveSidebarLink` to streamline sidebar link management.
- Enhanced UI elements for better responsiveness and aesthetics.
- Introduced a new `StaffModeNotice` component for staff mode indications.
- Adjusted layout components for consistent styling.
- Reorganized billing-related components into a unified structure.
- Improved pagination button styles for better visibility.

> The following files were skipped due to too many changes: `apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/rpc/page.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**
  * Introduced a full-width sidebar layout with collapsible submenus and responsive navigation.
  * Added a team sidebar layout with structured navigation for team dashboards.
  * Added collapsible UI components for use in layouts and menus.
  * Added a reusable StaffModeNotice component for staff mode indication.

* **Bug Fixes**
  * Improved container sizing and maximum width constraints for better layout consistency across analytics, audit log, and ecosystem pages.

* **Refactor**
  * Simplified and reorganized sidebar layouts, removing complex internal logic and mobile navigation from several components.
  * Updated navigation structures to use new sidebar and tab-based layouts.
  * Streamlined and restyled headers, banners, and button components for a more cohesive look.
  * Replaced inline staff mode banners with the StaffModeNotice component.
  * Removed sidebar navigation from usage and settings layouts for a cleaner interface.
  * Removed gas credits settings and related components from the settings area.
  * Refactored ecosystem pages to redirect directly to creation, removing landing page.
  * Updated billing-related URL paths by removing deprecated `/settings` segments for consistency.
  * Removed account plan constants and unused hooks for cleaner codebase.
  * Cleaned up imports and replaced some relative imports with absolute paths.

* **Style**
  * Enhanced visual styling and responsiveness for range selectors, sidebars, and headers.
  * Adjusted text sizes and spacing in mobile navigation and file sections for improved readability.
  * Added rounded corners and adjusted spacing in date and interval selectors.
  * Added responsive minimum widths and consistent borders to pagination buttons and links.

* **Chores**
  * Added a new dependency for collapsible UI support.
  * Updated import paths and added lint suppression comments for code clarity and maintainability.
  * Added responsive minimum widths to pagination buttons and consistent border styling to pagination links.
  * Updated multiple URLs in links and buttons to reflect new billing paths without `/settings` segment.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-28 12:10:06 +00:00
Joaquim VergesandGitHub 143ab6d127 [Portal] simplify get started wallet documentation (#7466) 2025-06-28 04:10:53 -07:00
bc512551ab [SDK] Add enableCard prop to control fiat payment visibility (#7465)
Co-authored-by: Claude <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
2025-06-28 04:09:52 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
8e29d48426 chore(deps): bump @vercel/functions from 2.1.0 to 2.2.2 (#7422)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-28 01:09:38 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
e7e6446e7d chore(deps-dev): bump checkly from 5.6.0 to 6.0.1 (#7424)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-28 01:09:21 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
7113f7c669 Version Packages (#7463)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-27 18:56:26 -07:00
f9d7935d84 Update engine API (#7427)
Signed-off-by: Prithvish Baidya <[email protected]>
Co-authored-by: Prithvish Baidya <[email protected]>
2025-06-27 18:41:37 -07:00
FirekeeperandGitHub acd5656d4d [SDK] EIP-7702 Session Keys (#7432) 2025-06-27 18:11:19 -07:00
gregandGitHub 6d1d344c48 Fix: Exclude IAW when smart wallets are used (#7454) 2025-06-27 13:36:11 -07:00
MananTank 26b8c320ae [TOOL-4899] Dashboard: fetch token icon from bridge api as fallback in coin asset page (#7460)
<!--

## 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 introduces a new utility function to fetch token information from a bridge and integrates it into the `ERC20PublicPage` component to enhance contract metadata with token icons.

### Detailed summary
- Added `fetchTokenInfoFromBridge` function in `fetch-coin-info.ts` to fetch token details from a bridge API.
- Integrated `fetchTokenInfoFromBridge` in the `ERC20PublicPage` component.
- Updated contract metadata to include the token icon if not already present.

> ✨ 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 ERC20 public pages to automatically display token icons when available, enriching token metadata with external information.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 19:46:52 +00:00
Phillip HoandGitHub c7f7f48222 chore: change webhook back to object (#7461) 2025-06-28 02:18:40 +08:00
MananTank e814248d9c [TOOL-4898] Dashboard: Replace PayEmbed with BuyWidget in asset page, add tracking (#7459)
<!--

## 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 `PayEmbed` component to `BuyWidget` in the `BuyTokenEmbed` function, enhancing the functionality with error reporting and success tracking for asset purchases.

### Detailed summary
- Replaced `PayEmbed` with `BuyWidget` in `BuyTokenEmbed`.
- Added `amount`, `chain`, and `className` props to `BuyWidget`.
- Implemented `onError` and `onSuccess` callbacks for analytics reporting.
- Updated the token address prop to ensure correct type.
- Modified chart className in `contract-analytics.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**
  * Updated the buy token section to use an improved widget with enhanced error and success handling, including dynamic titles and analytics reporting.

* **Style**
  * Adjusted the chart's aspect ratio for better display across different screen sizes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 16:43:21 +00:00
MananTank d7a0613067 [TOOL-4897] Dashboard: Add Contract creator badge in Coin and NFT asset page (#7458)
<!--

## 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 introduces the `contractCreator` property to multiple components, allowing the display of the contract creator's address in the UI. It also adds a new function, `getContractCreator`, to retrieve the contract creator's information based on the contract's role.

### Detailed summary
- Added `contractCreator` prop to `NFTPublicPageLayout`, `ContractHeaderUI`, and `ContractCreatorBadge`.
- Implemented `getContractCreator` function to fetch the contract creator using `ThirdwebContract`.
- Updated `NFTPublicPage` and `ERC20PublicPage` to call `getContractCreator` and pass the result to the UI.
- Enhanced storybook stories to include `contractCreator` in various scenarios.

> ✨ 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 display of contract creator information on ERC20 and NFT public pages.
  * Introduced a badge showing the contract creator's address in the contract header section.

* **Enhancements**
  * Contract headers now conditionally show the creator badge if creator data is available.
  * Storybook stories for contract headers updated to include contract creator scenarios for improved UI previews.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 16:31:14 +00:00
MananTank dbc031664d [TOOL-4867] Dashboard: Fix Coin asset page crash on "unlimited" maxClaimableSupply (#7457)
<!--

## 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 handling of the `totalSupply` property in the `SupplyClaimedProgress` component and related files to support the string value `"unlimited"` instead of using a constant value from `thirdweb/utils`.

### Detailed summary
- Changed `totalSupply` type from `bigint` to `bigint | "unlimited"` in `SupplyClaimedProgress`.
- Updated the condition to check for `"unlimited"` instead of `maxUint256`.
- Modified the story for `SupplyClaimedProgress` to use `"unlimited"` instead of `maxUint256`.
- Adjusted `totalSupply` handling in `TokenDropClaim` to return `"unlimited"` if `maxClaimableSupply` equals `maxUint256`.

> ✨ 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**
  * Updated the supply progress display to clearly indicate when the total supply is unlimited.
* **Refactor**
  * Improved internal handling and representation of unlimited supply for better clarity in the UI.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 16:20:18 +00:00
saminacodes 5640d48854 [Docs] Project Rebrand (#7455)
CORE-0000

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on renaming and rebranding various components and documentation from `Universal Bridge` and `Engine` to `Payments` and `Transactions`, respectively, to better reflect their functionality and purpose.

### Detailed summary
- Renamed `Universal Bridge` to `Payments` across multiple files.
- Renamed `Engine` to `Transactions` across various components and documentation.
- Updated metadata and titles in numerous `.mdx` files to reflect the new branding.
- Changed references in UI components and layout files to match new naming conventions.
- Adjusted descriptions and summaries in documentation to align with the new terms.
- Updated links and API references to point to the correct 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

* **New Features**
  * Expanded the learning resources section with updated and additional cards, including new topics like "Contracts" and "Vault".

* **Style**
  * Updated navigation and sidebar labels for improved clarity (e.g., "Connect" to "Wallets", "Bridge" to "Payments", "Engine" to "Transactions").
  * Swapped the order of the GitHub icon and theme switcher in the header for better usability.

* **Documentation**
  * Renamed all references from "Universal Bridge" to "Payments" and from "Engine" to "Transactions" across guides, FAQs, and documentation.
  * Updated instructions, headings, and content to reflect new product names and improved clarity.
  * Added a new FAQ entry explaining the difference between "Transactions Cloud" and "Dedicated" infrastructure.
  * Updated links and navigation paths to match new terminology.
  * Adjusted terminology in wallet-related documentation to replace "Connect" with "Wallets".
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 15:26:01 +00:00
GiselleNessi 9d6739ea59 updated text support page (#7447)
<!--

## 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 descriptions and titles of various features in the support section of the dashboard, as well as changing a header for improved clarity.

### Detailed summary
- Updated `description` and `title` for the wallets feature.
- Changed `description` and `title` for the universal bridge feature, along with its `viewAllUrl`.
- Modified `description` and `title` for the engine feature, including its `viewAllUrl`.
- Revised `description` for the insight feature.
- Changed the header from "Learning Resources" to "Support Articles".

> ✨ 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 product names and descriptions for greater clarity in the Support section.
  * Changed the heading above product cards from "Learning Resources" to "Support Articles."
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 10:52:59 +00:00
GiselleNessi dc49683357 removed next steps chainlist page (#7443)
<!--

## 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 removing unused components and updating product descriptions in the `page.tsx` and `products.ts` files.

### Detailed summary
- Deleted `NextSteps` and `ClaimChainSection` components from `page.tsx`.
- Removed related JSX comments in `page.tsx`.
- Updated product descriptions and names in `products.ts`:
  - Changed "Pre-built contracts & deployment tools" to "Create, deploy and manage smart contracts".
  - Changed "Client-side SDKs for wallets and blockchain interactions" to "Create and manage crypto wallets".
  - Changed "Engine" to "Transactions".
  - Changed "Account factory contracts, bundler & paymaster" to "Enable gas sponsorship for seamless transactions".
  - Changed "Point of sale solution for bridging, onramping & swapping" to "Enable payments in any token on any chain".
  - Changed "Query, transform and analyze blockchain data" to "Query and analyze blockchain data".

> ✨ 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**
  * Removed the "Next Steps" and "Claim Chain" sections from the chain page, including related external links and prompts.
* **Documentation**
  * Updated product names and descriptions to use clearer, more user-focused language for better understanding of features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-27 10:42:56 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
30496388c4 Version Packages (#7453)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-27 03:40:38 -07:00
Joaquim VergesandGitHub c2ef5eb51c [SDK] Update zod dependency to 3.25.67 (#7451) 2025-06-27 01:11:51 -07:00
gregandGitHub 277c2e2ed9 Feature: Add fallback when we cant fetch the token in new widgets (#7452) 2025-06-26 16:43:46 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
0ac5e59eb9 Version Packages (#7445)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-26 14:56:22 -07:00
gregfromstl fa5e13b5d3 Feature: Adds onramp webhook schema to sdk (#7450)
<!--

## 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 adding onramp webhook parsing functionality to the `Universal Bridge` in the `thirdweb` package, along with updates to existing tests to accommodate new payload structures.

### Detailed summary
- Added onramp webhook parsing for `Universal Bridge`.
- Updated `chainId` and `transactionHash` values in tests.
- Modified the structure of `validWebhook` and `validPayload` in `Webhook.test.ts`.
- Changed `destinationAmount` and `originAmount` types to `bigint`.
- Introduced `onchainWebhookSchema` and `onrampWebhookSchema` in `Webhook.ts`.
- Updated `webhookSchema` to include `onchain` and `onramp` transaction types.
- Enhanced the `parse` function to return a `WebhookPayload` that satisfies the new schema.

> ✨ 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 webhook parsing to support onramp webhooks for the Universal Bridge.

* **Refactor**
  * Improved validation and structure of webhook payloads for clearer distinction between onchain and onramp types.
  * Updated numeric fields to ensure correct data types and improved payload handling.

* **Documentation**
  * Added a changeset file describing the new onramp webhook parsing capability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 21:30:46 +00:00
gregandGitHub 45bb790dd1 Fix: Include correct client in payment link UI (#7449) 2025-06-26 11:21:52 -07:00
0xFirekeeper 102a8c8224 [Portal] EIP-7702 Session Key Docs (.NET) (#7448)
Closes TOOL-4880

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces new features and updates for the `EcosystemWallet` in the Thirdweb .NET SDK, focusing on EIP-7702 functionalities, including session management and permissions.

### Detailed summary
- Added new sidebar links for EIP-7702 actions.
- Updated `CreateSessionKey` function to include EIP-7702 functionalities.
- Introduced detailed documentation for new methods: `SignerHasFullPermissions`, `GetCallPoliciesForSigner`, `GetTransferPoliciesForSigner`, `GetSessionExpirationForSigner`, and `GetSessionStateForSigner`.
- Each method includes usage examples, parameter details, return values, and exception handling.

> ✨ 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**
  * Expanded sidebar navigation with new links for EIP-7702 session key actions under the wallet section.
  * Added documentation for EIP-7702 session key management, including creating session keys, checking signer permissions, retrieving call and transfer policies, session expiration, and session state.

* **Documentation**
  * Introduced detailed guides and usage examples for new EIP-7702 wallet session key features and related methods in the .NET SDK.
  * Clarified sidebar link names to distinguish between EIP-4337 and EIP-7702 session key creation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-26 16:19:05 +00:00
Phillip HoandGitHub 472e737616 chore: webhook payload must be an array (#7444) 2025-06-26 18:38:21 +08:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
0345492e99 Version Packages (#7433)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-26 03:01:11 -07:00
gregandGitHub e650434061 [SDK] Fix: Chain name label (#7442) 2025-06-25 15:47:17 -07:00
gregandGitHub 6712911950 [SDK] Chore: Remove onrampTokenAddress set to ETH (#7441) 2025-06-25 14:22:20 -07:00
orbuloandGitHub 1387337955 [SDK] Feature: update hey-api version to 0.76.0 (#7431) 2025-06-25 12:30:12 -07:00
Phillip HoandGitHub a2b737e144 fix: typo on a field in webhook event helper (#7440) 2025-06-25 23:19:02 +08:00
Phillip HoandGitHub c5f9921dc9 feat: add webhook producer to service-utils (#7439) 2025-06-25 13:35:19 +08:00
Joaquim VergesandGitHub 830125c920 Add CLAUDE.md (#7438) 2025-06-24 19:11:06 -07:00
Joaquim VergesandGitHub af89836b6c [SDK] Handle sponsored gas on TransactionWidget (#7437) 2025-06-24 19:10:47 -07:00
MananTank d85ee5fac3 Dashboard: add "Contracts" link in contract layout header (#7436)
![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/yNOf1svJ8o3zjO7zQouZ/05f5e0d2-cfee-4604-8567-a630e13f8232.png)

<!--

## 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 introduces a new optional property, `currentProjectSubpath`, to enhance the `TeamHeader` components by allowing the display of additional project navigation details, including a label, href, and icon.

### Detailed summary
- Added `currentProjectSubpath` property to `TeamHeaderLoggedIn` and `TeamHeaderDesktopUI`.
- Updated `TeamHeaderUI` to render project subpath details if provided.
- Introduced a new story in `TeamHeaderUI.stories.tsx` to showcase the `currentProjectSubpath` feature.
- Integrated `currentProjectSubpath` into the `ContractLayout` component for enhanced navigation.

> ✨ 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 displaying an active project subpage link with an icon in the team header, enhancing breadcrumb navigation for projects.
  - Updated the team header to visually indicate the current subpage within a project.

- **Documentation**
  - Added a new Storybook variant to demonstrate the team header with an active subpage link.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 23:37:56 +00:00
MananTank 8bb4d4bc11 Dashboard: remove date selector from UB FTUX, improved skeletons (#7435)
<!--

## 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 `Page` component in the `loading.tsx` file and the `PayAnalytics` component in the `PayAnalytics.tsx` file, enhancing the structure and user experience by modifying the rendering of analytics and loading states.

### Detailed summary
- Removed `ResponsiveSuspense` and `PayAnalyticsFilter` from `loading.tsx`.
- Integrated `PayAnalytics` directly into the `Page` component.
- Added `ResponsiveSuspense` with a skeleton loader in `PayAnalytics`.
- Reorganized analytics display in `PayAnalytics`, including filtering and layout adjustments.

> ✨ 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**
  - Improved the loading experience in the PayAnalytics section with responsive skeleton placeholders during data loading.
  - Updated the layout to display analytics filters above the loading state for better usability.

- **Chores**
  - Removed unused loading and suspense logic from related pages to streamline the user interface.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 22:27:52 +00:00
MananTank 3c6668b6c8 [TOOL-4833] Add Manage Contract button in new public contract pages (#7434)
<!--

## 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 handling of `projectSlug` and `teamSlug` properties across various components in the application, improving navigation and data management related to teams and projects.

### Detailed summary
- Added `projectSlug` and `teamSlug` props in several components including `cards.tsx`, `DeployedContractsPage.tsx`, and `layout.tsx`.
- Updated links to include `teamSlug` and `projectSlug` for better navigation.
- Introduced new API function `getContractImportedProjects` to fetch projects with imported contracts.
- Created `TeamSelectorCard` and `ProjectAndTeamSelectorCard` components for selecting teams and projects.
- Improved UI elements such as buttons and tooltips in `ContractHeaderUI` and `ImportModal`.
- Enhanced type definitions for better type safety and clarity in components.

> ✨ 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 team and project selector UI, enabling users to easily select teams or projects from visual cards.
  - Added a project and team selector for associating contracts, allowing users to view, select, or import contracts into projects across teams.
  - Enhanced contract management by providing direct navigation to contract pages based on project selection.
  - Improved contract view links to include team and project information in URLs for clearer navigation.
  - Added functionality to fetch projects that have imported specific contracts within teams.

- **UI Improvements**
  - Updated button styles with rounded edges for a polished look.
  - Added copy address and manage contract buttons with icons and tooltips for enhanced usability.

- **Storybook/Documentation**
  - Added Storybook stories to visually test and demonstrate the new team and project selector components under various scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-24 21:58:48 +00:00
gregandGitHub 6aa2765a34 Feature: UB Widget Tracking and Docs (#7426) 2025-06-24 13:19:01 -07:00
2202 changed files with 89750 additions and 64848 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ jobs:
- name: Setup Biome
uses: biomejs/setup-biome@a9763ed3d2388f5746f9dc3e1a55df7f4609bc89 # v2.5.1
with:
version: 2.0.4
version: 2.0.6
- run: pnpm lint
+290
View File
@@ -0,0 +1,290 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Development Commands
### Package Management
- Use `pnpm install` (or `pnpm install --ignore-scripts` on Windows)
- Monorepo managed with Turborepo and pnpm workspaces
### Building
```bash
# Build all packages
pnpm build
# Build specific packages with dependencies
turbo run build --filter=./packages/*
# Development with watch mode
pnpm dev # Core thirdweb package
pnpm dashboard # Run dashboard + dependencies
pnpm playground # Run playground + dependencies
pnpm portal # Run portal docs + dependencies
```
### Testing
```bash
# Run all tests
pnpm test
# Interactive testing (thirdweb package)
cd packages/thirdweb && pnpm test:devr
# Test specific file
pnpm test:dev <path-to-test-file>
# E2E testing (dashboard)
cd apps/dashboard && pnpm playwright
```
### Code Quality
```bash
# Lint all packages
pnpm lint
# Auto-fix linting issues
pnpm fix
# Format code
turbo run format
# Biome is the primary linter/formatter
```
### Development Workflow
```bash
# Start development server for dashboard
pnpm dashboard
# Start playground for SDK testing
pnpm playground
# Generate changeset for releases
pnpm changeset
# Version packages
pnpm version-packages
```
## Repository Architecture
### Monorepo Structure
This is a Turborepo monorepo with the main thirdweb v5 SDK consolidated into `/packages/thirdweb/`. Legacy packages are in `/legacy_packages/`.
### Core Package (`/packages/thirdweb/`)
**Main Modules:**
- `client/` - ThirdwebClient foundation
- `chains/` - 50+ supported blockchain definitions
- `contract/` - Contract interaction with automatic ABI resolution
- `transaction/` - Transaction management and execution
- `wallets/` - Comprehensive wallet integration system
- `extensions/` - Modular contract extensions (ERC20, ERC721, etc.)
- `auth/` - SIWE authentication and signature verification
- `pay/` - Fiat and crypto payment infrastructure
- `storage/` - IPFS integration for decentralized storage
- `rpc/` - Low-level blockchain communication
**Exports Structure:**
The SDK uses modular exports from `src/exports/` including:
- `thirdweb.ts` - Core client and utilities
- `chains.ts` - Chain definitions
- `wallets.ts` - Wallet connectors
- `react.ts` - React hooks and components
- `extensions/` - Contract standards and protocols
### Applications (`/apps/`)
- **dashboard** - Web-based developer console (Next.js, Chakra UI)
- **playground-web** - Interactive SDK testing environment
- **portal** - Documentation site with MDX
- **nebula** - Account abstraction and smart wallet management
- **wallet-ui** - Wallet interface and testing
### Key Packages (`/packages/`)
- **thirdweb** - Main SDK (TypeScript, React, React Native)
- **engine** - thirdweb Engine API client
- **insight** - Analytics and data APIs
- **nebula** - Account abstraction client
- **service-utils** - Shared utilities across services
## Development Practices
### GitHub Workflow & Pull Requests
- **PR titles**: Must start with affected workspace in brackets (e.g. `[SDK]`, `[Dashboard]`, `[Portal]`, `[Playground]`)
- **PR descriptions**: Begin with one-sentence summary, add checklist of changes, reference issues with `Fixes #123`
- **Commits**: Keep small and topical – one logical change per commit
- **Branch naming**: Use `area/brief-topic` format (e.g. `sdk/fix-gas-estimate`). Avoid personal names
- **Reviews**: Request at least one core maintainer review. Do not self-merge unless sole package owner
- **CI requirements**: All checks (type-check, Biome, tests) must pass before merging
### Code Quality & Formatting
- **Biome**: Primary linter/formatter (rules in `biome.json`)
- **Pre-commit**: Run `pnpm biome check --apply` before committing
- **Build verification**: Run `pnpm build` after each file change to ensure everything builds
- Avoid editor-specific configs; rely on shared settings
### TypeScript Guidelines
- **Style**: Write idiomatic TypeScript with explicit function declarations and return types
- **File structure**: Limit each file to one stateless, single-responsibility function for clarity
- **Types**: Re-use shared types from `@/types` or local `types.ts` barrels
- **Interfaces vs Types**: Prefer type aliases over interface except for nominal shapes
- **Type safety**: Avoid `any` and `unknown` unless unavoidable; narrow generics when possible
- **Architecture**: Choose composition over inheritance; leverage utility types (`Partial`, `Pick`, etc.)
### Testing Strategy
- **Co-location**: Place tests alongside code: `foo.ts` ↔ `foo.test.ts`
- **Test approach**: Use real function invocations with stub data; avoid brittle mocks
- **Network mocking**: Use Mock Service Worker (MSW) for fetch/HTTP call interception
- **Test quality**: Keep tests deterministic and side-effect free
- **Running tests**: `cd packages/thirdweb && pnpm test:dev <filename>`
- **Test accounts**: Predefined accounts in `test/src/test-wallets.ts`
- **Chain forking**: Use `FORKED_ETHEREUM_CHAIN` for mainnet interactions, `ANVIL_CHAIN` for isolated tests
### SDK Development (`packages/thirdweb`)
#### Public API Guidelines
- **Exports**: Export everything via `exports/` directory, grouped by feature
- **Documentation**: Every public symbol must have comprehensive TSDoc with:
- At least one `@example` block that compiles
- Custom annotation tags (`@beta`, `@internal`, `@experimental`)
- **Comments**: Comment only ambiguous logic; avoid restating TypeScript in prose
#### Performance Optimization
- **Lazy loading**: Load heavy dependencies inside async paths to keep initial bundle lean:
```typescript
const { jsPDF } = await import("jspdf");
```
- **Bundle budgets**: Track via `package.json#size-limit`
- **Dependencies**: De-duplicate across packages through pnpm workspace hoisting
### Dashboard & Playground Development
#### UI Component Standards
- **Core components**: Import primitives from `@/components/ui/*` (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator)
- **Navigation**: Use `NavLink` for internal navigation with automatic active states
- **Organization**: Group feature-specific components under `feature/components/*` with barrel `index.ts`
#### Styling Conventions
- **CSS framework**: Tailwind CSS only – no inline styles or CSS modules
- **Class merging**: Use `cn()` from `@/lib/utils` for conditional logic
- **Design tokens**: Use design system tokens (backgrounds: `bg-card`, borders: `border-border`, muted text: `text-muted-foreground`)
- **Component API**: Expose `className` prop on root element for overrides
#### Component Architecture
- **Server Components** (Node edge):
- Start files with `import "server-only";`
- Read cookies/headers with `next/headers`
- Access server-only environment variables
- Perform heavy data fetching
- Implement redirect logic with `redirect()` from `next/navigation`
- **Client Components** (browser):
- Begin files with `'use client';`
- Handle interactive UI with React hooks (`useState`, `useEffect`, React Query, wallet hooks)
- Access browser APIs (`localStorage`, `window`, `IntersectionObserver`)
- Support fast transitions with prefetched data
#### Data Fetching Patterns
- **Server Side**:
- Always call `getAuthToken()` to retrieve JWT from cookies
- Use `Authorization: Bearer` header – never embed tokens in URLs
- Return typed results (`Project[]`, `User[]`) – avoid `any`
- **Client Side**:
- Wrap calls in React Query (`@tanstack/react-query`)
- Use descriptive, stable `queryKeys` for cache hits
- Configure `staleTime`/`cacheTime` based on freshness (default ≥ 60s)
- Keep tokens secret via internal API routes or server actions
#### Analytics Event Guidelines
- **When to add**: Only create events that answer clear product/business questions
- **Check duplicates**: Review `src/@/analytics/report.ts` first
- **Naming**:
- Event name: human-readable `<subject> <verb>` (e.g. "contract deployed")
- Function: `report<Subject><Verb>` (PascalCase)
- **Template**:
```typescript
/**
* ### Why do we need to report this event?
* - Tracks number of contracts deployed
*
* ### Who is responsible for this event?
* @username
*/
export function reportContractDeployed(properties: {
address: string;
chainId: number;
}) {
posthog.capture("contract deployed", properties);
}
```
- **Client-side only**: Never import `posthog-js` in server components
- **Changes**: Inform **#eng-core-services** before renaming/removing events
### Extension Development
- Extensions follow modular pattern in `src/extensions/`
- Auto-generated contracts from ABI definitions
- Composable functions with TypeScript safety
- Support for read/write operations
### Wallet Architecture
- Unified `Wallet` and `Account` interfaces
- Support for in-app wallets (social/email login)
- Smart wallets with account abstraction
- EIP-1193, EIP-5792, EIP-7702 standard support
## Contribution Workflow
1. **Fork and Clone**: Create fork, clone, create feature branch
2. **Install**: `pnpm install` (use `--ignore-scripts` on Windows)
3. **Develop**: Use appropriate dev commands above
4. **Test**: Write unit tests, run linting, test on demo apps
5. **Changeset**: Run `pnpm changeset` for semantic versioning
6. **PR**: Submit pull request to main branch
### Release Testing
Comment `/release-pr` on PR to trigger dev release to npm for testing.
### Changeset Guidelines
Each change in `packages/*` should contain a changeset for the appropriate package with the appropriate version bump:
- **patch**: Changes that don't impact the public API
- **minor**: Any new/modified public API
- **major**: Breaking changes (surface prominently in PR descriptions)
### Documentation Standards
- For new UI components, add Storybook stories (`*.stories.tsx`) alongside the code
- Surface breaking changes prominently in PR descriptions
- Keep documentation focused on developer experience and practical usage
## Multi-Platform Support
The SDK supports:
- **Web**: React hooks and components
- **React Native**: Mobile-specific exports and components
- **Node.js**: Server-side functionality
- **Framework Adapters**: Wagmi, Ethers compatibility layers
Key files:
- `src/exports/react.native.ts` - React Native specific exports
- `packages/react-native-adapter/` - Mobile platform shims
- `packages/wagmi-adapter/` - Wagmi ecosystem integration
+142 -28
View File
@@ -15,37 +15,150 @@
<p align="center"><strong>All-in-one web3 SDK for Browser, Node and Mobile apps</strong></p>
## Features
## Core Package
- Support for React & React-Native
- First party support for [Embedded Wallets](https://portal.thirdweb.com/connect/embedded-wallet/overview) (social/email login)
- First party support for [Account Abstraction](https://portal.thirdweb.com/connect/account-abstraction/overview)
- Instant connection to any chain with RPC Edge integration
- Integrated IPFS upload/download
- UI Components for connection, transactions, nft rendering
- High level contract extensions for interacting with common standards
#### [`thirdweb`](./packages/thirdweb/README.md)
The main SDK package providing all-in-one web3 functionality for Browser, Node, and Mobile applications.
```bash
npm install thirdweb
```
**Features:**
- Type-safe contract and transaction APIs
- In-app wallets with social/email login
- Account abstraction (ERC4337/EIP7702) support
- 500+ external wallets supported
- Built in infra (RPC, bundler, paymaster, indexer)
- React hooks and UI components
- Automatic ABI resolution
- IPFS upload/download
- Cross-platform support (Web, React Native)
## Library Comparison
### Documentation
| | thirdweb | Wagmi + Viem | Ethers@6 |
| ----------------------------------------- | -------- | ------------------ | -------- |
| Type safe contract API | ✅ | ✅ | ✅ |
| Type safe wallet API | ✅ | ✅ | ✅ |
| EVM utils | ✅ | ✅ | ✅ |
| RPC for any EVM | ✅  | ⚠️ public RPC only | ❌ |
| Automatic ABI Resolution | ✅ | ❌ | ❌ |
| IPFS Upload/Download | ✅ | ❌ | ❌ |
| Embedded wallet (email/ social login) | ✅ | ⚠️ via 3rd party | ❌ |
| Account abstraction (ERC4337) support | ✅ | ⚠️ via 3rd party | ❌ |
| Web3 wallet connectors | ✅ | ✅ | ❌ |
| Local wallet creation | ✅ | ✅ | ✅ |
| Auth (SIWE) | ✅ | ✅ | ❌ |
| Extensions functions for common standards | ✅ | ✅ | ❌ |
| React Hooks | ✅ | ✅ | ❌ |
| React UI components | ✅ | ❌ | ❌ |
| React Native Hooks | ✅ | ✅ | ❌ |
| React Native UI Components | ✅ | ❌ | ❌ |
Visit the [developer portal](https://portal.thirdweb.com) for full documentation.
### 🚀 Quick Start
#### For React Applications
```bash
npm install thirdweb
```
```typescript
import { createThirdwebClient } from "thirdweb";
import { ConnectButton, useActiveAccount } from "thirdweb/react";
const client = createThirdwebClient({
clientId: "YOUR_CLIENT_ID",
});
function App() {
const account = useActiveAccount();
console.log("Connected as", account?.address);
return <ConnectButton client={client} />;
}
```
For React Native Applications, you'll also need to install the `@thirdweb-dev/react-native-adapter` package and import it at app startup for polyfills.
#### For Backend Applications
```bash
npm install thirdweb
```
```typescript
import { createThirdwebClient, Engine } from "thirdweb";
const client = createThirdwebClient({
secretKey: "YOUR_SECRET_KEY",
});
const wallet = Engine.serverWallet({
client,
address: "0x...",
});
const transaction = transfer({
contract: getContract({
client,
address: "0x...", // token contract
chain: defineChain(1),
}),
to: "0x...", // recipient
amount: "0.01", // amount in tokens
});
await wallet.enqueueTransaction({
transaction,
});
```
## Adapters
#### [`@thirdweb-dev/react-native-adapter`](./packages/react-native-adapter/README.md)
Required polyfills and configuration for running the thirdweb SDK in React Native applications.
```bash
npm install @thirdweb-dev/react-native-adapter
```
#### [`@thirdweb-dev/wagmi-adapter`](./packages/wagmi-adapter/README.md)
Integration layer for using thirdweb's in-app wallets with wagmi.
```bash
npm install @thirdweb-dev/wagmi-adapter
```
## Type safe API wrappers
#### [`@thirdweb-dev/api`](./packages/api/README.md)
TypeScript SDK for thirdweb's API, combining all of thirdweb products.
```bash
npm install @thirdweb-dev/api
```
#### [`@thirdweb-dev/engine`](./packages/engine/README.md)
TypeScript SDK for Engine, thirdweb's backend onchain executor service.
```bash
npm install @thirdweb-dev/engine
```
#### [`@thirdweb-dev/insight`](./packages/insight/README.md)
TypeScript SDK for Insight, thirdweb's multichain indexer service.
```bash
npm install @thirdweb-dev/insight
```
#### [`@thirdweb-dev/vault-sdk`](./packages/vault-sdk/README.md)
SDK for interacting with Vault, thirdweb's secure key management service.
```bash
npm install @thirdweb-dev/vault-sdk
```
#### [`@thirdweb-dev/nebula`](./packages/nebula/README.md)
TypeScript SDK for Nebula, thirdweb's AI agent service.
```bash
npm install @thirdweb-dev/nebula
```
## Contributing
@@ -55,7 +168,8 @@ See our [open source page](https://thirdweb.com/open-source) for more informatio
## Additional Resources
- [Documentation](https://portal.thirdweb.com/typescript/v5)
- [Dashboard](https://thirdweb.com/login)
- [Documentation](https://portal.thirdweb.com/)
- [Templates](https://thirdweb.com/templates)
- [YouTube](https://www.youtube.com/c/thirdweb)
+1 -1
View File
@@ -37,7 +37,7 @@ NEXT_PUBLIC_TYPESENSE_CONTRACT_API_KEY=
# posthog API key
# - not required for prod/staging
NEXT_PUBLIC_POSTHOG_API_KEY="ignored"
NEXT_PUBLIC_POSTHOG_KEY=""
# Stripe Customer portal
NEXT_PUBLIC_STRIPE_KEY=
-61
View File
@@ -10,13 +10,6 @@ module.exports = {
"plugin:storybook/recommended",
],
overrides: [
// disable restricted imports in chakra
{
files: "src/chakra/**/*",
rules: {
"no-restricted-imports": ["off"],
},
},
// allow direct PostHog imports inside analytics helpers
{
files: "src/@/analytics/**/*",
@@ -91,60 +84,6 @@ module.exports = {
"error",
{
paths: [
{
// these are provided by chakra folder, so we don't want to import them from chakra directly
importNames: [
"Card",
"Button",
"Checkbox",
"Badge",
"Drawer",
"Heading",
"Text",
"FormLabel",
"FormHelperText",
"FormErrorMessage",
"MenuGroup",
"VStack",
"HStack",
"AspectRatio",
"useToast",
"useClipboard",
"Badge",
"Stack",
// also the types
"ButtonProps",
"BadgeProps",
"DrawerProps",
"HeadingProps",
"TextProps",
"FormLabelProps",
"HelpTextProps",
"MenuGroupProps",
"MenuItemProps",
"AspectRatioProps",
"BadgeProps",
"StackProps",
],
message:
'import component from "chakra" folder instead if you have to use chakra component, But use shadcn component otherwise',
name: "@chakra-ui/react",
},
{
message:
"Import from `@chakra-ui/react` instead of `@chakra-ui/layout`.",
name: "@chakra-ui/layout",
},
{
message:
"Import from `@chakra-ui/react` instead of `@chakra-ui/button`.",
name: "@chakra-ui/button",
},
{
message:
"Import from `@chakra-ui/react` instead of `@chakra-ui/menu`.",
name: "@chakra-ui/menu",
},
{
importNames: ["useRouter"],
message:
-5
View File
@@ -20,11 +20,6 @@ const config: StorybookConfig = {
name: getAbsolutePath("@storybook/nextjs"),
options: {},
},
refs: {
"@chakra-ui/react": {
disable: true,
},
},
staticDirs: ["../public"],
features: {
experimentalRSC: true,
+1 -1
View File
@@ -1,4 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
"extends": "//"
}
+9 -4
View File
@@ -9,17 +9,20 @@ module.exports = [
// -- build category
"/wallets",
"/account-abstraction",
"/universal-bridge",
"/payments",
"/auth",
"/in-app-wallets",
"/transactions",
// -- end build category
// -- storage
// -- scale category
"/rpc",
"/insight",
"/storage",
// -- end scale category
// -- nebula
"/nebula",
// --insight
"/insight",
// -- contracts
"/contracts",
"/contracts/modular-contracts",
@@ -59,4 +62,6 @@ module.exports = [
// -- universal bridge landing pages --
"/universal-bridge-regions/:region_slug",
"/enterprise",
"/token",
"/vault",
];
+19 -28
View File
@@ -115,9 +115,6 @@ const SENTRY_OPTIONS: SentryBuildOptions = {
const FRAMER_ADDITIONAL_LANGUAGES = ["es"];
const baseNextConfig: NextConfig = {
compiler: {
emotion: true,
},
eslint: {
ignoreDuringBuilds: true,
},
@@ -208,35 +205,29 @@ function getConfig(): NextConfig {
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withPlausibleProxy } = require("next-plausible");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withSentryConfig } = require("@sentry/nextjs");
return withBundleAnalyzer(
withPlausibleProxy({
customDomain: "https://pl.thirdweb.com",
scriptName: "pl",
})(
withSentryConfig(
{
...baseNextConfig,
// @ts-expect-error - this is a valid option
webpack: (config) => {
if (config.cache) {
config.cache = Object.freeze({
type: "memory",
});
}
config.module = {
...config.module,
exprContextCritical: false,
};
// Important: return the modified config
return config;
},
withSentryConfig(
{
...baseNextConfig,
// @ts-expect-error - this is a valid option
webpack: (config) => {
if (config.cache) {
config.cache = Object.freeze({
type: "memory",
});
}
config.module = {
...config.module,
exprContextCritical: false,
};
// Important: return the modified config
return config;
},
SENTRY_OPTIONS,
),
},
SENTRY_OPTIONS,
),
);
}
+28 -39
View File
@@ -1,16 +1,12 @@
{
"dependencies": {
"@chakra-ui/react": "^2.8.2",
"@chakra-ui/styled-system": "^2.9.2",
"@chakra-ui/theme-tools": "^2.1.2",
"@emotion/react": "11.14.0",
"@emotion/styled": "11.14.0",
"@hookform/resolvers": "^3.9.1",
"@marsidev/react-turnstile": "^1.1.0",
"@radix-ui/react-accordion": "^1.2.11",
"@radix-ui/react-alert-dialog": "^1.1.14",
"@radix-ui/react-avatar": "^1.1.10",
"@radix-ui/react-checkbox": "^1.3.2",
"@radix-ui/react-collapsible": "^1.1.11",
"@radix-ui/react-dialog": "1.1.14",
"@radix-ui/react-dropdown-menu": "^2.1.15",
"@radix-ui/react-hover-card": "^1.1.14",
@@ -23,55 +19,52 @@
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-switch": "^1.2.5",
"@radix-ui/react-tooltip": "1.2.7",
"@scalar/api-reference-react": "^0.6.19",
"@sentry/nextjs": "9.29.0",
"@scalar/api-reference-react": "0.7.25",
"@sentry/nextjs": "9.34.0",
"@shazow/whatsabi": "0.22.2",
"@tanstack/react-query": "5.80.7",
"@tanstack/react-query": "5.81.5",
"@tanstack/react-table": "^8.21.3",
"@thirdweb-dev/service-utils": "workspace:*",
"@thirdweb-dev/vault-sdk": "workspace:*",
"@vercel/functions": "2.1.0",
"@vercel/functions": "2.2.2",
"@vercel/og": "^0.6.8",
"abitype": "1.0.8",
"chakra-react-select": "^4.7.6",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"color": "5.0.0",
"compare-versions": "^6.1.0",
"date-fns": "4.1.0",
"fast-xml-parser": "^5.2.5",
"framer-motion": "12.17.0",
"fuse.js": "7.1.0",
"input-otp": "^1.4.1",
"ioredis": "^5.6.1",
"ipaddr.js": "^2.2.0",
"lucide-react": "0.514.0",
"next": "15.3.3",
"next-plausible": "^3.12.4",
"lucide-react": "0.525.0",
"next": "15.3.5",
"next-themes": "^0.4.6",
"nextjs-toploader": "^1.6.12",
"nuqs": "^2.4.3",
"p-limit": "^6.2.0",
"papaparse": "^5.5.3",
"pluralize": "^8.0.0",
"posthog-js": "1.252.0",
"prettier": "3.5.3",
"qrcode": "^1.5.3",
"posthog-js": "1.256.1",
"posthog-node": "^5.4.0",
"prettier": "3.6.2",
"react": "19.1.0",
"react-children-utilities": "^2.10.0",
"react-day-picker": "^8.10.1",
"react-dom": "19.1.0",
"react-dropzone": "^14.3.8",
"react-error-boundary": "^5.0.0",
"react-error-boundary": "6.0.0",
"react-hook-form": "7.55.0",
"react-markdown": "10.1.0",
"react-qrcode-logo": "^3.0.0",
"react-table": "^7.8.0",
"recharts": "2.15.3",
"remark-gfm": "4.0.1",
"responsive-rsc": "0.0.7",
"server-only": "^0.0.1",
"shiki": "1.27.0",
"sonner": "2.0.5",
"sonner": "2.0.6",
"spdx-correct": "^3.2.0",
"stripe": "17.7.0",
"swagger-ui-react": "^5.24.1",
@@ -81,24 +74,22 @@
"tiny-invariant": "^1.3.3",
"use-debounce": "^10.0.5",
"vaul": "^1.1.2",
"zod": "3.25.62"
"zod": "3.25.75"
},
"devDependencies": {
"@biomejs/biome": "2.0.4",
"@chakra-ui/cli": "^2.4.1",
"@chromatic-com/storybook": "4.0.0",
"@next/bundle-analyzer": "15.3.3",
"@next/eslint-plugin-next": "15.3.3",
"@playwright/test": "1.53.0",
"@storybook/addon-docs": "9.0.8",
"@storybook/addon-links": "9.0.8",
"@storybook/addon-onboarding": "9.0.8",
"@storybook/nextjs": "9.0.8",
"@biomejs/biome": "2.0.6",
"@chromatic-com/storybook": "4.0.1",
"@next/bundle-analyzer": "15.3.5",
"@next/eslint-plugin-next": "15.3.5",
"@playwright/test": "1.53.2",
"@storybook/addon-docs": "9.0.15",
"@storybook/addon-links": "9.0.15",
"@storybook/addon-onboarding": "9.0.15",
"@storybook/nextjs": "9.0.15",
"@types/color": "4.2.0",
"@types/node": "22.14.1",
"@types/papaparse": "^5.3.16",
"@types/pluralize": "^0.0.33",
"@types/qrcode": "^1.5.5",
"@types/react": "19.1.8",
"@types/react-dom": "19.1.6",
"@types/react-table": "^7.7.20",
@@ -107,15 +98,15 @@
"@typescript-eslint/eslint-plugin": "7.14.1",
"@typescript-eslint/parser": "7.14.1",
"autoprefixer": "^10.4.21",
"checkly": "5.6.0",
"checkly": "6.0.1",
"eslint": "8.57.0",
"eslint-config-biome": "1.9.4",
"eslint-plugin-react-compiler": "19.1.0-rc.2",
"eslint-plugin-storybook": "9.0.8",
"eslint-plugin-storybook": "9.0.15",
"knip": "5.60.2",
"next-sitemap": "^4.2.3",
"postcss": "8.5.5",
"storybook": "9.0.8",
"postcss": "8.5.6",
"storybook": "9.0.15",
"tailwindcss": "3.4.17",
"typescript": "5.8.3"
},
@@ -128,12 +119,10 @@
"dev": "next dev --turbopack",
"fix": "biome check ./src --fix && eslint ./src --fix",
"format": "biome format ./src --write",
"gen:theme-typings": "chakra-cli tokens src/chakra/theme/index.ts",
"knip": "knip",
"lint": "biome check ./src && knip && eslint ./src",
"playwright": "playwright test",
"postbuild": "next-sitemap",
"postinstall": "pnpm run gen:theme-typings",
"preinstall": "npx only-allow pnpm",
"start": "next start",
"storybook": "storybook dev -p 6006",
@@ -141,4 +130,4 @@
"update-checkly": "npx checkly deploy"
},
"version": "3.0.0"
}
}
@@ -1,2 +0,0 @@
name,description,image,animation_url,external_url,background_color,youtube_url,additional,properties,can be,added
Token 0 Name,Token 0 Description,ipfs://ipfsHash/0,ipfs://ipfsHash/0,https://thirdweb.com,#0098EE,,every,row,is a ,property
1 name description image animation_url external_url background_color youtube_url additional properties can be added
2 Token 0 Name Token 0 Description ipfs://ipfsHash/0 ipfs://ipfsHash/0 https://thirdweb.com #0098EE every row is a property
@@ -1,4 +0,0 @@
name,description,image,animation_url,external_url,background_color,youtube_url,additional,properties,can be,added
Token 0 Name,Token 0 Description,0.png,0.mp4,https://thirdweb.com,#0098EE,,every,row,is a ,property
Token 1 Name,Token 1 Description,0.png,0.mp4,https://thirdweb.com,#0098EE,,every,row,is a ,property
Token 2 Name,Token 2 Description,0.png,0.mp4,https://thirdweb.com,#0098EE,,every,row,is a ,property
1 name description image animation_url external_url background_color youtube_url additional properties can be added
2 Token 0 Name Token 0 Description 0.png 0.mp4 https://thirdweb.com #0098EE every row is a property
3 Token 1 Name Token 1 Description 0.png 0.mp4 https://thirdweb.com #0098EE every row is a property
4 Token 2 Name Token 2 Description 0.png 0.mp4 https://thirdweb.com #0098EE every row is a property
@@ -1,2 +0,0 @@
name,description,external_url,background_color,youtube_url,additional,properties,can be,added
Token 0 Name,Token 0 Description,https://thirdweb.com,#0098EE,,every,row,is a ,property
1 name description external_url background_color youtube_url additional properties can be added
2 Token 0 Name Token 0 Description https://thirdweb.com #0098EE every row is a property
@@ -1,3 +0,0 @@
address,maxClaimable
0x0000000000000000000000000000000000000000,2
0x000000000000000000000000000000000000dEaD,5
1 address maxClaimable
2 0x0000000000000000000000000000000000000000 2
3 0x000000000000000000000000000000000000dEaD 5
@@ -1,3 +0,0 @@
address,maxClaimable,price,currencyAddress
0x0000000000000000000000000000000000000000,2,0.1,0x0000000000000000000000000000000000000000
0x000000000000000000000000000000000000dEaD,5,2.5,0x0000000000000000000000000000000000000000
1 address maxClaimable price currencyAddress
2 0x0000000000000000000000000000000000000000 2 0.1 0x0000000000000000000000000000000000000000
3 0x000000000000000000000000000000000000dEaD 5 2.5 0x0000000000000000000000000000000000000000
@@ -1,3 +0,0 @@
address
0x0000000000000000000000000000000000000000
0x000000000000000000000000000000000000dEaD
1 address
2 0x0000000000000000000000000000000000000000
3 0x000000000000000000000000000000000000dEaD
+56 -14
View File
@@ -66,15 +66,20 @@ const projectRoute = "/team/:team_slug/:project_slug";
const projectPageRedirects = [
{
destination: `${projectRoute}/universal-bridge/:path*`,
destination: `${projectRoute}/payments/:path*`,
permanent: false,
source: `${projectRoute}/connect/pay/:path*`,
},
{
destination: `${projectRoute}/universal-bridge/:path*`,
destination: `${projectRoute}/payments/:path*`,
permanent: false,
source: `${projectRoute}/connect/universal-bridge/:path*`,
},
{
destination: `${projectRoute}/payments/:path*`,
permanent: false,
source: `${projectRoute}/universal-bridge/:path*`,
},
{
destination: `${projectRoute}/account-abstraction/:path*`,
permanent: false,
@@ -106,9 +111,27 @@ const projectPageRedirects = [
source: `${projectRoute}/nebula/:path*`,
},
{
source: `${projectRoute}/connect/analytics`,
destination: `${projectRoute}`,
permanent: false,
source: `${projectRoute}/connect/analytics`,
},
];
const teamPageRedirects = [
{
destination: "/team/:team_slug/~/billing/:path*",
permanent: false,
source: "/team/:team_slug/~/settings/billing/:path*",
},
{
destination: "/team/:team_slug/~/billing/invoices/:path*",
permanent: false,
source: "/team/:team_slug/~/settings/invoices/:path*",
},
{
destination: "/team/:team_slug/~/billing",
permanent: false,
source: "/team/:team_slug/~/settings/credits",
},
];
@@ -309,13 +332,6 @@ async function redirects() {
permanent: false,
source: "/solutions/chains",
},
// redirect /rpc to portal
{
destination:
"https://portal.thirdweb.com/infrastructure/rpc-edge/overview",
permanent: false,
source: "/rpc-edge",
},
// redirect /sdk to portal
{
destination: "https://portal.thirdweb.com/connect/blockchain-api",
@@ -364,12 +380,22 @@ async function redirects() {
permanent: false,
source: "/template/:slug",
},
// redirect /connect/pay to /universal-bridge
// redirect /connect/pay to /payments
{
destination: "/universal-bridge",
permanent: false,
destination: "/payments",
permanent: true,
source: "/connect/pay",
},
{
destination: "/payments",
permanent: true,
source: "/universal-bridge",
},
{
destination: "/payments/:slug",
permanent: true,
source: "/universal-bridge/:slug",
},
// PREVIOUS CAMPAIGNS
{
destination: "/",
@@ -405,7 +431,7 @@ async function redirects() {
source: "/connect/account-abstraction",
},
{
destination: "/universal-bridge",
destination: "/payments",
permanent: false,
source: "/connect/universal-bridge",
},
@@ -424,8 +450,24 @@ async function redirects() {
permanent: false,
source: "/engine",
},
{
destination: "/rpc",
permanent: false,
source: "/rpc-edge",
},
{
destination: "/payments",
permanent: false,
source: "/universal-bridge",
},
...legacyDashboardToTeamRedirects,
...projectPageRedirects,
...teamPageRedirects,
{
source: "/support/:path*",
destination: "/team/~/~/support",
permanent: false,
},
];
}
@@ -12,7 +12,7 @@ import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { API_SERVER_SECRET } from "@/constants/server-envs";
import { isVercel } from "@/utils/vercel";
import { verifyTurnstileToken } from "./verifyTurnstileToken";
import { verifyTurnstileToken } from "../../app/login/verifyTurnstileToken";
export async function getLoginPayload(
params: GenerateLoginPayloadParams,
+87 -1
View File
@@ -1,7 +1,10 @@
"use server";
import "server-only";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import type { ChainInfraSKU } from "@/types/billing";
import { getAbsoluteUrl } from "@/utils/vercel";
export async function reSubscribePlan(options: {
teamId: string;
@@ -14,7 +17,10 @@ export async function reSubscribePlan(options: {
}
const res = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${options.teamId}/checkout/resubscribe-plan`,
new URL(
`/v1/teams/${options.teamId}/checkout/resubscribe-plan`,
NEXT_PUBLIC_THIRDWEB_API_HOST,
),
{
body: JSON.stringify({}),
headers: {
@@ -35,3 +41,83 @@ export async function reSubscribePlan(options: {
status: 200,
};
}
export async function getChainInfraCheckoutURL(options: {
teamSlug: string;
skus: ChainInfraSKU[];
chainId: number;
annual: boolean;
}) {
const token = await getAuthToken();
if (!token) {
return {
error: "You are not logged in",
status: "error",
} as const;
}
const res = await fetch(
new URL(
`/v1/teams/${options.teamSlug}/checkout/create-link`,
NEXT_PUBLIC_THIRDWEB_API_HOST,
),
{
body: JSON.stringify({
annual: options.annual,
baseUrl: getAbsoluteUrl(),
chainId: options.chainId,
skus: options.skus,
}),
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
method: "POST",
},
);
if (!res.ok) {
const text = await res.text();
console.error("Failed to create checkout link", text, res.status);
switch (res.status) {
case 402: {
return {
error:
"You have outstanding invoices, please pay these first before re-subscribing.",
status: "error",
} as const;
}
case 429: {
return {
error: "Too many requests, please try again later.",
status: "error",
} as const;
}
case 403: {
return {
error: "You are not authorized to deploy infrastructure.",
status: "error",
} as const;
}
default: {
return {
error: "An unknown error occurred, please try again later.",
status: "error",
} as const;
}
}
}
const json = await res.json();
if (!json.result) {
return {
error: "An unknown error occurred, please try again later.",
status: "error",
} as const;
}
return {
data: json.result as string,
status: "success",
} as const;
}
@@ -98,7 +98,7 @@ export async function getWalletNFTs(params: {
type OwnedNFTInsightResponse = {
name: string;
description: string;
image_url: string;
image_url?: string;
background_color: string;
external_url: string;
metadata_url: string;
@@ -186,7 +186,7 @@ async function getWalletNFTsFromInsight(params: {
description: nft.description,
external_url: nft.external_url,
image: isDev
? nft.image_url.replace("ipfscdn.io/", "thirdwebstorage-dev.com/")
? nft.image_url?.replace("ipfscdn.io/", "thirdwebstorage-dev.com/")
: nft.image_url,
name: nft.name,
uri: isDev
@@ -0,0 +1,57 @@
import "server-only";
import { unstable_cache } from "next/cache";
import { PostHog } from "posthog-node";
let _posthogClient: PostHog | null = null;
function getPostHogServer(): PostHog | null {
if (!_posthogClient && process.env.NEXT_PUBLIC_POSTHOG_KEY) {
_posthogClient = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
host: "https://us.i.posthog.com",
});
}
return _posthogClient;
}
/**
* Check if a feature flag is enabled for a specific user
* @param flagKey - The feature flag key
* @param userEmail - The user's email address for filtering
*/
export const isFeatureFlagEnabled = unstable_cache(
async (params: {
flagKey: string;
accountId: string;
email: string | undefined;
}): Promise<boolean> => {
const posthogClient = getPostHogServer();
if (!posthogClient) {
console.warn("Posthog client not set");
return true;
}
const { flagKey, accountId, email } = params;
try {
if (posthogClient && accountId) {
const isEnabled = await posthogClient.isFeatureEnabled(
flagKey,
accountId,
{
personProperties: email ? { email } : undefined,
},
);
if (isEnabled !== undefined) {
return isEnabled;
}
}
} catch (error) {
console.error(`Error checking feature flag ${flagKey}:`, error);
}
return false;
},
["is-feature-flag-enabled"],
{
revalidate: 3600, // 1 hour
},
);
+49 -1
View File
@@ -1,6 +1,7 @@
import posthog from "posthog-js";
import type { Team } from "@/api/team";
import type { ProductSKU } from "../types/billing";
// ----------------------------
// CONTRACTS
@@ -361,7 +362,11 @@ export function reportAssetCreationFailed(
properties: { contractType: AssetContractType; error: string } & (
| {
assetType: "nft";
step: "deploy-contract" | "mint-nfts" | "set-claim-conditions";
step:
| "deploy-contract"
| "mint-nfts"
| "set-claim-conditions"
| "set-admins";
}
| {
assetType: "coin";
@@ -380,3 +385,46 @@ export function reportAssetCreationFailed(
step: properties.step,
});
}
type UpsellParams = {
content: "storage-limit";
campaign: "create-coin" | "create-nft";
sku: Exclude<ProductSKU, null>;
};
/**
* ### Why do we need to report this event?
* - To track how effective the upsells are in driving users to upgrade
*
* ### Who is responsible for this event?
* @MananTank
*/
export function reportUpsellShown(properties: UpsellParams) {
posthog.capture("upsell shown", properties);
}
/**
* ### Why do we need to report this event?
* - To track how effective the upsells are in driving users to upgrade
*
* ### Who is responsible for this event?
* @MananTank
*/
export function reportUpsellClicked(properties: UpsellParams) {
posthog.capture("upsell clicked", properties);
}
// ----------------------------
// PAYMENTS
// ----------------------------
/**
* ### Why do we need to report this event?
* - To track conversions on payment overview page
*
* ### Who is responsible for this event?
* @samina
*/
export function reportPaymentCardClick(properties: { id: string }) {
posthog.capture("payment card clicked", properties);
}
+203 -1
View File
@@ -6,17 +6,54 @@ import type {
EcosystemWalletStats,
EngineCloudStats,
InAppWalletStats,
RpcMethodStats,
TransactionStats,
UniversalBridgeStats,
UniversalBridgeWalletStats,
UserOpStats,
WalletStats,
WalletUserStats,
WebhookLatencyStats,
WebhookRequestStats,
WebhookSummaryStats,
} from "@/types/analytics";
import { getAuthToken } from "./auth-token";
import { getChains } from "./chain";
export interface InsightChainStats {
date: string;
chainId: string;
totalRequests: number;
}
export interface InsightStatusCodeStats {
date: string;
httpStatusCode: number;
totalRequests: number;
}
export interface InsightEndpointStats {
date: string;
endpoint: string;
totalRequests: number;
}
interface InsightUsageStats {
date: string;
totalRequests: number;
}
export interface RpcMethodStats {
date: string;
evmMethod: string;
count: number;
}
export interface RpcUsageTypeStats {
date: string;
usageType: string;
count: number;
}
async function fetchAnalytics(
input: string | URL,
init?: RequestInit,
@@ -76,6 +113,9 @@ function buildSearchParams(params: AnalyticsQueryParams): URLSearchParams {
if (params.period) {
searchParams.append("period", params.period);
}
if (params.limit) {
searchParams.append("limit", params.limit.toString());
}
return searchParams;
}
@@ -225,6 +265,26 @@ export async function getRpcMethodUsage(
return json.data as RpcMethodStats[];
}
export async function getRpcUsageByType(
params: AnalyticsQueryParams,
): Promise<RpcUsageTypeStats[]> {
const searchParams = buildSearchParams(params);
const res = await fetchAnalytics(
`v2/rpc/usage-types?${searchParams.toString()}`,
{
method: "GET",
},
);
if (res?.status !== 200) {
console.error("Failed to fetch RPC usage");
return [];
}
const json = await res.json();
return json.data as RpcUsageTypeStats[];
}
export async function getWalletUsers(
params: AnalyticsQueryParams,
): Promise<WalletUserStats[]> {
@@ -424,3 +484,145 @@ export async function getEngineCloudMethodUsage(
const json = await res.json();
return json.data as EngineCloudStats[];
}
export async function getWebhookSummary(
params: AnalyticsQueryParams & { webhookId: string },
): Promise<{ data: WebhookSummaryStats[] } | { error: string }> {
const searchParams = buildSearchParams(params);
searchParams.append("webhookId", params.webhookId);
const res = await fetchAnalytics(
`v2/webhook/summary?${searchParams.toString()}`,
);
if (!res.ok) {
const reason = await res.text();
return { error: reason };
}
return (await res.json()) as { data: WebhookSummaryStats[] };
}
export async function getWebhookRequests(
params: AnalyticsQueryParams & { webhookId?: string },
): Promise<{ data: WebhookRequestStats[] } | { error: string }> {
const searchParams = buildSearchParams(params);
if (params.webhookId) {
searchParams.append("webhookId", params.webhookId);
}
const res = await fetchAnalytics(
`v2/webhook/requests?${searchParams.toString()}`,
);
if (!res.ok) {
const reason = await res.text();
return { error: reason };
}
return (await res.json()) as { data: WebhookRequestStats[] };
}
export async function getWebhookLatency(
params: AnalyticsQueryParams & { webhookId?: string },
): Promise<{ data: WebhookLatencyStats[] } | { error: string }> {
const searchParams = buildSearchParams(params);
if (params.webhookId) {
searchParams.append("webhookId", params.webhookId);
}
const res = await fetchAnalytics(
`v2/webhook/latency?${searchParams.toString()}`,
);
if (!res.ok) {
const reason = await res.text();
return { error: reason };
}
return (await res.json()) as { data: WebhookLatencyStats[] };
}
export async function getInsightChainUsage(
params: AnalyticsQueryParams,
): Promise<{ data: InsightChainStats[] } | { errorMessage: string }> {
const searchParams = buildSearchParams(params);
const res = await fetchAnalytics(
`v2/insight/usage/by-chain?${searchParams.toString()}`,
{
method: "GET",
},
);
if (res?.status !== 200) {
const reason = await res?.text();
const errMsg = `Failed to fetch Insight chain usage: ${res?.status} - ${res.statusText} - ${reason}`;
console.error(errMsg);
return { errorMessage: errMsg };
}
const json = await res.json();
return { data: json.data as InsightChainStats[] };
}
export async function getInsightStatusCodeUsage(
params: AnalyticsQueryParams,
): Promise<{ data: InsightStatusCodeStats[] } | { errorMessage: string }> {
const searchParams = buildSearchParams(params);
const res = await fetchAnalytics(
`v2/insight/usage/by-status-code?${searchParams.toString()}`,
{
method: "GET",
},
);
if (res?.status !== 200) {
const reason = await res?.text();
const errMsg = `Failed to fetch Insight status code usage: ${res?.status} - ${res.statusText} - ${reason}`;
console.error(errMsg);
return { errorMessage: errMsg };
}
const json = await res.json();
return { data: json.data as InsightStatusCodeStats[] };
}
export async function getInsightEndpointUsage(
params: AnalyticsQueryParams,
): Promise<{ data: InsightEndpointStats[] } | { errorMessage: string }> {
const searchParams = buildSearchParams(params);
const res = await fetchAnalytics(
`v2/insight/usage/by-endpoint?${searchParams.toString()}`,
{
method: "GET",
},
);
if (res?.status !== 200) {
const reason = await res?.text();
const errMsg = `Failed to fetch Insight endpoint usage: ${res?.status} - ${res.statusText} - ${reason}`;
console.error(errMsg);
return { errorMessage: errMsg };
}
const json = await res.json();
return { data: json.data as InsightEndpointStats[] };
}
export async function getInsightUsage(
params: AnalyticsQueryParams,
): Promise<{ data: InsightUsageStats[] } | { errorMessage: string }> {
const searchParams = buildSearchParams(params);
const res = await fetchAnalytics(
`v2/insight/usage?${searchParams.toString()}`,
{
method: "GET",
},
);
if (res?.status !== 200) {
const reason = await res?.text();
const errMsg = `Failed to fetch Insight usage: ${res?.status} - ${res.statusText} - ${reason}`;
console.error(errMsg);
return { errorMessage: errMsg };
}
const json = await res.json();
return { data: json.data as InsightUsageStats[] };
}
-36
View File
@@ -1,44 +1,8 @@
import "server-only";
import type { ChainMetadata } from "thirdweb/chains";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { API_SERVER_SECRET } from "@/constants/server-envs";
import type { ChainService } from "@/types/chain";
export async function getGasSponsoredChains() {
if (!API_SERVER_SECRET) {
throw new Error("API_SERVER_SECRET is not set");
}
const res = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/chains/gas-sponsored`,
{
headers: {
"Content-Type": "application/json",
"x-service-api-key": API_SERVER_SECRET,
},
next: {
revalidate: 15 * 60, //15 minutes
},
},
);
if (!res.ok) {
console.error(
"Failed to fetch gas sponsored chains",
res.status,
res.statusText,
);
res.body?.cancel();
return [];
}
try {
return (await res.json()).data as number[];
} catch (e) {
console.error("Failed to parse gas sponsored chains", e);
return [];
}
}
export function getChains() {
return fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/chains`,
@@ -1,22 +1,26 @@
export const authOptions = [
"email",
"phone",
"passkey",
"siwe",
"guest",
"google",
"facebook",
"x",
"discord",
"farcaster",
"telegram",
"github",
"twitch",
"steam",
"apple",
"coinbase",
"line",
] as const;
import "server-only";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import { getAuthToken } from "./auth-token";
export type AuthOption =
| "email"
| "phone"
| "passkey"
| "siwe"
| "guest"
| "google"
| "facebook"
| "x"
| "discord"
| "farcaster"
| "telegram"
| "github"
| "twitch"
| "steam"
| "apple"
| "coinbase"
| "line";
export type Ecosystem = {
name: string;
@@ -24,7 +28,7 @@ export type Ecosystem = {
id: string;
slug: string;
permission: "PARTNER_WHITELIST" | "ANYONE";
authOptions: (typeof authOptions)[number][];
authOptions: AuthOption[];
customAuthOptions?: {
authEndpoint?: {
url: string;
@@ -47,6 +51,54 @@ export type Ecosystem = {
updatedAt: string;
};
export async function fetchEcosystemList(teamIdOrSlug: string) {
const token = await getAuthToken();
if (!token) {
return [];
}
const res = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${teamIdOrSlug}/ecosystem-wallet`,
{
headers: {
Authorization: `Bearer ${token}`,
},
},
);
if (!res.ok) {
return [];
}
return (await res.json()).result as Ecosystem[];
}
export async function fetchEcosystem(slug: string, teamIdOrSlug: string) {
const token = await getAuthToken();
if (!token) {
return null;
}
const res = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${teamIdOrSlug}/ecosystem-wallet/${slug}`,
{
headers: {
Authorization: `Bearer ${token}`,
},
},
);
if (!res.ok) {
const data = await res.json();
console.error(data);
return null;
}
const data = (await res.json()) as { result: Ecosystem };
return data.result;
}
type PartnerPermission = "PROMPT_USER_V1" | "FULL_CONTROL_V1";
export type Partner = {
id: string;
@@ -1,4 +1,5 @@
import "server-only";
import { getAddress } from "thirdweb";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
export type ProjectContract = {
@@ -43,3 +44,43 @@ export async function getProjectContracts(options: {
return data.result;
}
export type PartialProject = {
id: string;
name: string;
slug: string;
image: string | null;
};
/**
* get a list of projects within a team that have a given contract imported
*/
export async function getContractImportedProjects(options: {
teamId: string;
authToken: string;
chainId: number;
contractAddress: string;
}) {
const url = new URL(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${options.teamId}/projects/contracts/lookup?chainId=${options.chainId}&contractAddress=${getAddress(options.contractAddress)}`,
);
const res = await fetch(url, {
headers: {
Authorization: `Bearer ${options.authToken}`,
},
});
if (!res.ok) {
const errorMessage = await res.text();
console.error("Error fetching: /projects/contracts/lookup");
console.error(errorMessage);
return [];
}
const data = (await res.json()) as {
result: PartialProject[];
};
return data.result;
}
+149
View File
@@ -0,0 +1,149 @@
"use server";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import type { SupportTicket } from "../../app/(app)/team/[team_slug]/(team)/~/support/types/tickets";
import { getAuthToken, getAuthTokenWalletAddress } from "./auth-token";
const ESCALATION_FEEDBACK_RATING = 9999;
export async function createSupportTicket(params: {
message: string;
teamSlug: string;
teamId: string;
title: string;
conversationId?: string;
}): Promise<{ data: SupportTicket } | { error: string }> {
const token = await getAuthToken();
if (!token) {
return { error: "No auth token available" };
}
try {
const walletAddress = await getAuthTokenWalletAddress();
const encodedTeamSlug = encodeURIComponent(params.teamSlug);
const apiUrl = `${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${encodedTeamSlug}/support-conversations`;
// Build the payload for creating a conversation
// If the message does not already include wallet address, prepend it
let message = params.message;
if (!message.includes("Wallet address:")) {
message = `Wallet address: ${String(walletAddress || "-")}\n${message}`;
}
const payload = {
markdown: message.trim(),
title: params.title,
};
const body = JSON.stringify(payload);
const headers: Record<string, string> = {
Accept: "application/json",
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"Accept-Encoding": "identity",
};
const response = await fetch(apiUrl, {
body,
headers,
method: "POST",
});
if (!response.ok) {
const errorText = await response.text();
return { error: `API Server error: ${response.status} - ${errorText}` };
}
const createdConversation: SupportTicket = await response.json();
// Escalate to SIWA feedback endpoint if conversationId is provided
if (params.conversationId) {
try {
const siwaUrl = process.env.NEXT_PUBLIC_SIWA_URL;
if (siwaUrl) {
const res = await fetch(`${siwaUrl}/v1/chat/feedback`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
...(params.teamId ? { "x-team-id": params.teamId } : {}),
},
body: JSON.stringify({
conversationId: params.conversationId,
feedbackRating: ESCALATION_FEEDBACK_RATING,
}),
});
if (!res.ok) {
// Log error but don't fail the ticket creation
const errorMessage = await res.text();
console.error("Failed to escalate to SIWA feedback:", errorMessage);
}
}
} catch (error) {
// Log error but don't fail the ticket creation
console.error("Failed to escalate to SIWA feedback:", error);
}
}
return { data: createdConversation };
} catch (error) {
return {
error: `Failed to create support ticket: ${error instanceof Error ? error.message : "Unknown error"}`,
};
}
}
export async function sendMessageToTicket(request: {
ticketId: string;
teamSlug: string;
teamId: string;
message: string;
}): Promise<{ success: true } | { error: string }> {
if (!request.ticketId || !request.teamSlug) {
return { error: "Ticket ID and team slug are required" };
}
const token = await getAuthToken();
if (!token) {
return { error: "No auth token available" };
}
try {
const encodedTeamSlug = encodeURIComponent(request.teamSlug);
const encodedTicketId = encodeURIComponent(request.ticketId);
const apiUrl = `${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${encodedTeamSlug}/support-conversations/${encodedTicketId}/messages`;
// Append /unthread send for customer messages to ensure proper routing
const messageWithUnthread = `${request.message.trim()}\n/unthread send`;
const payload = {
markdown: messageWithUnthread,
};
const body = JSON.stringify(payload);
const headers: Record<string, string> = {
Accept: "application/json",
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
"Accept-Encoding": "identity",
...(request.teamId ? { "x-team-id": request.teamId } : {}),
};
const response = await fetch(apiUrl, {
body,
headers,
method: "POST",
});
if (!response.ok) {
const errorText = await response.text();
return { error: `API Server error: ${response.status} - ${errorText}` };
}
return { success: true };
} catch (error) {
return {
error: `Failed to send message: ${error instanceof Error ? error.message : "Unknown error"}`,
};
}
}
+67 -2
View File
@@ -1,6 +1,6 @@
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
import type { ProductSKU } from "@/types/billing";
import type { ChainInfraSKU, ProductSKU } from "@/types/billing";
type InvoiceLine = {
// amount for this line item
@@ -22,7 +22,7 @@ type Invoice = {
export type TeamSubscription = {
id: string;
type: "PLAN" | "USAGE" | "PLAN_ADD_ON" | "PRODUCT";
type: "PLAN" | "USAGE" | "PLAN_ADD_ON" | "PRODUCT" | "CHAIN";
status:
| "incomplete"
| "incomplete_expired"
@@ -37,6 +37,13 @@ export type TeamSubscription = {
trialStart: string | null;
trialEnd: string | null;
upcomingInvoice: Invoice;
skus: (ProductSKU | ChainInfraSKU)[];
};
type ChainTeamSubscription = Omit<TeamSubscription, "skus"> & {
chainId: string;
skus: ChainInfraSKU[];
isLegacy: boolean;
};
export async function getTeamSubscriptions(slug: string) {
@@ -60,3 +67,61 @@ export async function getTeamSubscriptions(slug: string) {
}
return null;
}
const CHAIN_PLAN_TO_INFRA = {
"chain:plan:gold": ["chain:infra:rpc", "chain:infra:account_abstraction"],
"chain:plan:platinum": [
"chain:infra:rpc",
"chain:infra:insight",
"chain:infra:account_abstraction",
],
"chain:plan:ultimate": [
"chain:infra:rpc",
"chain:infra:insight",
"chain:infra:account_abstraction",
],
};
export async function getChainSubscriptions(slug: string) {
const allSubscriptions = await getTeamSubscriptions(slug);
if (!allSubscriptions) {
return null;
}
// first replace any sku that MIGHT match a chain plan
const updatedSubscriptions = allSubscriptions
.filter((s) => s.type === "CHAIN")
.map((s) => {
const skus = s.skus;
const updatedSkus = skus.flatMap((sku) => {
const plan =
CHAIN_PLAN_TO_INFRA[sku as keyof typeof CHAIN_PLAN_TO_INFRA];
return plan ? plan : sku;
});
return {
...s,
isLegacy: updatedSkus.length !== skus.length,
skus: updatedSkus,
};
});
return updatedSubscriptions.filter(
(s): s is ChainTeamSubscription =>
"chainId" in s && typeof s.chainId === "string",
);
}
export async function getChainSubscriptionForChain(
slug: string,
chainId: number,
) {
const chainSubscriptions = await getChainSubscriptions(slug);
if (!chainSubscriptions) {
return null;
}
return (
chainSubscriptions.find((s) => s.chainId === chainId.toString()) ?? null
);
}
+1 -1
View File
@@ -48,7 +48,7 @@ export async function service_getTeamBySlug(slug: string) {
return null;
}
export function getTeamById(id: string) {
function getTeamById(id: string) {
return getTeamBySlug(id);
}
@@ -1,4 +1,5 @@
"use server";
import type { Address } from "thirdweb";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_BRIDGE_HOST } from "@/constants/public-envs";
@@ -96,6 +97,139 @@ export async function deleteWebhook(props: {
return;
}
type PaymentLink = {
id: string;
link: string;
title: string;
imageUrl: string;
createdAt: string;
updatedAt: string;
destinationToken: {
chainId: number;
address: Address;
symbol: string;
name: string;
decimals: number;
iconUri: string;
};
receiver: Address;
amount: bigint;
};
export async function getPaymentLinks(props: {
clientId: string;
teamId: string;
}): Promise<Array<PaymentLink>> {
const authToken = await getAuthToken();
const res = await fetch(`${UB_BASE_URL}/v1/developer/links`, {
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
"x-client-id": props.clientId,
"x-team-id": props.teamId,
},
method: "GET",
});
if (!res.ok) {
const text = await res.text();
throw new Error(text);
}
const json = (await res.json()) as {
data: Array<PaymentLink & { amount: string }>;
};
return json.data.map((link) => ({
id: link.id,
link: link.link,
title: link.title,
imageUrl: link.imageUrl,
createdAt: link.createdAt,
updatedAt: link.updatedAt,
destinationToken: {
chainId: link.destinationToken.chainId,
address: link.destinationToken.address,
symbol: link.destinationToken.symbol,
name: link.destinationToken.name,
decimals: link.destinationToken.decimals,
iconUri: link.destinationToken.iconUri,
},
receiver: link.receiver,
amount: BigInt(link.amount),
}));
}
export async function createPaymentLink(props: {
clientId: string;
teamId: string;
title: string;
imageUrl?: string;
intent: {
destinationChainId: number;
destinationTokenAddress: Address;
receiver: Address;
amount: bigint;
purchaseData?: unknown;
};
}) {
const authToken = await getAuthToken();
const res = await fetch(`${UB_BASE_URL}/v1/developer/links`, {
body: JSON.stringify({
title: props.title,
imageUrl: props.imageUrl,
intent: {
destinationChainId: props.intent.destinationChainId,
destinationTokenAddress: props.intent.destinationTokenAddress,
receiver: props.intent.receiver,
amount: props.intent.amount.toString(),
purchaseData: props.intent.purchaseData,
},
}),
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
"x-client-id": props.clientId,
"x-team-id": props.teamId,
},
method: "POST",
});
if (!res.ok) {
const text = await res.text();
throw new Error(text);
}
return;
}
export async function deletePaymentLink(props: {
clientId: string;
teamId: string;
paymentLinkId: string;
}) {
const authToken = await getAuthToken();
const res = await fetch(
`${UB_BASE_URL}/v1/developer/links/${props.paymentLinkId}`,
{
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
"x-client-id": props.clientId,
"x-team-id": props.teamId,
},
method: "DELETE",
},
);
if (!res.ok) {
const text = await res.text();
throw new Error(text);
}
return;
}
export type Fee = {
feeRecipient: string;
feeBps: number;
@@ -195,30 +329,28 @@ export type Payment = {
export async function getPayments(props: {
clientId: string;
teamId: string;
paymentLinkId?: string;
limit?: number;
offset?: number;
}) {
const authToken = await getAuthToken();
// Build URL with query parameters if provided
let url = `${UB_BASE_URL}/v1/developer/payments`;
const queryParams = new URLSearchParams();
const url = new URL(`${UB_BASE_URL}/v1/developer/payments`);
if (props.limit) {
queryParams.append("limit", props.limit.toString());
url.searchParams.append("limit", props.limit.toString());
}
if (props.offset) {
queryParams.append("offset", props.offset.toString());
url.searchParams.append("offset", props.offset.toString());
}
// Append query params to URL if any exist
const queryString = queryParams.toString();
if (queryString) {
url = `${url}?${queryString}`;
if (props.paymentLinkId) {
url.searchParams.append("paymentLinkId", props.paymentLinkId);
}
const res = await fetch(url, {
const res = await fetch(url.toString(), {
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
@@ -13,12 +13,18 @@ export type TokenMetadata = {
iconUri?: string;
};
export async function getUniversalBridgeTokens(props: { chainId?: number }) {
export async function getUniversalBridgeTokens(props: {
chainId?: number;
address?: string;
}) {
const url = new URL(`${UB_BASE_URL}/v1/tokens`);
if (props.chainId) {
url.searchParams.append("chainId", String(props.chainId));
}
if (props.address) {
url.searchParams.append("tokenAddress", props.address);
}
url.searchParams.append("limit", "1000");
const res = await fetch(url.toString(), {
+362
View File
@@ -0,0 +1,362 @@
"use server";
import { getAuthToken } from "@/api/auth-token";
import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs";
export interface WebhookConfig {
id: string;
teamId: string;
projectId: string;
destinationUrl: string;
description: string;
pausedAt: string | null;
webhookSecret: string;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
topics: {
id: string;
serviceName: string;
description: string;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
filters: object | null;
}[];
}
type WebhookConfigsResponse =
| {
data: WebhookConfig[];
status: "success";
}
| {
body: string;
reason: string;
status: "error";
};
interface CreateWebhookConfigRequest {
topicIdsWithFilters: { id: string; filters: object | null }[];
destinationUrl: string;
description: string;
isPaused?: boolean;
}
type CreateWebhookConfigResponse =
| {
data: WebhookConfig;
status: "success";
}
| {
body: string;
reason: string;
status: "error";
};
export interface Topic {
id: string;
serviceName: string;
description: string;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
}
type TopicsResponse =
| {
data: Topic[];
status: "success";
}
| {
body: string;
reason: string;
status: "error";
};
interface UpdateWebhookConfigRequest {
destinationUrl?: string;
topicIdsWithFilters?: { id: string; filters: object | null }[];
description?: string;
isPaused?: boolean;
}
type UpdateWebhookConfigResponse =
| {
data: WebhookConfig;
status: "success";
}
| {
body: string;
reason: string;
status: "error";
};
type DeleteWebhookConfigResponse =
| {
data: WebhookConfig;
status: "success";
}
| {
body: string;
reason: string;
status: "error";
};
export async function getWebhookConfigs(props: {
teamIdOrSlug: string;
projectIdOrSlug: string;
}): Promise<WebhookConfigsResponse> {
const authToken = await getAuthToken();
if (!authToken) {
return {
body: "Authentication required",
reason: "no_auth_token",
status: "error",
};
}
const response = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${props.teamIdOrSlug}/projects/${props.projectIdOrSlug}/webhook-configs`,
{
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
method: "GET",
},
);
if (!response.ok) {
const body = await response.text();
return {
body,
reason: "unknown",
status: "error",
};
}
const result = await response.json();
return {
data: result.data,
status: "success",
};
}
export async function createWebhookConfig(props: {
teamIdOrSlug: string;
projectIdOrSlug: string;
config: CreateWebhookConfigRequest;
}): Promise<CreateWebhookConfigResponse> {
const authToken = await getAuthToken();
if (!authToken) {
return {
body: "Authentication required",
reason: "no_auth_token",
status: "error",
};
}
const response = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${props.teamIdOrSlug}/projects/${props.projectIdOrSlug}/webhook-configs`,
{
body: JSON.stringify(props.config),
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
method: "POST",
},
);
if (!response.ok) {
const body = await response.text();
return {
body,
reason: "unknown",
status: "error",
};
}
const result = await response.json();
return {
data: result.data,
status: "success",
};
}
export async function getAvailableTopics(): Promise<TopicsResponse> {
const authToken = await getAuthToken();
if (!authToken) {
return {
body: "Authentication required",
reason: "no_auth_token",
status: "error",
};
}
const response = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/webhook-topics`,
{
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
method: "GET",
},
);
if (!response.ok) {
const body = await response.text();
return {
body,
reason: "unknown",
status: "error",
};
}
const result = await response.json();
return {
data: result.data,
status: "success",
};
}
export async function updateWebhookConfig(props: {
teamIdOrSlug: string;
projectIdOrSlug: string;
webhookConfigId: string;
config: UpdateWebhookConfigRequest;
}): Promise<UpdateWebhookConfigResponse> {
const authToken = await getAuthToken();
if (!authToken) {
return {
body: "Authentication required",
reason: "no_auth_token",
status: "error",
};
}
const response = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${props.teamIdOrSlug}/projects/${props.projectIdOrSlug}/webhook-configs/${props.webhookConfigId}`,
{
body: JSON.stringify(props.config),
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
method: "PATCH",
},
);
if (!response.ok) {
const body = await response.text();
return {
body,
reason: "unknown",
status: "error",
};
}
const result = await response.json();
return {
data: result.data,
status: "success",
};
}
export async function deleteWebhookConfig(props: {
teamIdOrSlug: string;
projectIdOrSlug: string;
webhookConfigId: string;
}): Promise<DeleteWebhookConfigResponse> {
const authToken = await getAuthToken();
if (!authToken) {
return {
body: "Authentication required",
reason: "no_auth_token",
status: "error",
};
}
const response = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${props.teamIdOrSlug}/projects/${props.projectIdOrSlug}/webhook-configs/${props.webhookConfigId}`,
{
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
method: "DELETE",
},
);
if (!response.ok) {
const body = await response.text();
return {
body,
reason: "unknown",
status: "error",
};
}
const result = await response.json();
return {
data: result.data,
status: "success",
};
}
type TestDestinationUrlResponse =
| {
result: {
httpStatusCode: number;
httpResponseBody: string;
};
status: "success";
}
| {
body: string;
reason: string;
status: "error";
};
export async function testDestinationUrl(props: {
teamIdOrSlug: string;
projectIdOrSlug: string;
destinationUrl: string;
}): Promise<TestDestinationUrlResponse> {
const authToken = await getAuthToken();
if (!authToken) {
return {
body: "Authentication required",
reason: "no_auth_token",
status: "error",
};
}
const resp = await fetch(
`${NEXT_PUBLIC_THIRDWEB_API_HOST}/v1/teams/${props.teamIdOrSlug}/projects/${props.projectIdOrSlug}/webhook-configs/test-destination-url`,
{
body: JSON.stringify({ destinationUrl: props.destinationUrl }),
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
method: "POST",
},
);
if (!resp.ok) {
return {
body: await resp.text(),
reason: "unknown",
status: "error",
};
}
return await resp.json();
}
@@ -8,11 +8,13 @@ import {
SelectValue,
} from "@/components/ui/select";
import { normalizeTime } from "@/lib/time";
import { cn } from "@/lib/utils";
export function DateRangeSelector(props: {
range: Range;
setRange: (range: Range) => void;
popoverAlign?: "start" | "end" | "center";
className?: string;
}) {
const { range, setRange } = props;
const daysDiff = differenceInCalendarDays(range.to, range.from);
@@ -26,7 +28,7 @@ export function DateRangeSelector(props: {
return (
<DatePickerWithRange
className="w-auto bg-card"
className={cn("w-auto bg-card", props.className)}
from={range.from}
header={
<div className="mb-2 border-border border-b p-4">
@@ -76,8 +76,9 @@ export function RangeSelector({
});
return (
<div className="flex justify-end gap-4">
<div className="flex justify-end gap-3 flex-col lg:flex-row">
<DateRangeSelector
className="rounded-full"
range={localRange}
setRange={(newRange) => {
setRange(newRange);
@@ -89,7 +90,7 @@ export function RangeSelector({
}}
/>
<IntervalSelector
className="bg-card"
className="bg-card rounded-full"
intervalType={localInterval}
setIntervalType={(newInterval) => {
setInterval(newInterval);
@@ -1,23 +1,18 @@
"use client";
import {
Alert,
AlertIcon,
Flex,
FormControl,
Input,
InputGroup,
InputRightElement,
Textarea,
} from "@chakra-ui/react";
import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "chakra/button";
import { FormErrorMessage, FormHelperText, FormLabel } from "chakra/form";
import { Heading } from "chakra/heading";
import { Text } from "chakra/text";
import { ChevronLeftIcon, EyeIcon, EyeOffIcon } from "lucide-react";
import { useRef, useState } from "react";
import { useDropzone } from "react-dropzone";
import {
ArrowLeftIcon,
ArrowRightIcon,
EyeIcon,
EyeOffIcon,
HelpCircleIcon,
LockKeyholeIcon,
RefreshCcwIcon,
ShuffleIcon,
} from "lucide-react";
import Link from "next/link";
import { useState } from "react";
import { useForm } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import type { CreateDelayedRevealBatchParams } from "thirdweb/extensions/erc721";
@@ -25,12 +20,14 @@ import type { NFTInput } from "thirdweb/utils";
import { z } from "zod";
import { FileInput } from "@/components/blocks/FileInput";
import { TransactionButton } from "@/components/tx-button";
import { Checkbox, CheckboxWithLabel } from "@/components/ui/checkbox";
import { UnderlineLink } from "@/components/ui/UnderlineLink";
import type { ComponentWithChildren } from "@/types/component-with-children";
import { Button } from "@/components/ui/button";
import { Form, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { processInputData, shuffleData } from "@/utils/batch";
import { TabButtons } from "../ui/tabs";
import { BatchTable } from "./batch-table";
import { SelectOption } from "./lazy-mint-form/select-option";
import { UploadStep } from "./upload-step";
type DelayedSubmit = {
@@ -44,16 +41,6 @@ type InstantSubmit = {
type SubmitType = DelayedSubmit | InstantSubmit;
interface BatchLazyMintEVMProps {
nextTokenIdToMint: bigint;
canCreateDelayedRevealBatch: boolean;
onSubmit: (formData: SubmitType) => Promise<unknown>;
chainId: number;
client: ThirdwebClient;
}
type BatchLazyMintProps = BatchLazyMintEVMProps;
const BatchLazyMintFormSchema = z
.object({
confirmPassword: z
@@ -73,7 +60,7 @@ const BatchLazyMintFormSchema = z
name: z.string().min(1, "A name is required"),
})
.optional(),
revealType: z.literal("instant").or(z.literal("delayed")).optional(),
revealType: z.literal("instant").or(z.literal("delayed")),
// shared logic
shuffle: z.boolean().default(false),
@@ -91,18 +78,21 @@ function useBatchLazyMintForm() {
return useForm<BatchLazyMintFormType>({
defaultValues: {
metadatas: [],
revealType: undefined,
revealType: "instant",
shuffle: false,
},
resolver: zodResolver(BatchLazyMintFormSchema),
});
}
export const BatchLazyMint: ComponentWithChildren<
BatchLazyMintProps & {
isLoggedIn: boolean;
}
> = (props) => {
export function BatchLazyMint(props: {
nextTokenIdToMint: bigint;
canCreateDelayedRevealBatch: boolean;
onSubmit: (formData: SubmitType) => Promise<unknown>;
chainId: number;
client: ThirdwebClient;
isLoggedIn: boolean;
}) {
const [step, setStep] = useState(0);
const form = useBatchLazyMintForm();
@@ -110,369 +100,415 @@ export const BatchLazyMint: ComponentWithChildren<
const nftMetadatas = form.watch("metadatas");
const hasError = !!form.getFieldState("metadatas", form.formState).error;
const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDrop: async (acceptedFiles) => {
try {
await processInputData(acceptedFiles, (data) =>
form.setValue("metadatas", data),
);
} catch {
form.setError("metadatas", {
message: "Invalid metadata files",
type: "validate",
});
}
if (nftMetadatas.length === 0) {
form.setError("metadatas", {
message: "Invalid metadata files",
type: "validate",
});
}
},
});
const paginationPortalRef = useRef<HTMLDivElement>(null);
return (
<form
className="mt-4 flex w-full flex-col"
onSubmit={form.handleSubmit((data) => {
// first shuffle
const shuffledMetadatas = data.shuffle
? shuffleData(data.metadatas)
: data.metadatas;
<Form {...form}>
<form
className="mt-4 flex w-full flex-col"
onSubmit={form.handleSubmit(async (data) => {
// first shuffle
const shuffledMetadatas = data.shuffle
? shuffleData(data.metadatas)
: data.metadatas;
// check submit is instant
if (data.revealType === "instant") {
return props.onSubmit({
data: { metadatas: shuffledMetadatas },
revealType: "instant",
});
}
// validate password
if (!data.password) {
form.setError("password", {
message: "A password is required for delayed reveal.",
type: "validate",
});
return;
}
// validate placeholder
if (!data.placeHolder?.name) {
form.setError("placeHolder.name", {
message: "A name is required for delayed reveal.",
type: "validate",
});
}
// submit
return props.onSubmit({
data: {
metadata: shuffledMetadatas,
password: data.password,
placeholderMetadata: {
description: data.placeHolder?.description,
image: data.placeHolder?.image,
name: data.placeHolder?.name,
// check submit is instant
if (data.revealType === "instant") {
return props.onSubmit({
data: { metadatas: shuffledMetadatas },
revealType: "instant",
});
}
// validate password
if (!data.password) {
form.setError("password", {
message: "A password is required for delayed reveal.",
type: "validate",
});
return;
}
// validate placeholder
if (!data.placeHolder?.name) {
form.setError("placeHolder.name", {
message: "A name is required for delayed reveal.",
type: "validate",
});
}
// submit
await props.onSubmit({
data: {
metadata: shuffledMetadatas,
password: data.password,
placeholderMetadata: {
description: data.placeHolder?.description,
image: data.placeHolder?.image,
name: data.placeHolder?.name,
},
},
},
revealType: "delayed",
});
})}
>
{step === 0 ? (
<div className="flex flex-col gap-6">
{nftMetadatas.length > 0 ? (
<>
<BatchTable
client={props.client}
data={nftMetadatas}
nextTokenIdToMint={props.nextTokenIdToMint}
portalRef={paginationPortalRef}
/>
<div className="border-border border-t">
<div className="flex flex-col items-center justify-between p-0 md:flex-row md:p-4">
<div ref={paginationPortalRef} />
<div className="mt-4 flex w-full flex-row items-center gap-2 md:mt-0 md:w-auto">
<Button
borderRadius="md"
isDisabled={!hasError}
onClick={() => {
form.reset();
}}
w={{ base: "100%", md: "auto" }}
>
Reset
</Button>
<Button
borderRadius="md"
colorScheme="primary"
onClick={() => setStep(1)}
w={{ base: "100%", md: "auto" }}
>
Next
</Button>
</div>
revealType: "delayed",
});
})}
>
{step === 0 ? (
<div>
{nftMetadatas.length > 0 ? (
<div className="pb-10">
<h2 className="text-2xl font-semibold tracking-tight mb-4">
Upload NFTs
</h2>
<BatchTable
client={props.client}
data={nftMetadatas}
nextTokenIdToMint={props.nextTokenIdToMint}
/>
<div className="mt-5 flex justify-end gap-4">
<Button
className="w-full md:w-auto gap-2"
disabled={!hasError}
onClick={() => {
form.reset();
}}
variant="outline"
>
<RefreshCcwIcon className="size-4" />
Reset
</Button>
<Button
className="w-full md:w-auto gap-2"
onClick={() => setStep(1)}
>
Next <ArrowRightIcon className="size-4" />
</Button>
</div>
</div>
</>
) : (
<UploadStep
getInputProps={getInputProps}
getRootProps={getRootProps}
hasFailed={hasError}
isDragActive={isDragActive}
/>
)}
</div>
) : (
<>
<Flex align="center" justify="space-between" mb={2} py={4} w="100%">
<div className="flex flex-row items-center gap-2">
) : (
<UploadStep
hasFailed={hasError}
reset={() => {
form.reset();
}}
onDrop={async (acceptedFiles) => {
try {
await processInputData(acceptedFiles, (data) =>
form.setValue("metadatas", data),
);
} catch {
form.setError("metadatas", {
message: "Invalid metadata files",
type: "validate",
});
}
if (nftMetadatas.length === 0) {
form.setError("metadatas", {
message: "Invalid metadata files",
type: "validate",
});
}
}}
/>
)}
</div>
) : (
<div className="container px-0 max-w-4xl pb-14">
<div className="flex mb-3">
<Button
className="text-muted-foreground"
className="gap-2 -translate-x-3 text-muted-foreground"
size="sm"
onClick={() => setStep(0)}
variant="ghost"
>
<ChevronLeftIcon className="size-5 cursor-pointer" />
<ArrowLeftIcon className="size-4" />
Back
</Button>
<Heading className="my-auto" size="title.md">
When will you reveal your NFTs?
</Heading>
</div>
</Flex>
<SelectReveal
canCreateDelayedRevealBatch={props.canCreateDelayedRevealBatch}
client={props.client}
form={form}
/>
{form.watch("revealType") && (
<>
<CheckboxWithLabel>
<Checkbox
checked={form.watch("shuffle")}
className="mt-3"
onCheckedChange={(val) => form.setValue("shuffle", !!val)}
/>
<div className="flex flex-col items-center gap-1 md:flex-row">
<p>Shuffle the order of the NFTs before uploading.</p>
<em>This is an off-chain operation and is not provable.</em>
</div>
</CheckboxWithLabel>
<div className="w-full md:w-[61%]">
<TransactionButton
className="mt-4 w-full"
client={props.client}
disabled={!nftMetadatas.length}
isLoggedIn={props.isLoggedIn}
isPending={form.formState.isSubmitting}
transactionCount={1}
txChainID={props.chainId}
type="submit"
>
{form.formState.isSubmitting
? `Uploading ${nftMetadatas.length} NFTs`
: `Upload ${nftMetadatas.length} NFTs`}
</TransactionButton>
{props.children}
</div>
<Text mt={2} size="body.sm">
<UnderlineLink
className="text-primary-500"
href="https://support.thirdweb.com/dashboard/n5evQ4EfEjEifczEQaZ1hL/batch-upload-troubleshooting/5WMQFqfaUTU1C8NM8FtJ2X"
rel="noopener noreferrer"
target="_blank"
>
Experiencing issues uploading your files?
</UnderlineLink>
</Text>
</>
)}
</>
)}
</form>
);
};
interface SelectRevealProps {
<h2 className="text-2xl font-semibold tracking-tight mb-4">
Upload NFTs
</h2>
<SelectReveal
canCreateDelayedRevealBatch={props.canCreateDelayedRevealBatch}
client={props.client}
form={form}
/>
<div className="h-4" />
<div className="space-y-6">
{form.watch("revealType") === "delayed" && (
<DelayedRevealConfiguration client={props.client} form={form} />
)}
{/* shuffle */}
<ShuffleNFTsCard
isShuffleEnabled={form.watch("shuffle")}
onShuffleChange={(val) => form.setValue("shuffle", val)}
/>
<div className="space-y-3">
<div className="flex justify-end">
<TransactionButton
client={props.client}
disabled={!nftMetadatas.length}
isLoggedIn={props.isLoggedIn}
isPending={form.formState.isSubmitting}
transactionCount={1}
txChainID={props.chainId}
type="submit"
>
{form.formState.isSubmitting
? `Uploading ${nftMetadatas.length} NFTs`
: `Upload ${nftMetadatas.length} NFTs`}
</TransactionButton>
</div>
<div className="flex justify-end">
<Link
className="text-sm flex items-center gap-2 text-muted-foreground hover:text-foreground"
href="https://portal.thirdweb.com/knowledge-base/troubleshoot/contracts/batch-upload"
rel="noopener noreferrer"
target="_blank"
>
<HelpCircleIcon className="size-4" />
Experiencing issues uploading your files?
</Link>
</div>
</div>
</div>
</div>
)}
</form>
</Form>
);
}
function ShuffleNFTsCard(props: {
isShuffleEnabled: boolean;
onShuffleChange: (val: boolean) => void;
}) {
return (
<div className="px-4 lg:px-6 py-8 border rounded-lg bg-card relative">
<div className="flex mb-3">
<div className="p-2 rounded-full border bg-card">
<ShuffleIcon className="size-4 text-muted-foreground" />
</div>
</div>
<h3 className="font-semibold text-lg mb-0.5 tracking-tight">
Shuffle NFTs
</h3>
<p className="text-sm text-muted-foreground">
Shuffle the order of the NFTs before uploading. This is an off-chain
operation and is not provable
</p>
<Switch
checked={props.isShuffleEnabled}
onCheckedChange={(val) => props.onShuffleChange(!!val)}
className="absolute right-4 top-4 lg:right-6 lg:top-8"
/>
</div>
);
}
function SelectReveal(props: {
form: ReturnType<typeof useBatchLazyMintForm>;
canCreateDelayedRevealBatch: boolean;
client: ThirdwebClient;
}) {
const { form, canCreateDelayedRevealBatch } = props;
return (
<div>
{canCreateDelayedRevealBatch && (
<TabButtons
containerClassName="mb-8"
tabClassName="!text-sm"
tabs={[
{
name: "Reveal upon mint",
onClick: () => {
form.setValue("revealType", "instant");
// reset all fields related to delayed reveal
form.resetField("password");
form.resetField("confirmPassword");
form.resetField("placeHolder");
},
isActive: form.watch("revealType") === "instant",
},
{
name: "Delayed Reveal",
onClick: () => form.setValue("revealType", "delayed"),
isActive: form.watch("revealType") === "delayed",
},
]}
/>
)}
{form.watch("revealType") === "instant" && (
<div>
<h2 className="font-semibold text-xl mb-1 tracking-tight leading-none">
Reveal upon mint
</h2>
<p className="text-muted-foreground text-sm">
Collectors will immediately see the final NFT when they complete the
minting
</p>
</div>
)}
{form.watch("revealType") === "delayed" && (
<div>
<h2 className="font-semibold text-xl mb-1 tracking-tight leading-none">
Delayed Reveal
</h2>
<p className="text-muted-foreground text-sm">
Collectors will mint your placeholder image, then you reveal at a
later time
</p>
</div>
)}
</div>
);
}
const SelectReveal: React.FC<SelectRevealProps> = ({
form,
client,
canCreateDelayedRevealBatch,
}) => {
function DelayedRevealConfiguration(props: {
form: ReturnType<typeof useBatchLazyMintForm>;
client: ThirdwebClient;
}) {
const { form, client } = props;
const [show, setShow] = useState(false);
const imageUrl = form.watch("placeHolder.image");
return (
<Flex flexDir="column">
<Flex
flexDir={{ base: "column", md: "row" }}
gap={{ base: 3, md: 6 }}
mb={6}
>
<SelectOption
description="Collectors will immediately see the final NFT when they complete the minting"
isActive={form.watch("revealType") === "instant"}
name="Reveal upon mint"
onClick={() => form.setValue("revealType", "instant")}
/>
<SelectOption
description="Collectors will mint your placeholder image, then you reveal at a later time"
disabled={!canCreateDelayedRevealBatch}
disabledText="This contract doesn't implement Delayed Reveal"
isActive={form.watch("revealType") === "delayed"}
name="Delayed Reveal"
onClick={() => form.setValue("revealType", "delayed")}
/>
</Flex>
<div className="flex flex-col gap-3">
{form.watch("revealType") === "delayed" && (
<>
<Heading size="title.sm">Let&apos;s set a password</Heading>
<Alert borderRadius="lg" status="warning">
<AlertIcon />
You&apos;ll need this password to reveal your NFTs. Please save it
somewhere safe.
</Alert>
<div className="space-y-6">
{/* password */}
<div className="border px-4 lg:px-6 py-8 rounded-lg bg-card">
<div className="flex mb-3">
<div className="p-2 rounded-full border bg-card">
<LockKeyholeIcon className="size-4 text-muted-foreground" />
</div>
</div>
<h3 className="font-semibold text-lg mb-0.5 tracking-tight">
Set password
</h3>
<p className="text-sm text-muted-foreground mb-4">
You'll need this password to reveal your NFTs. Please save it
somewhere safe
</p>
<Flex
flexDir={{ base: "column", md: "row" }}
gap={{ base: 4, md: 0 }}
>
<FormControl
isInvalid={
!!form.getFieldState("password", form.formState).error
}
isRequired
mr={4}
<div className="space-y-5">
{/* select password */}
<FormItem className="space-y-1">
<FormLabel>Password</FormLabel>
<div className="relative max-w-md">
<Input
{...form.register("password")}
className="pr-10"
type={show ? "text" : "password"}
/>
<Button
variant="ghost"
className="absolute right-3 top-1/2 -translate-y-1/2 p-2 h-auto text-muted-foreground"
onClick={() => setShow(!show)}
>
<FormLabel>Password</FormLabel>
<InputGroup>
<Input
{...form.register("password")}
placeholder="Choose password"
type={show ? "text" : "password"}
/>
<InputRightElement cursor="pointer">
{show ? (
<EyeIcon
className="size-3"
onClick={() => setShow(!show)}
/>
) : (
<EyeOffIcon
className="size-3"
onClick={() => setShow(!show)}
/>
)}
</InputRightElement>
</InputGroup>
<FormErrorMessage>
{
form.getFieldState("password", form.formState).error
?.message
}
</FormErrorMessage>
</FormControl>
<FormControl
isInvalid={
!!form.getFieldState("confirmPassword", form.formState).error
}
isRequired
>
<FormLabel>Confirm password</FormLabel>
<Input
{...form.register("confirmPassword")}
placeholder="Confirm password"
type="password"
/>
<FormErrorMessage>
{
form.getFieldState("confirmPassword", form.formState).error
?.message
}
</FormErrorMessage>
</FormControl>
</Flex>
<div className="flex flex-col gap-5">
<Heading size="title.sm">Placeholder</Heading>
<FormControl
isInvalid={
!!form.getFieldState("placeHolder.image", form.formState)
.error
}
>
<FormLabel>Image</FormLabel>
<div className="w-auto md:w-[350px]">
<FileInput
accept={{ "image/*": [] }}
className="rounded border border-border transition-all duration-200"
client={client}
setValue={(file) =>
form.setValue("placeHolder.image", file)
}
showUploadButton
value={imageUrl}
/>
</div>
<FormHelperText>
You can optionally upload an image as the placeholder.
</FormHelperText>
<FormErrorMessage>
{
form.getFieldState("placeHolder.image", form.formState)
.error?.message
}
</FormErrorMessage>
</FormControl>
<FormControl
isInvalid={
!!form.getFieldState("placeHolder.name", form.formState).error
}
isRequired
>
<FormLabel>Name</FormLabel>
<Input
{...form.register("placeHolder.name")}
placeholder="eg. My NFT (Coming soon)"
/>
<FormErrorMessage>
{
form.getFieldState("placeHolder.name", form.formState).error
?.message
}
</FormErrorMessage>
</FormControl>
<FormControl
isInvalid={
!!form.getFieldState("placeHolder.name", form.formState).error
}
>
<FormLabel>Description</FormLabel>
<Textarea
{...form.register("placeHolder.description")}
placeholder="eg. Reveal on July 15th!"
/>
<FormErrorMessage>
{
form.getFieldState(
"placeHolder.description",
form.formState,
).error?.message
}
</FormErrorMessage>
</FormControl>
{show ? (
<EyeIcon className="size-4" />
) : (
<EyeOffIcon className="size-4" />
)}
</Button>
</div>
</>
)}
<FormMessage>
{form.getFieldState("password", form.formState).error?.message}
</FormMessage>
</FormItem>
{/* confirm password */}
<FormItem className="space-y-1">
<FormLabel>Confirm password</FormLabel>
<div className="relative max-w-md">
<Input
{...form.register("confirmPassword")}
className="pr-10"
type="password"
/>
</div>
<FormMessage>
{
form.getFieldState("confirmPassword", form.formState).error
?.message
}
</FormMessage>
</FormItem>
</div>
</div>
</Flex>
{/* placeholder */}
<div className="border px-4 lg:px-6 py-8 rounded-lg bg-card">
<div className="flex mb-3">
<div className="p-2 rounded-full border bg-card">
<EyeIcon className="size-4 text-muted-foreground" />
</div>
</div>
<h3 className="font-semibold text-lg tracking-tight mb-0.5">
Set placeholder metadata
</h3>
<p className="text-sm text-muted-foreground mb-4">
The placeholder metadata will be displayed for all NFTs until you
reveal your NFTs
</p>
<div className="flex flex-col lg:flex-row gap-5">
<FormItem className="w-[200px]">
<FormLabel>Image</FormLabel>
<FileInput
accept={{ "image/*": [] }}
className="rounded border bg-background transition-all duration-200 "
client={client}
setValue={(file) => form.setValue("placeHolder.image", file)}
value={imageUrl}
/>
<FormMessage>
{
form.getFieldState("placeHolder.image", form.formState).error
?.message
}
</FormMessage>
</FormItem>
<div className="grow space-y-5 flex flex-col">
<FormItem>
<FormLabel>Name</FormLabel>
<Input
className="max-w-sm"
{...form.register("placeHolder.name")}
placeholder="My NFT (Coming soon)"
/>
<FormMessage>
{
form.getFieldState("placeHolder.name", form.formState).error
?.message
}
</FormMessage>
</FormItem>
<FormItem className="grow flex flex-col">
<FormLabel>Description</FormLabel>
<Textarea
{...form.register("placeHolder.description")}
className="grow"
placeholder="Reveal on July 15th!"
/>
<FormMessage>
{
form.getFieldState("placeHolder.description", form.formState)
.error?.message
}
</FormMessage>
</FormItem>
</div>
</div>
</div>
</div>
);
};
}
@@ -1,237 +1,183 @@
/** biome-ignore-all lint/nursery/noNestedComponentDefinitions: FIXME */
import { FilePreview } from "@app/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/_common/file-preview";
import {
Flex,
IconButton,
Portal,
Select,
Table,
TableContainer,
Tbody,
Td,
Th,
Thead,
Tr,
} from "@chakra-ui/react";
import {
ChevronFirstIcon,
ChevronLastIcon,
ChevronLeftIcon,
ChevronRightIcon,
} from "lucide-react";
import { useMemo } from "react";
import { type Column, usePagination, useTable } from "react-table";
import { useState } from "react";
import type { ThirdwebClient } from "thirdweb";
import type { NFTInput } from "thirdweb/utils";
import { FilePreview } from "@/components/blocks/file-preview";
import { PaginationButtons } from "@/components/blocks/pagination-buttons";
import { CodeClient } from "@/components/ui/code/code.client";
import {
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { ToolTipLabel } from "@/components/ui/tooltip";
interface BatchTableProps {
type BatchTableProps = {
data: NFTInput[];
portalRef: React.RefObject<HTMLDivElement | null>;
nextTokenIdToMint?: bigint;
client: ThirdwebClient;
}
};
export const BatchTable: React.FC<BatchTableProps> = ({
export function BatchTable({
data,
portalRef,
nextTokenIdToMint,
client,
}) => {
const columns = useMemo(() => {
let cols: Column<NFTInput>[] = [];
if (nextTokenIdToMint !== undefined) {
cols = cols.concat({
accessor: (_row, index) => String(nextTokenIdToMint + BigInt(index)),
Header: "Token ID",
});
}
}: BatchTableProps) {
const [currentPage, setCurrentPage] = useState(1);
const pageSize = 10;
cols = cols.concat([
{
accessor: (row) => row.image,
Cell: ({ cell: { value } }: { cell: { value?: string } }) => (
<FilePreview
className="size-24 shrink-0 rounded-lg object-contain"
client={client}
srcOrFile={value}
/>
),
Header: "Image",
},
{
accessor: (row) => row.animation_url,
Cell: ({ cell: { value } }: { cell: { value?: string } }) => (
<FilePreview
className="size-24 shrink-0 rounded-lg"
client={client}
srcOrFile={value}
/>
),
Header: "Animation Url",
},
{ accessor: (row) => row.name, Header: "Name" },
{
accessor: (row) => (
<ToolTipLabel label={row.description}>
<p className="line-clamp-6 whitespace-pre-wrap">
{row.description}
</p>
</ToolTipLabel>
),
Header: "Description",
},
{
accessor: (row) => row.attributes || row.properties,
// biome-ignore lint/suspicious/noExplicitAny: FIXME
Cell: ({ cell }: { cell: any }) =>
cell.value ? (
<CodeClient
code={JSON.stringify(cell.value || {}, null, 2)}
lang="json"
scrollableClassName="max-w-[300px]"
/>
) : null,
Header: "Attributes",
},
{ accessor: (row) => row.external_url, Header: "External URL" },
{ accessor: (row) => row.background_color, Header: "Background Color" },
]);
return cols;
}, [nextTokenIdToMint, client]);
const totalPages = Math.ceil(data.length / pageSize);
const startIndex = (currentPage - 1) * pageSize;
const endIndex = startIndex + pageSize;
const currentData = data.slice(startIndex, endIndex);
const {
getTableProps,
getTableBodyProps,
headerGroups,
prepareRow,
// Instead of using 'rows', we'll use page,
page,
// which has only the rows for the active page
const handlePageChange = (page: number) => {
setCurrentPage(page);
};
// The rest of these things are super handy, too ;)
canPreviousPage,
canNextPage,
pageOptions,
pageCount,
gotoPage,
nextPage,
previousPage,
setPageSize,
state: { pageIndex, pageSize },
} = useTable(
{
columns,
data,
initialState: {
pageIndex: 0,
pageSize: 50,
},
},
// will be fixed with @tanstack/react-table v8
// eslint-disable-next-line react-compiler/react-compiler
usePagination,
);
const showTokenId = nextTokenIdToMint !== undefined;
const showExternalUrl = data.some((row) => row.external_url);
const showBackgroundColor = data.some((row) => row.background_color);
const showAnimationUrl = data.some((row) => row.animation_url);
const showDescription = data.some((row) => row.description);
const showAttributes = data.some((row) => row.attributes || row.properties);
const showPagination = totalPages > 1;
// Render the UI for your table
return (
<Flex flexGrow={1} overflow="auto">
<TableContainer className="w-full" maxW="100%">
<Table {...getTableProps()}>
<Thead>
{headerGroups.map((headerGroup, index) => (
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME
<Tr {...headerGroup.getHeaderGroupProps()} key={index}>
{headerGroup.headers.map((column, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME
<Th {...column.getHeaderProps()} border="none" key={i}>
<p className="text-muted-foreground">
{column.render("Header")}
</p>
</Th>
))}
</Tr>
))}
</Thead>
<Tbody {...getTableBodyProps()}>
{page.map((row, rowIndex) => {
prepareRow(row);
<div className="rounded-lg border bg-card">
<TableContainer className="border-0">
<Table>
<TableHeader>
<TableRow>
{showTokenId && <TableHead>Token ID</TableHead>}
<TableHead>Image</TableHead>
{showAnimationUrl && <TableHead>Animation Url</TableHead>}
<TableHead>Name</TableHead>
{showDescription && (
<TableHead className="min-w-[300px]">Description</TableHead>
)}
{showAttributes && <TableHead>Attributes</TableHead>}
{showExternalUrl && <TableHead>External URL</TableHead>}
{showBackgroundColor && <TableHead>Background Color</TableHead>}
</TableRow>
</TableHeader>
<TableBody>
{currentData.map((row, rowIndex) => {
const actualIndex = startIndex + rowIndex;
return (
<Tr
{...row.getRowProps()}
_last={{ borderBottomWidth: 0 }}
borderBottomWidth={1}
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME
key={rowIndex}
<TableRow
className="border-b last:border-b-0"
key={actualIndex}
>
{row.cells.map((cell, cellIndex) => {
return (
<Td
{...cell.getCellProps()}
borderBottomWidth="inherit"
borderColor="borderColor"
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME
key={cellIndex}
>
{cell.render("Cell")}
</Td>
);
})}
</Tr>
{/* Token ID */}
{showTokenId && (
<TableCell>
{String(nextTokenIdToMint + BigInt(actualIndex))}
</TableCell>
)}
{/* Image */}
<TableCell className="min-w-36">
<FilePreview
className="size-36 shrink-0 rounded-lg object-contain"
client={client}
srcOrFile={
typeof row.image === "string" ||
row.image instanceof File
? row.image
: undefined
}
/>
</TableCell>
{/* Animation Url */}
{showAnimationUrl && (
<TableCell className="min-w-36">
<FilePreview
className="size-36 shrink-0 rounded-lg"
client={client}
srcOrFile={
typeof row.animation_url === "string" ||
row.animation_url instanceof File
? row.animation_url
: undefined
}
/>
</TableCell>
)}
{/* Name */}
<TableCell>{row.name}</TableCell>
{/* Description */}
{showDescription && (
<TableCell className="max-w-xs">
<p className="whitespace-pre-wrap">{row.description}</p>
</TableCell>
)}
{/* Attributes */}
{showAttributes && (
<TableCell>
{row.attributes || row.properties ? (
<CodeClient
code={JSON.stringify(
row.attributes || row.properties || {},
null,
2,
)}
lang="json"
scrollableClassName="max-w-[300px] max-h-[400px]"
className="bg-background [&>*]:text-xs"
/>
) : null}
</TableCell>
)}
{/* External URL */}
{showExternalUrl && (
<TableCell>
{typeof row.external_url === "string" ? (
<ToolTipLabel label={row.external_url}>
<span>
{row.external_url.slice(0, 20) +
(row.external_url.length > 20 ? "..." : "")}
</span>
</ToolTipLabel>
) : row.external_url instanceof File ? (
<FilePreview
client={client}
srcOrFile={row.external_url}
/>
) : null}
</TableCell>
)}
{/* Background Color */}
{showBackgroundColor && (
<TableCell>{row.background_color}</TableCell>
)}
</TableRow>
);
})}
</Tbody>
</TableBody>
</Table>
</TableContainer>
<Portal containerRef={portalRef}>
<div className="flex w-full items-center justify-center">
<div className="flex flex-row items-center gap-2">
<IconButton
aria-label="first page"
icon={<ChevronFirstIcon className="size-4" />}
isDisabled={!canPreviousPage}
onClick={() => gotoPage(0)}
/>
<IconButton
aria-label="previous page"
icon={<ChevronLeftIcon className="size-4" />}
isDisabled={!canPreviousPage}
onClick={() => previousPage()}
/>
<p className="whitespace-nowrap">
Page <strong>{pageIndex + 1}</strong> of{" "}
<strong>{pageOptions.length}</strong>
</p>
<IconButton
aria-label="next page"
icon={<ChevronRightIcon className="size-4" />}
isDisabled={!canNextPage}
onClick={() => nextPage()}
/>
<IconButton
aria-label="last page"
icon={<ChevronLastIcon className="size-4" />}
isDisabled={!canNextPage}
onClick={() => gotoPage(pageCount - 1)}
/>
<Select
onChange={(e) => {
setPageSize(Number.parseInt(e.target.value as string, 10));
}}
value={pageSize}
>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="250">250</option>
<option value="500">500</option>
</Select>
</div>
{showPagination && (
<div className="border-t py-5">
<PaginationButtons
activePage={currentPage}
totalPages={totalPages}
onPageClick={handlePageChange}
/>
</div>
</Portal>
</Flex>
)}
</div>
);
};
}
@@ -42,18 +42,18 @@ export const SelectOption: React.FC<SelectOptionProps> = ({
disabled
? "pointer-events-none cursor-not-allowed bg-muted"
: "cursor-pointer",
isActive && "border-primary",
isActive && "bg-muted/50 border-active-border",
className,
)}
onClick={onClick}
{...divProps}
>
<div className="flex flex-row justify-between">
<div className="flex flex-row items-start">
<div className="mt-0.5 mr-2.5 flex h-4 w-4 items-center justify-center rounded-full border border-inverted text-inverted">
<div className="flex flex-row items-start gap-4">
<div className="flex size-5 shrink-0 items-center justify-center rounded-full border border-inverted text-inverted">
{isActive && <div className="h-2 w-2 rounded-full bg-inverted" />}
</div>
<div className="ml-4 flex flex-col gap-2 self-start">
<div>
<h4
className={cn(
"font-semibold text-sm",
@@ -62,7 +62,11 @@ export const SelectOption: React.FC<SelectOptionProps> = ({
>
{name}
</h4>
{description && <p className="mt-1 text-sm">{description}</p>}
{description && (
<p className="mt-1 text-sm text-muted-foreground">
{description}
</p>
)}
</div>
</div>
{infoText && (
@@ -1,137 +1,299 @@
import { UploadIcon } from "lucide-react";
import { useState } from "react";
import { InlineCode } from "@/components/ui/inline-code";
import { UnorderedList } from "@/components/ui/List/List";
import { cn } from "@/lib/utils";
import { TabButtons } from "@/components/ui/tabs";
import { DownloadableCode } from "../blocks/code/downloadable-code";
import { DropZone } from "../blocks/drop-zone/drop-zone";
interface UploadStepProps {
// biome-ignore lint/suspicious/noExplicitAny: FIXME
getRootProps: any;
// biome-ignore lint/suspicious/noExplicitAny: FIXME
getInputProps: any;
hasFailed: boolean;
isDragActive: boolean;
onDrop: (acceptedFiles: File[]) => void;
reset: () => void;
}
export const UploadStep: React.FC<UploadStepProps> = ({
getRootProps,
hasFailed,
isDragActive,
getInputProps,
}) => {
export function UploadStep(props: UploadStepProps) {
const [tab, setTab] = useState<"csv" | "json">("csv");
return (
<div className="flex flex-col items-center gap-8 md:flex-row">
<div className="relative aspect-square w-full md:w-1/2">
<div
className={cn(
"flex h-full cursor-pointer rounded-md border border-border hover:border-blue-500",
hasFailed ? "bg-red-200" : "bg-background",
)}
{...getRootProps()}
>
<input {...getInputProps()} />
<div className="m-auto flex flex-col p-6">
<UploadIcon
className={cn(
"mx-auto mb-2 size-8",
hasFailed ? "text-red-500" : "text-gray-600",
)}
<div className="container px-0 max-w-3xl">
<h2 className="text-2xl font-semibold tracking-tight mb-4">
Upload NFTs
</h2>
<DropZone
className="w-full py-24"
onDrop={props.onDrop}
isError={props.hasFailed}
title={props.hasFailed ? "Invalid files" : "Upload files"}
description={
props.hasFailed
? "Make sure the uploaded files follow the requirements mentioned below"
: "Drag and drop the files or folder"
}
resetButton={{
label: "Reset",
onClick: props.reset,
}}
accept={undefined}
/>
<div className="h-8" />
<div className="w-full">
<TabButtons
tabs={[
{
isActive: tab === "csv",
name: "CSV",
onClick: () => setTab("csv"),
},
{
isActive: tab === "json",
name: "JSON",
onClick: () => setTab("json"),
},
]}
/>
<div className="h-6" />
<div className="space-y-8">
<Section title="Uploading Files">
<p>
Make sure to drag and drop the {tab === "csv" ? "CSV" : "JSON"}{" "}
and the assets at the same time or upload a folder with all the
files in it.
</p>
<p>
Asset names <em>must</em> be sequential 0,1,2,3...n.[extension].
It doesn't matter at what number you begin. Example: 131.png,
132.png etc.
</p>
<p>
Images and other file types can be used in combination. They both
have to follow the asset naming convention above. Example: 0.png
and 0.mp4, 1.png and 1.glb etc.
</p>
</Section>
<Section title={`${tab === "csv" ? "CSV" : "JSON"} File Format`}>
<p>
The {tab === "csv" ? "CSV" : "JSON"} file must have a{" "}
<InlineCode code="name" /> {tab === "csv" ? "column" : "property"}
, which defines the name of the NFT
</p>
<p>
Other optional {tab === "csv" ? "columns" : "properties"} are{" "}
<InlineCode code="description" />,{" "}
<InlineCode code="background_color" />,{" "}
<InlineCode code="external_url" />,{" "}
<InlineCode code="animation_url" />,{" "}
{tab === "json" && (
<>
,
<InlineCode code="attributes" />
</>
)}{" "}
and <InlineCode code="supply" />
{". "}
{tab === "csv" &&
"All other columns will be treated as Attributes. For example: See 'eyes', 'nose' below."}
</p>
<DownloadableCode
code={tab === "csv" ? csv_example_basic : json_example_basic}
fileNameWithExtension={
tab === "csv" ? "example.csv" : "example.json"
}
lang={tab === "csv" ? "csv" : "json"}
/>
{isDragActive ? (
<p className="text-center text-muted-foreground">
Drop the files here
</p>
) : (
<p
className={cn(
"text-center leading-[1.2]",
hasFailed ? "text-red-500" : "text-muted-foreground",
)}
>
{hasFailed
? `No valid CSV or JSON file found. Please make sure your NFT metadata includes at least a "name" field and try again.`
: "Drag & Drop files or folders here, or click to select files"}
</p>
)}
</div>
</Section>
<Section title="Map your assets to NFTs">
<p>
If you want to map your media files to your NFTs, you can add the
name of your files to the <InlineCode code="image" /> and{" "}
<InlineCode code="animation_url" />{" "}
{tab === "csv" ? "columns" : "properties"}.{" "}
<DownloadableCode
code={
tab === "csv"
? csv_with_image_number_example
: json_with_image_number_example
}
fileNameWithExtension={
tab === "csv"
? "example-with-maps.csv"
: "example-with-maps.json"
}
lang={tab === "csv" ? "csv" : "json"}
/>
</p>
</Section>
<Section title="Using asset links instead of uploading assets">
<p>
When uploading files, assets will be uploaded and pinned to IPFS
automatically. If you already have the files uploaded elsewhere,
you can specify the IPFS or HTTP(s) links in the{" "}
<InlineCode code="image" /> and/or{" "}
<InlineCode code="animation_url" />{" "}
{tab === "csv" ? "columns" : "properties"}. instead of uploading
the assets and just upload a single{" "}
{tab === "csv" ? "CSV" : "JSON"} file.
<DownloadableCode
code={
tab === "csv"
? csv_with_image_link_example
: json_with_image_link_example
}
fileNameWithExtension={
tab === "csv"
? "example-with-ipfs.csv"
: "example-with-ipfs.json"
}
lang={tab === "csv" ? "csv" : "json"}
/>
</p>
</Section>
</div>
</div>
<div className="flex w-full flex-col gap-2 md:w-1/2">
<p className="text-lg">Requirements</p>
<UnorderedList>
<li>
Files <em>must</em> contain one .csv or .json file with metadata. -{" "}
<a
className="text-link-foreground hover:text-foreground"
download
href="/assets/examples/example.csv"
>
Download example.csv
</a>
.{" "}
<a
className="text-link-foreground hover:text-foreground"
download
href="/assets/examples/example.json"
>
Download example.json
</a>
.
</li>
<li>
The csv <em>must</em> have a <InlineCode code="name" /> column,
which defines the name of the NFT.
</li>
<li>
Asset names <em>must</em> be sequential 0,1,2,3...n.[extension]. It
doesn&apos;t matter at what number you begin. (Example:{" "}
<InlineCode code="131.png" />, <InlineCode code="132.png" />
).
</li>
<li>
Make sure to drag and drop the CSV/JSON and the images{" "}
<strong>at the same time</strong>.
</li>
</UnorderedList>
<p className="mt-4 text-lg">Options</p>
<UnorderedList>
<li>
Images and other file types can be used in combination.
<br />
<small>
They both have to follow the asset naming convention above.
(Example: <InlineCode code="0.png" /> and{" "}
<InlineCode code="0.mp4" />,<InlineCode code="1.png" /> and{" "}
<InlineCode code="1.glb" />, etc.)
</small>
</li>
<li>
When uploading files, we will upload them and pin them to IPFS
automatically for you. If you already have the files uploaded, you
can add an <InlineCode code="image" /> and/or
<InlineCode code="animation_url" /> column and add the IPFS hashes
there.{" "}
<a
className="text-link-foreground hover:text-foreground"
download
href="/assets/examples/example-with-ipfs.csv"
>
Download example.csv
</a>
</li>
<li>
If you want to make your media files map to your NFTs, you can add
the name of your files to the <InlineCode code="image" /> and
<InlineCode code="animation_url" /> column.{" "}
<a
className="text-link-foreground hover:text-foreground"
download
href="/assets/examples/example-with-maps.csv"
>
Download example.csv
</a>
</li>
</UnorderedList>
</div>
</div>
);
};
}
function Section(props: { title: string; children: React.ReactNode }) {
return (
<section>
<h2 className="mb-1 font-medium text-base text-foreground">
{props.title}
</h2>
<div className="space-y-1.5 text-muted-foreground leading-relaxed">
{props.children}
</div>
</section>
);
}
const csv_example_basic = `\
name,description,background_color,eyes,nose
Token 0 Name,Token 0 Description,#0098EE,red,green
Token 1 Name,Token 1 Description,#0098EE,blue,yellow`;
const json_example_basic = `\
[
{
"name": "Token 0 Name",
"description": "Token 0 Description",
"background_color": "#0098EE",
"attributes": [
{
"trait_type": "eyes",
"value": "red"
},
{
"trait_type": "nose",
"value": "green"
}
]
},
{
"name": "Token 1 Name",
"description": "Token 1 Description",
"background_color": "#0098EE",
"attributes": [
{
"trait_type": "eyes",
"value": "blue"
},
{
"trait_type": "nose",
"value": "yellow"
}
]
}
]`;
const csv_with_image_link_example = `\
name,description,image,animation_url,background_color,eyes,nose
Token 0 Name,Token 0 Description,ipfs://ipfsHash/0,ipfs://ipfsHash/0,#0098EE,red,green
Token 1 Name,Token 1 Description,ipfs://ipfsHash/1,ipfs://ipfsHash/1,#0098EE,blue,yellow`;
const json_with_image_link_example = `\
[
{
"name": "Token 0 Name",
"description": "Token 0 Description",
"image": "ipfs://ipfsHash/0",
"animation_url": "ipfs://ipfsHash/0",
"attributes": [
{
"trait_type": "eyes",
"value": "red"
},
{
"trait_type": "nose",
"value": "green"
}
]
},
{
"name": "Token 1 Name",
"description": "Token 1 Description",
"image": "ipfs://ipfsHash/1",
"animation_url": "ipfs://ipfsHash/1",
"attributes": [
{
"trait_type": "eyes",
"value": "blue"
},
{
"trait_type": "nose",
"value": "yellow"
}
]
}
]`;
const csv_with_image_number_example = `\
name,description,image,animation_url,background_color,eyes,nose
Token 0 Name,Token 0 Description,0.png,0.mp4,#0098EE,red,green
Token 1 Name,Token 1 Description,1.png,1.mp4,#0098EE,blue,yellow`;
const json_with_image_number_example = `\
[
{
"name": "Token 0 Name",
"description": "Token 0 Description",
"image": "0.png",
"animation_url": "0.mp4",
"attributes": [
{
"trait_type": "eyes",
"value": "red"
},
{
"trait_type": "nose",
"value": "green"
}
]
},
{
"name": "Token 1 Name",
"description": "Token 1 Description",
"image": "1.png",
"animation_url": "1.mp4",
"attributes": [
{
"trait_type": "eyes",
"value": "blue"
},
{
"trait_type": "nose",
"value": "yellow"
}
]
}
]`;
@@ -82,7 +82,7 @@ function UnpaidInvoicesWarning({ teamSlug }: { teamSlug: string }) {
<Button asChild className="w-full gap-2 bg-card" variant="outline">
<Link
href={`/team/${teamSlug}/~/settings/invoices?status=open`}
href={`/team/${teamSlug}/~/billing/invoices?status=open`}
rel="noopener noreferrer"
target="_blank"
>
@@ -1,45 +1,18 @@
import { formatDistance } from "date-fns";
import { CircleAlertIcon } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import type { ThirdwebClient } from "thirdweb";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import type { Account, BillingCredit } from "@/hooks/useApi";
import { useLocalStorage } from "@/hooks/useLocalStorage";
import { ChainIconClient } from "@/icons/ChainIcon";
import type { BillingCredit } from "@/hooks/useApi";
import { formatToDollars } from "./formatToDollars";
interface CreditsItemProps {
credit?: BillingCredit;
isOpCreditDefault?: boolean;
onClickApply?: () => void;
twAccount: Account;
client: ThirdwebClient;
teamSlug: string;
}
export const CreditsItem: React.FC<CreditsItemProps> = ({
credit,
isOpCreditDefault,
onClickApply,
twAccount,
client,
teamSlug,
}) => {
const [hasAppliedForOpGrant] = useLocalStorage(
`appliedForOpGrant-${twAccount.id}`,
false,
);
const isOpCredit = credit?.name.startsWith("OP -") || isOpCreditDefault;
export const CreditsItem: React.FC<CreditsItemProps> = ({ credit }) => {
const isTwCredit = credit?.name.startsWith("TW -");
const isStartupCredit = credit?.name.startsWith("SU -");
let creditTitle = credit?.name ?? "thirdweb credits";
if (isOpCredit) {
creditTitle = "Optimism sponsorship credits";
} else if (isTwCredit) {
if (isTwCredit) {
creditTitle = "thirdweb credits";
} else if (isStartupCredit) {
creditTitle = "Startup grant credits";
@@ -50,13 +23,7 @@ export const CreditsItem: React.FC<CreditsItemProps> = ({
<div className="flex flex-col gap-3 p-4 lg:p-6">
<div className="relative">
<div className="absolute top-0 right-0">
{isOpCredit ? (
<ChainIconClient
className="size-6"
client={client}
src="ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png"
/>
) : isTwCredit ? (
{isTwCredit ? (
<Image
alt="tw-credit"
className="size-6"
@@ -112,35 +79,7 @@ export const CreditsItem: React.FC<CreditsItemProps> = ({
</div>
)}
</div>
{hasAppliedForOpGrant && !credit && isOpCredit && (
<Alert variant="info">
<CircleAlertIcon className="size-5" />
<AlertTitle>Grant application pending approval</AlertTitle>
<AlertDescription>
You will receive an email once your application&apos;s status
changes.
</AlertDescription>
</Alert>
)}
</div>
{!hasAppliedForOpGrant && isOpCredit && (
<div className="mt-2 flex justify-end border-t px-4 py-4 lg:px-6">
<Button asChild size="sm" variant="outline">
<Link
href={`/team/${teamSlug}/~/settings/credits`}
onClick={() => {
if (onClickApply) {
onClickApply();
}
}}
>
Apply Now
</Link>
</Button>
</div>
)}
</div>
);
};
@@ -2,41 +2,26 @@
// TODO - convert to RSC
import type { ThirdwebClient } from "thirdweb";
import { type Account, useAccountCredits } from "@/hooks/useApi";
import { useAccountCredits } from "@/hooks/useApi";
import { CreditsItem } from "./CreditsItem";
export const CreditsInfoCard = (props: {
twAccount: Account;
client: ThirdwebClient;
teamSlug: string;
}) => {
export const CreditsInfoCard = () => {
const { data: credits } = useAccountCredits();
if (!credits) {
return null;
}
const opCredit = credits.find((crd) => crd.name.startsWith("OP -"));
const restCredits = credits.filter((crd) => !crd.name.startsWith("OP -"));
if (restCredits.length === 0) {
return null;
}
return (
<section className="flex flex-col gap-4">
<CreditsItem
client={props.client}
credit={opCredit}
isOpCreditDefault={true}
teamSlug={props.teamSlug}
twAccount={props.twAccount}
/>
{restCredits?.map((credit) => (
<CreditsItem
client={props.client}
credit={credit}
key={credit.couponId}
teamSlug={props.teamSlug}
twAccount={props.twAccount}
/>
{restCredits.map((credit) => (
<CreditsItem credit={credit} key={credit.couponId} />
))}
</section>
);
@@ -60,7 +60,7 @@ function BillingWarning({ teamSlug }: { teamSlug: string }) {
You have outstanding invoices. Please{" "}
<Link
className="font-medium text-amber-700 underline transition-colors hover:text-amber-900 dark:text-amber-400 dark:hover:text-amber-300"
href={`/team/${teamSlug}/~/settings/invoices?status=open`}
href={`/team/${teamSlug}/~/billing/invoices?status=open`}
>
pay them
</Link>{" "}
@@ -1,3 +1,4 @@
import { ArrowLeftIcon } from "lucide-react";
import { useMemo, useState } from "react";
import { isAddress, NATIVE_TOKEN_ADDRESS, ZERO_ADDRESS } from "thirdweb";
import { Button } from "@/components/ui/button";
@@ -109,10 +110,10 @@ export function CurrencySelector({
className="rounded-r-none rounded-l-md"
onClick={() => setIsAddingCurrency(false)}
>
&lt;-
<ArrowLeftIcon className="size-4" />
</Button>
<Input
className="w-full rounded-none"
className={cn("w-full rounded-none", className)}
onChange={(e) => setEditCustomCurrency(e.target.value)}
placeholder="ERC20 Address"
required
@@ -156,7 +157,7 @@ export function CurrencySelector({
: value?.toLowerCase()
}
>
<SelectTrigger>
<SelectTrigger className={className}>
<SelectValue placeholder="Select Currency" />
</SelectTrigger>
<SelectContent>
@@ -1,4 +1,3 @@
import { FilePreview } from "@app/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/_common/file-preview";
import { FilePlusIcon, UploadIcon } from "lucide-react";
import { useCallback, useEffect, useRef } from "react";
import {
@@ -8,6 +7,7 @@ import {
useDropzone,
} from "react-dropzone";
import type { ThirdwebClient } from "thirdweb";
import { FilePreview } from "@/components/blocks/file-preview";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
@@ -2,6 +2,7 @@ import { AsteriskIcon, InfoIcon } from "lucide-react";
import type React from "react";
import { Label } from "@/components/ui/label";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { cn } from "../../lib/utils";
export function FormFieldSetup(props: {
htmlFor?: string;
@@ -10,13 +11,22 @@ export function FormFieldSetup(props: {
children: React.ReactNode;
tooltip?: React.ReactNode;
isRequired: boolean;
labelClassName?: string;
labelContainerClassName?: string;
helperText?: React.ReactNode;
className?: string;
}) {
return (
<div className={props.className}>
<div className="mb-2 inline-flex items-center gap-1">
<Label htmlFor={props.htmlFor}>{props.label}</Label>
<div
className={cn(
"mb-2 inline-flex items-center gap-1",
props.labelContainerClassName,
)}
>
<Label htmlFor={props.htmlFor} className={props.labelClassName}>
{props.label}
</Label>
{props.isRequired && (
<AsteriskIcon className="size-3.5 text-destructive-text" />
@@ -44,7 +44,7 @@ export const GatedSwitch: React.FC<GatedSwitchProps> = (
<div className="flex w-full flex-col gap-2">
<Button asChild className="justify-start gap-2" size="sm">
<Link
href={`/team/${props.teamSlug}/~/settings/billing?showPlans=true&highlight=${props.requiredPlan}`}
href={`/team/${props.teamSlug}/~/billing?showPlans=true&highlight=${props.requiredPlan}`}
rel="noopener noreferrer"
target="_blank"
>
@@ -53,7 +53,7 @@ export function MobileSidebar(props: {
);
}
export function useActiveSidebarLink(links: SidebarLink[]) {
function useActiveSidebarLink(links: SidebarLink[]) {
const pathname = usePathname();
const activeLink = useMemo(() => {
@@ -152,6 +152,7 @@ export function SingleNetworkSelector(props: {
disableChainId?: boolean;
align?: "center" | "start" | "end";
disableTestnets?: boolean;
disableDeprecated?: boolean;
placeholder?: string;
client: ThirdwebClient;
}) {
@@ -169,8 +170,17 @@ export function SingleNetworkSelector(props: {
chains = chains.filter((chain) => chainIdSet.has(chain.chainId));
}
if (props.disableDeprecated) {
chains = chains.filter((chain) => chain.status !== "deprecated");
}
return chains;
}, [allChains, props.chainIds, props.disableTestnets]);
}, [
allChains,
props.chainIds,
props.disableTestnets,
props.disableDeprecated,
]);
const options = useMemo(() => {
return chainsToShow.map((chain) => {
@@ -1,24 +1,7 @@
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupContent,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
SidebarMenuSubItem,
SidebarRail,
SidebarSeparator,
SidebarTrigger,
useSidebar,
} from "@/components/ui/sidebar";
"use client";
import { cn } from "../../lib/utils";
import { AppFooter } from "../footers/app-footer";
import { NavLink } from "../ui/NavLink";
import { Separator } from "../ui/separator";
import { MobileSidebar, useActiveSidebarLink } from "./MobileSidebar";
import { MobileSidebar } from "./MobileSidebar";
import { CustomSidebar, type SidebarLink } from "./Sidebar";
export function SidebarLayout(props: {
@@ -51,129 +34,3 @@ export function SidebarLayout(props: {
</div>
);
}
export function FullWidthSidebarLayout(props: {
contentSidebarLinks: SidebarLink[];
footerSidebarLinks?: SidebarLink[];
children: React.ReactNode;
className?: string;
}) {
const { contentSidebarLinks, children, footerSidebarLinks } = props;
return (
<div
className={cn(
"relative flex w-full flex-1 overflow-y-hidden",
props.className,
)}
>
{/* left - sidebar */}
<Sidebar className="pt-2" collapsible="icon" side="left">
<SidebarContent className="p-2">
<RenderSidebarMenu links={contentSidebarLinks} />
</SidebarContent>
{footerSidebarLinks && (
<SidebarFooter className="pb-3">
<RenderSidebarMenu links={footerSidebarLinks} />
</SidebarFooter>
)}
<SidebarRail />
</Sidebar>
{/* right - content */}
<div className="flex h-full flex-grow flex-col overflow-y-auto">
<MobileSidebarTrigger
links={[...contentSidebarLinks, ...(footerSidebarLinks || [])]}
/>
<main className="flex min-w-0 grow flex-col max-sm:w-full">
{children}
</main>
<AppFooter containerClassName="max-w-7xl" />
</div>
</div>
);
}
function RenderSidebarGroup(props: {
sidebarLinks: SidebarLink[];
groupName: string;
}) {
return (
<SidebarGroup className="p-0">
<SidebarMenuItem>
<SidebarGroupLabel> {props.groupName}</SidebarGroupLabel>
<SidebarGroupContent>
<RenderSidebarMenu links={props.sidebarLinks} />
</SidebarGroupContent>
</SidebarMenuItem>
</SidebarGroup>
);
}
function RenderSidebarMenu(props: { links: SidebarLink[] }) {
const sidebar = useSidebar();
return (
<SidebarMenu className="gap-1.5">
{props.links.map((link, idx) => {
// link
if ("href" in link) {
return (
<SidebarMenuSubItem key={link.href}>
<SidebarMenuButton asChild>
<NavLink
activeClassName="text-foreground bg-accent"
className="flex items-center gap-2 text-muted-foreground text-sm hover:bg-accent"
exactMatch={link.exactMatch}
href={link.href}
isActive={link.isActive}
onClick={() => {
sidebar.setOpenMobile(false);
}}
>
{link.icon && <link.icon className="size-4" />}
<span>{link.label}</span>
</NavLink>
</SidebarMenuButton>
</SidebarMenuSubItem>
);
}
// separator
if ("separator" in link) {
return (
<SidebarSeparator
className="my-1"
key={`separator-${
// biome-ignore lint/suspicious/noArrayIndexKey: index is fine here
idx
}`}
/>
);
}
// group
return (
<RenderSidebarGroup
groupName={link.group}
key={link.group}
sidebarLinks={link.links}
/>
);
})}
</SidebarMenu>
);
}
function MobileSidebarTrigger(props: { links: SidebarLink[] }) {
const activeLink = useActiveSidebarLink(props.links);
return (
<div className="flex items-center gap-3 border-b px-4 py-4 lg:hidden">
<SidebarTrigger className="size-4" />
<Separator className="h-4" orientation="vertical" />
{activeLink && <span className="text-sm">{activeLink.label}</span>}
</div>
);
}
@@ -1,3 +1,4 @@
/** biome-ignore-all lint/a11y/useSemanticElements: FIXME */
"use client";
import {
@@ -164,7 +165,6 @@ export function TWTable<TRowData>(tableProps: TWTableProps<TRowData>) {
return (
<TableRow
key={row.id}
// biome-ignore lint/a11y/useSemanticElements: FIXME
role="group"
{...(tableProps.onRowClick
? {
@@ -45,7 +45,7 @@ export function TeamPlanBadge(props: {
}
e.stopPropagation();
e.preventDefault();
router.push(`/team/${props.teamSlug}/~/settings/billing?showPlans=true`);
router.push(`/team/${props.teamSlug}/~/billing?showPlans=true`);
}
return (
@@ -11,9 +11,10 @@ import { SelectWithSearch } from "@/components/blocks/select-with-search";
import { Badge } from "@/components/ui/badge";
import { useAllChainsData } from "@/hooks/chains/allChains";
import { useTokensData } from "@/hooks/tokens";
import { replaceIpfsUrl } from "@/lib/sdk";
import { cn } from "@/lib/utils";
import { fallbackChainIcon } from "@/utils/chain-icons";
import { resolveSchemeWithErrorHandler } from "@/utils/resolveSchemeWithErrorHandler";
import { Spinner } from "../ui/Spinner/Spinner";
type Option = { label: string; value: string };
@@ -121,7 +122,10 @@ export function TokenSelector(props: {
return option.label;
}
const resolvedSrc = token.iconUri
? replaceIpfsUrl(token.iconUri, props.client)
? resolveSchemeWithErrorHandler({
client: props.client,
uri: token.iconUri,
})
: fallbackChainIcon;
return (
@@ -186,9 +190,14 @@ export function TokenSelector(props: {
options={options}
overrideSearchFn={searchFn}
placeholder={
tokensQuery.isPending
? "Loading Tokens"
: props.placeholder || "Select Token"
tokensQuery.isPending ? (
<div className="flex items-center gap-2">
<Spinner className="size-4" />
<span>Loading tokens</span>
</div>
) : (
props.placeholder || "Select Token"
)
}
popoverContentClassName={props.popoverContentClassName}
renderOption={renderOption}
@@ -38,12 +38,18 @@ const ACCENT = {
type UpsellBannerCardProps = {
title: React.ReactNode;
description: React.ReactNode;
cta: {
text: React.ReactNode;
icon?: React.ReactNode;
target?: "_blank";
link: string;
};
cta?:
| {
text: React.ReactNode;
icon?: React.ReactNode;
target?: "_blank";
link: string;
}
| {
text: React.ReactNode;
icon?: React.ReactNode;
onClick: () => void;
};
accentColor?: keyof typeof ACCENT;
icon?: React.ReactNode;
};
@@ -93,25 +99,41 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
</div>
</div>
<Button
asChild
className={cn(
"mt-2 gap-2 hover:translate-y-0 hover:shadow-inner sm:mt-0",
color.btn,
)}
size="sm"
>
<Link
href={props.cta.link}
rel={
props.cta.target === "_blank" ? "noopener noreferrer" : undefined
}
target={props.cta.target}
{props.cta && "target" in props.cta ? (
<Button
asChild
className={cn(
"mt-2 gap-2 hover:translate-y-0 hover:shadow-inner sm:mt-0",
color.btn,
)}
size="sm"
>
<Link
href={props.cta.link}
rel={
props.cta.target === "_blank"
? "noopener noreferrer"
: undefined
}
target={props.cta.target}
>
{props.cta.text}
{props.cta.icon && <span className="ml-2">{props.cta.icon}</span>}
</Link>
</Button>
) : props.cta && "onClick" in props.cta ? (
<Button
className={cn(
"mt-2 gap-2 hover:translate-y-0 hover:shadow-inner sm:mt-0",
color.btn,
)}
onClick={props.cta.onClick}
size="sm"
>
{props.cta.text}
{props.cta.icon && <span className="ml-2">{props.cta.icon}</span>}
</Link>
</Button>
</Button>
) : null}
</div>
</div>
);
@@ -29,6 +29,7 @@ type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
title: string;
description?: string;
titleClassName?: string;
headerClassName?: string;
};
customHeader?: React.ReactNode;
// chart config
@@ -52,6 +53,12 @@ type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
toolTipLabelFormatter?: (label: string, payload: unknown) => React.ReactNode;
toolTipValueFormatter?: (value: unknown) => React.ReactNode;
emptyChartState?: React.ReactElement;
margin?: {
top?: number;
right?: number;
bottom?: number;
left?: number;
};
};
export function ThirdwebAreaChart<TConfig extends ChartConfig>(
@@ -62,7 +69,7 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
return (
<Card className={props.className}>
{props.header && (
<CardHeader>
<CardHeader className={props.header.headerClassName}>
<CardTitle className={cn("mb-2", props.header.titleClassName)}>
{props.header.title}
</CardTitle>
@@ -85,7 +92,16 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
{props.emptyChartState}
</EmptyChartState>
) : (
<AreaChart accessibilityLayer data={props.data}>
<AreaChart
accessibilityLayer
data={props.data}
margin={{
right: props.margin?.right ?? 0,
left: props.margin?.left ?? 0,
bottom: props.margin?.bottom ?? 10,
top: props.margin?.top ?? 0,
}}
>
<CartesianGrid vertical={false} />
{props.yAxis && <YAxis axisLine={false} tickLine={false} />}
<XAxis
@@ -3,6 +3,7 @@ import type React from "react";
import { type Dispatch, type SetStateAction, useMemo } from "react";
import { CodeClient } from "@/components/ui/code/code.client";
import { TabButtons } from "@/components/ui/tabs";
import { cn } from "@/lib/utils";
export type CodeEnvironment =
| "javascript"
@@ -50,6 +51,7 @@ interface CodeSegmentProps {
isInstallCommand?: boolean;
hideTabs?: boolean;
onlyTabs?: boolean;
codeContainerClassName?: string;
}
export const CodeSegment: React.FC<CodeSegmentProps> = ({
@@ -59,6 +61,7 @@ export const CodeSegment: React.FC<CodeSegmentProps> = ({
isInstallCommand,
hideTabs,
onlyTabs,
codeContainerClassName,
}) => {
const activeEnvironment: CodeEnvironment = useMemo(() => {
return (
@@ -86,7 +89,7 @@ export const CodeSegment: React.FC<CodeSegmentProps> = ({
return (
<div
className={
"flex flex-col overflow-hidden rounded-lg border border-border"
"flex flex-col overflow-hidden rounded-lg border border-border grow"
}
>
{!hideTabs && (
@@ -106,7 +109,11 @@ export const CodeSegment: React.FC<CodeSegmentProps> = ({
{onlyTabs ? null : (
<CodeClient
className="rounded-none border-none"
className={cn(
"rounded-none border-none grow",
codeContainerClassName,
)}
scrollableContainerClassName="h-full"
code={code}
lang={
isInstallCommand
@@ -0,0 +1,45 @@
"use client";
import { ArrowDownToLineIcon, FileTextIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { CodeClient } from "@/components/ui/code/code.client";
import { handleDownload } from "../download-file-button";
export function DownloadableCode(props: {
code: string;
lang: "csv" | "json";
fileNameWithExtension: string;
}) {
return (
<div className="!my-5 bg-card">
<p className="text-sm text-muted-foreground border border-b-0 px-4 py-3 pr-3.5 rounded-lg rounded-b-none flex items-center justify-between">
<span className="flex items-center gap-1.5">
<FileTextIcon className="size-3.5" />
{props.fileNameWithExtension}
</span>
<Button
className="h-auto bg-background p-2"
onClick={() => {
handleDownload({
fileContent: props.code,
fileFormat:
props.lang === "csv" ? "text/csv" : "application/json",
fileNameWithExtension: props.fileNameWithExtension,
});
}}
size="sm"
variant="outline"
>
<ArrowDownToLineIcon className="size-3" />
</Button>
</p>
<div className="relative">
<CodeClient
code={props.code}
lang={props.lang}
scrollableClassName="max-h-[300px] bg-background bg-card"
className="rounded-t-none"
/>
</div>
</div>
);
}
@@ -1,5 +1,6 @@
import { ArrowDownToLineIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
export function handleDownload(params: {
fileContent: string;
@@ -22,10 +23,14 @@ export function DownloadFileButton(props: {
fileNameWithExtension: string;
fileFormat: "text/csv" | "application/json";
label: string;
variant?: "default" | "outline";
className?: string;
iconClassName?: string;
}) {
return (
<Button
className="gap-2"
className={cn("gap-2", props.className)}
variant={props.variant}
onClick={() => {
handleDownload({
fileContent: props.fileContent,
@@ -35,7 +40,7 @@ export function DownloadFileButton(props: {
}}
size="sm"
>
<ArrowDownToLineIcon className="size-4" />
<ArrowDownToLineIcon className={cn("size-4", props.iconClassName)} />
{props.label}
</Button>
);
@@ -26,7 +26,7 @@ export function DropZone(props: {
return (
<div
className={cn(
"flex cursor-pointer items-center justify-center rounded-md border border-dashed bg-card py-10 hover:border-active-border",
"flex cursor-pointer items-center justify-center rounded-md border border-dashed bg-card py-10 hover:border-active-border px-4",
props.isError &&
"border-red-500 bg-red-200/30 text-red-500 hover:border-red-600 dark:border-red-900 dark:bg-red-900/30 dark:hover:border-red-800",
props.className,
@@ -37,7 +37,12 @@ export function FilePreview(props: {
if (!objectUrl) {
return (
<div className={cn("flex items-center justify-center", props.className)}>
<div
className={cn(
"flex items-center justify-center bg-accent",
props.className,
)}
>
<ImageOffIcon className="size-6 text-muted-foreground" />
</div>
);
@@ -56,7 +61,10 @@ export function FilePreview(props: {
return (
<MediaRenderer
className={cn(props.className, "[&>div]:!bg-muted")}
className={cn(
props.className,
"[&>div]:!bg-accent [&_a]:!text-muted-foreground [&_a]:!no-underline [&_svg]:!size-6 [&_svg]:!text-muted-foreground relative overflow-hidden",
)}
client={props.client}
src={objectUrl}
/>
@@ -0,0 +1,304 @@
"use client";
import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
import { usePathname } from "next/navigation";
import { useMemo } from "react";
import { AppFooter } from "@/components/footers/app-footer";
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/ui/collapsible";
import { DynamicHeight } from "@/components/ui/DynamicHeight";
import { NavLink } from "@/components/ui/NavLink";
import { Separator } from "@/components/ui/separator";
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupContent,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
SidebarMenuSub,
SidebarMenuSubItem,
SidebarRail,
SidebarSeparator,
SidebarTrigger,
useSidebar,
} from "@/components/ui/sidebar";
import { cn } from "@/lib/utils";
type ShadcnSidebarBaseLink = {
href: string;
label: React.ReactNode;
exactMatch?: boolean;
icon?: React.FC<{ className?: string }>;
isActive?: (pathname: string) => boolean;
};
type ShadcnSidebarLink =
| ShadcnSidebarBaseLink
| {
group: string;
links: ShadcnSidebarBaseLink[];
}
| {
separator: true;
}
| {
subMenu: Omit<ShadcnSidebarBaseLink, "href" | "exactMatch">;
links: Omit<ShadcnSidebarBaseLink, "icon">[];
};
export function FullWidthSidebarLayout(props: {
contentSidebarLinks: ShadcnSidebarLink[];
footerSidebarLinks?: ShadcnSidebarLink[];
children: React.ReactNode;
className?: string;
}) {
const { contentSidebarLinks, children, footerSidebarLinks } = props;
return (
<div
className={cn(
"relative flex w-full flex-1 overflow-y-hidden",
props.className,
)}
>
{/* left - sidebar */}
<Sidebar className="pt-2" collapsible="icon" side="left">
<SidebarContent className="p-2">
<RenderSidebarMenu links={contentSidebarLinks} />
</SidebarContent>
{footerSidebarLinks && (
<SidebarFooter className="pb-3">
<RenderSidebarMenu links={footerSidebarLinks} />
</SidebarFooter>
)}
<SidebarRail />
</Sidebar>
{/* right - content */}
<div className="flex h-full flex-grow flex-col overflow-y-auto">
<MobileSidebarTrigger
links={[...contentSidebarLinks, ...(footerSidebarLinks || [])]}
/>
<main className="flex min-w-0 grow flex-col max-sm:w-full">
{children}
</main>
<AppFooter containerClassName="max-w-7xl" />
</div>
</div>
);
}
function MobileSidebarTrigger(props: { links: ShadcnSidebarLink[] }) {
const activeLink = useActiveShadcnSidebarLink(props.links);
const parentSubNav = props.links.find(
(link) =>
"subMenu" in link && link.links.some((l) => l.href === activeLink?.href),
);
return (
<div className="flex items-center gap-3 border-b px-4 py-4 lg:hidden">
<SidebarTrigger className="size-4" />
<Separator
className="h-4 bg-muted-foreground/50"
orientation="vertical"
/>
{parentSubNav && "subMenu" in parentSubNav && (
<>
<span className="text-sm">{parentSubNav.subMenu.label}</span>
<ChevronRightIcon className="size-4 text-muted-foreground/50 -mx-1.5" />
</>
)}
{activeLink && <span className="text-sm">{activeLink.label}</span>}
</div>
);
}
function useActiveShadcnSidebarLink(links: ShadcnSidebarLink[]) {
const pathname = usePathname();
const activeLink = useMemo(() => {
function isActive(link: ShadcnSidebarBaseLink) {
if (link.exactMatch) {
return link.href === pathname;
}
return pathname?.startsWith(link.href);
}
for (const link of links) {
if ("links" in link) {
for (const subLink of link.links) {
if (isActive(subLink)) {
return subLink;
}
}
} else if ("href" in link) {
if (isActive(link)) {
return link;
}
}
}
}, [links, pathname]);
return activeLink;
}
function useIsSubnavActive(links: ShadcnSidebarBaseLink[]) {
const pathname = usePathname();
const isSubnavActive = useMemo(() => {
function isActive(link: ShadcnSidebarBaseLink) {
if (link.exactMatch) {
return link.href === pathname;
}
return pathname?.startsWith(link.href);
}
return links.some(isActive);
}, [links, pathname]);
return isSubnavActive;
}
function RenderSidebarGroup(props: {
sidebarLinks: ShadcnSidebarLink[];
groupName: string;
}) {
return (
<SidebarGroup className="p-0">
<SidebarMenuItem>
<SidebarGroupLabel> {props.groupName}</SidebarGroupLabel>
<SidebarGroupContent>
<RenderSidebarMenu links={props.sidebarLinks} />
</SidebarGroupContent>
</SidebarMenuItem>
</SidebarGroup>
);
}
function RenderSidebarSubmenu(props: {
links: ShadcnSidebarBaseLink[];
subMenu: Omit<ShadcnSidebarBaseLink, "href" | "exactMatch">;
}) {
const sidebar = useSidebar();
const isSubnavActive = useIsSubnavActive(props.links);
return (
<SidebarMenu>
<DynamicHeight transition="height 200ms ease">
<Collapsible className="group/collapsible" defaultOpen={isSubnavActive}>
<SidebarMenuItem>
<CollapsibleTrigger asChild>
<SidebarMenuButton className="text-sm text-muted-foreground whitespace-nowrap">
{props.subMenu.icon && (
<props.subMenu.icon className="size-4" />
)}
<span>{props.subMenu.label}</span>
<ChevronDownIcon className="ml-auto group-[[data-state=open]]/collapsible:rotate-180 transition-transform" />
</SidebarMenuButton>
</CollapsibleTrigger>
<CollapsibleContent className="mt-0.5">
<SidebarMenuSub className="pr-0 pl-2">
{props.links.map((link) => {
return (
<SidebarMenuSubItem key={link.href}>
<NavLink
activeClassName="text-foreground bg-accent "
className="flex items-center gap-2 text-muted-foreground text-sm hover:bg-accent hover:text-foreground px-2 py-1.5 rounded-lg w-full"
exactMatch={link.exactMatch}
href={link.href}
isActive={link.isActive}
onClick={() => {
sidebar.setOpenMobile(false);
}}
>
{link.icon && <link.icon className="size-4" />}
<span className="whitespace-nowrap">{link.label}</span>
</NavLink>
</SidebarMenuSubItem>
);
})}
</SidebarMenuSub>
</CollapsibleContent>
</SidebarMenuItem>
</Collapsible>
</DynamicHeight>
</SidebarMenu>
);
}
function RenderSidebarMenu(props: { links: ShadcnSidebarLink[] }) {
const sidebar = useSidebar();
return (
<SidebarMenu className="gap-1.5">
{props.links.map((link, idx) => {
// link
if ("href" in link) {
return (
<SidebarMenuSubItem key={link.href}>
<SidebarMenuButton asChild>
<NavLink
activeClassName="text-foreground bg-accent"
className="flex items-center gap-2 text-muted-foreground text-sm hover:bg-accent"
exactMatch={link.exactMatch}
href={link.href}
isActive={link.isActive}
onClick={() => {
sidebar.setOpenMobile(false);
}}
>
{link.icon && <link.icon className="size-4" />}
<span>{link.label}</span>
</NavLink>
</SidebarMenuButton>
</SidebarMenuSubItem>
);
}
// separator
if ("separator" in link) {
return (
<SidebarSeparator
className="my-1"
key={`separator-${
// biome-ignore lint/suspicious/noArrayIndexKey: index is fine here
idx
}`}
/>
);
}
// subnav
if ("subMenu" in link) {
return (
<RenderSidebarSubmenu
key={`submenu_$${
// biome-ignore lint/suspicious/noArrayIndexKey: index is fine here
idx
}`}
links={link.links}
subMenu={link.subMenu}
/>
);
}
// group
return (
<RenderSidebarGroup
groupName={link.group}
key={link.group}
sidebarLinks={link.links}
/>
);
})}
</SidebarMenu>
);
}
@@ -94,7 +94,7 @@ export const MarkdownRenderer: React.FC<{
<h2
className={cn(
commonHeadingClassName,
"mb-3 border-border border-b pb-2 text-xl md:text-2xl",
"mb-3 border-dashed border-b pb-2 text-xl md:text-2xl",
)}
{...cleanedProps(props)}
/>
@@ -105,7 +105,7 @@ export const MarkdownRenderer: React.FC<{
{...cleanedProps(props)}
className={cn(
commonHeadingClassName,
"mt-8 mb-3 border-border border-b pb-2 text-lg md:text-xl",
"mt-8 mb-3 border-dashed border-b pb-2 text-lg md:text-xl",
)}
/>
),
@@ -147,7 +147,7 @@ export const MarkdownRenderer: React.FC<{
li: ({ children: c, ...props }) => (
<li
className={cn(
"mb-1.5 text-muted-foreground leading-loose [&>p]:m-0",
"text-muted-foreground leading-relaxed [&>p]:m-0",
markdownProps.li?.className,
)}
{...cleanedProps(props)}
@@ -157,7 +157,7 @@ export const MarkdownRenderer: React.FC<{
),
ol: (props) => (
<ol
className="mb-4 list-outside list-decimal pl-5 [&_ol_li:first-of-type]:mt-1.5 [&_ul_li:first-of-type]:mt-1.5"
className="mb-4 list-outside list-decimal pl-4 space-y-2 [&>li]:first:mt-2"
{...cleanedProps(props)}
/>
),
@@ -165,7 +165,7 @@ export const MarkdownRenderer: React.FC<{
p: (props) => (
<p
className={cn(
"mb-4 text-muted-foreground leading-loose",
"mb-3 text-muted-foreground leading-7",
markdownProps.p?.className,
)}
{...cleanedProps(props)}
@@ -201,7 +201,7 @@ export const MarkdownRenderer: React.FC<{
ul: (props) => {
return (
<ul
className="mb-4 list-outside list-disc pl-5 [&_ol_li:first-of-type]:mt-1.5 [&_ul_li:first-of-type]:mt-1.5"
className="mb-4 list-outside list-disc pl-4 space-y-2 [&>li]:first:mt-2"
{...cleanedProps(props)}
/>
);
@@ -18,7 +18,7 @@ export type MultiStepState<T extends string> = {
}
| {
type: "error";
message: React.ReactNode;
message: string;
};
label: string;
description?: string;
@@ -27,6 +27,10 @@ export type MultiStepState<T extends string> = {
export function MultiStepStatus<T extends string>(props: {
steps: MultiStepState<T>[];
onRetry: (step: MultiStepState<T>) => void;
renderError?: (
step: MultiStepState<T>,
errorMessage: string,
) => React.ReactNode;
}) {
return (
<DynamicHeight>
@@ -66,22 +70,24 @@ export function MultiStepStatus<T extends string>(props: {
</p>
)}
{step.status.type === "error" && (
<div className="mt-1 space-y-2">
<p className="mb-1 text-red-500 text-sm">
{step.status.message}
</p>
<Button
className="gap-2"
onClick={() => props.onRetry(step)}
size="sm"
variant="destructive"
>
<RefreshCwIcon className="size-4" />
Retry
</Button>
</div>
)}
{step.status.type === "error"
? props.renderError?.(step, step.status.message) || (
<div className="mt-1 space-y-2">
<p className="mb-1 text-red-500 text-sm">
{step.status.message}
</p>
<Button
className="gap-2"
onClick={() => props.onRetry(step)}
size="sm"
variant="destructive"
>
<RefreshCwIcon className="size-4" />
Retry
</Button>
</div>
)
: null}
</div>
</div>
))}
@@ -48,7 +48,7 @@ export const PaginationButtons = (props: {
<PaginationContent>
<PaginationItem>
<PaginationPrevious
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
disabled={activePage === 1}
onClick={() => {
setPage(activePage - 1);
@@ -57,7 +57,7 @@ export const PaginationButtons = (props: {
</PaginationItem>
<PaginationItem>
<PaginationNext
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
disabled={activePage === totalPages}
onClick={() => {
setPage(activePage + 1);
@@ -78,7 +78,7 @@ export const PaginationButtons = (props: {
{pages.map((page) => (
<PaginationItem key={page}>
<PaginationLink
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
isActive={activePage === page}
onClick={() => {
setPage(page);
@@ -98,7 +98,7 @@ export const PaginationButtons = (props: {
<PaginationContent>
<PaginationItem>
<PaginationPrevious
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
disabled={activePage === 1}
onClick={() => {
setPage(activePage - 1);
@@ -111,7 +111,7 @@ export const PaginationButtons = (props: {
<>
<PaginationItem>
<PaginationLink
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
onClick={() => {
setPage(1);
}}
@@ -129,7 +129,7 @@ export const PaginationButtons = (props: {
{activePage - 1 > 0 && (
<PaginationItem className="max-sm:hidden">
<PaginationLink
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
onClick={() => {
setPage(activePage - 1);
}}
@@ -140,7 +140,7 @@ export const PaginationButtons = (props: {
)}
<PaginationItem>
<PaginationLink className="rounded-full" isActive>
<PaginationLink className="rounded-full lg:min-w-[38px]" isActive>
{activePage}
</PaginationLink>
</PaginationItem>
@@ -148,7 +148,7 @@ export const PaginationButtons = (props: {
{activePage + 1 <= totalPages && (
<PaginationItem className="max-sm:hidden">
<PaginationLink
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
onClick={() => {
setPage(activePage + 1);
}}
@@ -167,7 +167,7 @@ export const PaginationButtons = (props: {
<PaginationItem>
<PaginationLink
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
onClick={() => {
setPage(totalPages);
}}
@@ -180,7 +180,7 @@ export const PaginationButtons = (props: {
<PaginationItem>
<PaginationNext
className="rounded-full"
className="rounded-full lg:min-w-[38px]"
disabled={activePage === totalPages}
onClick={() => {
setPage(activePage + 1);
@@ -1,3 +1,4 @@
/** biome-ignore-all lint/a11y/useSemanticElements: FIXME */
"use client";
import { CheckIcon, ChevronDownIcon, SearchIcon } from "lucide-react";
@@ -21,7 +22,7 @@ interface SelectWithSearchProps
}[];
value: string | undefined;
onValueChange: (value: string) => void;
placeholder: string;
placeholder: string | React.ReactNode;
searchPlaceholder?: string;
className?: string;
overrideSearchFn?: (
@@ -190,7 +191,6 @@ export const SelectWithSearch = React.forwardRef<
ref={
i === optionsToShow.length - 1 ? lastItemRef : undefined
}
// biome-ignore lint/a11y/useSemanticElements: TDOO
role="option"
variant="ghost"
>
@@ -1,6 +1,6 @@
"use client";
import { CrownIcon, LockIcon, SparklesIcon } from "lucide-react";
import { CrownIcon, LockIcon } from "lucide-react";
import Link from "next/link";
import type React from "react";
import type { Team } from "@/api/team";
@@ -111,18 +111,15 @@ export function UpsellContent(props: {
<CardContent className="space-y-6">
{props.benefits && props.benefits.length > 0 && (
<div className="space-y-3">
<h4 className="font-semibold text-muted-foreground text-sm uppercase tracking-wide">
What you'll get:
<h4 className="font-semibold text-foreground text-sm capitalize text-center">
What you'll get
</h4>
<div className="grid gap-2">
<div className="grid gap-1.5">
{props.benefits.map((benefit) => (
<div
className="flex items-center gap-3"
className="flex items-center justify-center gap-3 text-center text-balance"
key={benefit.description}
>
<div className="flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full bg-accent">
<SparklesIcon className="h-3 w-3 text-success-text" />
</div>
<span className="text-sm">{benefit.description}</span>
{benefit.status === "soon" && (
<Badge className="text-xs" variant="secondary">
@@ -138,7 +135,7 @@ export function UpsellContent(props: {
<div className="flex flex-col gap-3 pt-4 sm:flex-row">
<Button asChild className="flex-1 py-3 font-semibold" size="lg">
<Link
href={`/team/${props.teamSlug}/~/settings/billing?showPlans=true&highlight=${props.requiredPlan}`}
href={`/team/${props.teamSlug}/~/billing?showPlans=true&highlight=${props.requiredPlan}`}
>
<CrownIcon className="mr-2 h-4 w-4" />
Upgrade to{" "}
@@ -146,9 +143,7 @@ export function UpsellContent(props: {
</Link>
</Button>
<Button asChild className="md:flex-1" size="lg" variant="outline">
<Link
href={`/team/${props.teamSlug}/~/settings/billing?showPlans=true`}
>
<Link href={`/team/${props.teamSlug}/~/billing?showPlans=true`}>
View All Plans
</Link>
</Button>
@@ -23,7 +23,6 @@ export function WalletAddress(props: {
className?: string;
iconClassName?: string;
client: ThirdwebClient;
preventOpenOnFocus?: boolean;
}) {
// default back to zero address if no address provided
const address = useMemo(() => props.address || ZERO_ADDRESS, [props.address]);
@@ -59,15 +58,16 @@ export function WalletAddress(props: {
// special case for zero address
if (address === ZERO_ADDRESS) {
return <span className="cursor-pointer font-mono">{shortenedAddress}</span>;
return (
<span className={cn("cursor-pointer font-mono", props.className)}>
{shortenedAddress}
</span>
);
}
return (
<HoverCard>
<HoverCardTrigger
asChild
tabIndex={props.preventOpenOnFocus ? -1 : undefined}
>
<HoverCardTrigger asChild tabIndex={-1}>
<Button
className={cn(
"flex flex-row items-center gap-2 px-0",
@@ -116,13 +116,12 @@ export function ChatBar(props: {
) : (
<Button
aria-label="Send"
className="!h-auto w-auto border border-nebula-pink-foreground p-2 disabled:opacity-100"
className="!h-auto w-auto p-2 disabled:opacity-100"
disabled={message.trim() === "" || props.isConnectingWallet}
onClick={() => {
if (message.trim() === "") return;
handleSubmit(message);
}}
variant="pink"
>
<ArrowUpIcon className="size-4" />
</Button>
@@ -1,8 +1,10 @@
"use client";
import { MessageCircleIcon, XIcon } from "lucide-react";
import { useSelectedLayoutSegments } from "next/navigation";
import { useCallback, useRef, useState } from "react";
import { createThirdwebClient } from "thirdweb";
import type { Team } from "@/api/team";
import { Button } from "@/components/ui/button";
import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "@/constants/public-envs";
import { cn } from "@/lib/utils";
@@ -14,22 +16,22 @@ const client = createThirdwebClient({
});
export function CustomChatButton(props: {
isLoggedIn: boolean;
networks: "mainnet" | "testnet" | "all" | null;
isFloating: boolean;
pageType: "chain" | "contract" | "support";
label: string;
examplePrompts: string[];
authToken: string | undefined;
teamId: string | undefined;
authToken: string;
team: Team;
clientId: string | undefined;
requireLogin?: boolean;
}) {
const layoutSegments = useSelectedLayoutSegments();
const [isOpen, setIsOpen] = useState(false);
const [hasBeenOpened, setHasBeenOpened] = useState(false);
const closeModal = useCallback(() => setIsOpen(false), []);
const ref = useRef<HTMLDivElement>(null);
if (layoutSegments[0] === "~" && layoutSegments[1] === "support") {
return null;
}
return (
<>
{/* Inline Button (not floating) */}
@@ -54,14 +56,14 @@ export function CustomChatButton(props: {
ref={ref}
>
{/* Header with close button */}
<div className="flex items-center justify-between border-b px-4 py-2">
<div className="flex items-center justify-between border-b px-4 py-4">
<div className="flex items-center gap-2 font-semibold text-lg">
<MessageCircleIcon className="size-5 text-muted-foreground" />
{props.label}
</div>
<Button
aria-label="Close chat"
className="h-auto w-auto p-1 text-muted-foreground"
className="h-auto w-auto p-1 text-muted-foreground rounded-full"
onClick={closeModal}
size="icon"
variant="ghost"
@@ -80,9 +82,7 @@ export function CustomChatButton(props: {
message: prompt,
title: prompt,
}))}
networks={props.networks}
requireLogin={props.requireLogin}
teamId={props.teamId}
team={props.team}
/>
)}
</div>
@@ -1,44 +1,36 @@
"use client";
import { ArrowRightIcon } from "lucide-react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useCallback, useState } from "react";
import type { ThirdwebClient } from "thirdweb";
import { useActiveWalletConnectionStatus } from "thirdweb/react";
import type { Team } from "@/api/team";
import { Button } from "@/components/ui/button";
import { NebulaIcon } from "@/icons/NebulaIcon";
import { ThirdwebMiniLogo } from "../../../app/(app)/components/ThirdwebMiniLogo";
import { ChatBar } from "./ChatBar";
import type { UserMessage, UserMessageContent } from "./CustomChats";
import { type CustomChatMessage, CustomChats } from "./CustomChats";
import type { ExamplePrompt, NebulaContext } from "./types";
import type { ExamplePrompt } from "./types";
export default function CustomChatContent(props: {
authToken: string | undefined;
teamId: string | undefined;
team: Team;
clientId: string | undefined;
client: ThirdwebClient;
examplePrompts: ExamplePrompt[];
networks: NebulaContext["networks"];
requireLogin?: boolean;
}) {
if (props.requireLogin !== false && !props.authToken) {
return <LoggedOutStateChatContent />;
}
return (
<CustomChatContentLoggedIn
authToken={props.authToken || ""}
client={props.client}
clientId={props.clientId}
examplePrompts={props.examplePrompts}
teamId={props.teamId}
team={props.team}
/>
);
}
function CustomChatContentLoggedIn(props: {
authToken: string;
teamId: string | undefined;
team: Team;
clientId: string | undefined;
client: ThirdwebClient;
examplePrompts: ExamplePrompt[];
@@ -55,6 +47,9 @@ function CustomChatContentLoggedIn(props: {
const [enableAutoScroll, setEnableAutoScroll] = useState(false);
const connectionStatus = useActiveWalletConnectionStatus();
const [showSupportForm, setShowSupportForm] = useState(false);
const [productLabel, setProductLabel] = useState("");
const handleSendMessage = useCallback(
async (userMessage: UserMessage) => {
const abortController = new AbortController();
@@ -96,7 +91,7 @@ function CustomChatContentLoggedIn(props: {
headers: {
Authorization: `Bearer ${props.authToken}`,
"Content-Type": "application/json",
...(props.teamId ? { "x-team-id": props.teamId } : {}),
"x-team-id": props.team.id,
...(props.clientId ? { "x-client-id": props.clientId } : {}),
},
method: "POST",
@@ -132,7 +127,7 @@ function CustomChatContentLoggedIn(props: {
setEnableAutoScroll(false);
}
},
[props.authToken, props.clientId, props.teamId, sessionId],
[props.authToken, props.clientId, props.team.id, sessionId],
);
const handleFeedback = useCallback(
@@ -165,7 +160,7 @@ function CustomChatContentLoggedIn(props: {
headers: {
Authorization: `Bearer ${props.authToken}`,
"Content-Type": "application/json",
...(props.teamId ? { "x-team-id": props.teamId } : {}),
"x-team-id": props.team.id,
},
method: "POST",
});
@@ -188,9 +183,20 @@ function CustomChatContentLoggedIn(props: {
// Consider implementing retry logic here
}
},
[sessionId, props.authToken, props.teamId, messages],
[sessionId, props.authToken, props.team.id, messages],
);
const handleAddSuccessMessage = useCallback((message: string) => {
setMessages((prev) => [
...prev,
{
type: "assistant" as const,
text: message,
request_id: undefined,
},
]);
}, []);
const showEmptyState = !userHasSubmittedMessage && messages.length === 0;
return (
<div className="flex grow flex-col overflow-hidden">
@@ -212,6 +218,12 @@ function CustomChatContentLoggedIn(props: {
sessionId={sessionId}
setEnableAutoScroll={setEnableAutoScroll}
useSmallText
showSupportForm={showSupportForm}
setShowSupportForm={setShowSupportForm}
productLabel={productLabel}
setProductLabel={setProductLabel}
team={props.team}
addSuccessMessage={handleAddSuccessMessage}
/>
)}
<ChatBar
@@ -245,42 +257,6 @@ function CustomChatContentLoggedIn(props: {
);
}
function LoggedOutStateChatContent() {
const pathname = usePathname();
return (
<div className="flex grow flex-col items-center justify-center p-4">
<div className="mb-4 flex justify-center">
<div className="rounded-full border p-1">
<div className="rounded-full border bg-card p-2">
<NebulaIcon className="size-7 text-muted-foreground" />
</div>
</div>
</div>
<h1 className="px-4 text-center font-semibold text-3xl tracking-tight md:text-4xl">
How can I help you <br className="max-sm:hidden" />
today?
</h1>
<div className="h-3" />
<p className="text-base text-muted-foreground">
Sign in to use AI Assistant
</p>
<div className="h-5" />
<Button asChild>
<Link
className="w-full max-w-96 gap-2"
href={`/login?next=${encodeURIComponent(pathname)}`}
>
Sign in
<ArrowRightIcon className="size-4" />
</Link>
</Button>
</div>
);
}
function EmptyStateChatPageContent(props: {
sendMessage: (message: UserMessage) => void;
examplePrompts: { title: string; message: string }[];
@@ -288,9 +264,12 @@ function EmptyStateChatPageContent(props: {
return (
<div className="flex flex-1 flex-col items-center justify-center overflow-auto p-4 ">
<div className="mb-4 flex justify-center">
<div className="rounded-full border-[1.5px] border-nebula-pink-foreground/20 bg-[hsl(var(--nebula-pink-foreground)/5%)] p-1">
<div className="rounded-full border-[1.5px] border-nebula-pink-foreground/40 bg-[hsl(var(--nebula-pink-foreground)/5%)] p-2">
<NebulaIcon className="size-7 text-nebula-pink-foreground" />
<div className="rounded-full border p-1 bg-muted/20">
<div className="rounded-full border p-2 bg-inverted">
<ThirdwebMiniLogo
isMonoChrome
className="size-7 text-inverted-foreground"
/>
</div>
</div>
</div>
@@ -301,11 +280,12 @@ function EmptyStateChatPageContent(props: {
</h1>
<div className="h-6" />
<div className="flex max-w-lg flex-col flex-wrap justify-center gap-2.5">
<div className="flex flex-col items-center justify-center gap-2.5 overflow-hidden">
{props.examplePrompts.map((prompt) => (
<Button
disabled={false}
key={prompt.title}
className="rounded-full text-xs sm:text-sm truncate bg-card w-fit h-auto py-1.5 whitespace-pre-wrap"
onClick={() =>
props.sendMessage({
content: [
@@ -1,15 +1,26 @@
import {
AlertCircleIcon,
MessageCircleIcon,
ArrowRightIcon,
ThumbsDownIcon,
ThumbsUpIcon,
} from "lucide-react";
import { useEffect, useRef, useState } from "react";
import type { ThirdwebClient } from "thirdweb";
import type { Team } from "@/api/team";
import { MarkdownRenderer } from "@/components/blocks/markdown-renderer";
import { DynamicHeight } from "@/components/ui/DynamicHeight";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { ScrollShadow } from "@/components/ui/ScrollShadow/ScrollShadow";
import { cn } from "@/lib/utils";
import { Reasoning } from "./Reasoning";
import { ThirdwebMiniLogo } from "../../../app/(app)/components/ThirdwebMiniLogo";
import { SupportTicketForm } from "../../../app/(app)/team/[team_slug]/(team)/~/support/_components/SupportTicketForm";
import { Button } from "../ui/button";
import { TextShimmer } from "../ui/text-shimmer";
// Define local types
export type UserMessageContent = { type: "text"; text: string };
@@ -46,11 +57,18 @@ export function CustomChats(props: {
enableAutoScroll: boolean;
useSmallText?: boolean;
sendMessage: (message: UserMessage) => void;
onFeedback?: (messageIndex: number, feedback: 1 | -1) => void;
onFeedback?: (messageIndex: number, feedback: 1 | -1) => Promise<void>;
showSupportForm: boolean;
setShowSupportForm: (v: boolean) => void;
productLabel: string;
setProductLabel: (v: string) => void;
team: Team;
addSuccessMessage?: (message: string) => void;
}) {
const { messages, setEnableAutoScroll, enableAutoScroll } = props;
const scrollAnchorRef = useRef<HTMLDivElement>(null);
const chatContainerRef = useRef<HTMLDivElement>(null);
const [supportTicketCreated, setSupportTicketCreated] = useState(false);
// auto scroll to bottom when messages change
// eslint-disable-next-line no-restricted-syntax
@@ -86,6 +104,8 @@ export function CustomChats(props: {
chatScrollContainer.addEventListener("wheel", disableScroll);
}, [setEnableAutoScroll, enableAutoScroll]);
const [showSupportFormDialog, setShowSupportFormDialog] = useState(false);
return (
<div
className="relative flex max-h-full flex-1 flex-col overflow-hidden"
@@ -123,6 +143,66 @@ export function CustomChats(props: {
sendMessage={props.sendMessage}
sessionId={props.sessionId}
/>
{/* Support Case Button/Form in last assistant message */}
{message.type === "assistant" &&
index === props.messages.length - 1 && (
<>
{/* Only show button/form if ticket not created */}
{!supportTicketCreated && (
<div className="mt-3 pl-12">
<Dialog
open={showSupportFormDialog}
onOpenChange={setShowSupportFormDialog}
>
<Button
onClick={() => setShowSupportFormDialog(true)}
size="sm"
variant="outline"
className="rounded-full bg-card"
>
Create Support Case
<ArrowRightIcon className="w-4 h-4 ml-2" />
</Button>
<DialogContent className="p-0 bg-card">
<DynamicHeight>
<DialogHeader className="p-4 lg:p-6 border-b border-dashed space-y-1">
<DialogTitle className="text-xl font-semibold text-foreground tracking-tight">
Create Support Case
</DialogTitle>
<p className="text-muted-foreground text-sm">
Let's create a detailed support case for
our technical team.
</p>
</DialogHeader>
<SupportTicketForm
team={props.team}
productLabel={props.productLabel}
setProductLabel={props.setProductLabel}
conversationId={props.sessionId}
closeForm={() => {
setShowSupportFormDialog(false);
}}
onSuccess={() => {
props.setShowSupportForm(false);
props.setProductLabel("");
setSupportTicketCreated(true);
// Add success message as a regular assistant message
if (props.addSuccessMessage) {
const supportPortalUrl = `/team/${props.team.slug}/~/support`;
props.addSuccessMessage(
`Your support ticket has been created! Our team will get back to you soon. You can also visit the [support portal](${supportPortalUrl}) to track your case.`,
);
}
}}
/>
</DynamicHeight>
</DialogContent>
</Dialog>
</div>
)}
</>
)}
</div>
);
})}
@@ -143,7 +223,7 @@ function RenderMessage(props: {
nextMessage: CustomChatMessage | undefined;
authToken: string;
sessionId: string | undefined;
onFeedback?: (messageIndex: number, feedback: 1 | -1) => void;
onFeedback?: (messageIndex: number, feedback: 1 | -1) => Promise<void>;
}) {
const { message } = props;
@@ -179,13 +259,16 @@ function RenderMessage(props: {
<div
className={cn(
"flex size-9 items-center justify-center rounded-full",
message.type === "assistant" && "border bg-card",
message.type === "assistant" && "border bg-inverted",
message.type === "error" && "border",
message.type === "presence" && "border bg-card",
message.type === "presence" && "border bg-inverted",
)}
>
{(message.type === "presence" || message.type === "assistant") && (
<MessageCircleIcon className="size-5 text-muted-foreground" />
<ThirdwebMiniLogo
className="size-4 text-inverted-foreground"
isMonoChrome
/>
)}
{message.type === "error" && (
@@ -227,7 +310,7 @@ function RenderMessage(props: {
function CustomFeedbackButtons(props: {
message: CustomChatMessage & { type: "assistant" };
messageIndex: number;
onFeedback: (messageIndex: number, feedback: 1 | -1) => void;
onFeedback: (messageIndex: number, feedback: 1 | -1) => Promise<void>;
className?: string;
}) {
const [isSubmitting, setIsSubmitting] = useState(false);
@@ -240,9 +323,9 @@ function CustomFeedbackButtons(props: {
await props.onFeedback(props.messageIndex, feedback);
} catch (_e) {
// Handle error silently
} finally {
setIsSubmitting(false);
}
setIsSubmitting(false);
};
// Don't show buttons if feedback already given
@@ -251,25 +334,26 @@ function CustomFeedbackButtons(props: {
}
return (
<div className={cn("flex gap-2", props.className)}>
<button
aria-label="Thumbs up"
className="text-muted-foreground transition-colors hover:text-green-500 disabled:opacity-50"
<div className={cn("flex gap-1.5", props.className)}>
<Button
aria-label="Upvote"
variant="outline"
disabled={isSubmitting}
onClick={() => handleFeedback(1)}
type="button"
className="size-8 p-0 rounded-lg bg-card"
>
<ThumbsUpIcon className="size-5" />
</button>
<button
aria-label="Thumbs down"
className="text-muted-foreground transition-colors hover:text-red-500 disabled:opacity-50"
<ThumbsUpIcon className="size-3.5" />
</Button>
<Button
aria-label="Downvote"
variant="outline"
disabled={isSubmitting}
onClick={() => handleFeedback(-1)}
type="button"
className="size-8 p-0 rounded-lg bg-card"
>
<ThumbsDownIcon className="size-5" />
</button>
<ThumbsDownIcon className="size-3.5" />
</Button>
</div>
);
}
@@ -296,7 +380,11 @@ function RenderResponse(props: {
);
case "presence":
return <Reasoning isPending={isMessagePending} texts={message.texts} />;
return (
<div className="h-8 flex items-center">
<TextShimmer text="Reasoning..." />
</div>
);
case "error":
return (
@@ -325,19 +413,15 @@ function StyledMarkdownRenderer(props: {
}) {
return (
<MarkdownRenderer
className="text-foreground [&>*:first-child]:mt-0 [&>*:first-child]:border-none [&>*:first-child]:pb-0 [&>*:last-child]:mb-0"
className="[&>*:first-child]:mt-0 [&>*:first-child]:border-none [&>*:first-child]:pb-0 [&>*:last-child]:mb-0"
code={{
className: "bg-transparent",
className: "bg-card",
ignoreFormattingErrors: true,
}}
inlineCode={{ className: "border-none" }}
li={{ className: "text-foreground" }}
markdownText={props.text}
p={{
className:
props.type === "assistant"
? "text-foreground"
: "text-foreground leading-normal",
className: props.type === "assistant" ? "" : "leading-normal",
}}
skipHtml
/>
@@ -1,62 +0,0 @@
import { ChevronDownIcon } from "lucide-react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { DynamicHeight } from "@/components/ui/DynamicHeight";
import { TextShimmer } from "@/components/ui/text-shimmer";
import { cn } from "@/lib/utils";
export function Reasoning(props: { isPending: boolean; texts: string[] }) {
const [_isOpen, setIsOpen] = useState(false);
const isOpen = props.isPending ? true : _isOpen;
const showAll = !props.isPending;
const lastText = props.texts[props.texts.length - 1];
return (
<DynamicHeight>
<Button
className="h-auto w-auto items-center gap-1 px-0 py-1 pb-2 font-normal text-base text-muted-foreground hover:text-foreground hover:no-underline"
onClick={() => setIsOpen(!isOpen)}
size="sm"
variant="link"
>
{props.isPending ? (
<TextShimmer text="Reasoning..." />
) : (
<span className="text-foreground">Reasoning</span>
)}
{!props.isPending && (
<ChevronDownIcon
className={cn(
"size-4 transition-transform",
isOpen && "rotate-180",
)}
/>
)}
</Button>
{isOpen && (
<>
{showAll && props.texts.length > 0 && (
<ul className="list-none space-y-1.5">
{props.texts.map((text) => (
<li
className="fade-in-0 animate-in text-muted-foreground text-sm leading-relaxed duration-300"
key={text}
>
{text.trim()}
</li>
))}
</ul>
)}
{!showAll && lastText && (
<div className="text-muted-foreground text-sm leading-relaxed">
{lastText.trim()}
</div>
)}
</>
)}
</DynamicHeight>
);
}
@@ -6,12 +6,6 @@ export type ExamplePrompt = {
// TODO - remove "Nebula" wording and simplify types
export type NebulaContext = {
chainIds: string[] | null;
walletAddress: string | null;
networks: "mainnet" | "testnet" | "all" | null;
};
type NebulaUserMessageContentItem =
| {
type: "image";
@@ -1,7 +1,6 @@
"use client";
import { useFavoriteChainIds } from "@app/(dashboard)/(chain)/components/client/star-button";
import { doLogout } from "@app/login/auth-actions";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
@@ -14,6 +13,7 @@ import {
useActiveAccount,
useConnectModal,
} from "thirdweb/react";
import { doLogout } from "@/actions/auth-actions";
import { resetAnalytics } from "@/analytics/reset";
import { CustomChainRenderer } from "@/components/misc/CustomChainRenderer";
import { LazyConfigureNetworkModal } from "@/components/misc/configure-networks/LazyConfigureNetworkModal";
@@ -120,20 +120,18 @@ export const CustomConnectWallet = (props: {
if ((!isLoggedIn || !account) && loginRequired) {
return (
<>
<Button
asChild
className={props.signInLinkButtonClassName}
size="lg"
variant="default"
<Button
asChild
className={props.signInLinkButtonClassName}
size="lg"
variant="default"
>
<Link
href={`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`}
>
<Link
href={`/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`}
>
Connect Wallet
</Link>
</Button>
</>
Connect Wallet
</Link>
</Button>
);
}
@@ -1,9 +1,6 @@
"use client";
import { Flex, FormControl } from "@chakra-ui/react";
import { useMutation, useQuery } from "@tanstack/react-query";
import { verifyContract } from "app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/sources/ContractSourcesPage";
import { FormHelperText, FormLabel } from "chakra/form";
import { Text } from "chakra/text";
import {
ArrowUpFromLineIcon,
CircleAlertIcon,
@@ -27,6 +24,7 @@ import {
reportContractDeployed,
reportContractDeployFailed,
} from "@/analytics/report";
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
import { NetworkSelectorButton } from "@/components/misc/NetworkSelectorButton";
import { SolidityInput } from "@/components/solidity-inputs";
import {
@@ -932,14 +930,17 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
<Fieldset legend="Deploy Options">
<div className="flex flex-col gap-6">
{/* Chain */}
<FormControl isRequired>
<FormLabel>Chain</FormLabel>
<p className="mb-3 text-muted-foreground text-sm">
Select a network to deploy this contract on. We recommend
starting with a testnet
</p>
<FormFieldSetup
isRequired
label="Chain"
errorMessage={undefined}
helperText={
<span>
Select a network to deploy this contract on. We recommend
starting with a testnet
</span>
}
>
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-4 md:flex-row">
<NetworkSelectorButton
@@ -953,7 +954,6 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
: metadata?.networksForDeployment?.networksEnabled
}
/>
<Button asChild variant="outline">
<Link
className="gap-3"
@@ -967,12 +967,11 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
</Button>
</div>
</div>
</FormControl>
</FormFieldSetup>
{metadata?.deployType === "standard" && (
<>
{/* Deterministic deploy */}
<div className="flex flex-col gap-3">
<CheckboxWithLabel>
<Checkbox
@@ -1006,16 +1005,21 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
{/* Optional Salt Input */}
{isCreate2Deployment && (
<FormControl>
<Flex alignItems="center" my={1}>
<FormLabel display="flex" flex="1" mb={0}>
<Flex alignItems="baseline" gap={1}>
Optional Salt Input
<Text size="label.sm">(saltForCreate2)</Text>
</Flex>
</FormLabel>
<FormHelperText mt={0}>string</FormHelperText>
</Flex>
<FormFieldSetup
isRequired={false}
label={
<span className="flex items-center gap-1">
Optional Salt Input
<span className="font-normal text-muted-foreground text-xs">
(saltForCreate2)
</span>
</span>
}
errorMessage={
form.getFieldState("saltForCreate2", form.formState)
.error?.message
}
>
<SolidityInput
solidityType="string"
{...form.register("saltForCreate2")}
@@ -1034,7 +1038,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
Include deployer wallet address in salt (recommended)
</span>
</CheckboxWithLabel>
</FormControl>
</FormFieldSetup>
)}
</>
)}
@@ -1,8 +1,7 @@
import { FormControl } from "@chakra-ui/react";
import { FormErrorMessage, FormLabel } from "chakra/form";
import { useMemo } from "react";
import type { ThirdwebClient } from "thirdweb";
import type { FetchDeployMetadataResult } from "thirdweb/contract";
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
import { SolidityInput } from "@/components/solidity-inputs";
import type { CustomContractDeploymentForm } from "./custom-contract";
import { PrimarySaleFieldset } from "./primary-sale-fieldset";
@@ -104,14 +103,15 @@ function RenderModule(props: {
`moduleData.${module.name}.${param.name}` as const;
return (
<FormControl
isInvalid={
!!form.getFieldState(formFieldKey, form.formState).error
}
isRequired
<FormFieldSetup
key={formFieldKey}
htmlFor={formFieldKey}
label={param.name}
isRequired={true}
errorMessage={
form.getFieldState(formFieldKey, form.formState).error?.message
}
>
<FormLabel> {param.name}</FormLabel>
<SolidityInput
client={props.client}
// @ts-expect-error - old types, need to update
@@ -119,13 +119,7 @@ function RenderModule(props: {
solidityType={param.type}
{...form.register(formFieldKey)}
/>
<FormErrorMessage>
{
form.getFieldState(formFieldKey, form.formState).error
?.message
}
</FormErrorMessage>
</FormControl>
</FormFieldSetup>
);
})}
</div>
@@ -1,8 +1,8 @@
import Link from "next/link";
import type { ThirdwebClient } from "thirdweb";
import { BasisPointsInput } from "@/components/blocks/BasisPointsInput";
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
import { SolidityInput } from "@/components/solidity-inputs";
import { UnderlineLink } from "@/components/ui/UnderlineLink";
import { Fieldset } from "./common";
import type { CustomContractDeploymentForm } from "./custom-contract";
@@ -78,30 +78,28 @@ export const PlatformFeeFieldset: React.FC<PlatformFeeFieldsetProps> = ({
</FormFieldSetup>
</>
) : isMarketplace ? (
<p className="mb-3 pt-4 text-muted-foreground text-sm italic">
<p className="text-muted-foreground text-sm leading-relaxed">
A 2.5% platform fee is deducted from each sale to support ongoing
platform operations and improvements.{" "}
<Link
className="text-blue-500 underline"
platform operations and improvements. <br />
<UnderlineLink
href={"https://thirdweb.com/pricing"}
rel="noopener noreferrer"
target="_blank"
>
See fee breakdown on pricing page.
</Link>
</UnderlineLink>
</p>
) : (
<p className="mb-3 pt-4 text-muted-foreground text-sm italic">
<p className="text-muted-foreground text-sm leading-relaxed">
A 2.5% platform fee is deducted from each primary sale price to
support ongoing platform operations and improvements.{" "}
<Link
className="text-blue-500 underline"
support ongoing platform operations and improvements. <br />
<UnderlineLink
href={"https://thirdweb.com/pricing"}
rel="noopener noreferrer"
target="_blank"
>
See fee breakdown on pricing page.
</Link>
</UnderlineLink>
</p>
)}
</div>
@@ -1,20 +1,24 @@
import type { Abi } from "abitype";
import { Select } from "chakra-react-select";
import { useMemo } from "react";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
interface AbiSelectorProps {
abi: Abi;
defaultValue: string;
value: string;
onChange: (fn: string) => void;
}
export const AbiSelector: React.FC<AbiSelectorProps> = ({
export function AbiSelector({
abi,
value,
defaultValue,
onChange,
}) => {
}: {
abi: Abi;
defaultValue: string;
value: string;
onChange: (fn: string) => void;
}) {
const options = useMemo(() => {
return abi
.filter((f) => f.type === "function")
@@ -26,24 +30,17 @@ export const AbiSelector: React.FC<AbiSelectorProps> = ({
}, [abi]);
return (
<div className="flex w-full flex-row items-center gap-2">
<Select
chakraStyles={{
container: (provided) => ({
...provided,
width: "full",
}),
}}
defaultValue={options.find((o) => o.value === defaultValue)}
onChange={(selectedFn) => {
if (selectedFn) {
onChange((selectedFn as { label: string; value: string }).value);
}
}}
options={options}
placeholder="Select function"
value={options.find((o) => o.value === value)}
/>
</div>
<Select value={value} onValueChange={onChange} defaultValue={defaultValue}>
<SelectTrigger className="w-full bg-card">
<SelectValue placeholder="Select function" />
</SelectTrigger>
<SelectContent>
{options.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>
);
};
}
@@ -1,4 +1,3 @@
import { FormControl, useBreakpointValue } from "@chakra-ui/react";
import type { AbiParameter } from "abitype";
import { useId, useState } from "react";
import { useFormContext } from "react-hook-form";
@@ -12,6 +11,7 @@ import { Input } from "@/components/ui/input";
import { Separator } from "@/components/ui/separator";
import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { useIsMobile } from "@/hooks/use-mobile";
import { getTemplateValuesForType } from "@/lib/deployment/template-values";
import { DecodedInputArrayFieldset } from "./decoded-bytes-input/decoded-input-array-fieldset";
import { RefInputFieldset } from "./ref-contract-input/ref-input-fieldset";
@@ -25,7 +25,7 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
client,
}) => {
const form = useFormContext();
const isMobile = useBreakpointValue({ base: true, md: false });
const isMobile = useIsMobile();
const displayNameId = useId();
const descriptionId = useId();
const [isCustomInputEnabledArray, setIsCustomInputEnabledArray] = useState(
@@ -70,22 +70,20 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
return (
<fieldset>
<h2 className="font-semibold text-3xl tracking-tight">
<h2 className="text-2xl font-semibold tracking-tight mb-1">
Contract Parameters
</h2>
<p className="text-muted-foreground">
<p className="text-muted-foreground text-sm mb-6">
These are the parameters users will need to fill in when deploying this
contract.
</p>
<div className="h-6" />
<div className="flex flex-col gap-8">
{deployParams.map((param, idx) => {
const paramTemplateValues = getTemplateValuesForType(param.type);
return (
<div
className="rounded-lg border border-border bg-card p-6"
className="rounded-lg border border-border bg-card p-4"
key={`implementation_${param.name}`}
>
{/* Title + Type */}
@@ -100,12 +98,12 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
)}
</h3>
<InlineCode
className="px-2 text-base text-muted-foreground"
className="px-2 text-muted-foreground text-sm"
code={param.type}
/>
</div>
<div className="h-5" />
<div className="h-4" />
{/* Display Name */}
<FormFieldSetup
@@ -140,7 +138,7 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
/>
</FormFieldSetup>
<div className="h-5" />
<div className="h-4" />
{/* Description */}
<FormFieldSetup
@@ -217,25 +215,23 @@ export const ContractParamsFieldset: React.FC<ContractParamsFieldsetProps> = ({
{/* Inputs */}
{!isCustomInputEnabledArray[idx] ? (
<FormControl>
<SolidityInput
className="!bg-background !text-sm placeholder:!text-sm"
client={client}
placeholder={
isMobile ||
paramTemplateValues?.[0]?.value ===
"{{trusted_forwarders}}"
? "Pre-filled value."
: "This value will be pre-filled in the deploy form."
}
solidityType={param.type}
{...form.register(
`constructorParams.${
param.name ? param.name : "*"
}.defaultValue`,
)}
/>
</FormControl>
<SolidityInput
className="!bg-background !text-sm placeholder:!text-sm"
client={client}
placeholder={
isMobile ||
paramTemplateValues?.[0]?.value ===
"{{trusted_forwarders}}"
? "Pre-filled value."
: "This value will be pre-filled in the deploy form."
}
solidityType={param.type}
{...form.register(
`constructorParams.${
param.name ? param.name : "*"
}.defaultValue`,
)}
/>
) : param.type === "address" || param.type === "address[]" ? (
<RefInputFieldset client={client} param={param} />
) : (
@@ -1,33 +1,26 @@
import {
Box,
Flex,
FormControl,
IconButton,
Input,
ListItem,
UnorderedList,
} from "@chakra-ui/react";
import type { Abi } from "abitype";
import { Button } from "chakra/button";
import { Heading } from "chakra/heading";
import { Text } from "chakra/text";
import { PlusIcon, TrashIcon } from "lucide-react";
import { type Dispatch, type SetStateAction, useEffect } from "react";
import { Controller, useFieldArray, useFormContext } from "react-hook-form";
import { useFieldArray, useFormContext } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors";
import { Button } from "@/components/ui/button";
import {
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { useCustomFactoryAbi } from "@/hooks/contract-hooks";
import { AbiSelector } from "./abi-selector";
interface CustomFactoryProps {
export function CustomFactory(props: {
setCustomFactoryAbi: Dispatch<SetStateAction<Abi>>;
client: ThirdwebClient;
}
export const CustomFactory: React.FC<CustomFactoryProps> = ({
setCustomFactoryAbi,
client,
}) => {
}) {
const { setCustomFactoryAbi, client } = props;
const form = useFormContext();
const customFactoryAbi = useCustomFactoryAbi(
@@ -35,7 +28,6 @@ export const CustomFactory: React.FC<CustomFactoryProps> = ({
form.watch("customFactoryAddresses[0].value"),
form.watch("customFactoryAddresses[0].key"),
);
// FIXME: all of this logic needs to be reworked
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
@@ -58,102 +50,130 @@ export const CustomFactory: React.FC<CustomFactoryProps> = ({
}, [fields, append]);
return (
<Flex flexDir="column" gap={12} pb={0} px={0}>
<UnorderedList>
<Text as={ListItem}>
<div className="space-y-12">
{/* Description */}
<div className="space-y-1.5 text-sm text-muted-foreground">
<p>
Use this if you want to invoke your own function with custom logic
when users deploy your contract.
</Text>
<Text as={ListItem}>
</p>
<p>
You need to have factory contracts pre-deployed to all networks that
you want to support.
</Text>
</UnorderedList>
<Flex flexDir="column" gap={4}>
<Flex flexDir="column" gap={2}>
<Heading size="title.md">Factory contract addresses</Heading>
<Text>
Paste the contract address of your factory contracts. Your contract
can be deployed only to networks with valid factory address.
</Text>
</Flex>
{fields.map((field, index) => (
<div key={field.id}>
<FormControl as={Flex} gap={4} isRequired>
<Box w={{ base: "full", md: "40%" }}>
<Controller
control={form.control}
name={`customFactoryAddresses[${index}].key`}
render={({ field: _field }) => {
return (
<SingleNetworkSelector
chainId={_field.value}
client={client}
onChange={(value) => {
_field.onChange(value);
}}
/>
);
}}
/>
</Box>
<Box w="full">
<Input
isRequired
{...form.register(`customFactoryAddresses[${index}].value`)}
placeholder="Factory contract address"
/>
</Box>
<IconButton
aria-label="Remove row"
icon={<TrashIcon className="size-5" />}
isDisabled={fields.length === 1 || form.formState.isSubmitting}
onClick={() => remove(index)}
</p>
</div>
{/* Factory contract addresses */}
<div>
<h2 className="text-xl font-semibold tracking-tight mb-1">
Factory contract addresses
</h2>
<p className="text-sm text-muted-foreground mb-4">
Paste the contract address of your factory contracts. Your contract
can be deployed only to networks with valid factory address.
</p>
<div className="space-y-3 mb-5">
{fields.map((field, index) => (
<div
key={field.id}
className="flex flex-col lg:flex-row gap-4 lg:items-end"
>
<FormField
control={form.control}
name={`customFactoryAddresses[${index}].key`}
render={({ field }) => (
<FormItem className="w-full lg:w-80 space-y-1.5">
<FormLabel>Network</FormLabel>
<SingleNetworkSelector
chainId={field.value}
disableChainId
className="bg-card"
client={client}
onChange={field.onChange}
/>
</FormItem>
)}
/>
</FormControl>
</div>
))}
<FormField
control={form.control}
name={`customFactoryAddresses[${index}].value`}
render={({ field }) => (
<FormItem className="grow space-y-1.5">
<FormLabel>Factory contract address</FormLabel>
<FormControl>
<Input
required
className="bg-card"
{...field}
placeholder="0x..."
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<Button
type="button"
variant="outline"
className="rounded-full p-0 size-10 bg-card self-end"
aria-label="Remove row"
disabled={fields.length === 1 || form.formState.isSubmitting}
onClick={() => remove(index)}
>
<TrashIcon className="size-4" />
</Button>
</div>
))}
</div>
<div>
<Button
borderRadius="md"
colorScheme="primary"
leftIcon={<PlusIcon className="size-5" />}
onClick={() => append({ key: "", value: "" })}
variant="outline"
size="sm"
type="button"
className="rounded-full bg-card"
onClick={() => append({ key: "", value: "" })}
>
Add Network
<PlusIcon className="size-5 mr-2" /> Add Network
</Button>
</div>
</Flex>
<Flex flexDir="column" gap={4}>
<Flex flexDir="column" gap={2}>
<Heading size="title.md">Factory function</Heading>
<Text>Choose the factory function to deploy your contracts.</Text>
</Flex>
<FormControl isRequired>
{customFactoryAbi?.data ? (
<AbiSelector
abi={customFactoryAbi.data}
defaultValue="deployProxyByImplementation"
onChange={(selectedFn) =>
form.setValue(
"factoryDeploymentData.customFactoryInput.factoryFunction",
selectedFn,
)
}
value={form.watch(
</div>
{/* Factory function */}
<div>
<h2 className="text-xl font-semibold tracking-tight mb-1">
Factory function
</h2>
<p className="text-sm text-muted-foreground mb-4">
Choose the factory function to deploy your contracts.
</p>
{customFactoryAbi?.data ? (
<AbiSelector
abi={customFactoryAbi.data}
defaultValue="deployProxyByImplementation"
onChange={(selectedFn) =>
form.setValue(
"factoryDeploymentData.customFactoryInput.factoryFunction",
)}
/>
) : (
<Text fontStyle="italic">
Custom factory ABI not found. Please provide a valid imported
contract on the previous step.
</Text>
)}
</FormControl>
</Flex>
</Flex>
selectedFn,
)
}
value={form.watch(
"factoryDeploymentData.customFactoryInput.factoryFunction",
)}
/>
) : (
<p className="text-sm text-red-500 font-medium">
Custom factory ABI not found. Please provide a valid imported
contract on the previous step.
</p>
)}
</div>
</div>
);
};
}
@@ -1,10 +1,7 @@
import { Flex, FormControl, ListItem, UnorderedList } from "@chakra-ui/react";
import type { Abi } from "abitype";
import { Heading } from "chakra/heading";
import { Link } from "chakra/link";
import { Text } from "chakra/text";
import { useFormContext } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import { UnderlineLink } from "../../ui/UnderlineLink";
import { AbiSelector } from "./abi-selector";
import { NetworksFieldset } from "./networks-fieldset";
@@ -13,63 +10,62 @@ interface DefaultFactoryProps {
client: ThirdwebClient;
}
export const DefaultFactory: React.FC<DefaultFactoryProps> = ({
abi,
client,
}) => {
export function DefaultFactory({ abi, client }: DefaultFactoryProps) {
const form = useFormContext();
return (
<Flex flexDir="column" gap={12} pb={0} px={0}>
<UnorderedList>
<Text as={ListItem}>
<div className="space-y-12">
{/* Description */}
<div className="space-y-1.5 text-sm text-muted-foreground">
<p>
Default factory lets users deploy your contract to{" "}
<strong>any EVM network</strong>.
</Text>
<Text as={ListItem}>
<em className="font-medium">any EVM network</em>.
</p>
<p>
The factory deploys EIP-1167 minimal proxies of your contract. This
makes it much cheaper to deploy.
</Text>
<Text as={ListItem}>
</p>
<p>
The factory is{" "}
<Link
color="primary.500"
<UnderlineLink
href="https://github.com/thirdweb-dev/contracts/blob/main/contracts/TWStatelessFactory.sol"
isExternal
target="_blank"
rel="noopener noreferrer"
>
open-source
</Link>
</UnderlineLink>
, permissionless, and does not alter contract ownership.
</Text>
<Text as={ListItem}>
</p>
<p>
Your contract needs to be written in the upgradeable/initializable
pattern. It needs to contain an initializer function.
</Text>
</UnorderedList>
<Flex flexDir="column" gap={4}>
<Flex flexDir="column" gap={2}>
<Heading size="title.md">Initializer function</Heading>
<Text>
Choose the initializer function to invoke on your proxy contracts.
</Text>
</Flex>
<FormControl isRequired>
<AbiSelector
abi={abi}
defaultValue="initialize"
onChange={(selectedFn) =>
form.setValue(
"factoryDeploymentData.implementationInitializerFunction",
selectedFn,
)
}
value={form.watch(
</p>
</div>
{/* Initializer function */}
<div>
<h3 className="text-lg font-semibold mb-1">Initializer function</h3>
<p className="text-muted-foreground text-sm mb-4">
Choose the initializer function to invoke on your proxy contracts.
</p>
<AbiSelector
abi={abi}
defaultValue="initialize"
onChange={(selectedFn) =>
form.setValue(
"factoryDeploymentData.implementationInitializerFunction",
)}
/>
</FormControl>
</Flex>
selectedFn,
)
}
value={form.watch(
"factoryDeploymentData.implementationInitializerFunction",
)}
/>
</div>
{/* Networks */}
<NetworksFieldset client={client} />
</Flex>
</div>
);
};
}
@@ -1,5 +1,4 @@
import { PlusIcon } from "lucide-react";
import { useEffect } from "react";
import { useFieldArray, useFormContext } from "react-hook-form";
import { Button } from "@/components/ui/button";
import { ExternalLinksInput } from "./external-links-input";
@@ -12,35 +11,26 @@ export const ExternalLinksFieldset = () => {
name: "externalLinks",
});
// FIXME: all of this logic needs to be reworked
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
if (fields.length === 0) {
append(
{
name: "",
url: "",
},
{ shouldFocus: false },
);
}
}, [fields, append]);
return (
<fieldset className="flex flex-col gap-8">
<div className="flex flex-col gap-2">
<h3 className="font-semibold text-xl tracking-tight">Resources</h3>
<p className="text-muted-foreground">
<fieldset>
<div>
<h3 className="font-semibold text-xl tracking-tight mb-1">Resources</h3>
<p className="text-muted-foreground text-sm mb-5">
Provide links to docs, usage guides etc. for the contract.
</p>
</div>
<div className="flex flex-col gap-4">
{fields.map((item, index) => (
<ExternalLinksInput index={index} key={item.id} remove={remove} />
<ExternalLinksInput
index={index}
key={item.id}
remove={remove}
disableRemove={fields.length === 1}
/>
))}
<div>
<Button
className="gap-2"
className="gap-2 bg-card rounded-full"
onClick={() =>
append({
name: "",
@@ -51,7 +41,7 @@ export const ExternalLinksFieldset = () => {
type="button"
variant="outline"
>
<PlusIcon className="size-5" />
<PlusIcon className="size-4" />
Add Resource
</Button>
</div>
@@ -3,82 +3,82 @@ import { useFormContext } from "react-hook-form";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Separator } from "@/components/ui/separator";
interface ExternalLinksInputProps {
index: number;
remove: (index: number) => void;
disableRemove: boolean;
}
export const ExternalLinksInput: React.FC<ExternalLinksInputProps> = ({
index,
remove,
disableRemove,
}) => {
const form = useFormContext();
return (
<div className="flex flex-col gap-2">
<div className="flex w-full flex-col gap-4 md:flex-row md:gap-2">
<div className="flex flex-1 flex-col gap-1">
<Label className="capitalize" htmlFor={`externalLinks.${index}.name`}>
Resource Name
</Label>
<Input
id={`externalLinks.${index}.name`}
placeholder="Resource name"
{...form.register(`externalLinks.${index}.name`)}
/>
{form.getFieldState(`externalLinks.${index}.name`, form.formState)
.error?.message && (
<p className="text-destructive-text text-sm">
{
form.getFieldState(
`externalLinks.${index}.name`,
form.formState,
).error?.message
}
</p>
)}
</div>
<div className="flex flex-1 flex-col gap-1">
<Label className="capitalize" htmlFor={`externalLinks.${index}.url`}>
Link
</Label>
<Input
id={`externalLinks.${index}.url`}
placeholder="Provide URL to the resource page"
{...form.register(`externalLinks.${index}.url`, {
required: true,
validate: (value: string) => {
if (value.match(new RegExp(/^https:\/\/[^\s/$.?#].[^\s]*$/))) {
return true;
}
return "Provide a valid URL";
},
})}
/>
{form.getFieldState(`externalLinks.${index}.url`, form.formState)
.error?.message && (
<p className="text-destructive-text text-sm">
{
form.getFieldState(`externalLinks.${index}.url`, form.formState)
.error?.message
}
</p>
)}
</div>
<Button
aria-label="Remove row"
className="self-end"
onClick={() => remove(index)}
size="icon"
variant="ghost"
>
<TrashIcon className="size-5" />
<span className="sr-only">Remove row</span>
</Button>
<div className="flex w-full flex-col gap-3 md:flex-row">
{/* Resource name */}
<div className="flex flex-1 flex-col gap-2">
<Label className="capitalize" htmlFor={`externalLinks.${index}.name`}>
Name
</Label>
<Input
id={`externalLinks.${index}.name`}
{...form.register(`externalLinks.${index}.name`)}
className="bg-card"
/>
{form.getFieldState(`externalLinks.${index}.name`, form.formState).error
?.message && (
<p className="text-destructive-text text-sm">
{
form.getFieldState(`externalLinks.${index}.name`, form.formState)
.error?.message
}
</p>
)}
</div>
<Separator />
{/* Resource URL */}
<div className="flex flex-1 flex-col gap-2">
<Label className="capitalize" htmlFor={`externalLinks.${index}.url`}>
Link
</Label>
<Input
id={`externalLinks.${index}.url`}
className="bg-card"
{...form.register(`externalLinks.${index}.url`, {
required: true,
validate: (value: string) => {
if (value.match(new RegExp(/^https:\/\/[^\s/$.?#].[^\s]*$/))) {
return true;
}
return "Provide a valid URL";
},
})}
/>
{form.getFieldState(`externalLinks.${index}.url`, form.formState).error
?.message && (
<p className="text-destructive-text text-sm">
{
form.getFieldState(`externalLinks.${index}.url`, form.formState)
.error?.message
}
</p>
)}
</div>
<Button
className="self-end rounded-full p-0 bg-card"
disabled={disableRemove}
onClick={() => remove(index)}
size="icon"
variant="outline"
aria-label="Remove resource"
>
<TrashIcon className="size-4" />
</Button>
</div>
);
};
@@ -1,10 +1,8 @@
import { ButtonGroup, Flex } from "@chakra-ui/react";
import type { Abi } from "abitype";
import { Button } from "chakra/button";
import { Heading } from "chakra/heading";
import type { Dispatch, SetStateAction } from "react";
import { useFormContext } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import { TabButtons } from "../../ui/tabs";
import { CustomFactory } from "./custom-factory";
import { DefaultFactory } from "./default-factory";
@@ -20,47 +18,45 @@ export const FactoryFieldset: React.FC<FactoryFieldsetProps> = ({
client,
}) => {
const form = useFormContext();
const tab = form.watch("deployType");
return (
<Flex as="fieldset" direction="column" gap={12}>
<Flex direction="column" gap={6}>
<Heading size="title.lg">Factory deploy settings</Heading>
<ButtonGroup size="sm" spacing={{ base: 0.5, md: 2 }} variant="ghost">
<Button
_active={{
bg: "bgBlack",
color: "bgWhite",
}}
isActive={form.watch("deployType") === "autoFactory"}
onClick={() => form.setValue("deployType", "autoFactory")}
rounded="lg"
type="button"
>
Default Factory
</Button>
<Button
_active={{
bg: "bgBlack",
color: "bgWhite",
}}
isActive={form.watch("deployType") === "customFactory"}
onClick={() => form.setValue("deployType", "customFactory")}
rounded="lg"
type="button"
>
Custom Factory (Advanced)
</Button>
</ButtonGroup>
{form.watch("deployType") === "autoFactory" && (
<DefaultFactory abi={abi} client={client} />
)}
{form.watch("deployType") === "customFactory" && (
<CustomFactory
client={client}
setCustomFactoryAbi={setCustomFactoryAbi}
/>
)}
</Flex>
</Flex>
<div>
<h2 className="text-2xl font-semibold tracking-tight mb-1">
Factory deploy settings
</h2>
<p className="text-muted-foreground mb-6">
Choose how you want to deploy your contract
</p>
<TabButtons
tabClassName="!text-sm font-semibold"
tabs={[
{
name: "Default Factory",
onClick: () => form.setValue("deployType", "autoFactory"),
isActive: tab === "autoFactory",
},
{
name: "Custom Factory (Advanced)",
onClick: () => form.setValue("deployType", "customFactory"),
isActive: tab === "customFactory",
},
]}
/>
<div className="h-4" />
{form.watch("deployType") === "autoFactory" && (
<DefaultFactory abi={abi} client={client} />
)}
{form.watch("deployType") === "customFactory" && (
<CustomFactory
client={client}
setCustomFactoryAbi={setCustomFactoryAbi}
/>
)}
</div>
);
};
@@ -1,4 +1,3 @@
import { FormControl, useBreakpointValue } from "@chakra-ui/react";
import type { AbiParameter } from "abitype";
import { useState } from "react";
import { useFormContext } from "react-hook-form";
@@ -7,6 +6,7 @@ import { SolidityInput } from "@/components/solidity-inputs";
import { Checkbox, CheckboxWithLabel } from "@/components/ui/checkbox";
import { InlineCode } from "@/components/ui/inline-code";
import { Switch } from "@/components/ui/switch";
import { useIsMobile } from "@/hooks/use-mobile";
import { getTemplateValuesForType } from "@/lib/deployment/template-values";
import { RefInputImplFieldset } from "./ref-contract-impl-input/ref-input-impl-fieldset";
@@ -19,7 +19,7 @@ export const ImplementationParamsFieldset: React.FC<
> = ({ implParams, client }) => {
const form = useFormContext();
const isMobile = useBreakpointValue({ base: true, md: false });
const isMobile = useIsMobile();
const [isCustomInputEnabled, setIsCustomInputEnabled] = useState(
Array(implParams.length).fill(false),
@@ -119,25 +119,23 @@ export const ImplementationParamsFieldset: React.FC<
</div>
{!isCustomInputEnabled[idx] ? (
<FormControl>
<SolidityInput
className="!bg-background !text-sm placeholder:!text-sm"
client={client}
placeholder={
isMobile ||
paramTemplateValues?.[0]?.value ===
"{{trusted_forwarders}}"
? "Pre-filled value."
: "This value will be pre-filled in the deploy form."
}
solidityType={param.type}
{...form.register(
`implConstructorParams.${
param.name ? param.name : "*"
}.defaultValue`,
)}
/>
</FormControl>
<SolidityInput
className="!bg-background !text-sm placeholder:!text-sm"
client={client}
placeholder={
isMobile ||
paramTemplateValues?.[0]?.value ===
"{{trusted_forwarders}}"
? "Pre-filled value."
: "This value will be pre-filled in the deploy form."
}
solidityType={param.type}
{...form.register(
`implConstructorParams.${
param.name ? param.name : "*"
}.defaultValue`,
)}
/>
) : (
<RefInputImplFieldset client={client} param={param} />
)}
@@ -1,9 +1,6 @@
"use client";
import { Box, Divider, Flex, IconButton } from "@chakra-ui/react";
import type { Abi } from "abitype";
import { Button } from "chakra/button";
import { Text } from "chakra/text";
import { ChevronFirstIcon } from "lucide-react";
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
import { useId, useMemo, useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
@@ -15,6 +12,8 @@ import {
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
import { reportContractPublished } from "@/analytics/report";
import { CustomConnectWallet } from "@/components/connect-wallet";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/Spinner/Spinner";
import {
DASHBOARD_ENGINE_RELAYER_URL,
DASHBOARD_FORWARDER_ADDRESS,
@@ -22,7 +21,6 @@ import {
import { useEns, useFunctionParamsFromABI } from "@/hooks/contract-hooks";
import { useTxNotifications } from "@/hooks/useTxNotifications";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { useIsomorphicLayoutEffect } from "@/lib/useIsomorphicLayoutEffect";
import { ContractParamsFieldset } from "./contract-params-fieldset";
import { FactoryFieldset } from "./factory-fieldset";
import { ImplementationParamsFieldset } from "./impl-params-fieldset";
@@ -183,284 +181,238 @@ export function ContractPublishForm(props: {
// during loading and after success we should stay in loading state
const isPending = sendTx.isPending || sendTx.isSuccess;
useIsomorphicLayoutEffect(() => {
window?.scrollTo({
behavior: "smooth",
top: 0,
});
}, []);
const formId = useId();
return (
<FormProvider {...form}>
<div className="w-full">
<Flex
as="form"
direction="column"
gap={6}
id={formId}
onSubmit={form.handleSubmit((data) => {
if (!account) {
// no account, do nothing
return;
}
const addressArray =
Object.keys(data?.customFactoryAddresses || {}).length > 0
? (data?.customFactoryAddresses as unknown as {
key: number;
value: string;
}[])
: [];
<form
className="flex flex-col gap-6"
id={formId}
onSubmit={form.handleSubmit((data) => {
if (!account) {
// no account, do nothing
return;
}
const addressArray =
Object.keys(data?.customFactoryAddresses || {}).length > 0
? (data?.customFactoryAddresses as unknown as {
key: number;
value: string;
}[])
: [];
const addressObj = addressArray.reduce<Record<number, string>>(
(obj, item) => {
obj[item.key] = item.value;
return obj;
},
{},
);
const addressObj = addressArray.reduce<Record<number, string>>(
(obj, item) => {
obj[item.key] = item.value;
return obj;
},
{},
);
const metadata = {
...data,
factoryDeploymentData: {
...data.factoryDeploymentData,
customFactoryInput: {
customFactoryAddresses:
addressObj ||
data.factoryDeploymentData?.customFactoryInput
?.customFactoryAddresses,
factoryFunction:
data.factoryDeploymentData?.customFactoryInput
?.factoryFunction || "deployProxyByImplementation",
params:
data.factoryDeploymentData?.customFactoryInput?.params ||
[],
},
implementationAddresses:
data.factoryDeploymentData?.implementationAddresses || {},
implementationInitializerFunction:
data.factoryDeploymentData
?.implementationInitializerFunction || "initialize",
const metadata = {
...data,
factoryDeploymentData: {
...data.factoryDeploymentData,
customFactoryInput: {
customFactoryAddresses:
addressObj ||
data.factoryDeploymentData?.customFactoryInput
?.customFactoryAddresses,
factoryFunction:
data.factoryDeploymentData?.customFactoryInput
?.factoryFunction || "deployProxyByImplementation",
params:
data.factoryDeploymentData?.customFactoryInput?.params || [],
},
networksForDeployment: {
allNetworks:
data.deployType === "customFactory"
? false
: data.networksForDeployment?.allNetworks,
networksEnabled:
addressArray.length > 0
? Object.keys(addressObj).map((val) => Number(val))
: data.networksForDeployment?.networksEnabled,
},
} satisfies FetchDeployMetadataResult & {
name: string;
version: string;
};
implementationAddresses:
data.factoryDeploymentData?.implementationAddresses || {},
implementationInitializerFunction:
data.factoryDeploymentData?.implementationInitializerFunction ||
"initialize",
},
networksForDeployment: {
allNetworks:
data.deployType === "customFactory"
? false
: data.networksForDeployment?.allNetworks,
networksEnabled:
addressArray.length > 0
? Object.keys(addressObj).map((val) => Number(val))
: data.networksForDeployment?.networksEnabled,
},
} satisfies FetchDeployMetadataResult & {
name: string;
version: string;
};
const tx = publishContract({
account,
contract: getContractPublisher(props.client),
metadata,
previousMetadata: props.publishMetadata,
});
const tx = publishContract({
account,
contract: getContractPublisher(props.client),
metadata,
previousMetadata: props.publishMetadata,
});
sendTx.mutate(tx, {
onError: (err) => {
console.error("Failed to publish contract", err);
onError(err);
},
onSuccess: async () => {
onSuccess();
sendTx.mutate(tx, {
onError: (err) => {
console.error("Failed to publish contract", err);
onError(err);
},
onSuccess: async () => {
onSuccess();
reportContractPublished({
contractName: props.publishMetadata.name,
deployType: data.deployType,
publisher: ensNameOrAddress ?? "",
version: data.version,
});
await props.onPublishSuccess().catch((err) => {
console.error("Failed to run onPublishSuccess", err);
});
if (successRedirectUrl) {
router.push(successRedirectUrl, { scroll: true });
}
},
});
})}
>
{fieldsetToShow !== "landing" && (
<div>
<IconButton
aria-label="Back"
icon={<ChevronFirstIcon className="size-6" />}
onClick={() =>
fieldsetToShow === "contractParams" &&
(form.watch("deployType") === "autoFactory" ||
form.watch("deployType") === "customFactory")
? setFieldsetToShow("factory")
: fieldsetToShow === "contractParams" &&
form.watch("deployType") === "standard"
? setFieldsetToShow("networks")
: fieldsetToShow === "implParams"
? setFieldsetToShow("contractParams")
: setFieldsetToShow("landing")
}
variant="ghost"
w="inherit"
reportContractPublished({
contractName: props.publishMetadata.name,
deployType: data.deployType,
publisher: ensNameOrAddress ?? "",
version: data.version,
});
await props.onPublishSuccess().catch((err) => {
console.error("Failed to run onPublishSuccess", err);
});
if (successRedirectUrl) {
router.push(successRedirectUrl, { scroll: true });
}
},
});
})}
>
{fieldsetToShow !== "landing" && (
<div>
<Button
size="sm"
className="-translate-x-3"
variant="ghost"
onClick={() =>
fieldsetToShow === "contractParams" &&
(form.watch("deployType") === "autoFactory" ||
form.watch("deployType") === "customFactory")
? setFieldsetToShow("factory")
: fieldsetToShow === "contractParams" &&
form.watch("deployType") === "standard"
? setFieldsetToShow("networks")
: fieldsetToShow === "implParams"
? setFieldsetToShow("contractParams")
: setFieldsetToShow("landing")
}
>
<ArrowLeftIcon className="size-4 mr-2" />
Back
</Button>
</div>
)}
{fieldsetToShow === "landing" && (
<LandingFieldset
client={props.client}
latestVersion={latestVersion}
placeholderVersion={placeholderVersion}
/>
)}
{fieldsetToShow === "contractParams" && (
<ContractParamsFieldset
client={props.client}
deployParams={deployParams}
/>
)}
{fieldsetToShow === "implParams" && implDeployParams?.length > 0 && (
<ImplementationParamsFieldset
client={props.client}
implParams={implDeployParams}
/>
)}
{fieldsetToShow === "factory" && (
<div className="flex flex-col gap-24">
<FactoryFieldset
abi={props.publishMetadata.abi || []}
client={props.client}
setCustomFactoryAbi={setCustomFactoryAbi}
/>
</div>
)}
{fieldsetToShow === "networks" && (
<NetworksFieldset client={props.client} />
)}
<div className="flex items-center gap-4 justify-end border-t py-6 mt-6">
{!account ? (
<CustomConnectWallet
client={props.client}
isLoggedIn={props.isLoggedIn}
/>
) : fieldsetToShow === "landing" &&
form.watch("deployType") === "standard" ? (
<NextButton
disabled={disableNext}
onClick={() => setFieldsetToShow("networks")}
/>
) : fieldsetToShow === "landing" &&
(form.watch("deployType") === "autoFactory" ||
form.watch("deployType") === "customFactory") ? (
<NextButton
disabled={disableNext}
onClick={() => setFieldsetToShow("factory")}
/>
) : fieldsetToShow !== "contractParams" &&
fieldsetToShow !== "implParams" &&
deployParams?.length > 0 ? (
<NextButton
disabled={disableNext}
onClick={() => setFieldsetToShow("contractParams")}
/>
) : fieldsetToShow !== "contractParams" &&
fieldsetToShow !== "implParams" &&
deployParams?.length === 0 &&
implDeployParams?.length > 0 ? (
<NextButton
disabled={disableNext}
onClick={() => setFieldsetToShow("implParams")}
/>
) : fieldsetToShow === "contractParams" &&
implDeployParams?.length > 0 ? (
<NextButton
disabled={disableNext}
onClick={() => setFieldsetToShow("implParams")}
/>
) : (
<div className="flex items-start justify-between gap-4 w-full">
<span className="text-sm text-muted-foreground">
Publishing your contract is free, we cover all gas costs
</span>
<Button
className="gap-2"
form={formId}
disabled={isDisabled}
type="submit"
>
Back
</IconButton>
{isPending && <Spinner className="size-4" />}
{sendTx.isSuccess
? "Preparing page"
: sendTx.isPending
? "Publishing contract"
: "Publish Contract"}
</Button>
</div>
)}
{fieldsetToShow === "landing" && (
<LandingFieldset
client={props.client}
latestVersion={latestVersion}
placeholderVersion={placeholderVersion}
/>
)}
{fieldsetToShow === "contractParams" && (
<ContractParamsFieldset
client={props.client}
deployParams={deployParams}
/>
)}
{fieldsetToShow === "implParams" && implDeployParams?.length > 0 && (
<ImplementationParamsFieldset
client={props.client}
implParams={implDeployParams}
/>
)}
{fieldsetToShow === "factory" && (
<Flex flexDir="column" gap={24}>
<FactoryFieldset
abi={props.publishMetadata.abi || []}
client={props.client}
setCustomFactoryAbi={setCustomFactoryAbi}
/>
</Flex>
)}
{fieldsetToShow === "networks" && (
<Flex flexDir="column" gap={24}>
<NetworksFieldset client={props.client} fromStandard />
</Flex>
)}
<Flex flexDir="column" gap={6}>
<Divider />
<Flex
alignItems="center"
flexDir={{ base: "column", md: "row" }}
gap={4}
justifyContent="space-between"
>
{!account ? (
<>
<Box />
<CustomConnectWallet
client={props.client}
isLoggedIn={props.isLoggedIn}
/>
</>
) : fieldsetToShow === "landing" &&
form.watch("deployType") === "standard" ? (
<>
<Box />
<Button
colorScheme="primary"
isDisabled={disableNext}
onClick={() => setFieldsetToShow("networks")}
>
Next
</Button>
</>
) : fieldsetToShow === "landing" &&
(form.watch("deployType") === "autoFactory" ||
form.watch("deployType") === "customFactory") ? (
<>
<Box />
<Button
colorScheme="primary"
isDisabled={disableNext}
onClick={() => setFieldsetToShow("factory")}
>
Next
</Button>
</>
) : fieldsetToShow !== "contractParams" &&
fieldsetToShow !== "implParams" &&
deployParams?.length > 0 ? (
<>
<Box />
<Button
colorScheme="primary"
isDisabled={disableNext}
onClick={() => setFieldsetToShow("contractParams")}
>
Next
</Button>
</>
) : fieldsetToShow !== "contractParams" &&
fieldsetToShow !== "implParams" &&
deployParams?.length === 0 &&
implDeployParams?.length > 0 ? (
<>
<Box />
<Button
colorScheme="primary"
isDisabled={disableNext}
onClick={() => setFieldsetToShow("implParams")}
>
Next
</Button>
</>
) : fieldsetToShow === "contractParams" &&
implDeployParams?.length > 0 ? (
<>
<Box />
<Button
colorScheme="primary"
isDisabled={disableNext}
onClick={() => setFieldsetToShow("implParams")}
>
Next
</Button>
</>
) : (
<>
<Text fontStyle="italic">
Publishing your contract is free, we cover all gas costs.
</Text>
<Button
// differentiate this from the edit button
borderRadius="md"
colorScheme="blue"
form={formId}
isDisabled={isDisabled}
isLoading={isPending}
key="submit-button"
loadingText={
sendTx.isSuccess
? "Preparing page"
: "Publishing contract"
}
position="relative"
type="submit"
>
Publish Contract
</Button>
</>
)}
</Flex>
</Flex>
</Flex>
</div>
</div>
</form>
</FormProvider>
);
}
function NextButton(props: { disabled: boolean; onClick: () => void }) {
return (
<Button
disabled={props.disabled}
onClick={props.onClick}
className="gap-2 w-32"
>
Next
<ArrowRightIcon className="size-4" />
</Button>
);
}
@@ -1,41 +1,30 @@
import {
Box,
Flex,
FormControl,
Input,
Tab,
TabList,
TabPanel,
TabPanels,
Tabs,
Textarea,
} from "@chakra-ui/react";
import { Card } from "chakra/card";
import { FormErrorMessage, FormHelperText, FormLabel } from "chakra/form";
import { Heading } from "chakra/heading";
import { Link } from "chakra/link";
import { Text } from "chakra/text";
import { compare, validate } from "compare-versions";
import { useState } from "react";
import { useFormContext } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import type { ExtendedMetadata } from "thirdweb/utils";
import { SelectOption } from "@/components/batch-upload/lazy-mint-form/select-option";
import { FileInput } from "@/components/blocks/FileInput";
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
import { SolidityInput } from "@/components/solidity-inputs";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { MarkdownRenderer } from "../../blocks/markdown-renderer";
import { TabButtons } from "../../ui/tabs";
import { UnderlineLink } from "../../ui/UnderlineLink";
import { ExternalLinksFieldset } from "./external-links-fieldset";
interface LandingFieldsetProps {
type LandingFieldsetProps = {
latestVersion: string | undefined;
placeholderVersion: string;
client: ThirdwebClient;
}
};
export const LandingFieldset: React.FC<LandingFieldsetProps> = ({
export function LandingFieldset({
latestVersion,
placeholderVersion,
client,
}) => {
}: LandingFieldsetProps) {
const form = useFormContext<ExtendedMetadata>();
const logoUrl = form.watch("logo");
@@ -66,205 +55,235 @@ export const LandingFieldset: React.FC<LandingFieldsetProps> = ({
}
};
const [readmeTab, setReadmeTab] = useState<"write" | "preview">("write");
const [changelogTab, setChangelogTab] = useState<"write" | "preview">(
"write",
);
return (
<Flex as="fieldset" direction="column" gap={16} mt={{ base: 4, md: 12 }}>
<Flex direction="column" gap={2}>
<Heading size="title.lg">
<fieldset className="space-y-12">
{/* header */}
<div>
<h1 className="text-2xl font-semibold tracking-tight mb-1">
{!latestVersion ? "Publish" : "Edit"} your contract
</Heading>
<Text fontStyle="normal">
</h1>
<p className="text-muted-foreground text-sm">
Publishing your contract makes it shareable, discoverable, and
deployable in a single click.{" "}
<Link
color="blue.500"
<UnderlineLink
href="https://portal.thirdweb.com/contracts/publish/overview"
isExternal
target="_blank"
rel="noopener noreferrer"
>
Learn more
</Link>
</Text>
</Flex>
<Flex gap={6} w="full">
<FormControl isInvalid={!!form.formState.errors.logo} w="auto">
<FormLabel>Image</FormLabel>
<Box width="141px">
</UnderlineLink>
</p>
</div>
{/* logo, name, description */}
<div className="flex flex-col md:flex-row gap-6 w-full">
<FormFieldSetup
label="Image"
errorMessage={form.formState.errors?.logo?.message as string}
isRequired={false}
className="w-auto"
>
<div className="w-[200px]">
<FileInput
accept={{ "image/*": [] }}
className="rounded border border-border transition-all duration-200"
className="rounded-lg border bg-card transition-all duration-200"
client={client}
helperText="Image"
// @ts-expect-error - we upload the file later this is fine
setValue={(file) => form.setValue("logo", file)}
value={logoUrl}
/>
</Box>
<FormErrorMessage>
{form.formState.errors?.logo?.message as unknown as string}
</FormErrorMessage>
</FormControl>
<Flex flexDir="column" gap={4} w="full">
<FormControl
isInvalid={!!form.formState.errors.displayName}
isRequired
</div>
</FormFieldSetup>
<div className="flex flex-col gap-4 w-full grow">
<FormFieldSetup
htmlFor="displayName"
label="Contract Name"
errorMessage={form.formState.errors?.displayName?.message}
isRequired={true}
>
<FormLabel>Contract Name</FormLabel>
<Input
id="displayName"
onChange={(e) => form.setValue("displayName", e.target.value)}
placeholder="Ex. MyContract"
className="bg-card"
value={form.watch("displayName")}
/>
<FormErrorMessage>
{form.formState.errors?.displayName?.message}
</FormErrorMessage>
</FormControl>
<FormControl isInvalid={!!form.formState.errors.description}>
<FormLabel>Description</FormLabel>
</FormFieldSetup>
<FormFieldSetup
htmlFor="description"
label="Description"
errorMessage={form.formState.errors?.description?.message}
isRequired={false}
className="grow flex flex-col"
>
<Textarea
id="description"
onChange={(e) => form.setValue("description", e.target.value)}
placeholder="Briefly describe what your contract does."
rows={2}
className="bg-card grow"
value={form.watch("description")}
/>
<FormErrorMessage>
{form.formState.errors?.description?.message}
</FormErrorMessage>
</FormControl>
</Flex>
</Flex>
</FormFieldSetup>
</div>
</div>
<div>
<Heading mb={2} size="title.md">
README
</Heading>
<Text mb={4} size="body.md">
<h2 className="text-xl font-semibold mb-1 tracking-tight">README</h2>
<p className="text-muted-foreground text-sm mb-5">
Describe what your contract does and how it should be used. Markdown
formatting is supported.
</Text>
<FormControl isInvalid={!!form.formState.errors.readme}>
<Tabs colorScheme="gray" isLazy lazyBehavior="keepMounted">
<TabList
borderBottomColor="borderColor"
borderBottomWidth="1px"
px={0}
>
<Tab gap={2}>
<Heading size="label.lg">Write</Heading>
</Tab>
<Tab gap={2}>
<Heading size="label.lg">Preview</Heading>
</Tab>
</TabList>
<TabPanels pt={2}>
<TabPanel pb={0} px={0}>
<Textarea
{...form.register("readme")}
placeholder="Describe how users can use this contract. Add links if relevant."
rows={12}
/>
<FormErrorMessage>
{form.formState.errors?.readme?.message}
</FormErrorMessage>
</TabPanel>
<TabPanel pb={0} px={0}>
<Card>
<MarkdownRenderer markdownText={form.watch("readme") || ""} />
</Card>
</TabPanel>
</TabPanels>
</Tabs>
</FormControl>
</p>
<TabButtons
tabClassName="!text-sm"
tabs={[
{
name: "Write",
onClick: () => setReadmeTab("write"),
isActive: readmeTab === "write",
},
{
name: "Preview",
onClick: () => setReadmeTab("preview"),
isActive: readmeTab === "preview",
},
]}
/>
<div className="mt-2">
{readmeTab === "write" && (
<Textarea
{...form.register("readme")}
placeholder="Describe how users can use this contract. Add links if relevant."
rows={12}
className="bg-card"
/>
)}
{readmeTab === "preview" && (
<div className="p-4 rounded-lg border border-border bg-card">
<MarkdownRenderer markdownText={form.watch("readme") || ""} />
</div>
)}
</div>
{form.formState.errors.readme && (
<p className="text-red-500 text-sm mt-2">
{form.formState.errors.readme.message}
</p>
)}
</div>
<ExternalLinksFieldset />
<div>
<Heading mb={2} size="title.md">
Version information
</Heading>
<Text mb={4} size="body.md">
<h2 className="text-xl font-semibold mb-1">Version information</h2>
<p className="text-muted-foreground text-sm mb-5">
Set your contract version number, add release notes, and link to your
contract&apos;s audit report.
</Text>
<Flex flexDir="column" gap={6}>
<FormControl isInvalid={!!form.formState.errors.version} isRequired>
<Flex alignItems="center" mb={1}>
<FormLabel flex="1" mb={0}>
Version
</FormLabel>
{latestVersion && (
<Text size="body.md">latest version: {latestVersion}</Text>
)}
</Flex>
</p>
<div className="space-y-6">
<FormFieldSetup
htmlFor="version"
label={
<div className="flex items-center justify-between w-full">
<span>Version</span>
{latestVersion && (
<span className="text-sm text-muted-foreground">
latest version: {latestVersion}
</span>
)}
</div>
}
errorMessage={form.formState.errors?.version?.message}
isRequired={true}
>
<Input
id="version"
onChange={handleVersionChange}
className="bg-card"
placeholder={placeholderVersion}
value={form.watch("version")}
/>
<FormErrorMessage>
{form.formState.errors?.version?.message}
</FormErrorMessage>
</FormControl>
</FormFieldSetup>
{latestVersion && (
<FormControl isInvalid={!!form.formState.errors.changelog}>
<FormLabel>Release notes</FormLabel>
<Tabs colorScheme="gray" isLazy lazyBehavior="keepMounted">
<TabList
borderBottomColor="borderColor"
borderBottomWidth="1px"
px={0}
>
<Tab gap={2}>
<Heading size="label.lg">Write</Heading>
</Tab>
<Tab gap={2}>
<Heading size="label.lg">Preview</Heading>
</Tab>
</TabList>
<TabPanels pt={2}>
<TabPanel pb={0} px={0}>
<Textarea
{...form.register("changelog")}
placeholder="Mention what is new in this version of your contract."
<div>
<h3 className="text-sm font-medium mb-2">Release notes</h3>
{form.formState.errors?.changelog?.message && (
<p className="text-red-500 text-sm mt-2">
{form.formState.errors.changelog.message}
</p>
)}
<TabButtons
tabClassName="!text-sm"
tabs={[
{
name: "Write",
onClick: () => setChangelogTab("write"),
isActive: changelogTab === "write",
},
{
name: "Preview",
onClick: () => setChangelogTab("preview"),
isActive: changelogTab === "preview",
},
]}
/>
<div className="mt-2">
{changelogTab === "write" && (
<Textarea
{...form.register("changelog")}
placeholder="Mention what is new in this version of your contract."
className="bg-card"
/>
)}
{changelogTab === "preview" && (
<div className="p-4 rounded-lg border bg-card">
<MarkdownRenderer
markdownText={form.watch("changelog") || ""}
/>
<FormErrorMessage>
{form.formState.errors?.changelog?.message}
</FormErrorMessage>
</TabPanel>
<TabPanel pb={0} px={0}>
<Card>
<MarkdownRenderer
markdownText={form.watch("changelog") || ""}
/>
</Card>
</TabPanel>
</TabPanels>
</Tabs>
</FormControl>
</div>
)}
</div>
</div>
)}
<FormControl isInvalid={!!form.formState.errors.audit}>
<FormLabel>Audit report</FormLabel>
<FormFieldSetup
label="Audit report"
errorMessage={form.formState.errors?.audit?.message}
isRequired={false}
helperText="You can add a IPFS hash or URL pointing to an audit report, or add a file and we'll upload it to IPFS."
>
<SolidityInput
client={client}
solidityType="string"
{...form.register("audit")}
placeholder="ipfs://... or https://..."
className="bg-card"
/>
<FormHelperText>
<Text size="body.sm">
You can add a IPFS hash or URL pointing to an audit report, or
add a file and we&apos;ll upload it to IPFS.
</Text>
</FormHelperText>
</FormControl>
</Flex>
</FormFieldSetup>
</div>
</div>
<div>
<Heading mb={2} size="title.md">
Deployment options
</Heading>
<Text mb={4} size="body.md">
<h2 className="text-xl font-semibold mb-1">Deployment options</h2>
<p className="text-muted-foreground text-sm mb-3">
Choose how users will deploy your published contract.
</Text>
<Flex flexDir="column" gap={2} width="full">
</p>
<div className="flex flex-col md:flex-row gap-4 w-full">
<SelectOption
className="w-full"
description="Users will directly deploy the full contract."
@@ -282,8 +301,8 @@ export const LandingFieldset: React.FC<LandingFieldsetProps> = ({
name="Deploy via factory"
onClick={() => form.setValue("deployType", "autoFactory")}
/>
</Flex>
</div>
</div>
</Flex>
</fieldset>
);
};
}
@@ -1,5 +1,3 @@
import { Heading } from "chakra/heading";
import { Text } from "chakra/text";
import { useFormContext } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import { MultiNetworkSelector } from "@/components/blocks/NetworkSelectors";
@@ -10,57 +8,55 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { cn } from "@/lib/utils";
interface NetworksFieldsetProps {
fromStandard?: boolean;
client: ThirdwebClient;
}
export const NetworksFieldset: React.FC<NetworksFieldsetProps> = ({
fromStandard,
client,
}) => {
const form = useFormContext();
return (
<div className={cn("flex flex-col", fromStandard ? "gap-6" : "gap-4")}>
<div className="flex flex-col gap-2">
<Heading size={fromStandard ? "title.lg" : "title.md"}>
Networks that your contract can be deployed to
</Heading>
</div>
<div className="flex flex-col gap-2" data-required>
<Select
onValueChange={(value) =>
form.setValue("networksForDeployment.allNetworks", value === "all")
}
value={
form.watch("networksForDeployment.allNetworks") ? "all" : "specific"
}
>
<SelectTrigger className="w-full">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="all">All networks</SelectItem>
<SelectItem value="specific">Specific networks</SelectItem>
</SelectContent>
</Select>
<div className="space-y-4">
<div>
<h2 className="text-lg font-semibold tracking-tight mb-1">
Select networks
</h2>
<p className="text-muted-foreground text-sm mb-4">
Select the networks that your contract can be deployed to
</p>
</div>
<Select
onValueChange={(value) =>
form.setValue("networksForDeployment.allNetworks", value === "all")
}
value={
form.watch("networksForDeployment.allNetworks") ? "all" : "specific"
}
>
<SelectTrigger className="w-full bg-card">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="all">All networks</SelectItem>
<SelectItem value="specific">Specific networks</SelectItem>
</SelectContent>
</Select>
{!form.watch("networksForDeployment.allNetworks") && (
<div className="flex flex-col gap-2">
<Text>Please select the networks you want to enable:</Text>
<MultiNetworkSelector
client={client}
onChange={(chainIds) =>
form.setValue("networksForDeployment.networksEnabled", chainIds)
}
selectedChainIds={
form.watch("networksForDeployment.networksEnabled") || []
}
/>
</div>
<MultiNetworkSelector
className="bg-card"
client={client}
onChange={(chainIds) =>
form.setValue("networksForDeployment.networksEnabled", chainIds)
}
selectedChainIds={
form.watch("networksForDeployment.networksEnabled") || []
}
/>
)}
</div>
);
@@ -1,20 +1,16 @@
import type { AbiParameter } from "abitype";
import { Button } from "chakra/button";
import { PlusIcon } from "lucide-react";
import { useFieldArray, useFormContext } from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { RefContractImplInput } from "./ref-input-impl";
interface RefInputImplFieldsetProps {
export function RefInputImplFieldset(props: {
param: AbiParameter;
client: ThirdwebClient;
}
export const RefInputImplFieldset: React.FC<RefInputImplFieldsetProps> = ({
param,
client,
}) => {
}) {
const { param, client } = props;
const form = useFormContext();
const { fields, append, remove } = useFieldArray({
@@ -63,4 +59,4 @@ export const RefInputImplFieldset: React.FC<RefInputImplFieldsetProps> = ({
)}
</div>
);
};
}
@@ -1,85 +1,82 @@
"use client";
import { Edit3Icon } from "lucide-react";
import Link from "next/link";
import { type ThirdwebClient, ZERO_ADDRESS } from "thirdweb";
import {
AccountAddress,
AccountAvatar,
AccountBlobbie,
AccountName,
AccountProvider,
} from "thirdweb/react";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { useEns } from "@/hooks/contract-hooks";
import { replaceDeployerAddress } from "@/lib/publisher-utils";
import { shortenIfAddress } from "@/utils/usedapp-external";
interface PublisherHeaderProps {
wallet: string;
client: ThirdwebClient;
}
export const PublisherHeader: React.FC<PublisherHeaderProps> = ({
export function PublisherLink({
wallet,
client,
}) => {
}: {
wallet: string;
client: ThirdwebClient;
}) {
const ensQuery = useEns({
addressOrEnsName: wallet,
client,
});
return (
<div className="flex w-full flex-col gap-4">
<h4 className="font-semibold text-lg tracking-tight">Published by</h4>
<AccountProvider
// passing zero address during loading time to prevent the component from crashing
address={ensQuery.data?.address || ZERO_ADDRESS}
client={client}
>
<div className="relative flex items-center gap-3">
<AccountProvider
// passing zero address during loading time to prevent the component from crashing
address={ensQuery.data?.address || ZERO_ADDRESS}
client={client}
>
<div className="flex items-center gap-2.5 relative">
<div>
<AccountAvatar
className="size-10 rounded-full border border-border border-solid object-cover"
className="size-[34px] rounded-full border border-border border-solid object-cover"
fallbackComponent={
<AccountBlobbie className="size-10 rounded-full" />
<div className="size-[34px] rounded-full flex items-center justify-center border bg-card">
<Edit3Icon className="size-3.5 text-muted-foreground" />
</div>
}
loadingComponent={<Skeleton className="size-10 rounded-full" />}
loadingComponent={<Skeleton className="size-[34px] rounded-full" />}
/>
<Link
className="before:absolute before:inset-0 hover:underline"
href={replaceDeployerAddress(
`/${ensQuery.data?.ensName || wallet}`,
)}
rel="noopener noreferrer"
target="_blank"
>
<AccountName
className="font-medium"
fallbackComponent={
// When social profile API support other TLDs as well - we can remove this condition
ensQuery.data?.ensName ? (
<span> {ensQuery.data?.ensName} </span>
) : (
<AccountAddress
formatFn={(addr) =>
shortenIfAddress(replaceDeployerAddress(addr))
}
/>
)
}
formatFn={(name) => replaceDeployerAddress(name)}
loadingComponent={<Skeleton className="h-8 w-40" />}
/>
</Link>
</div>
</AccountProvider>
<Button asChild className="bg-card" variant="outline">
<Link href={replaceDeployerAddress(`/${wallet}`)}>
View all contracts
<Link
className="hover:underline before:absolute before:inset-0 space-y-1.5"
href={replaceDeployerAddress(`/${ensQuery.data?.ensName || wallet}`)}
rel="noopener noreferrer"
target="_blank"
>
<div className="text-sm font-medium text-foreground leading-none">
Published by
</div>
<AccountName
className="text-sm text-foreground leading-none"
fallbackComponent={
// When social profile API support other TLDs as well - we can remove this condition
ensQuery.data?.ensName ? (
<span className="text-sm text-muted-foreground leading-none">
{ensQuery.data?.ensName}
</span>
) : (
<AccountAddress
className="text-sm text-muted-foreground leading-none"
formatFn={(addr) =>
shortenIfAddress(replaceDeployerAddress(addr))
}
/>
)
}
formatFn={(name) => replaceDeployerAddress(name)}
loadingComponent={<Skeleton className="h-[17px] w-40" />}
/>
</Link>
</Button>
</div>
</div>
</AccountProvider>
);
};
}
@@ -3,8 +3,9 @@
import type { StaticImageData } from "next/image";
import Image from "next/image";
import type { FetchDeployMetadataResult } from "thirdweb/contract";
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
import { replaceIpfsUrl } from "@/lib/sdk";
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs";
import { getConfiguredThirdwebClient } from "@/constants/thirdweb.server";
import { resolveSchemeWithErrorHandler } from "@/utils/resolveSchemeWithErrorHandler";
import generalContractIcon from "../../../../../public/assets/tw-icons/general.png";
type ContractIdImageProps = {
@@ -26,7 +27,17 @@ export const ContractIdImage: React.FC<ContractIdImageProps> = ({
<img
alt=""
className="size-8 rounded-full"
src={replaceIpfsUrl(logo, serverThirdwebClient)}
src={
DASHBOARD_THIRDWEB_SECRET_KEY
? resolveSchemeWithErrorHandler({
client: getConfiguredThirdwebClient({
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
teamId: undefined,
}),
uri: logo,
})
: logo
}
/>
);
}
@@ -314,7 +314,7 @@ const NetworkFilterCell = React.memo(function NetworkFilterCell({
client: ThirdwebClient;
}) {
if (chainIds.length < 2) {
return <> NETWORK </>;
return "NETWORK";
}
return (
@@ -1,32 +1,11 @@
"use client";
import {
Alert,
AlertDescription,
AlertIcon,
AlertTitle,
Flex,
GridItem,
List,
ListItem,
SimpleGrid,
Tab,
TabList,
TabPanel,
TabPanels,
Tabs,
useBreakpointValue,
} from "@chakra-ui/react";
import {
type Abi,
type AbiEvent,
type AbiFunction,
formatAbiItem,
} from "abitype";
import { Button } from "chakra/button";
import { Card } from "chakra/card";
import { Heading } from "chakra/heading";
import { Link } from "chakra/link";
import { Text } from "chakra/text";
import { CircleAlertIcon } from "lucide-react";
import { useSearchParams } from "next/navigation";
import { useMemo, useState } from "react";
import * as ERC20Ext from "thirdweb/extensions/erc20";
@@ -35,23 +14,19 @@ import * as ERC1155Ext from "thirdweb/extensions/erc1155";
import * as ERC4337Ext from "thirdweb/extensions/erc4337";
import { useActiveAccount } from "thirdweb/react";
import { toFunctionSelector } from "thirdweb/utils";
import {
type CodeEnvironment,
CodeSegment,
} from "@/components/blocks/code/code-segment.client";
import { getContractFunctionsFromAbi } from "@/components/contract-components/getContractFunctionsFromAbi";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { TabButtons } from "@/components/ui/tabs";
import { UnderlineLink } from "@/components/ui/UnderlineLink";
import { useAllChainsData } from "@/hooks/chains/allChains";
import { useContractEvents } from "@/hooks/contract-hooks";
interface CodeOverviewProps {
abi?: Abi;
contractAddress?: string;
onlyInstall?: boolean;
chainId: number;
noSidebar?: boolean;
}
import { useIsMobile } from "@/hooks/use-mobile";
import { cn } from "@/lib/utils";
export const COMMANDS = {
events: {
@@ -434,7 +409,7 @@ const EXTENSION_NAMESPACE_FUNCTION_MAPPING = {
>
>;
interface SnippetOptions {
type SnippetOptions = {
contractAddress?: string;
fn?: AbiFunction | AbiEvent;
args?: string[];
@@ -442,7 +417,7 @@ interface SnippetOptions {
clientId?: string;
chainId?: number;
extensionNamespace?: string;
}
};
export function formatSnippet(
// biome-ignore lint/suspicious/noExplicitAny: FIXME
@@ -537,13 +512,21 @@ export function formatSnippet(
return code;
}
export const CodeOverview: React.FC<CodeOverviewProps> = ({
abi,
contractAddress = "0x...",
onlyInstall = false,
noSidebar = false,
chainId,
}) => {
export function CodeOverview(props: {
abi?: Abi;
contractAddress?: string;
onlyInstall?: boolean;
chainId: number;
noSidebar?: boolean;
}) {
const {
abi,
contractAddress = "0x...",
onlyInstall = false,
noSidebar = false,
chainId,
} = props;
const searchParams = useSearchParams();
const defaultEnvironment = searchParams?.get("environment") as
| CodeEnvironment
@@ -556,7 +539,7 @@ export const CodeOverview: React.FC<CodeOverviewProps> = ({
const [tab, setTab] = useState("write");
const address = useActiveAccount()?.address;
const isMobile = useBreakpointValue({ base: true, md: false });
const isMobile = useIsMobile();
const functionSelectors = useMemo(() => {
return (abi || [])
@@ -626,340 +609,306 @@ export const CodeOverview: React.FC<CodeOverviewProps> = ({
events && events.length > 0 ? events[0] : undefined,
);
const tabList = useMemo(() => {
const _tablist: Array<{
name: string;
onClick: () => void;
isActive: boolean;
}> = [];
if (writeFunctions && writeFunctions.length > 0) {
_tablist.push({
name: "Write",
onClick: () => setTab("write"),
isActive: tab === "write",
});
}
if (readFunctions && readFunctions.length > 0) {
_tablist.push({
name: "Read",
onClick: () => setTab("read"),
isActive: tab === "read",
});
}
if (events && events.length > 0) {
_tablist.push({
name: "Events",
onClick: () => setTab("events"),
isActive: tab === "events",
});
}
return _tablist;
}, [writeFunctions, readFunctions, events, tab]);
return (
<SimpleGrid
columns={12}
display={{ base: "block", md: "grid" }}
gap={16}
justifyContent="space-between"
maxW="full"
overflowX={{ base: "scroll", md: "hidden" }}
>
<GridItem as={Flex} colSpan={12} flexDir="column" gap={12}>
{isAccountFactory && (
<Flex flexDirection="column" gap={4}>
<Flex flexDir="column" gap={6}>
<Heading size="title.md">Integrate your account factory</Heading>
<Alert
alignItems="start"
as={Flex}
borderRadius="md"
flexDir="column"
gap={2}
status="info"
>
<Flex justifyContent="start">
<AlertIcon />
<AlertTitle>Account Factory</AlertTitle>
</Flex>
<AlertDescription>
The recommended way to use account factories is to integrate
the{" "}
<UnderlineLink
className="text-primary-500"
href="https://portal.thirdweb.com/connect/account-abstraction/overview"
rel="noopener noreferrer"
target="_blank"
>
Connect SDK
</UnderlineLink>{" "}
in your applications. This will ensure account contracts are
deployed for your users only when they need it.
</AlertDescription>
</Alert>
<Flex flexDir="column" gap={2}>
<CodeSegment
environment={environment}
hideTabs
setEnvironment={setEnvironment}
snippet={formatSnippet(
(WALLETS_SNIPPETS.find((w) => w.id === "smart-wallet")
?.supportedLanguages || {}) as Record<
CodeEnvironment,
string
>,
{
address,
chainId,
contractAddress,
},
)}
/>
</Flex>
</Flex>
</Flex>
<div className="space-y-12">
{isAccountFactory && (
<AccountFactorySection
address={address}
chainId={chainId}
contractAddress={contractAddress}
environment={environment}
setEnvironment={setEnvironment}
/>
)}
<div className="flex flex-col gap-4">
<div className="space-y-2">
<h2 className="text-2xl font-semibold tracking-tight">
{isAccountFactory
? "Direct contract interaction (advanced)"
: chainInfo
? "Interact with this contract from your app"
: "Getting Started"}
</h2>
</div>
{(noSidebar || isMobile) && (
<div className="flex flex-col gap-2">
<p className="text-sm text-muted-foreground">Choose a language:</p>
<CodeSegment
environment={environment}
onlyTabs
setEnvironment={setEnvironment}
snippet={COMMANDS.install}
/>
</div>
)}
<Flex flexDirection="column" gap={4}>
<Flex flexDir="column" gap={2}>
<Heading size="title.md">
{isAccountFactory
? "Direct contract interaction (advanced)"
: chainInfo
? "Interact with this contract from your app"
: "Getting Started"}
</Heading>
</Flex>
{(noSidebar || isMobile) && (
<Flex flexDir="column" gap={2}>
<Text>Choose a language:</Text>
<div className="flex flex-col gap-2">
{environment === "react-native" || environment === "unity" ? (
<p className="text-sm text-muted-foreground">
Install the latest version of the SDK.{" "}
<UnderlineLink
className="text-primary-500"
href={`https://portal.thirdweb.com/${environment}`}
rel="noopener noreferrer"
target="_blank"
>
Learn how in the{" "}
{environment === "react-native" ? "React Native" : "Unity"}{" "}
documentation
</UnderlineLink>
.
</p>
) : (
<>
<p className="text-sm text-muted-foreground">
Install the latest version of the SDK:
</p>
<CodeSegment
environment={environment}
onlyTabs
hideTabs
isInstallCommand
setEnvironment={setEnvironment}
snippet={COMMANDS.install}
/>
</Flex>
</>
)}
<Flex flexDir="column" gap={2}>
{environment === "react-native" || environment === "unity" ? (
<Text>
Install the latest version of the SDK. <br />
<UnderlineLink
className="text-primary-500"
href={`https://portal.thirdweb.com/${environment}`}
rel="noopener noreferrer"
target="_blank"
>
Learn how in the{" "}
{environment === "react-native" ? "React Native" : "Unity"}{" "}
documentation
</UnderlineLink>
.
</Text>
) : (
<>
<Text>Install the latest version of the SDK:</Text>
<CodeSegment
environment={environment}
hideTabs
isInstallCommand
setEnvironment={setEnvironment}
snippet={COMMANDS.install}
/>
</>
)}
</Flex>
<Flex flexDir="column" gap={2}>
<Text>Initialize the SDK and contract on your project:</Text>
</div>
<div className="flex flex-col gap-2">
<p className="text-sm text-muted-foreground">
Initialize the SDK and contract on your project:
</p>
<CodeSegment
environment={environment}
hideTabs
setEnvironment={setEnvironment}
snippet={formatSnippet(COMMANDS.setup, {
chainId,
contractAddress,
})}
/>
<p className="text-sm text-muted-foreground">
You will need to pass a client ID/secret key to use thirdweb&apos;s
infrastructure services. If you don&apos;t have any API keys yet you
can create one by creating a project for free from the{" "}
<UnderlineLink href="/team">dashboard</UnderlineLink>.
</p>
</div>
</div>
{!onlyInstall && (
<div>
<h2 className="text-lg font-semibold tracking-tight mb-3">
All Functions & Events
</h2>
<div className="grid grid-cols-1 lg:grid-cols-[1fr_2fr] gap-4">
<div className="border bg-card rounded-lg overflow-hidden ">
{(writeFunctions || []).length > 0 ||
(readFunctions || []).length > 0 ? (
<div>
{/* tabs */}
<div className="bg-background">
<TabButtons
tabs={tabList}
tabClassName="!text-sm"
tabContainerClassName="px-3 pt-2"
/>
</div>
{tab === "write" && (
<AccentButtonListContainer>
{writeFunctions?.map((fn) => (
<AccentButton
isActive={write?.signature === fn.signature}
key={fn.signature}
label={fn.name}
onClick={() => {
setTab("write");
setWrite(fn);
}}
/>
))}
</AccentButtonListContainer>
)}
{tab === "read" && (
<AccentButtonListContainer>
{readFunctions?.map((fn) => (
<AccentButton
isActive={read?.signature === fn.signature}
key={fn.signature}
onClick={() => {
setTab("read");
setRead(fn);
}}
label={fn.name}
/>
))}
</AccentButtonListContainer>
)}
{tab === "events" && (
<AccentButtonListContainer>
{events?.map((ev) => (
<AccentButton
isActive={event?.name === ev.name}
key={ev.name}
onClick={() => {
setTab("events");
setEvent(ev);
}}
label={ev.name}
/>
))}
</AccentButtonListContainer>
)}
</div>
) : null}
</div>
<CodeSegment
environment={environment}
hideTabs
setEnvironment={setEnvironment}
snippet={formatSnippet(COMMANDS.setup, {
chainId,
contractAddress,
})}
/>
<Text>
You will need to pass a client ID/secret key to use
thirdweb&apos;s infrastructure services. If you don&apos;t have
any API keys yet you can create one by creating a project for free
from the{" "}
<Link color="primary.500" href="/team">
dashboard
</Link>
.
</Text>
</Flex>
</Flex>
{!onlyInstall && (
<Flex flexDirection="column" gap={6}>
<Heading size="title.md">All Functions & Events</Heading>
<SimpleGrid columns={12} gap={3} height="100%">
<GridItem
as={Card}
colSpan={{ base: 12, md: 4 }}
height="100%"
overflow="auto"
overflowY="auto"
pt={0}
px={0}
>
<List height="100%" overflowX="hidden">
{((writeFunctions || []).length > 0 ||
(readFunctions || []).length > 0) && (
<Tabs
colorScheme="gray"
display="flex"
flexDir="column"
h="100%"
position="relative"
>
<TabList as={Flex}>
{(writeFunctions || []).length > 0 && (
<Tab flex="1 1 0" gap={2}>
<Heading color="inherit" my={1} size="label.md">
Write
</Heading>
</Tab>
)}
{(readFunctions || []).length > 0 && (
<Tab flex="1 1 0" gap={2}>
<Heading color="inherit" my={1} size="label.md">
Read
</Heading>
</Tab>
)}
{(events || []).length > 0 && (
<Tab flex="1 1 0" gap={2}>
<Heading color="inherit" my={1} size="label.md">
Events
</Heading>
</Tab>
)}
</TabList>
<TabPanels h="auto" overflow="auto">
<TabPanel>
{writeFunctions?.map((fn) => (
<ListItem key={fn.signature} my={0.5}>
<Button
_hover={{
opacity: 1,
textDecor: "underline",
}}
color="heading"
fontFamily="mono"
fontWeight={
tab === "write" &&
write?.signature === fn.signature
? 600
: 400
}
onClick={() => {
setTab("write");
setWrite(fn);
}}
opacity={
tab === "write" &&
write?.signature === fn.signature
? 1
: 0.65
}
size="sm"
variant="link"
>
{fn.name}
</Button>
</ListItem>
))}
</TabPanel>
<TabPanel>
{readFunctions?.map((fn) => (
<ListItem key={fn.signature} my={0.5}>
<Button
_hover={{
opacity: 1,
textDecor: "underline",
}}
color="heading"
fontFamily="mono"
fontWeight={
tab === "read" &&
read?.signature === fn.signature
? 600
: 400
}
onClick={() => {
setTab("read");
setRead(fn);
}}
opacity={
tab === "read" &&
read?.signature === fn.signature
? 1
: 0.65
}
size="sm"
variant="link"
>
{fn.name}
</Button>
</ListItem>
))}
</TabPanel>
<TabPanel>
{events?.map((ev) => (
<ListItem key={ev.name} my={0.5}>
<Button
_hover={{
opacity: 1,
textDecor: "underline",
}}
color="heading"
fontFamily="mono"
fontWeight={
tab === "events" &&
(event as AbiEvent).name ===
(ev as AbiEvent).name
? 600
: 400
}
onClick={() => {
setTab("events");
setEvent(ev);
}}
opacity={
tab === "events" &&
(event as AbiEvent).name ===
(ev as AbiEvent).name
? 1
: 0.65
}
size="sm"
variant="link"
>
{ev.name}
</Button>
</ListItem>
))}
</TabPanel>
</TabPanels>
</Tabs>
)}
</List>
</GridItem>
<GridItem
as={Card}
colSpan={{ base: 12, md: 8 }}
height="100%"
overflow="auto"
>
<CodeSegment
environment={environment}
setEnvironment={setEnvironment}
snippet={formatSnippet(
// biome-ignore lint/suspicious/noExplicitAny: FIXME
COMMANDS[tab as keyof typeof COMMANDS] as any,
{
args:
abi
?.filter(
(f) => f.type === "function" || f.type === "event",
)
?.find(
(f) =>
f.name ===
(tab === "read"
? read?.name
: tab === "write"
? write?.name
: event?.name),
)
?.inputs.map((i) => i.name || "") || [],
snippet={formatSnippet(
// biome-ignore lint/suspicious/noExplicitAny: FIXME
COMMANDS[tab as keyof typeof COMMANDS] as any,
{
args:
abi
?.filter(
(f) => f.type === "function" || f.type === "event",
)
?.find(
(f) =>
f.name ===
(tab === "read"
? read?.name
: tab === "write"
? write?.name
: event?.name),
)
?.inputs.map((i) => i.name || "") || [],
chainId,
contractAddress,
extensionNamespace,
fn:
tab === "read" ? read : tab === "write" ? write : event,
},
)}
/>
</GridItem>
</SimpleGrid>
</Flex>
)}
</GridItem>
</SimpleGrid>
chainId,
contractAddress,
extensionNamespace,
fn: tab === "read" ? read : tab === "write" ? write : event,
},
)}
/>
</div>
</div>
)}
</div>
);
};
}
function AccentButtonListContainer(props: { children: React.ReactNode }) {
return (
<div className="flex flex-col gap-0.5 px-2 py-3 max-h-[300px] lg:max-h-[700px] overflow-y-auto">
{props.children}
</div>
);
}
function AccentButton(props: {
isActive: boolean;
onClick: () => void;
label: string;
}) {
return (
<Button
className={cn(
"text-sm justify-start h-auto py-1.5 px-2 text-muted-foreground font-normal font-mono",
props.isActive && "text-foreground bg-accent",
)}
onClick={props.onClick}
size="sm"
variant="ghost"
>
{props.label}
</Button>
);
}
function AccountFactorySection(props: {
environment: CodeEnvironment;
setEnvironment: (environment: CodeEnvironment) => void;
address?: string;
chainId: number;
contractAddress: string;
}) {
return (
<div className="space-y-4">
<div className="space-y-2">
<h2 className="text-lg font-semibold tracking-tight">
Integrate your account factory
</h2>
<Alert variant="info">
<CircleAlertIcon className="w-5 h-5 text-blue-500" />
<AlertTitle>Account Factory</AlertTitle>
<AlertDescription>
The recommended way to use account factories is to integrate the{" "}
<UnderlineLink
href="https://portal.thirdweb.com/transactions/sponsor"
rel="noopener noreferrer"
target="_blank"
>
thirdweb SDK
</UnderlineLink>{" "}
in your applications. This will ensure account contracts are
deployed for your users only when they need it.
</AlertDescription>
</Alert>
</div>
<div className="flex flex-col gap-2">
<CodeSegment
environment={props.environment}
hideTabs
setEnvironment={props.setEnvironment}
snippet={formatSnippet(
(WALLETS_SNIPPETS.find((w) => w.id === "smart-wallet")
?.supportedLanguages || {}) as Record<CodeEnvironment, string>,
{
address: props.address,
chainId: props.chainId,
contractAddress: props.contractAddress,
},
)}
/>
</div>
</div>
);
}
@@ -22,15 +22,16 @@ export default function ContractFunctionComment({
return null;
}
return (
<>
<p className="mt-6">
<div>
<h3 className="text-base font-semibold mt-6 mb-3">
About this function <Badge>Beta</Badge>
</p>
</h3>
<CodeClient
code={query.data}
copyButtonClassName="hidden"
lang="wikitext"
lang="solidity"
className="bg-background"
/>
</>
</div>
);
}
@@ -1,32 +1,7 @@
"use client";
import {
Box,
Divider,
Flex,
GridItem,
Image,
List,
SimpleGrid,
Tab,
TabList,
Table,
TabPanel,
TabPanels,
Tabs,
Tbody,
Td,
Th,
Thead,
Tr,
} from "@chakra-ui/react";
import type { AbiEvent, AbiFunction } from "abitype";
import { Button } from "chakra/button";
import { Card } from "chakra/card";
import { Heading } from "chakra/heading";
import { Text } from "chakra/text";
import { SearchIcon } from "lucide-react";
import { usePathname, useSearchParams } from "next/navigation";
import {
type Dispatch,
lazy,
@@ -45,12 +20,21 @@ import {
type CodeEnvironment,
CodeSegment,
} from "@/components/blocks/code/code-segment.client";
import { camelToTitle } from "@/components/solidity-inputs/helpers";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { Input } from "@/components/ui/input";
import {
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { TabButtons } from "@/components/ui/tabs";
import { useContractFunctionSelectors } from "@/hooks/contract-ui/useContractFunctionSelectors";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { cn } from "@/lib/utils";
import { COMMANDS, formatSnippet } from "../code-overview";
import { InteractiveAbiFunction } from "./interactive-abi-function";
@@ -137,25 +121,21 @@ function ContractFunctionInner(props: ContractFunctionProps) {
});
return (
<Flex direction="column" gap={1.5}>
<Flex alignItems="center" direction="row" flexWrap="wrap" gap={2}>
<Flex alignItems="baseline" flexWrap="wrap" gap={1}>
<Heading size="subtitle.md">{camelToTitle(fn.name)}</Heading>
<Heading className="text-muted-foreground" size="subtitle.sm">
({fn.name})
</Heading>
</Flex>
<div className="flex flex-col gap-1.5">
<div className="flex items-center flex-wrap gap-2 border-b pb-3 mb-3">
<h3 className="text-lg font-semibold">{fn.name}</h3>
{isFunction && <Badge variant="success">{fn.stateMutability}</Badge>}
{functionSelector && (
<CopyTextButton
className="ml-auto text-xs"
className="ml-auto text-xs font-mono py-1"
copyIconPosition="right"
textToCopy={functionSelector}
textToShow={functionSelector}
tooltip="The selector of this function"
/>
)}
</Flex>
</div>
{isFunction && (
<InteractiveAbiFunction
abiFunction={fn}
@@ -166,20 +146,20 @@ function ContractFunctionInner(props: ContractFunctionProps) {
)}
{codeSnippet && (
<>
<Heading mt={6} size="subtitle.md">
<div>
<h3 className="text-base font-semibold mt-6 mb-3">
Use this function in your app
</Heading>
<Divider mb={2} />
</h3>
<CodeSegment
environment={environment}
setEnvironment={setEnvironment}
snippet={codeSnippet}
codeContainerClassName="bg-background"
/>
</>
</div>
)}
<ContractFunctionComment contract={contract} functionName={fn.name} />
</Flex>
</div>
);
}
@@ -188,84 +168,48 @@ function ContractFunctionInputs(props: { fn: AbiFunction | AbiEvent }) {
const isFunction = "stateMutability" in fn;
return (
<Flex direction="column" gap={1.5}>
<Flex
alignItems={{ base: "start", md: "center" }}
direction={{ base: "column", md: "row" }}
gap={2}
>
<Flex alignItems="baseline" flexWrap="wrap" gap={1}>
<Heading size="subtitle.md">{camelToTitle(fn.name)}</Heading>
<Heading className="text-muted-foreground" size="subtitle.sm">
({fn.name})
</Heading>
</Flex>
<div className="flex flex-col gap-1.5">
<div className="flex items-center flex-wrap gap-2 border-b pb-2.5 mb-3">
<h3 className="text-base font-semibold">{fn.name}</h3>
{isFunction && <Badge variant="success">{fn.stateMutability}</Badge>}
</Flex>
</div>
{fn.inputs?.length ? (
<>
<Divider my={2} />
<Flex flexDir="column" gap={3}>
<Heading size="label.lg">Inputs</Heading>
<Box
borderTopRadius="lg"
overflowX="auto"
p={0}
position="relative"
>
<Table size="sm">
<Thead>
<Tr>
<Th border="none">
<Heading as="label" color="faded" size="label.sm">
Name
</Heading>
</Th>
<Th border="none">
<Heading as="label" color="faded" size="label.sm">
Type
</Heading>
</Th>
</Tr>
</Thead>
<Tbody>
{fn.inputs.map((input, idx) => (
<Tr
_last={{ borderBottomWidth: 0 }}
borderBottomWidth={1}
key={`${input.name}+${idx}}`}
>
<Td
borderBottomColor="borderColor"
borderBottomWidth="inherit"
>
{input?.name ? (
<Text fontFamily="mono">{input.name}</Text>
) : (
<Text
className="text-muted-foreground"
fontStyle="italic"
>
No name defined
</Text>
)}
</Td>
<Td
borderBottomColor="borderColor"
borderBottomWidth="inherit"
>
<Text fontFamily="mono">{input.type}</Text>
</Td>
</Tr>
))}
</Tbody>
</Table>
</Box>
</Flex>
</>
) : null}
</Flex>
<div>
<h4 className="text-base font-semibold mb-3">Inputs</h4>
<TableContainer>
<Table>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead>Type</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{fn.inputs.map((input, idx) => (
<TableRow key={`${input.name}+${idx}}`}>
<TableCell className="font-medium py-3">
{input?.name ? (
<span className="font-mono">{input.name}</span>
) : (
<span className="text-muted-foreground italic">
No name defined
</span>
)}
</TableCell>
<TableCell className="py-3">
<span className="font-mono">{input.type}</span>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</div>
) : (
<p className="text-muted-foreground text-base">No inputs required</p>
)}
</div>
);
}
@@ -280,6 +224,8 @@ type ExtensionFunctions = {
functions: AbiFunction[];
};
type ReadOrWriteTab = "read" | "write";
export const ContractFunctionsPanel: React.FC<ContractFunctionsPanelProps> = ({
fnsOrEvents,
contract,
@@ -296,6 +242,7 @@ export const ContractFunctionsPanel: React.FC<ContractFunctionsPanelProps> = ({
});
return results;
}, [fnsOrEvents]);
const writeFunctions: ExtensionFunctions[] = useMemo(() => {
return functionsWithExtension
.map((e) => {
@@ -313,6 +260,7 @@ export const ContractFunctionsPanel: React.FC<ContractFunctionsPanelProps> = ({
})
.filter((e) => e !== undefined) as ExtensionFunctions[];
}, [functionsWithExtension]);
const viewFunctions: ExtensionFunctions[] = useMemo(() => {
return functionsWithExtension
.map((e) => {
@@ -336,166 +284,117 @@ export const ContractFunctionsPanel: React.FC<ContractFunctionsPanelProps> = ({
return fnsOrEvents.filter((fn) => !("stateMutability" in fn)) as AbiEvent[];
}, [fnsOrEvents]);
// Load state from the URL
const searchParams = useSearchParams();
const _selector = searchParams?.get("selector");
const _item = _selector
? fnsOrEvents.find((o) => {
if (o.type === "function") {
const selector = toFunctionSelector(o as AbiFunction);
return selector === _selector;
}
return null;
})
: undefined;
const defaultSelected = fnsOrEvents[0];
const [selectedFunction, setSelectedFunction] = useState<
AbiFunction | AbiEvent | undefined
>(_item ?? fnsOrEvents[0]);
// Set the active tab to Write or Read depends on the `_item`
const _defaultTabIndex =
_item &&
"stateMutability" in _item &&
(_item.stateMutability === "view" || _item.stateMutability === "pure")
? 1
: 0;
>(defaultSelected);
const [_keywordSearch, setKeywordSearch] = useState<string>("");
const [keywordSearch] = useDebounce(_keywordSearch, 150);
const [activeTab, setActiveTab] = useState<ReadOrWriteTab>(() => {
const isDefaultSelectedReadFunction = viewFunctions.find((e) =>
e.functions.find((fn) => fn.name === defaultSelected?.name),
);
return isDefaultSelectedReadFunction ? "read" : "write";
});
const functionSection = (e: ExtensionFunctions) => {
const filteredFunctions = keywordSearch
? e.functions.filter((o) =>
o.name.toLowerCase().includes(keywordSearch.toLowerCase()),
)
: e.functions;
return (
<Flex flexDir="column" key={e.extension} mb={6}>
{e.extension ? (
<>
<Flex alignContent="center" alignItems="center" gap={2}>
<Image
alt="Extension detected"
mb="2px"
objectFit="contain"
src="/assets/dashboard/extension-check.svg"
<div key={e.extension} className="pb-6">
<div className="space-y-0.5">
{selectedFunction &&
filteredFunctions.map((fn) => (
<FunctionsOrEventsListItem
fn={fn}
key={`${fn.name}_${fn.type}_${fn.inputs.length}`}
selectedFunction={selectedFunction}
setSelectedFunction={setSelectedFunction}
/>
<Heading as="label" size="label.md">
{e.extension}
</Heading>
</Flex>
<Divider my={2} />
</>
) : (
<>
<Flex alignContent="center" alignItems="center" gap={2}>
<Heading as="label" size="label.md">
Other Functions
</Heading>
</Flex>
<Divider my={2} />
</>
)}
{selectedFunction &&
filteredFunctions.map((fn) => (
<FunctionsOrEventsListItem
fn={fn}
key={`${fn.name}_${fn.type}_${fn.inputs.length}`}
selectedFunction={selectedFunction}
setSelectedFunction={setSelectedFunction}
/>
))}
</Flex>
))}
</div>
</div>
);
};
return (
<SimpleGrid columns={12} gap={5} height="100%">
<GridItem
as={Card}
className="bg-card"
colSpan={{ base: 12, md: 4 }}
height="100%"
overflow="auto"
overflowY="auto"
pt={0}
px={0}
>
<List height="100%" overflowX="hidden">
{(writeFunctions.length > 0 || viewFunctions.length > 0) && (
<Tabs
colorScheme="gray"
defaultIndex={_defaultTabIndex}
display="flex"
flexDir="column"
h="100%"
position="relative"
>
<TabList as={Flex}>
{writeFunctions.length > 0 && (
<Tab flex="1 1 0" gap={2}>
<Heading color="inherit" my={1} size="label.md">
Write
</Heading>
</Tab>
)}
{viewFunctions.length > 0 && (
<Tab flex="1 1 0" gap={2}>
<Heading color="inherit" my={1} size="label.md">
Read
</Heading>
</Tab>
)}
</TabList>
<div className="grid grid-cols-1 lg:grid-cols-[1fr_2fr] h-full bg-card rounded-lg border">
{/* left */}
<div className="overflow-auto border-b lg:border-b-0 lg:border-r">
{(writeFunctions.length > 0 || viewFunctions.length > 0) && (
<div className="flex flex-col h-full relative">
<TabButtons
tabContainerClassName="px-3 pt-2"
tabClassName="!text-sm"
tabs={[
...(viewFunctions.length > 0
? [
{
name: "Read",
onClick: () => setActiveTab("read"),
isActive: activeTab === "read",
},
]
: []),
...(writeFunctions.length > 0
? [
{
name: "Write",
onClick: () => setActiveTab("write"),
isActive: activeTab === "write",
},
]
: []),
]}
/>
<div className="sticky top-0 z-[1]">
<div className="relative w-full">
<SearchIcon className="-translate-y-1/2 absolute top-[50%] left-3 size-4 text-muted-foreground" />
<Input
className="h-auto rounded-none border-x-0 bg-card py-3 pl-9 focus-visible:ring-0 focus-visible:ring-offset-0"
onChange={(e) => setKeywordSearch(e.target.value)}
placeholder="Search"
value={_keywordSearch}
/>
</div>
</div>
<TabPanels h="auto" overflow="auto">
{writeFunctions.length > 0 && (
<TabPanel>
{writeFunctions.map((e) => functionSection(e))}
</TabPanel>
)}
{viewFunctions.length > 0 && (
<TabPanel>
{viewFunctions.map((e) => functionSection(e))}
</TabPanel>
)}
</TabPanels>
</Tabs>
)}
{events.length > 0 && selectedFunction && (
<Box overflowX="hidden" pt={2} px={4}>
{events.map((fn) => (
<FunctionsOrEventsListItem
fn={fn}
key={`${fn.name}_${fn.type}_${fn.inputs.length}`}
selectedFunction={selectedFunction}
setSelectedFunction={setSelectedFunction}
<div className="sticky top-0 z-[1]">
<div className="relative w-full">
<SearchIcon className="-translate-y-1/2 absolute top-[50%] left-3 size-4 text-muted-foreground" />
<Input
className="h-auto rounded-none border-x-0 border-t-0 bg-card py-3 pl-9 focus-visible:ring-0 focus-visible:ring-offset-0"
onChange={(e) => setKeywordSearch(e.target.value)}
placeholder="Search"
value={_keywordSearch}
/>
))}
</Box>
)}
</List>
</GridItem>
<GridItem
as={Card}
className="bg-card"
colSpan={{ base: 12, md: 8 }}
height="100%"
overflow="auto"
>
</div>
</div>
<div className="h-auto overflow-auto pt-2 px-2">
{activeTab === "write" &&
writeFunctions.length > 0 &&
writeFunctions.map((e) => functionSection(e))}
{activeTab === "read" &&
viewFunctions.length > 0 &&
viewFunctions.map((e) => functionSection(e))}
</div>
</div>
)}
{events.length > 0 && selectedFunction && (
<div className="p-4 space-y-0.5">
{events.map((fn) => (
<FunctionsOrEventsListItem
fn={fn}
key={`${fn.name}_${fn.type}_${fn.inputs.length}`}
selectedFunction={selectedFunction}
setSelectedFunction={setSelectedFunction}
/>
))}
</div>
)}
</div>
{/* right */}
<div className="overflow-auto p-4">
{selectedFunction && (
<ContractFunction
contract={contract}
@@ -503,8 +402,8 @@ export const ContractFunctionsPanel: React.FC<ContractFunctionsPanelProps> = ({
isLoggedIn={isLoggedIn}
/>
)}
</GridItem>
</SimpleGrid>
</div>
</div>
);
};
@@ -524,31 +423,19 @@ const FunctionsOrEventsListItem: React.FC<FunctionsOrEventsListItemProps> = ({
const isActive =
selectedFunction?.name === fn.name &&
selectedFunction.inputs?.length === fn.inputs?.length;
const pathname = usePathname();
const router = useDashboardRouter();
return (
<li className="my-1">
<Button
className={cn(
"!font-medium !text-muted-foreground hover:!text-foreground font-mono",
{
"!text-foreground": isActive,
},
)}
onClick={() => {
setSelectedFunction(fn);
// Only apply to the Explorer page
if (pathname?.endsWith("/explorer") && fn.type === "function") {
const selector = toFunctionSelector(fn);
router.push(`${pathname}?selector=${selector}`);
}
}}
size="sm"
variant="link"
>
{fn.name}
</Button>
</li>
<Button
className={cn(
"text-muted-foreground hover:text-foreground font-mono w-full justify-start h-auto px-2 py-1.5",
isActive && "text-foreground bg-accent",
)}
onClick={() => {
setSelectedFunction(fn);
}}
size="sm"
variant="ghost"
>
{fn.name}
</Button>
);
};
@@ -1,19 +1,12 @@
"use client";
import {
Flex,
Tab,
TabList,
TabPanel,
TabPanels,
Tabs,
} from "@chakra-ui/react";
import type { Abi, AbiEvent, AbiFunction } from "abitype";
import { Heading } from "chakra/heading";
import { useState } from "react";
import type { ThirdwebContract } from "thirdweb";
import { SourcesPanel } from "@/components/contract-components/shared/sources-panel";
import type { SourceFile } from "@/components/contract-components/types";
import { CodeOverview } from "@/components/contracts/code-overview";
import { TabButtons } from "@/components/ui/tabs";
import { ContractFunctionsPanel } from "./contract-function";
interface ContractFunctionsOverview {
@@ -22,103 +15,96 @@ interface ContractFunctionsOverview {
contract?: ThirdwebContract;
sources?: SourceFile[];
abi?: Abi;
onlyFunctions?: boolean;
isLoggedIn: boolean;
}
type Tab = "functions" | "events" | "code" | "sources";
export const ContractFunctionsOverview: React.FC<ContractFunctionsOverview> = ({
functions,
events,
contract,
sources,
abi,
onlyFunctions,
isLoggedIn,
}) => {
if (onlyFunctions) {
return (
<Flex flexDir="column" gap={2} height="100%">
{functions && functions.length > 0 && (
<ContractFunctionsPanel
contract={contract}
fnsOrEvents={functions}
isLoggedIn={isLoggedIn}
/>
)}
</Flex>
);
}
const [activeTab, setActiveTab] = useState<Tab | undefined>(() => {
if (functions && functions.length > 0) return "functions";
if (events && events.length > 0) return "events";
if (abi) return "code";
if (sources && sources.length > 0) return "sources";
return undefined;
});
// Tab index: 0 = Functions, 1 = Events, 2 = Code, 3 = Sources
const tabOptions = [
...(functions && functions.length > 0
? [
{
name: "Functions",
onClick: () => setActiveTab("functions"),
isActive: activeTab === "functions",
},
]
: []),
...(events && events.length > 0
? [
{
name: "Events",
onClick: () => setActiveTab("events"),
isActive: activeTab === "events",
},
]
: []),
...(abi
? [
{
name: "Code",
onClick: () => setActiveTab("code"),
isActive: activeTab === "code",
},
]
: []),
...(sources && sources.length > 0
? [
{
name: "Sources",
onClick: () => setActiveTab("sources"),
isActive: activeTab === "sources",
},
]
: []),
];
return (
<Flex flexDir="column" gap={2} w="100%">
<Tabs colorScheme="gray" isLazy lazyBehavior="keepMounted">
<TabList borderBottomColor="borderColor" borderBottomWidth="1px" px={0}>
{functions && functions.length > 0 ? (
<Tab>
<Heading color="inherit" my={1} size="label.lg">
Functions
</Heading>
</Tab>
) : null}
{events?.length ? (
<Tab>
<Heading color="inherit" my={1} size="label.lg">
Events
</Heading>
</Tab>
) : null}
{abi && (
<Tab>
<Heading color="inherit" my={1} size="label.lg">
Code
</Heading>
</Tab>
)}
{sources && sources?.length > 0 && (
<Tab>
<Heading color="inherit" my={1} size="label.lg">
Sources
</Heading>
</Tab>
)}
</TabList>
<TabPanels py={2}>
{functions && functions.length > 0 ? (
<TabPanel h="40rem">
<ContractFunctionsPanel
contract={contract}
fnsOrEvents={functions}
isLoggedIn={isLoggedIn}
/>
</TabPanel>
) : null}
{events && events?.length > 0 ? (
<TabPanel>
<ContractFunctionsPanel
contract={contract}
fnsOrEvents={events}
isLoggedIn={isLoggedIn}
/>
</TabPanel>
) : null}
{abi && (
<TabPanel>
<div className="flex flex-col gap-6">
<CodeOverview
abi={abi}
chainId={contract?.chain.id || 1}
noSidebar
/>
</div>
</TabPanel>
)}
{(sources || abi) && (
<TabPanel>
<SourcesPanel abi={abi} sources={sources} />
</TabPanel>
)}
</TabPanels>
</Tabs>
</Flex>
<div>
<TabButtons tabs={tabOptions} />
<div className="pt-4">
{functions && functions.length > 0 && activeTab === "functions" && (
<div className="h-[70vh]">
<ContractFunctionsPanel
contract={contract}
fnsOrEvents={functions}
isLoggedIn={isLoggedIn}
/>
</div>
)}
{events && events.length > 0 && activeTab === "events" && (
<div className="h-[70vh]">
<ContractFunctionsPanel
contract={contract}
fnsOrEvents={events}
isLoggedIn={isLoggedIn}
/>
</div>
)}
{abi && activeTab === "code" && (
<CodeOverview abi={abi} chainId={contract?.chain.id || 1} noSidebar />
)}
{sources && sources.length > 0 && activeTab === "sources" && (
<SourcesPanel abi={abi} sources={sources} />
)}
</div>
</div>
);
};
@@ -1,20 +1,13 @@
"use client";
import {
ButtonGroup,
Divider,
Flex,
FormControl,
Input,
} from "@chakra-ui/react";
import { useMutation } from "@tanstack/react-query";
import { type AbiFunction, type AbiParameter, formatAbiItem } from "abitype";
import { Button } from "chakra/button";
import { Card } from "chakra/card";
import { FormErrorMessage, FormHelperText, FormLabel } from "chakra/form";
import { Heading } from "chakra/heading";
import { Text } from "chakra/text";
import { ExternalLinkIcon, InfoIcon, PlayIcon } from "lucide-react";
import {
ExternalLinkIcon,
InfoIcon,
PlayIcon,
RefreshCcwIcon,
} from "lucide-react";
import Link from "next/link";
import { useEffect, useId, useMemo, useState } from "react";
import { FormProvider, useFieldArray, useForm } from "react-hook-form";
@@ -29,16 +22,19 @@ import {
} from "thirdweb";
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
import { parseAbiParams, stringify, toFunctionSelector } from "thirdweb/utils";
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
import { SolidityInput } from "@/components/solidity-inputs";
import { camelToTitle } from "@/components/solidity-inputs/helpers";
import { TransactionButton } from "@/components/tx-button";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { CodeClient } from "@/components/ui/code/code.client";
import { PlainTextCodeBlock } from "@/components/ui/code/plaintext-code";
import { InlineCode } from "@/components/ui/inline-code";
import { Input } from "@/components/ui/input";
import { Spinner } from "@/components/ui/Spinner/Spinner";
import { Skeleton } from "@/components/ui/skeleton";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { UnderlineLink } from "@/components/ui/UnderlineLink";
import { replaceIpfsUrl } from "@/lib/sdk";
function formatResponseData(data: unknown): {
type: "json" | "text";
@@ -122,11 +118,11 @@ function formatContractCall(
return parsedParams;
}
interface InteractiveAbiFunctionProps {
type InteractiveAbiFunctionProps = {
abiFunction: AbiFunction;
contract: ThirdwebContract;
isLoggedIn: boolean;
}
};
function useAsyncRead(contract: ThirdwebContract, abiFunction: AbiFunction) {
const formattedAbi = formatAbiItem({
@@ -366,97 +362,72 @@ export const InteractiveAbiFunction: React.FC<InteractiveAbiFunctionProps> = (
return (
<FormProvider {...form}>
<Card
as={Flex}
bg="transparent"
border="none"
borderRadius="none"
boxShadow="none"
flexDirection="column"
flexGrow={1}
gap={4}
gridColumn={{ base: "span 12", md: "span 9" }}
p={0}
w="100%"
>
<Flex
as="form"
direction="column"
gap={2}
id={formId}
position="relative"
w="100%"
>
{fields.length > 0 && (
<>
<Divider mb="8px" />
{fields.map((item, index) => {
return (
<FormControl
isInvalid={
!!form.getFieldState(
`params.${index}.value`,
form.formState,
).error
}
key={item.id}
mb="8px"
>
<Flex justify="space-between">
<FormLabel>{camelToTitle(item.key)}</FormLabel>
<Text fontSize="12px">{item.key}</Text>
</Flex>
<SolidityInput
// @ts-expect-error - old types, need to update
solidityComponents={item.components}
solidityName={item.key}
solidityType={item.type}
{...form.register(`params.${index}.value`)}
functionName={abiFunction.name}
/>
<FormErrorMessage>
{
form.getFieldState(
`params.${index}.value`,
form.formState,
).error?.message
}
</FormErrorMessage>
</FormControl>
);
})}
</>
)}
<div className="space-y-6">
<form className="space-y-5 relative w-full" id={formId}>
{fields.length > 0 &&
fields.map((item, index) => {
const fieldError = form.getFieldState(
`params.${index}.value`,
form.formState,
).error;
return (
<FormFieldSetup
key={item.id}
htmlFor={`params.${index}.value`}
labelClassName="w-full"
labelContainerClassName="flex w-full"
label={
<div className="flex justify-between items-center w-full gap-3">
<span>{camelToTitle(item.key)}</span>
<span className="text-xs text-muted-foreground">
{item.key}
</span>
</div>
}
errorMessage={fieldError?.message}
isRequired={false}
className="mb-2"
>
<SolidityInput
// @ts-expect-error - old types, need to update
solidityComponents={item.components}
solidityName={item.key}
solidityType={item.type}
{...form.register(`params.${index}.value`)}
functionName={abiFunction.name}
/>
</FormFieldSetup>
);
})}
{abiFunction.stateMutability === "payable" && (
<>
<Divider mb="8px" />
<FormControl gap={0.5}>
<FormLabel>Native Token Value</FormLabel>
<Input {...form.register("value")} />
<FormHelperText>
The native currency value (in Ether) to send with this
transaction (ex: 0.01 to send 0.01 native currency).
</FormHelperText>
</FormControl>
</>
<FormFieldSetup
htmlFor="value"
label="Native Token Value"
errorMessage={undefined}
isRequired={false}
helperText="The native currency value (in Ether) to send with this transaction (ex: 0.01 to send 0.01 native currency)."
>
<Input {...form.register("value")} className="bg-background" />
</FormFieldSetup>
)}
{error ? (
<>
<Divider />
<Heading size="label.sm">Error</Heading>
<h3 className="text-sm font-medium">Error</h3>
<InlineCode
className="relative w-full whitespace-pre-wrap rounded-md border border-border p-4 text-red-500"
// biome-ignore lint/suspicious/noExplicitAny: FIXME
code={formatError(error as any)}
/>
</>
) : readLoading ? (
<Skeleton className="h-20 w-full rounded-lg" />
) : formattedResponseData ? (
<>
<Divider />
<div className="flex flex-row items-center gap-2">
<Heading size="label.sm">Output</Heading>
<h3 className="text-sm font-medium">Output</h3>
{/* Show the Solidity type of the function's output */}
{abiFunction.outputs.length > 0 && (
<Badge variant="default">
@@ -466,30 +437,32 @@ export const InteractiveAbiFunction: React.FC<InteractiveAbiFunctionProps> = (
</div>
{formattedResponseData.type === "text" ? (
<PlainTextCodeBlock code={formattedResponseData.data} />
<PlainTextCodeBlock
code={formattedResponseData.data}
className="bg-background"
/>
) : (
<CodeClient
code={formattedResponseData.data}
lang={formattedResponseData.type}
className="bg-background"
/>
)}
{/* If the result is an IPFS URI, show a handy link so that users can open it in a new tab */}
{formattedResponseData.type === "text" &&
formattedResponseData.data.startsWith("ipfs://") && (
<Text size="label.sm">
<UnderlineLink
href={replaceIpfsUrl(
formattedResponseData.data,
contract.client,
)}
rel="noopener noreferrer"
target="_blank"
>
Open in gateway
</UnderlineLink>
</Text>
<Link
href={`https://ipfs.io/ipfs/${formattedResponseData.data.split("ipfs://")[1]}`}
rel="noopener noreferrer"
className="text-sm text-muted-foreground hover:text-foreground inline-flex items-center gap-2 mt-1"
target="_blank"
>
Open In IPFS Gateway
<ExternalLinkIcon className="size-3.5" />
</Link>
)}
{/* Same with the logic above but this time it's applied to traditional urls */}
{((formattedResponseData.type === "text" &&
formattedResponseData.data.startsWith("https://")) ||
@@ -506,37 +479,46 @@ export const InteractiveAbiFunction: React.FC<InteractiveAbiFunctionProps> = (
)}
</>
) : null}
</Flex>
</form>
<Divider mt="auto" />
<ButtonGroup ml="auto">
<div className="flex gap-3 justify-end">
{isView ? (
<Button
colorScheme="primary"
form={formId}
isDisabled={!abiFunction}
isLoading={readLoading}
disabled={!abiFunction}
onClick={handleContractRead}
rightIcon={<PlayIcon className="size-4" />}
className="gap-2 bg-background rounded-full"
variant="outline"
>
Run
{/* run / rerun */}
{readLoading ? (
<Spinner className="size-4" />
) : readData ? (
<RefreshCcwIcon className="size-4 text-muted-foreground" />
) : (
<PlayIcon className="size-4 text-muted-foreground" />
)}
{readData ? "Run again" : readLoading ? "Running" : "Run"}
</Button>
) : (
<>
<Button
isDisabled={
!abiFunction || txSimulation.isPending || mutationLoading
}
isLoading={txSimulation.isPending}
onClick={handleContractSimulation}
>
<ToolTipLabel label="Simulate the transaction to see its potential outcome without actually sending it to the network. This action doesn't cost gas.">
<span className="mr-3">
<InfoIcon className="size-5" />
</span>
</ToolTipLabel>
Simulate
</Button>
<ToolTipLabel label="Simulate the transaction to see its potential outcome without actually sending it to the network. This action doesn't cost gas.">
<Button
className="gap-2 bg-background"
variant="outline"
disabled={
!abiFunction || txSimulation.isPending || mutationLoading
}
onClick={handleContractSimulation}
>
{txSimulation.isPending ? (
<Spinner className="size-4" />
) : (
<InfoIcon className="size-4 text-muted-foreground" />
)}
Simulate
</Button>
</ToolTipLabel>
<TransactionButton
client={contract.client}
disabled={
@@ -553,8 +535,8 @@ export const InteractiveAbiFunction: React.FC<InteractiveAbiFunctionProps> = (
</TransactionButton>
</>
)}
</ButtonGroup>
</Card>
</div>
</div>
</FormProvider>
);
};
@@ -37,6 +37,8 @@ type ImportModalProps = {
onClose: () => void;
teamId: string;
projectId: string;
projectSlug: string;
teamSlug: string;
client: ThirdwebClient;
type: "contract" | "asset";
onSuccess?: () => void;
@@ -69,7 +71,9 @@ export const ImportModal: React.FC<ImportModalProps> = (props) => {
client={props.client}
onSuccess={props.onSuccess}
projectId={props.projectId}
projectSlug={props.projectSlug}
teamId={props.teamId}
teamSlug={props.teamSlug}
type={props.type}
/>
</DialogContent>
@@ -96,6 +100,8 @@ const importFormSchema = z.object({
function ImportForm(props: {
teamId: string;
projectId: string;
teamSlug: string;
projectSlug: string;
client: ThirdwebClient;
type: "contract" | "asset";
onSuccess?: () => void;
@@ -216,7 +222,7 @@ function ImportForm(props: {
addContractToProject.data?.result ? (
<Button asChild className="gap-2">
<Link
href={`/${chainSlug}/${addContractToProject.data.result.contractAddress}`}
href={`/team/${props.teamSlug}/${props.projectSlug}/contract/${chainSlug}/${addContractToProject.data.result.contractAddress}`}
rel="noopener noreferrer"
target="_blank"
>
@@ -1,15 +1,4 @@
import {
Flex,
FormControl,
IconButton,
Input,
InputGroup,
InputRightElement,
Tooltip,
} from "@chakra-ui/react";
import { Button } from "chakra/button";
import { FormErrorMessage, FormLabel } from "chakra/form";
import { BanIcon, PlusIcon, TrashIcon, UploadIcon, XIcon } from "lucide-react";
import { PlusIcon, TrashIcon, XIcon } from "lucide-react";
import { useEffect } from "react";
import {
type ArrayPath,
@@ -25,7 +14,16 @@ import {
type WatchObserver,
} from "react-hook-form";
import type { ThirdwebClient } from "thirdweb";
import { FileInput } from "@/components/blocks/FileInput";
import { Button } from "@/components/ui/button";
import {
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { cn } from "@/lib/utils";
type OptionalPropertiesInput = {
[key: string]: string | number;
@@ -46,17 +44,15 @@ interface IPropertiesFormControlProps<
client: ThirdwebClient;
}
export const PropertiesFormControl = <
export function PropertiesFormControl<
TFieldValues extends IPropertyFieldValues,
>({
control,
register,
watch,
errors,
setValue,
client,
}: React.PropsWithChildren<IPropertiesFormControlProps<TFieldValues>>) => {
const { fields, append, remove, replace } = useFieldArray({
}: React.PropsWithChildren<IPropertiesFormControlProps<TFieldValues>>) {
const { fields, append, remove } = useFieldArray({
control,
name: "attributes" as ArrayPath<TFieldValues>,
});
@@ -72,19 +68,7 @@ export const PropertiesFormControl = <
return (
<div className="flex flex-col gap-4">
<Flex align="center" direction="row" justify="space-between">
<FormLabel m={0}>Attributes</FormLabel>
<Button
colorScheme="red"
// biome-ignore lint/suspicious/noExplicitAny: FIXME
onClick={() => replace([{ trait_type: "", value: "" } as any])}
rightIcon={<BanIcon className="size-4" />}
size="xs"
variant="outline"
>
Reset
</Button>
</Flex>
<FormLabel>Attributes</FormLabel>
{fields.map((field, index) => {
// biome-ignore lint/suspicious/noExplicitAny: FIXME
const keyError = (errors as any)?.attributes?.[index]?.trait_type
@@ -92,102 +76,108 @@ export const PropertiesFormControl = <
// biome-ignore lint/suspicious/noExplicitAny: FIXME
const valueError = (errors as any)?.attributes?.[index]?.value
?.message as string | undefined;
const isInvalid = !!(keyError || valueError);
const _isInvalid = !!(keyError || valueError);
return (
<div className="flex flex-row items-center gap-2" key={field.id}>
<FormControl
className="flex flex-row items-start gap-3"
isInvalid={isInvalid}
>
<FormControl isInvalid={!!keyError}>
<Input
{...register(
`attributes.${index}.trait_type` as Path<TFieldValues>,
)}
placeholder="trait_type"
/>
<FormErrorMessage>{keyError}</FormErrorMessage>
</FormControl>
<FormControl isInvalid={!!valueError}>
{watch(
`attributes.${index}.value` as unknown as WatchObserver<TFieldValues>,
) instanceof File ? (
<InputGroup>
<Input
isDisabled
value={
watch(`attributes.${index}.value` as Path<TFieldValues>)
.name
}
/>
<InputRightElement>
<TrashIcon
className="size-4 cursor-pointer text-red-300 hover:text-red-200"
onClick={() =>
setValue(
`attributes.${index}.value` as Path<TFieldValues>,
"" as PathValue<TFieldValues, Path<TFieldValues>>,
)
}
<div className="flex flex-row items-start gap-3 flex-1">
<FormField
control={control}
name={`attributes.${index}.trait_type` as Path<TFieldValues>}
render={({ field: traitField }) => (
<FormItem className="flex-1">
<FormControl>
<Input
{...traitField}
placeholder="trait_type"
className={cn(
"bg-card",
keyError && "border-destructive",
)}
/>
</InputRightElement>
</InputGroup>
) : (
<InputGroup>
<Input
{...register(
`attributes.${index}.value` as Path<TFieldValues>,
)}
placeholder="value"
/>
<InputRightElement>
<Tooltip label="Upload file" shouldWrapChildren>
<FileInput
client={client}
setValue={(file) => {
setValue(
`attributes.${index}.value` as Path<TFieldValues>,
file as PathValue<
TFieldValues,
Path<TFieldValues>
>,
);
}}
>
<UploadIcon className="size-4 text-muted-foreground" />
</FileInput>
</Tooltip>
</InputRightElement>
</InputGroup>
</FormControl>
{keyError && <FormMessage>{keyError}</FormMessage>}
</FormItem>
)}
<FormErrorMessage>{valueError}</FormErrorMessage>
</FormControl>
</FormControl>
<IconButton
aria-label="remove key value pair"
colorScheme="red"
icon={<XIcon />}
/>
<FormField
control={control}
name={`attributes.${index}.value` as Path<TFieldValues>}
render={({ field: valueField }) => (
<FormItem className="flex-1">
<FormControl>
{watch(
`attributes.${index}.value` as unknown as WatchObserver<TFieldValues>,
) instanceof File ? (
<div className="relative">
<Input
disabled
value={
watch(
`attributes.${index}.value` as Path<TFieldValues>,
).name
}
className="pr-10 bg-card"
/>
<Button
type="button"
variant="ghost"
size="sm"
className="absolute right-0 top-0 h-full px-3 hover:bg-transparent"
onClick={() =>
setValue(
`attributes.${index}.value` as Path<TFieldValues>,
"" as PathValue<
TFieldValues,
Path<TFieldValues>
>,
)
}
>
<TrashIcon className="size-4 text-muted-foreground hover:text-destructive" />
</Button>
</div>
) : (
<div className="relative">
<Input
{...valueField}
placeholder="value"
className={`pr-10 bg-card ${valueError ? "border-destructive" : ""}`}
/>
</div>
)}
</FormControl>
{valueError && <FormMessage>{valueError}</FormMessage>}
</FormItem>
)}
/>
</div>
<Button
type="button"
variant="outline"
size="sm"
className="rounded-full p-0 size-10 bg-card"
onClick={() => remove(index)}
size="xs"
variant="ghost"
/>
>
<XIcon className="size-4" />
</Button>
</div>
);
})}
<div className="flex flex-row gap-2">
<Button
colorScheme="purple"
leftIcon={<PlusIcon className="size-5" />}
className="rounded-full"
onClick={() =>
// biome-ignore lint/suspicious/noExplicitAny: FIXME
append({ trait_type: undefined, value: undefined } as any)
}
size="sm"
>
<PlusIcon className="size-4 mr-2" />
Add Row
</Button>
</div>
</div>
);
};
}
@@ -1,40 +1,32 @@
"use client";
import { Divider, Flex, GridItem, List, ListItem } from "@chakra-ui/react";
import { useQuery } from "@tanstack/react-query";
import { LinkButton } from "chakra/button";
import { Card } from "chakra/card";
import { Heading } from "chakra/heading";
import { Text } from "chakra/text";
import { format } from "date-fns";
import {
BookOpenTextIcon,
CalendarDaysIcon,
ExternalLinkIcon,
PencilIcon,
ServerIcon,
ShieldCheckIcon,
} from "lucide-react";
import Link from "next/link";
import { useMemo } from "react";
import type { ThirdwebClient } from "thirdweb";
import { useActiveAccount } from "thirdweb/react";
import { download } from "thirdweb/storage";
import invariant from "tiny-invariant";
import { PublisherHeader } from "@/components//contract-components/publisher/publisher-header";
import { PublisherLink } from "@/components//contract-components/publisher/publisher-header";
import { MarkdownRenderer } from "@/components/blocks/markdown-renderer";
import type { PublishedContractWithVersion } from "@/components/contract-components/fetch-contracts-with-versions";
import { ContractFunctionsOverview } from "@/components/contracts/functions/contract-functions";
import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import {
usePublishedContractEvents,
usePublishedContractFunctions,
} from "@/hooks/contract-hooks";
import { correctAndUniqueLicenses } from "@/lib/licenses";
import { replaceIpfsUrl } from "@/lib/sdk";
import { publicIPFSGateway } from "@/lib/sdk";
import { cn } from "@/lib/utils";
interface ExtendedPublishedContract extends PublishedContractWithVersion {
type ExtendedPublishedContract = PublishedContractWithVersion & {
name: string;
displayName?: string;
description?: string;
@@ -43,21 +35,19 @@ interface ExtendedPublishedContract extends PublishedContractWithVersion {
tags?: string[];
logo?: string;
audit?: string;
}
};
interface PublishedContractProps {
publishedContract: ExtendedPublishedContract;
isLoggedIn: boolean;
client: ThirdwebClient;
}
export const PublishedContract: React.FC<PublishedContractProps> = ({
export function PublishedContract({
publishedContract,
isLoggedIn,
client,
}) => {
const address = useActiveAccount()?.address;
maxWidthClassName,
}: {
publishedContract: ExtendedPublishedContract;
isLoggedIn: boolean;
client: ThirdwebClient;
maxWidthClassName?: string;
}) {
const contractFunctions = usePublishedContractFunctions(publishedContract);
const contractEvents = usePublishedContractEvents(publishedContract);
@@ -108,164 +98,143 @@ export const PublishedContract: React.FC<PublishedContractProps> = ({
);
return (
<>
<GridItem colSpan={{ base: 12, md: 9 }}>
<Flex flexDir="column" gap={6}>
{address === publishedContract.publisher && (
<LinkButton
href={`/contracts/publish/${encodeURIComponent(
publishedContract.publishMetadataUri.replace("ipfs://", ""),
)}`}
leftIcon={<PencilIcon className="size-3" />}
ml="auto"
size="sm"
variant="outline"
>
Edit
</LinkButton>
)}
{publishedContract?.readme && (
<Card as={Flex} flexDir="column" gap={2} p={6} position="relative">
<MarkdownRenderer markdownText={publishedContract?.readme} />
</Card>
)}
{publishedContract?.changelog && (
<Card as={Flex} flexDir="column" gap={2} p={0}>
<Heading pb={2} pt={5} px={6} size="title.sm">
{publishedContract?.version} Release Notes
</Heading>
<Divider />
<MarkdownRenderer
className="px-6 pt-2 pb-5"
markdownText={publishedContract?.changelog}
/>
</Card>
)}
{contractFunctions && (
<Card p={0}>
<ContractFunctionsOverview
abi={publishedContract?.abi}
events={contractEvents}
functions={contractFunctions}
isLoggedIn={isLoggedIn}
sources={sources.data}
/>
</Card>
)}
</Flex>
</GridItem>
<GridItem colSpan={{ base: 12, md: 3 }}>
<Flex flexDir="column" gap={6}>
{publishedContract.publisher && (
<PublisherHeader
<div>
{/* right side content moved below changelog */}
{publishedContract.publisher && (
<div className="border-b py-6">
<div
className={cn(
"flex flex-col md:flex-row lg:items-center gap-6 justify-between flex-wrap",
maxWidthClassName,
)}
>
<PublisherLink
client={client}
wallet={publishedContract.publisher}
/>
)}
<Separator />
<div className="flex flex-col gap-4">
<h4 className="font-semibold text-xl tracking-tight">Details</h4>
<List as={Flex} flexDir="column" gap={5}>
<ul className="flex flex-col md:flex-row gap-8 lg:items-center lg:gap-6">
{/* timestamp */}
{publishedContract.publishTimestamp && (
<ListItem>
<Flex alignItems="flex-start" gap={3}>
<CalendarDaysIcon className="size-5 text-muted-foreground" />
<Flex direction="column" gap={1}>
<Heading as="h5" size="label.sm">
Publish Date
</Heading>
<Text lineHeight={1.2} size="body.md">
{publishDate}
</Text>
</Flex>
</Flex>
</ListItem>
<li className="flex items-center gap-2.5">
<div className="p-2 rounded-full border bg-card">
<CalendarDaysIcon className="size-4 text-muted-foreground" />
</div>
<div className="space-y-1.5 [&>*]:leading-none">
<h5 className="text-sm font-medium">Publish Date</h5>
<p className="text-sm text-muted-foreground">
{publishDate}
</p>
</div>
</li>
)}
{/* audit */}
{publishedContract?.audit && (
<ListItem>
<Flex alignItems="flex-start" gap={3}>
<ShieldCheckIcon className="size-5 text-green-500" />
<Flex direction="column" gap={1}>
<Heading as="h5" size="label.sm">
Audit Report
</Heading>
<Text lineHeight={1.2} size="body.md">
<Link
className="text-link-foreground hover:text-foreground"
href={replaceIpfsUrl(publishedContract.audit, client)}
rel="noopener noreferrer"
target="_blank"
>
View Audit Report
</Link>
</Text>
</Flex>
</Flex>
</ListItem>
<li>
<div className="flex items-center gap-2.5">
<div className="p-2 rounded-full border bg-card">
<ShieldCheckIcon className="size-4 text-muted-foreground" />
</div>
<div className="space-y-1.5 [&>*]:leading-none">
<h5 className="text-sm font-medium">Audit Report</h5>
<Link
href={publicIPFSGateway(publishedContract.audit)}
rel="noopener noreferrer"
target="_blank"
className="flex items-center gap-2 text-sm hover:underline leading-none text-muted-foreground hover:text-foreground"
>
View Audit Report
<ExternalLinkIcon className="size-3.5" />
</Link>
</div>
</div>
</li>
)}
<ListItem>
<Flex alignItems="flex-start" gap={3}>
<BookOpenTextIcon className="size-5 text-muted-foreground" />
<Flex direction="column" gap={1}>
<Heading as="h5" size="label.sm">
License
{licenses.length > 1 ? "s" : ""}
</Heading>
<Text lineHeight={1.2} size="body.md">
{licenses.join(", ") || "None"}
</Text>
</Flex>
</Flex>
</ListItem>
{/* license */}
<li className="flex items-center gap-2.5">
<div className="p-2 rounded-full border bg-card">
<BookOpenTextIcon className="size-4 text-muted-foreground" />
</div>
<div className="space-y-1.5 [&>*]:leading-none">
<h5 className="text-sm font-medium">
License{licenses.length > 1 ? "s" : ""}
</h5>
<p className="text-sm text-muted-foreground">
{licenses.join(", ") || "None"}
</p>
</div>
</li>
{(publishedContract?.isDeployableViaProxy &&
hasImplementationAddresses) ||
(publishedContract?.isDeployableViaFactory &&
hasFactoryAddresses) ? (
<ListItem>
<Flex alignItems="flex-start" gap={2}>
<ServerIcon className="size-5 text-muted-foreground" />
<Flex direction="column" gap={1}>
<Heading as="h5" size="label.sm">
{publishedContract?.isDeployableViaFactory
? "Factory"
: "Proxy"}{" "}
Enabled
</Heading>
</Flex>
</Flex>
</ListItem>
<li className="flex items-center gap-2.5">
<div className="p-2 rounded-full border bg-card">
<ServerIcon className="size-4 text-muted-foreground" />
</div>
<h5 className="text-sm font-medium">
{publishedContract?.isDeployableViaFactory
? "Factory"
: "Proxy"}{" "}
Enabled
</h5>
</li>
) : null}
</List>
</ul>
</div>
</div>
)}
<Separator />
<div className={cn("py-8 space-y-8", maxWidthClassName)}>
{/* main content */}
<div className="space-y-6">
{/* readme */}
{publishedContract?.readme && (
<div className="overflow-hidden">
<MarkdownRenderer markdownText={publishedContract?.readme} />
</div>
)}
<Button asChild className="w-full gap-2 bg-card" variant="outline">
<Link
href="https://portal.thirdweb.com/contracts/publish/overview"
rel="noopener noreferrer"
target="_blank"
>
Learn more about Publish{" "}
<ExternalLinkIcon className="size-4 text-muted-foreground" />
</Link>
</Button>
</Flex>
</GridItem>
</>
{/* changelog */}
{publishedContract?.changelog && (
<div className="overflow-hidden">
<div className="border-b border-dashed pb-3 mb-3">
<h3 className="text-lg font-semibold">
{publishedContract?.version} Release Notes
</h3>
</div>
<MarkdownRenderer
markdownText={publishedContract?.changelog}
p={{
className: "text-sm leading-6",
}}
/>
</div>
)}
{contractFunctions && (
<ContractFunctionsOverview
abi={publishedContract?.abi}
events={contractEvents}
functions={contractFunctions}
isLoggedIn={isLoggedIn}
sources={sources.data}
/>
)}
</div>
</div>
</div>
);
};
}
// TODO: find a place to put this
type ContractSource = {
filename: string;
source: string;
};
async function fetchSourceFilesFromMetadata(
publishedMetadata: ExtendedPublishedContract,
client: ThirdwebClient,
@@ -46,9 +46,9 @@ function AnnouncementBannerUI(props: {
export function AnnouncementBanner() {
return (
<AnnouncementBannerUI
href="https://nebula.thirdweb.com/"
label="Announcing Nebula App — the most powerful AI for blockchains! Try it now!"
trackingLabel="nebula-beta-launch"
href="https://blog.thirdweb.com/the-fastest-way-to-build-web3-applications/"
label="We have re-branded our Engine, Payments, and Connect products. Please read the full blog post for details on changes"
trackingLabel="product-rebrand"
/>
);
}

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