Compare commits

...
Author SHA1 Message Date
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
cb64067f47 Version Packages (#5030)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-16 11:49:41 +13:00
MananTank 2ed3be210c Move /analytics contract page in app router folder (no code change) (#5046)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the import path for the `ContractAnalyticsPage` component in the `page.tsx` file located in the analytics tab of the dashboard. It simplifies the import by using a relative path.

### Detailed summary
- Changed the import path for `ContractAnalyticsPage` from a long relative path to a simplified relative import (`"./ContractAnalyticsPage"`).
- No other significant changes are noted in the diff.

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

<!-- end pr-codex -->
2024-10-15 22:27:27 +00:00
MananTank 0159983a99 Move /accounts contract page in app router folder (no code change) (#5044)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the structure of account-related components in the dashboard, improving import paths for better clarity and maintainability.

### Detailed summary
- Updated the import path for `AccountsPage` in `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/page.tsx`.
- Removed an unnecessary import of `useChainSlug` in `accounts-table.tsx` and replaced it with a direct import.
- Added `useChainSlug` import in `accounts-table.tsx` from a new path.

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

<!-- end pr-codex -->
2024-10-15 22:27:25 +00:00
joaquim-verges ec10e81624 fix: improve wallet linking for ecosystems (#5045)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing wallet connection functionality by integrating ecosystem wallet support across various components in the `thirdweb` package.

### Detailed summary
- Updated `ConnectWalletSocialOptions.tsx` to include `ecosystem` in wallet connection.
- Modified `PassKeyLogin.tsx` to add `ecosystem` handling during signup.
- Enhanced `WalletAuth.tsx` to support ecosystem wallets.
- Improved `SocialLogin.tsx` by incorporating `ecosystem` in login methods.
- Adjusted `OTPLoginUI.tsx` to manage `ecosystem` data during authentication processes.

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

<!-- end pr-codex -->
2024-10-15 22:17:24 +00:00
MananTank eaf303bc45 Move account-permissions page components in app router folder (No code change) (#5043)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring import statements for better path clarity and consistency in the `account-signers.tsx` and `account-signer.tsx` files.

### Detailed summary
- Updated import path for `AccountSigners` in `page.tsx` from a relative path to a more concise one.
- Adjusted the import path for `useAllChainsData` in `account-signer.tsx` to reflect a simpler structure.

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

<!-- end pr-codex -->
2024-10-15 22:13:21 +00:00
MananTank 0b671fe8fc Move Account Page components in app router folder (No Code Change) (#5042)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the code structure for better organization and maintainability, particularly in the `account` section of the dashboard. It modifies import paths and updates component references.

### Detailed summary
- Changed import path for `AccountPage` in `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/page.tsx`.
- Updated import path for `NFTCards` in `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/components/nfts-owned.tsx`.
- Modified import paths for `useV5DashboardChain` and `StoredChain` in `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/components/deposit-native.tsx`.

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

<!-- end pr-codex -->
2024-10-15 22:02:47 +00:00
MananTank e701fbf0d3 Migrate Marketplace listing cards on overview page to shadcn/tailwind (#5041)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on updating the styling and structure of components in the `MarketplaceDetails` and `ListingCards` sections, replacing certain components with new ones and enhancing the layout.

### Detailed summary
- Changed `rounded-xl` to `rounded-lg` in `nft-media.tsx`.
- Replaced `TrackedLink` with `TrackedLinkTW` in `MarketplaceDetails.tsx`.
- Removed unused imports from `MarketplaceDetails.tsx`.
- Updated layout in `ListingCards` with a new grid structure.
- Enhanced `Skeleton` components with `SkeletonContainer` for better loading states.
- Improved styling and structure of listing items.

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

<!-- end pr-codex -->
2024-10-15 21:44:53 +00:00
MananTank ccff347d96 Migrate Marketplace Listing Stats on Contract Overview page to shadcn+tailwind (#5040)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring components in the `MarketplaceDetails.tsx` and `listing-stats.tsx` files to replace instances of the `Flex` component with standard `div` elements, while also introducing a new `StatCard` component for displaying statistics.

### Detailed summary
- Replaced `Flex` components with `div` elements in `DirectListingCards`, `EnglishAuctionCards`, and `MarketplaceDetails`.
- Introduced a new `StatCard` component in `listing-stats.tsx` for displaying statistics.
- Updated the rendering of total listings, direct listings, and English auctions to use `StatCard`.

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

<!-- end pr-codex -->
2024-10-15 21:02:38 +00:00
MananTank 0cf478e33f Migrate ContractCheckList Card to shadcn + StepsCard UI adjustment (#5039)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the styling and structure of the `StepsCard` component in the dashboard by modifying the layout and updating the child elements to use `<p>` tags instead of `<Text>`, along with adjusting some class names for better styling consistency.

### Detailed summary
- Increased the gap in the `flex` container from `gap-5` to `gap-7`.
- Changed the margin-bottom of a `div` from `mb-3` to `mb-1`.
- Replaced `<Text>` components with `<p>` elements for children content in multiple steps.
- Updated `Link` components with new class names for consistent styling.

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

<!-- end pr-codex -->
2024-10-15 21:02:36 +00:00
MananTank 52d89ceb6d Move contract overview page components to app router folder (No code changes) (#5038)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the structure of the dashboard components by relocating several components to a new directory structure under `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components`.

### Detailed summary
- Moved `NFTCards` import in `nfts-owned.tsx` to a new path.
- Updated `NFTCards` import in `NFTDetails.tsx` to the new path.
- Added `getAllRoleMembers` import in `PermissionsTable.tsx` from a new path.
- Moved `getAllRoleMembers` import to a new path in `PermissionsTable.tsx`.
- Added `useContractFunctionSelectors` import in `ContractChecklist.tsx` from a new path.
- Moved `useContractFunctionSelectors` import to a new path in `ContractChecklist.tsx`.

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

<!-- end pr-codex -->
2024-10-15 21:02:35 +00:00
jnsdls 60a80ef304 remove all leftover react-icons refrerences (#5031)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on replacing instances of `react-icons` with `lucide-react` icons across various components in the application, enhancing the icon usage consistency and potentially improving performance.

### Detailed summary
- Removed `react-icons` in favor of `lucide-react` icons in multiple components.
- Updated imports and icon usage in `EditPage`, `SponsorshipPolicies`, `GuideShowcase`, `InstalledModulesTable`, and others.
- Added a new `GithubIcon` component in `GithubButtonLink`.
- Modified the `StatusCheck` component to use `lucide-react` icons for status representation.
- Adjusted icon properties and classes for better styling and consistency.

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

<!-- end pr-codex -->
2024-10-15 17:25:48 +00:00
arcoraven 82474486eb feat: Engine delete modal now prompts to permanently delete, calls new route (#4998)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on renaming and modifying the functionality related to deleting cloud-hosted engines in the `useEngine` hook and its usage in the `EngineInstancesTable`. The changes include updates to input types, function names, and UI elements for clarity and consistency.

### Detailed summary
- Renamed `RemoveCloudHostedInput` to `DeleteCloudHostedInput`.
- Changed `instanceId` to `deploymentId` in the input type.
- Renamed `useEngineRemoveCloudHosted` to `useEngineDeleteCloudHosted`.
- Updated API endpoint in the mutation function.
- Changed UI labels from "Remove" to "Delete" and "Cancel Engine Subscription" to "Permanently Delete Engine".
- Added feedback textarea in the delete confirmation modal.
- Enhanced alert messages for irreversible actions.
- Updated handling of deletion confirmation acknowledgment.

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

<!-- end pr-codex -->
2024-10-15 16:46:07 +00:00
kien-ngo 958bedd724 [Dashboard] Remove react-icons (1) (#5034)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the icon components throughout the application, replacing icons from `react-icons` with `lucide-react` icons for a more consistent design and possibly improved performance.

### Detailed summary
- Replaced `FiArrowRight` with `MoveRightIcon` in `guide-showcase.tsx`.
- Replaced `BiChevronDown` with `ChevronDownIcon` in `NetworkSelectorButton.tsx`.
- Replaced `FiCalendar` and `FiClock` with `CalendarIcon` and `ClockIcon` in `DevRelEvent.tsx`.
- Replaced `IoCheckmarkCircle` and `AiOutlineDollarCircle` with `CircleCheckIcon` and `CircleDollarSignIcon` in `FeatureItem.tsx`.
- Replaced `AiOutlineCode` and `CgFileDocument` with `FileTextIcon` and `SquareTerminalIcon` in `CodeSelector.tsx`.
- Replaced various `react-icons` in `IpfsUploadDropzone.tsx` with `lucide-react` icons.

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

<!-- end pr-codex -->
2024-10-15 14:03:40 +00:00
kien-ngo 3fe33a6ca0 [SDK] ERC1155 extension: mintToBatch (#5032)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds the `mintToBatch` function to the `ERC1155` extension, allowing multiple tokens to be minted in a single transaction. It includes new tests to ensure the functionality works as expected.

### Detailed summary
- Introduced `mintToBatch` function in `mintToBatch.ts`.
- Added `MintToBatchParams` type definition.
- Updated `erc1155.ts` to export `mintToBatch` and `MintToBatchParams`.
- Created tests for `mintToBatch` in `mintToBatch.test.ts` to validate minting multiple tokens.

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

<!-- end pr-codex -->
2024-10-15 08:14:41 +00:00
joaquim-verges 1994d9e52d feat: support for enclave migration in React Native (#4992)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `thirdweb` package by introducing support for enclave wallet migration in React Native and updating relevant dependencies, including `@thirdweb-dev/react-native-adapter`.

### Detailed summary
- Added support for enclave wallet migration in React Native.
- Updated dependency versions for `@thirdweb-dev/react-native-adapter` and `thirdweb`.
- Changed how `ecosystemId` is handled in multiple files to use an object structure.
- Enhanced error handling in wallet recovery functions.
- Updated `ConnectedButton`, `ConnectedModal`, and other UI components to accept `client` prop.
- Introduced migration functionality in `migrateToEnclaveWallet`.
- Refactored wallet-related actions to improve code consistency and structure.

> 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 -->
2024-10-15 08:10:05 +00:00
kien-ngo 44b2634d4c [Dashboard] Marketplace Listing drawer -> Sheet (#5008)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR refactors the `ListingDrawer` component by replacing the `Drawer` component with the `Sheet` component, streamlining the layout and improving the structure of the user interface.

### Detailed summary
- Removed `Drawer` component and replaced it with `Sheet` and `SheetContent`.
- Adjusted properties for `Sheet` to manage open state and layout.
- Updated class names for `SheetContent` to maintain styling consistency.

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

<!-- end pr-codex -->
2024-10-15 02:49:27 +00:00
kien-ngo 2e6361cc48 [Dashboard] Remove react-icons (3) (#5007)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating several components in the application to replace icons from `react-icons` with those from `lucide-react` and `@chakra-ui/react`, enhancing the visual consistency and modernizing the UI.

### Detailed summary
- Replaced `BsFillLightningChargeFill` with `ZapIcon` in `cta-buttons.tsx`.
- Updated `BsLightningCharge` to `ZapIcon` in `AnyEVM.tsx`.
- Added `InfoIcon` alongside `Trash2Icon` in `contract-subscriptions-table.tsx`.
- Replaced `FiInfo` with `InfoIcon` in `transaction-timeline.tsx`.
- Swapped `MdMarkEmailRead` with `MailCheckIcon` in `NewsletterSection.tsx`.
- Changed `IoIosInformationCircleOutline` to `InfoIcon` in `system-metrics/index.tsx`.
- Replaced `FaChartArea` with `ChartAreaIcon` in `system-metrics/index.tsx`.
- Updated `FiInfo` to `InfoIcon` in `transactions-table.tsx`.
- Changed `FiArrowLeft` to `MoveLeftIcon` and `FiArrowRight` to `MoveRightIcon` in `transactions-table.tsx`.
- Replaced multiple instances of `FiInfo` with `InfoIcon` in `TransactionDetailsDrawer`.

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

<!-- end pr-codex -->
2024-10-15 02:42:14 +00:00
kien-ngo d6f2acb7ac [Dashboard] Remove react-icons (2) (#5006)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating various components to replace icon imports from `react-icons` with icons from `lucide-react`. Additionally, it modifies the icon usage in several tables to enhance the UI consistency.

### Detailed summary
- Replaced `BsArrowRight` with `MoveRightIcon` in `RelevantDataSection`.
- Updated trash icons from `FiTrash` to `Trash2Icon` in:
  - `KeypairsTable`
  - `WebhooksTable`
  - `ContractSubscriptionTable`
  - `AdminsTable`
  - `EngineInstancesTable`
  - `RelayersTable`
  - `AccessTokensTable`
  - `BackendWalletsTable`
- Added `PencilIcon` in `AdminsTable`, `EngineInstancesTable`, `RelayersTable`, and `AccessTokensTable` for edit actions.
- Adjusted icon rendering to JSX syntax (`<IconName />`) for consistency across tables.

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

<!-- end pr-codex -->
2024-10-15 02:42:13 +00:00
kien-ngo f6cf5b5c86 [Dashboard] Remove react-icons (1) (#5005)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing several instances of icon imports from `react-icons` with new icons from `lucide-react` across various components in the project, enhancing the consistency and modern look of the UI.

### Detailed summary
- Replaced `AiOutlineInfoCircle` with `CirclePlusIcon` in `FormItem.tsx`.
- Replaced `AiOutlinePlusCircle` with `CirclePlusIcon` in multiple buttons: `AddAdminButton`, `AddAccessTokenButton`, `AddKeypairButton`, `AddWebhookButton`, `AddRelayerButton`, `AddContractSubscriptionButton`.
- Updated icons in `SettingDetectedState` from `VscExtensions` to `Grid2x2XIcon` and `FiExternalLink` to `ExternalLinkIcon`.
- Replaced `BsShieldFillCheck` with `ShieldCheckIcon` and `FiArrowRight` with `MoveRightIcon` in `PublishedContractTable`.
- Updated `ModalSizeButton` to use `ListIcon` and `Rows3Icon` instead of `FaRectangleList` and `RiFileListFill`.
- In `PublishedContract`, replaced icons: `BiPencil` with `PencilIcon`, `VscCalendar` with `CalendarDaysIcon`, `VscBook` with `BookOpenTextIcon`, and `VscServer` with `ServerIcon`.

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

<!-- end pr-codex -->
2024-10-15 02:42:11 +00:00
kien-ngo 7bfad6ee74 [Dashboard] Mobile menu drawer -> Sheet (#4999)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `MobileMenu` component in the `apps/dashboard/src/components/product-pages/common/nav/MobileMenu.tsx` file by replacing the `Drawer` component with a new `Sheet` component for improved UI handling.

### Detailed summary
- Removed `display` prop from `MobileMenu` in `Topnav.tsx`.
- Changed `MobileMenu` from using `useDisclosure` to `useState` for open state management.
- Replaced `Drawer` with `Sheet` for menu display.
- Updated `IconButton` size in `MobileMenu`.
- Adjusted `onItemClick` handlers to close the menu using `setOpen(false)`.

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

<!-- end pr-codex -->
2024-10-15 02:42:10 +00:00
kien-ngo 6faf63ff95 [SDK] Fix upload reveal batch (#5009)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the upload logic for creating delayed reveal batches in the `thirdweb` package. It improves the handling of file uploads and the calculation of starting file numbers for batches, ensuring proper functionality during NFT batch creation and reveal.

### Detailed summary
- Updated `createDelayedRevealBatch` to use `Promise.all` for concurrent uploads and token ID retrieval.
- Added logic to calculate the starting file number for batch uploads.
- Removed mock implementations for certain functions in the test file.
- Enhanced test cases to verify proper creation and revealing of NFT batches.

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

<!-- end pr-codex -->
2024-10-15 01:54:28 +00:00
jnsdls da9f1964e4 update dependencies (#5029)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating dependencies across multiple packages, including `@aws-sdk/client-lambda`, `@radix-ui/react-*` components, and various development tools. It also includes a code change to handle `htmlStyle` in the `RenderCode` component.

### Detailed summary
- Updated `@aws-sdk/client-lambda` to `3.670.0`.
- Updated various `@radix-ui/react-*` components to the latest versions.
- Increased the `limit` in `.size-limit.json` for `thirdweb` from `105 kB` to `110 kB`.
- Updated `typescript` and `vitest` versions across multiple packages.
- Code change in `RenderCode` to handle cases where `token.htmlStyle` is undefined.

> 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 -->
2024-10-14 22:52:59 +00:00
MananTank 96d4ad1849 Move Dashboard landing page to App router + Migrate to shadncn/tailwind (#4996)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring components in the `dashboard` section of the application, updating imports, and improving the layout and functionality of the `Changelog`, `HomeProductCard`, and `OnboardingSteps` components.

### Detailed summary
- Removed obsolete `Dashboard` constants.
- Updated `Link` import in `Changelog` from `tw-components` to `next/link`.
- Adjusted `Changelog` component to include a wider `Skeleton`.
- Modified `HomeProductCard` to use `next/image` and `next/link`.
- Enhanced `OnboardingSteps` to use a new structure for steps and modified the rendering logic.
- Changed step keys to a constant object format.
- Improved layout and styling for various components.

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

<!-- end pr-codex -->
2024-10-14 20:53:27 +00:00
MananTank 92fbb18ae9 Move Deployed Contracts Page to App Router (#4995)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the contract deployment and management features in the dashboard application. It introduces new components, improves layouts, and refines data handling for better user experience.

### Detailed summary
- Updated layout in `deploy.tsx` and `layout.tsx` to use flexbox for better responsiveness.
- Added `getAuthTokenWalletAddress` function in `getAuthToken.ts` for wallet address retrieval.
- Introduced `DeployedContractsPage` and `DeployedContractsTable` components for contract management.
- Refactored `DeployedContracts` component to accept contract list directly and handle loading state.
- Added `GetStartedWithContractsDeploy` component for user onboarding.
- Enhanced `DeployedContractsPageHeader` with import and deploy contract buttons.
- Improved sorting logic in `getSortedDeployedContracts.tsx`.
- Removed unused imports and cleaned up code for better readability.

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

<!-- end pr-codex -->
2024-10-14 20:53:26 +00:00
MananTank 6ceb24b0d6 Show Payment Modal when applying a coupon if account has no validPayment method setup (#5011)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances the `ApplyCouponCard` and `CouponSection` components by introducing new props for handling payment setup. It allows the UI to conditionally display messages and trigger payment modals based on the payment status.

### Detailed summary
- Added `isPaymentSetup` and `onAddPayment` props to `ApplyCouponCardUI`.
- Updated `ApplyCouponCard` to handle new props.
- Modified the `onSubmit` method to check payment setup status.
- Enhanced `CouponSection` to receive and use new props.
- Replaced modal handling with state management in `Billing`.
- Updated `CouponSection` to trigger payment modal when needed.

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

<!-- end pr-codex -->
2024-10-14 20:41:47 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
e06b40ee67 chore(deps): bump react-dropzone from 14.2.3 to 14.2.9 (#5022)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:40:26 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
f0d6212ef8 chore(deps): bump @radix-ui/react-accordion from 1.2.0 to 1.2.1 (#5024)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:39:05 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
52254865d3 chore(deps): bump @radix-ui/react-switch from 1.1.0 to 1.1.1 (#5020)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:31:41 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
068a83d9bd chore(deps): bump use-debounce from 10.0.3 to 10.0.4 (#5018)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:31:25 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
744c839cfa chore(deps): bump @radix-ui/react-popover from 1.1.1 to 1.1.2 (#5017)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:31:07 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
7470677509 chore(deps-dev): bump vite from 5.4.8 to 5.4.9 (#5016)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:30:01 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
c70777e4a7 chore(deps): bump @aws-sdk/credential-providers from 3.658.1 to 3.670.0 (#5014)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:29:42 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
06219c92cb chore(deps-dev): bump typedoc from 0.26.7 to 0.26.9 (#5015)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:29:22 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
d845d3e58d chore(deps-dev): bump eslint-plugin-tailwindcss from 3.17.4 to 3.17.5 (#5013)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:29:03 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6fb8141e24 chore(deps): bump @radix-ui/react-select from 2.1.1 to 2.1.2 (#5012)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-14 13:28:49 -07:00
arcoraven 4672475ced feat: Support multiple wallets in Engine dashboard (#4956)
- Adds support for configuring creds for AWS + GCP independently
- Moves all touched UI to tailwind
- Import / Create wallet buttons allow selecting the wallet type
- Unrelated: Moved version upgrade button to the new enpdoint. Will deprecate the old one.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the engine configuration components to improve how instances and wallet configurations are handled, enhancing the overall clarity and functionality of the engine's wallet management features.

### Detailed summary
- Removed `instanceUrl` prop in favor of `instance` for components.
- Introduced `LocalConfig` component for local wallet configuration.
- Added support for multiple wallet types with `EngineBackendWalletOptions`.
- Updated wallet configuration forms to use a unified `Form` component.
- Improved error handling and user feedback for wallet operations.
- Enhanced dialog components for creating and importing backend wallets.

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

<!-- end pr-codex -->
2024-10-14 19:42:57 +00:00
MananTank 926d823129 Fix ColorInput label click not triggering correct input in playground (#5010)
Fixes: DASH-315
2024-10-14 16:28:25 +00:00
kien-ngo 50e359d58b [SDK] Improve ERC1155 test coverage (#4985)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing test coverage for the ERC20 and ERC1155 extensions in the `thirdweb` package. It introduces conditional test execution based on the presence of a secret key and adds new tests to verify specific functionalities.

### Detailed summary
- Updated `describe` blocks to conditionally run tests based on `process.env.TW_SECRET_KEY` for multiple test files.
- Added tests for `isLazyMintSupported` in `erc1155: lazyMint`.
- Added tests for `isMintAdditionalSupplyToSupported` in `erc1155: mintAdditionalSupplyTo`.
- Added tests for `mintTo` functionality in `erc1155: mintTo`.
- Added tests for `isGetNFTsSupported` in `ERC1155 getNFTs`.

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

<!-- end pr-codex -->
2024-10-13 23:30:34 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
a1a6574c22 Version Packages (#5003)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-14 10:22:26 +13:00
gregandGitHub 98f358d63a fix: throw if no token is found in local storage (#4961) 2024-10-14 09:17:58 +13:00
db5457fa87 [SDK / Wallet UI] URI Connection (#4997)
Co-authored-by: Joaquim Verges <[email protected]>
2024-10-14 09:17:00 +13:00
Joaquim VergesandGitHub df0388d83b feat: expose auth options on useConnectModal (#5004) 2024-10-14 09:12:56 +13:00
kien-ngo 9685a85274 [SDK] Expose stuff for UD extensions, improve test (#4962)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `thirdweb` SDK by exposing new functionalities related to `UnstoppableDomains`, specifically the `namehash`, `reverseNameOf`, and `exists` methods, along with related error handling and utility functions.

### Detailed summary
- Added `namehash` and `reverseNameOf` functions to `UnstoppableDomains`.
- Introduced `exists` function to check the existence of a tokenId.
- Updated `resolveAddress` to utilize `exists` for validation.
- Added error handling for non-existent domain names in tests.
- Exported new types and functions from `unstoppable-domains`.

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

<!-- end pr-codex -->
2024-10-13 08:18:44 +00:00
joaquim-verges cd2c0f3868 feat: handle zksync direct deploys in deployContract (#5002)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `thirdweb` library with new features and bug fixes, particularly for zkSync deployments and improvements to various ERC1155 and ERC721 modules.

### Detailed summary
- Added support for zkSync direct deploys in `deployContract`.
- Updated `SequentialTokenIdERC1155` to include `startTokenId` in its module.
- Modified event signatures for `BatchMetadataUpdate` in both ERC721 and ERC1155.
- Increased test retry count and max concurrency in `vitest.config.ts`.
- Introduced new methods for batch metadata handling, including `getBatchIndex` and `getMetadataBatch`.
- Added `setBaseURI` functionality for both `BatchMetadataERC721` and `BatchMetadataERC1155`.
- Created parameter encoding functions for `updateTokenIdERC1155`.
- Enhanced error handling and configuration retrieval methods in modules.

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

<!-- end pr-codex -->
2024-10-13 06:30:11 +00:00
Joaquim VergesandGitHub 4f346e69e3 docs: update read-contract usage examples and explanations (#5001) 2024-10-12 22:13:53 +13:00
MananTank f9f536568e Remove scrollIntoView for activeTab (#5000)
Its creating issues with scrolling on iOS
2024-10-12 05:55:59 +00:00
MananTank 79f029cdae Only Show Top wallets in Connect Analytics, merge rest to Others + Remove dynamically generated colors (#4994)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the wallet analytics dashboard by improving the display of wallet statistics, adding new wallet types, and refining the chart configurations for better visualization of wallet usage data.

### Detailed summary
- Updated `globals.css` to remove redundant CSS variables.
- Added new wallet types in `storyUtils.ts`.
- Adjusted container widths in several story components to a maximum width of `1150px`.
- Enhanced `WalletConnectorsChartCard` to show top wallets and aggregate others.
- Updated chart configuration to handle "Others" category in both `WalletConnectorsChartCard` and `WalletDistributionChartCard`.
- Changed `ChartToShow` type to include `totalConnections` and `uniqueWalletsConnected`.
- Modified data handling in `WalletDistributionChartCard` to aggregate wallet stats correctly.
- Updated rendering logic to reflect changes in chart data and labels.

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

<!-- end pr-codex -->
2024-10-12 00:00:18 +05:30
gregfromstl 2914a50b84 Chore: deprecate iframe (#4991)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on deprecating two authentication strategies in the `types.ts` file related to in-app wallets. The strategies for `iframe_email_verification` and `iframe` are marked as deprecated, which indicates they should not be used in future implementations.

### Detailed summary
- Added `@deprecated` comment to the `iframe_email_verification` strategy.
- Added `@deprecated` comment to the `iframe` strategy.

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

<!-- end pr-codex -->
2024-10-11 16:46:44 +00:00
MananTank 1b559bf224 Add bottom padding to Sidebar (#4993)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on modifying the padding class in the `Sidebar.tsx` component to enhance the layout.

### Detailed summary
- Changed the class from `pt-7` to `py-7` in the `div` element, which adjusts the vertical padding (top and bottom) instead of just the top padding.

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

<!-- end pr-codex -->
2024-10-11 15:12:09 +00:00
Joaquim VergesandGitHub 982219a939 feat: add troubleshooting guide for React Native (#4990) 2024-10-11 13:36:03 +13:00
MananTank bed3561070 Update Banner copy (#4989)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the text of the `label` prop in the `AnnouncementBanner` component to provide a clearer and more concise message about the promotional offer for in-app wallets.

### Detailed summary
- Updated `label` prop in the `AnnouncementBanner` from:
  - 'Get 12 months of unlimited in-app wallets by applying the "FREEWALLETS" coupon in the billing dashboard'
  - To: 'Claim 12 months of free in-app wallets. Use code "FREEWALLETS". Redeem offer by October 31st!'

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

<!-- end pr-codex -->
2024-10-10 19:39:01 +00:00
MananTank 99adbe24ca Add Unlimited wallets Banner, Add Team & Legacy dashboard links in headers (#4971)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on removing the `DashboardTypeBanner` component and replacing it with the `UnlimitedWalletsBanner` in various files. It also introduces a new tooltip in the `SecondaryNav` and makes minor adjustments to the `BillingHeader` and `AnnouncementBanner`.

### Detailed summary
- Deleted `DashboardTypeBanner` component.
- Replaced instances of `TryTeamsUIBanner` and `TeamsUIBanner` with `UnlimitedWalletsBanner`.
- Added a tooltip in `SecondaryNav` for switching to the legacy dashboard.
- Simplified `BillingHeader` by changing the heading style.
- Updated `AnnouncementBanner` to include a new `UnlimitedWalletsBanner` function.

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

<!-- end pr-codex -->
2024-10-10 18:45:43 +00:00
MananTank d7e34f23e6 Add Date Range and Interval Selector on Connect Analytics page (#4988)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the date range selection functionality in the `PayAnalytics` and `ConnectAnalyticsDashboard` components by incorporating the `subDays` function and restructuring the date range handling.

### Detailed summary
- Added `subDays` import from `date-fns` for date calculations.
- Refactored `getLastNDaysRange` to use `subDays` for calculating past dates.
- Moved and restructured the `presets` rendering logic in `Filters` for clarity.
- Introduced `DateRangeSelector` and `IntervalSelector` components in `ConnectAnalyticsDashboard`.
- Replaced `useMemo` with `useState` for managing date ranges in `ConnectAnalyticsDashboard`.
- Simplified date range handling and interval type selection.

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

<!-- end pr-codex -->
2024-10-10 18:37:23 +00:00
arcoraven e06cc9b920 chore: New Engine Docs link, add some AA issues to troubleshooting guide (#4982)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates the API documentation links throughout the application to point to the new `thirdweb-engine.apidocumentation.com` URLs, ensuring that users access the correct and up-to-date API references.

### Detailed summary
- Updated `API Reference` link in `sidebar.tsx`.
- Changed API reference links in `page.mdx` files for:
  - `See API reference` section.
  - `Update Chain Configuration` instructions.
  - `Cancel Transaction` references.
  - `Contract Subscriptions` references.
  - `Retry Transaction` and `Cancel` instructions.
  - `Reset Nonce` instructions.
- Added new content regarding `UserOps` and error handling.

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

<!-- end pr-codex -->
2024-10-10 17:39:01 +00:00
MananTank ec5336695b Fix unhandled server error on certain deprecated chain slugs (#4986)
Fixes: DASH-311
2024-10-10 16:25:03 +00:00
MananTank e7dd1864f9 Fix View all analytics link in contract overview page (#4987)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the URL structure in the `Analytics.tsx` component to ensure the correct routing format for the analytics link.

### Detailed summary
- Changed the `href` attribute of the `Link` component from `${chainSlug}/${contractAddress}/analytics` to `/${chainSlug}/${contractAddress}/analytics` to include a leading slash.

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

<!-- end pr-codex -->
2024-10-10 16:19:02 +00:00
kien-ngo ba9a7d4148 [Dashboard] Remove react-icons (2) (#4983)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating icon imports from `react-icons` to `lucide-react` across several components, enhancing consistency and potentially reducing bundle size.

### Detailed summary
- Replaced `FiMenu` with `MenuIcon` in `MobileMenu.tsx`.
- Replaced `FiSearch` with `SearchIcon` in `HackathonFooter.tsx`.
- Replaced `FiArrowRight` with `MoveRightIcon` in `TWQueryTable.tsx`.
- Replaced `BsFillLightningChargeFill` with `ZapIcon` in `HomePageCard.tsx` and `HeroSection.tsx`.
- Replaced `BsShieldCheck` with `ShieldCheckIcon` in `PublishedContract`.
- Replaced `FiArrowRight` and `FaEllipsisVertical` with `MoveRightIcon` and `EllipsisVerticalIcon` in `TWTable.tsx`.

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

<!-- end pr-codex -->
2024-10-10 14:50:37 +00:00
kien-ngo c776943d4e [Dashboard] Remove react-icons (1) (#4980)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating icon imports in various components, replacing some icons from `react-icons` with corresponding icons from `lucide-react`, and modifying the icon usage in the `HomePageCodeBlock`, `CustomContractForm`, `PublisherSocials`, `EventsFeedItem`, and `FileInput` components.

### Detailed summary
- Replaced `BsLightning` with `ZapIcon` in `HomePageCodeBlock`.
- Replaced `FiHelpCircle` with `InfoIcon` in `CustomContractForm`.
- Replaced `FiGlobe` with `GlobeIcon` in `PublisherSocials`.
- Replaced `FiCopy` with `CopyIcon` and `FiChevronDown` with `ChevronDownIcon` in `EventsFeedItem`.
- Replaced `FiUpload` with `UploadIcon` and `FiImage` with `ImageIcon` in `FileInput`.

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

<!-- end pr-codex -->
2024-10-10 14:50:33 +00:00
kien-ngo abcbcd0b64 [Dashboard] Fix HStack (#4984)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the layout of various components in the dashboard by adding `items-center` and `gap-2` classes to `div` elements with the `flex` class. This improves vertical alignment and spacing between elements.

### Detailed summary
- Added `items-center` and `gap-2` classes to multiple `div` elements in:
  - `airdrop-upload.tsx`
  - `AccountForm.tsx`
  - `snapshot-upload.tsx`
  - `index.tsx`
  - `Steps.tsx`
  - `DowngradeDialog.tsx`
  - `PlanCard.tsx`
  - `batch-table.tsx`
  - `UsagePage.tsx`
  - `Header.tsx`
  - `Plan.tsx`

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

<!-- end pr-codex -->
2024-10-10 14:39:51 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
3d201fc603 Version Packages (#4975)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-10 21:40:11 +13:00
kien-ngo f3fee565f9 [SDK] Improve test coverage for ERC20 extensions (#4963)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on adding unit tests for various functionalities related to ERC20 contracts, including metadata retrieval, contract validation, and batch token transfers.

### Detailed summary
- Added tests for `getCurrencyMetadata` to validate ERC20 contracts and return correct metadata.
- Implemented tests for `isERC20` to check contract validity against USDT, USDC, and an NFT contract.
- Created tests for `transferBatch` to verify token transfers to multiple recipients.

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

<!-- end pr-codex -->
2024-10-10 02:32:36 +00:00
gregandGitHub ec0f8d20bb [React Native SDK] Fix: Remove device share if recovering private key fails (#4976) 2024-10-10 15:27:59 +13:00
Joaquim VergesandGitHub ccd4cd6f59 fix: overestimate zksync gas limit for paymaster extra gas (#4979) 2024-10-10 12:35:47 +13:00
MananTank bd0dbb7033 Team Member Settings Page updates (#4978)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `TeamMembersSettingsPage` by adding an alert for unavailable features, updating the logic for invite permissions, and refining member management with improved filtering and sorting functionalities.

### Detailed summary
- Added an `Alert` component in `TeamMembersSettingsPage` to notify users about feature availability.
- Changed the condition for `inviteEnabled` in `InviteSection` to check for non-free plans.
- Updated member management logic to filter and sort members based on roles.
- Modified the `ManageMembersSection` to use filtered member lists for display and actions.
- Adjusted the `createMemberStub` function to accept a `createdHours` parameter.
- Updated storybook examples to reflect changes in team plans and permissions.

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

<!-- end pr-codex -->
2024-10-09 22:46:10 +00:00
kien-ngo f5b82308ee [Dashboard] Fix minor layer issues (#4928)
Before:
![image](https://github.com/user-attachments/assets/5429077d-24ee-4641-8025-137a67ab187d)

After:
![image](https://github.com/user-attachments/assets/72784965-1708-48a9-b614-970697ad40b9)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the layout and styling of components in the `supply-cards.tsx` and `page.tsx` files to enhance the visual structure and responsiveness of the dashboard interface.

### Detailed summary
- In `supply-cards.tsx`, changed the layout from a row (`flex-row`) to a column (`flex-col`) for better alignment.
- In `page.tsx`, modified the layout to use `flex-col` with additional styling adjustments, including:
  - Updated heading class from `font-bold text-xl` to `font-semibold text-2xl tracking-tight`.
  - Adjusted the container to use a grid layout for better responsiveness.

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

<!-- end pr-codex -->
2024-10-09 22:27:50 +00:00
joaquim-verges 7c103431c4 feat: add Soneium Minato chain definition (#4977)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on adding a new blockchain definition for `soneiumMinato` and updating the in-app wallet component to link with `Metamask` and `Passkey`.

### Detailed summary
- Added `soneiumMinato` chain definition in `packages/thirdweb/src/chains/chain-definitions/soneium-minato.ts`.
- Updated `packages/thirdweb/src/exports/chains.ts` to export `soneiumMinato`.
- Modified `apps/playground-web/src/components/in-app-wallet/profile-sections.tsx` to include buttons for linking `Metamask` and `Passkey`, replacing the `Coinbase Wallet` button.

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

<!-- end pr-codex -->
2024-10-09 21:54:57 +00:00
ElasticBottle 6a4b776ecc chore: don't override auth token / client id when hitting in app wall… (#4974)
…et url

## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `thirdweb` dashboard by allowing account linking and improving the authorization logic in the `fetch.ts` file.

### Detailed summary
- Updated the authorization check in `fetch.ts` to exclude URLs from in-app wallets when sending the `authToken`.
- Introduced a new function `isInAppWalletUrl(url: string): boolean` to determine if a URL is from an in-app or embedded wallet.

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

<!-- end pr-codex -->
2024-10-09 18:30:50 +00:00
MananTank e29d80a9ec Spacing adjustments on account-abstraction policies form (#4973)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the layout and readability of the `SponsorshipPolicies` component in the `AccountAbstractionSettingsPage` by adjusting the spacing in flex containers and modifying text formatting for better clarity.

### Detailed summary
- Updated `div` elements to include `gap-6 lg:gap-12` for improved spacing.
- Changed text formatting to use `<br />` for line breaks instead of plain text.
- Made similar adjustments across multiple sections, including global spend limits and restrict to specific chains.

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

<!-- end pr-codex -->
2024-10-09 18:06:20 +00:00
MananTank 0c5b0bf007 Add /unlimited-wallets framer path in rewrites, format js files with biome (#4972)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating configuration settings, version numbers, and making minor adjustments in the codebase, including enhancing the `FRAMER_PATHS` and refining error messages in the UI.

### Detailed summary
- Added `editor.defaultFormatter` for `[javascript]` in `.vscode/settings.json`.
- Updated `version` from `5.61.3` to `5.61.4` in `packages/thirdweb/package.json`.
- Expanded `FRAMER_PATHS` in `apps/dashboard/next.config.js`.
- Added a new entry in `packages/thirdweb/CHANGELOG.md` for version `5.61.4`.
- Modified error message handling in `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx`.
- Changed fetch URL string formatting in `apps/dashboard/next-sitemap.config.js`.
- Renamed `_path` to `path` in the `transform` function of `apps/dashboard/next-sitemap.config.js`.

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

<!-- end pr-codex -->
2024-10-09 17:25:28 +00:00
MananTank 9adf6e6b25 Prefill Promo code on coupon card from search param + scroll into view (#4968)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces functionality for pre-filling a coupon code in the `ApplyCouponCard` component based on URL search parameters and enhances the user experience by scrolling into view when a coupon code is present.

### Detailed summary
- Added `BadgeContainer` for pre-filled coupon code display in `ApplyCouponCard.stories.tsx`.
- Utilized `useSearchParams` to retrieve the coupon code from the URL in `CouponCard.tsx`.
- Enhanced `ApplyCouponCardUI` to accept `prefillPromoCode` and `scrollIntoView` props.
- Implemented scrolling behavior to focus on the form when a coupon code is present.
- Wrapped `ApplyCouponCard` in a `Suspense` component to manage loading states effectively.

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

<!-- end pr-codex -->
2024-10-09 17:10:31 +00:00
MananTank 9330401645 Include search params when redirecting to login page (#4967)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the login flow by preserving search parameters in the URL when redirecting to the login page and updating the `useLoggedInUser` hook to handle login state more effectively.

### Detailed summary
- Added `searchParamsString` to include query parameters in the login redirect.
- Updated `useLoggedInUser` to redirect based on `isLoggedIn` status instead of `redirectTo`.
- Introduced `buildLoginPath` function to construct login URLs.
- Removed unused `pathname` from `EnsureLoginPayload`.

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

<!-- end pr-codex -->
2024-10-09 17:10:30 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
6527123e99 Version Packages (#4970)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-09 09:37:48 -07:00
MananTank 3446b4cabf Remove accidentally added file path in Pay UI (#4969)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the user interface by removing unnecessary text from the error message displayed in the Pay UI of the `BuyScreen` component.

### Detailed summary
- Updated the error message in the `BuyScreen` component to remove extra text.
- The error message now simply states "Minimum amount is {errorMsg.minAmount}" without additional, redundant details.

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

<!-- end pr-codex -->
2024-10-09 16:07:07 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
f83d2667be Version Packages (#4966)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-09 23:33:57 +13:00
Joaquim VergesandGitHub 24981a7f60 fix: respect raw accountSalt passed as hex (#4965) 2024-10-09 23:15:58 +13:00
kien-ngo f2c40bdadc [SDK] Improve test coverage for ERC721 extensions (#4964)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `erc721` extension by adding error handling, improving test coverage, and refining contract interactions, particularly regarding token URIs and contract support checks.

### Detailed summary
- Updated `getNFT.ts` to check for trimmed `uri`.
- Added new imports in test files for contracts and wallets.
- Implemented tests for unsupported contract methods in `getOwnedTokenIds.test.ts`.
- Added support check tests in `getNFTs.test.ts`.
- Created a test for default URI handling in `getNFT.test.ts`.

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

<!-- end pr-codex -->
2024-10-09 04:12:48 +00:00
MananTank 26e3c57e8f Complete various TODOs in team layout (#4959)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on enhancing the handling of team images across various components in the dashboard. It updates the `src` attributes for `GradientAvatar` and `ProjectAvatar` components to use the appropriate team images, while also improving the `InviteSection` button functionality.

### Detailed summary
- Updated `src` for `GradientAvatar` in `TeamSelectionUI.tsx` to use `team.image`.
- Modified `className` for `Img` in `ProjectAvatar.tsx` to include an additional `border-border` class.
- Changed `src` for `titleAvatarIcon` in `TeamSettingsSidebar.tsx` to use `props.team.image`.
- Updated the `Upgrade` button in `InviteSection.tsx` to be a link to billing settings.
- Set `src` for `GradientAvatar` in `TeamHeaderUI.tsx` and `TeamHeaderMobileUI.tsx` to use `currentTeam.image`.

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

<!-- end pr-codex -->
2024-10-08 23:59:42 +00:00
gregfromstl 89bcb92619 [SDK] Test: Replace deprecated checkContractWalletSignature use (#4949)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating the function used to verify wallet signatures in the `smart-wallet-integration.test.ts` file. The change improves clarity by renaming `checkContractWalletSignature` to `verifySignature` and modifies the way the contract is obtained.

### Detailed summary
- Renamed the function from `checkContractWalletSignature` to `verifySignature`.
- Changed the way the contract is constructed by removing the `getContract` call and directly using the parameters `address`, `chain`, and `client`.

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

<!-- end pr-codex -->
2024-10-08 22:22:20 +00:00
MananTank 74cd019f8a Add SelectWithSearch + Improved Single Network Selector component (#4957)
![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/yNOf1svJ8o3zjO7zQouZ/4586e4df-ba4e-4d02-b594-61c61c81f446.png)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR refactors the network selection components by replacing `NetworkDropdown` with `SingleNetworkSelector` across multiple files, enhancing the network selection UI and functionality.

### Detailed summary
- Removed `NetworkDropdown` from various components.
- Introduced `SingleNetworkSelector` to replace `NetworkDropdown`.
- Updated props for `SingleNetworkSelector` to improve chain selection.
- Refactored related imports to point to the new component location.

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

<!-- end pr-codex -->
2024-10-08 22:11:19 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
f5d2d35aaa Version Packages (#4960)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-09 10:55:47 +13:00
Joaquim VergesandGitHub 4170c60ca6 fix: export fetchKeyMetadataFromApi from service-utils (#4958) 2024-10-09 10:49:19 +13:00
MananTank c723aa9d5b Improved Multi Network Selector component (#4953)
Fixes: DASH-298

Its _blazingly fast_

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/yNOf1svJ8o3zjO7zQouZ/bf448bb9-716e-4c47-8930-0e75e5d32905.png)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the `NetworkDropdown` component into a new `MultiNetworkSelector` component, enhancing the multi-selection capabilities for network options while improving the overall code structure and functionality.

### Detailed summary
- Renamed `NetworkDropdown` to `MultiNetworkSelector` for multi-selection functionality.
- Updated `NetworksFieldset` and `AccountAbstractionSettingsPage` to utilize `MultiNetworkSelector`.
- Enhanced `MultiSelect` component with a `searchPlaceholder` prop and improved search functionality.
- Added `overrideSearchFn` and `renderOption` props to `MultiSelect` for customizable option rendering.
- Introduced `data-scrollable` attribute in `ScrollShadow` for better scrolling behavior.
- Improved styling and layout adjustments in various components.

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

<!-- end pr-codex -->
2024-10-08 21:33:20 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
33c2f56d3d Version Packages (#4950)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-09 10:08:26 +13:00
Joaquim VergesandGitHub eff129ab9a feat: export fetchKeyMetadataFromApi and remove checkPolicy options (#4955) 2024-10-09 09:13:24 +13:00
joaquim-verges 8efe536482 feat: add account factory 0.7 to explore (#4951)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces support for new account factories and updates documentation regarding custom account factories and Entrypoint v0.7. It enhances the `smartWallet` function and provides clearer information on available account factory options.

### Detailed summary
- Added support for `thirdweb.eth/AccountFactory_0_7` and `thirdweb.eth/ManagedAccountFactory_0_7`.
- Updated documentation to include usage of custom account factories with the `smartWallet` function.
- Included examples for using v0.7 Entrypoint with `smartWallet`.
- Revised default account factory information in the documentation to specify v0.6 and v0.7 options.

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

<!-- end pr-codex -->
2024-10-08 19:43:51 +00:00
GWSzeto 5c4c570176 fix: small typo in the getting started docs (#4954)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on modifying the initialization of `callbackFunctions` and `fallbackFunctions` in the `create-module-contract` function to use dynamic arrays instead of single instances.

### Detailed summary
- Changed `config.callbackFunctions` from a single `CallbackFunction` to a dynamic array of `CallbackFunction` with size 1.
- Changed `config.fallbackFunctions` from a single `FallbackFunction` to a dynamic array of `FallbackFunction` with size 2.

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

<!-- end pr-codex -->
2024-10-08 19:38:47 +00:00
Joaquim VergesandGitHub ea36c54118 feat: allow overriding callGasLimit for userops (#4948) 2024-10-09 07:25:47 +13:00
cf37bb5e54 Bump @storybook/test from 8.3.4 to 8.3.5 (#4943)
Co-authored-by: dependabot <[email protected]>
2024-10-08 10:32:20 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Manan Tank
fbab9f75d0 Bump @changesets/cli from 2.27.8 to 2.27.9 (#4941)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Manan Tank <[email protected]>
2024-10-08 10:32:08 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Manan Tank
96943e69f1 Bump @storybook/addon-interactions from 8.3.4 to 8.3.5 (#4940)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Manan Tank <[email protected]>
2024-10-08 10:31:57 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Manan Tank
6d84a5d81a Bump @shazow/whatsabi from 0.14.1 to 0.15.2 (#4942)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Manan Tank <[email protected]>
2024-10-08 10:31:32 -07:00
kien-ngo 4f6c364da2 [Dashboard] Add searchbar for Explorer (#4916)
Part of DASH-246

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a search functionality to filter displayed functions in the `ContractFunctionsPanel`. It enhances user experience by allowing users to search for specific functions using a search input.

### Detailed summary
- Added `SearchIcon` and `Input` components for search functionality.
- Implemented state management for keyword search using `useState` and `useDebounce`.
- Filtered functions based on the search input before rendering.
- Updated the layout to include the search input at the top of the functions list.

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

<!-- end pr-codex -->
2024-10-08 17:13:42 +00:00
kien-ngo 0e900fe319 [Dashboard] Replace erc721 claim Drawer with Sheet (#4932)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the `NFTClaimButton` component to replace the `Drawer` with a `Sheet` component for a better user interface. It enhances the form handling by integrating validation and error messaging for claiming NFTs.

### Detailed summary
- Removed the `Drawer` component and replaced it with a `Sheet`.
- Integrated `react-hook-form` for form handling.
- Added validation for the "To Address" and "Amount" fields.
- Implemented error messages for form validation.
- Added transaction handling logic for NFT claims.
- Used `TransactionButton` for submitting the claim.

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

<!-- end pr-codex -->
2024-10-08 16:47:31 +00:00
MananTank 1adbc62477 Migrate Engine Overview page to shadcn/tailwind - Part1 (#4926)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the `CreateBackendWalletButton` and `ImportBackendWalletButton` components to use a new dialog system, enhancing the user interface and improving code structure. It also introduces tooltips and updates form handling for better user experience.

### Detailed summary
- Replaced `Modal` with `Dialog` for `CreateBackendWalletButton` and `ImportBackendWalletButton`.
- Added `tooltip` prop in `FormFieldSetup`.
- Updated form handling for better state management and error display.
- Enhanced UI elements with improved styling and layout.
- Refactored wallet import and creation logic for clarity and maintainability.

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

<!-- end pr-codex -->
2024-10-08 16:36:28 +00:00
kien-ngo 87c88546ec [Dashboard] Small update to allow open link with Explorer (#4930)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances the `InteractiveAbiFunction` component by adding support for displaying links for both IPFS URIs and traditional URLs. It introduces an `ExternalLinkIcon` and a new `Link` component for external links, improving user accessibility to resources.

### Detailed summary
- Added import for `ExternalLinkIcon` and `Link` from `next/link`.
- Modified the `language` prop in `CodeBlock` based on the response data type.
- Introduced a link for IPFS URIs that opens in a new tab.
- Added a link for traditional URLs with an icon, enhancing user interaction.

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

<!-- end pr-codex -->
2024-10-08 16:26:08 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
d5039f4aa0 Version Packages (#4945)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-08 15:05:08 +13:00
Joaquim VergesandGitHub 7b7226f9c6 feat: export additional types from service-utils (#4946) 2024-10-08 14:33:58 +13:00
Joaquim VergesandGitHub 506764dabd feat: support showAllWallets prop in React Native Connect UI (#4933) 2024-10-08 11:19:54 +13:00
Joaquim VergesandGitHub a6449125b2 feat: add 'from' parameter to estimateGas example (#4938) 2024-10-08 11:19:27 +13:00
Joaquim VergesandGitHub 822ece45ec feat: add option to disable storing last passkey credentials (#4944) 2024-10-08 11:18:52 +13:00
MananTank fa826b5f1f Add Teams UI Banners (#4936)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new `DashboardTypeCookieSetter` component to manage dashboard type cookies and updates various parts of the application to utilize this functionality. It also adds new banner components for improved user notifications.

### Detailed summary
- Added `DashboardTypeCookieSetter` component to set dashboard type cookies.
- Integrated `DashboardTypeCookieSetter` in `AppShell`, `RootTeamLayout`, and `AccountLayout`.
- Created `TeamsUIBanner` and `TryTeamsUIBanner` components for user announcements.
- Updated routing logic in `login/page.tsx` based on cookie value.
- Modified `AnnouncementBanner` for better usability and appearance.
- Added a new button in `HeroSection` to redirect based on cookie value.

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

<!-- end pr-codex -->
2024-10-07 20:39:59 +00:00
MananTank dce2ca0e3d Fix MaskedAvatar component stuck in loading state (#4937)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on making minor adjustments to the text content in the `ambassadors.tsx` file and refining the handling of props in the `MaskedAvatar` component within `masked-avatar/index.tsx`.

### Detailed summary
- In `ambassadors.tsx`, added a space after "Meet the".
- In `masked-avatar/index.tsx`:
  - Changed `skeletonData` from `false` to `undefined`.
  - Changed `loadedData` from `isPending` to `src`.
  - Updated the render prop to use `v` instead of `src`.

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

<!-- end pr-codex -->
2024-10-07 19:28:23 +00:00
gregfromstl c6fbd60816 [SDK] Fix: pass gasPrice to injected provider (#4935)
<!-- start pr-codex -->

## PR-Codex overview
This PR introduces the handling of `gasPrice` in the transaction object within the `injected` wallet module.

### Detailed summary
- Added a new line to handle `gasPrice` in the transaction object.
- The `gasPrice` is conditionally converted to hexadecimal format using `numberToHex` if it exists.

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

<!-- end pr-codex -->
2024-10-07 19:11:21 +00:00
kien-ngo 8e8011370b [Dashboard] Replace Reveal-NFT Drawer with Sheet (#4931)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing the `Drawer` component with a `Sheet` component in the `NFTRevealButton`. It enhances the user interface for revealing NFTs by implementing a form within the `Sheet` for batch selection and password input.

### Detailed summary
- Removed `Drawer` and `NFTRevealForm` components.
- Added `Sheet`, `SheetContent`, `SheetHeader`, `SheetTitle`, and `SheetTrigger` components.
- Integrated a form for batch selection and password input using `react-hook-form`.
- Implemented analytics tracking for the reveal action.
- Added error handling and toast notifications for transaction status.

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

<!-- end pr-codex -->
2024-10-07 13:57:32 +00:00
0xFirekeeper 11de1f3ce2 [Portal] MAUI Template & Link Updates (#4929)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on enhancing the `.NET SDK Portal` and its documentation, updating package versions, and adding new features related to MAUI integration, while also improving the sidebar navigation.

### Detailed summary
- Added `.NET SDK Portal` link to the sidebar in `sidebar.tsx`.
- Updated `Thirdweb` package version from `1.0.0` to `2.4.0` in `page.mdx`.
- Added `MAUI Integration` link to the sidebar in `sidebar.tsx`.
- Updated reference link for `Full Reference` in `sidebar.tsx`.
- Introduced new content for MAUI integration in `page.mdx`.
- Enhanced documentation with new constants and functions in `utils/page.mdx`.

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

<!-- end pr-codex -->
2024-10-05 07:11:37 +00:00
kien-ngo 5c6f288d2a chore: Fix readContract docs (#4920)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `useReadContract` function calls in two files by adding a comma to the method definition for better syntax clarity.

### Detailed summary
- In `packages/thirdweb/src/transaction/read-contract.ts`:
  - Added a comma after the method definition for `tokenURI`.

- In `packages/thirdweb/src/react/core/hooks/contract/useReadContract.ts`:
  - Added a comma after the method definition for `tokenURI`.

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

<!-- end pr-codex -->
2024-10-05 02:08:10 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
4660e0ceb8 Version Packages (#4907)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-05 12:06:15 +13:00
YashandGitHub 5211446f20 Cache create2 factory addresses (#4922) 2024-10-05 10:27:46 +13:00
joaquim-verges d4c423cd97 fix: handle 0n as from/to blocks in getContractEvents (#4919)
Fixes CNCT-1987

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the validation of `fromBlock` and `toBlock` parameters in the `getContractEvents` function to ensure they are explicitly defined before performing any calculations.

### Detailed summary
- Updated condition to check if `fromBlock` and `toBlock` are not `undefined` instead of truthy.
- Adjusted logic for setting `restParams.toBlock` and `restParams.fromBlock` based on the new checks.

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

<!-- end pr-codex -->
2024-10-04 20:48:05 +00:00
dirtycajunrice b6bf3b923d Updated docs and replaced outdated speed-racer (#4903)
## Problem solved

* Updated Unreal Engine docs
* Replaced speed-racer references with tappyfowl
* Fixed all references of `unreal`  to `unreal-engine`

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on renaming the `unreal` module to `unreal-engine`, updating related paths, icons, and metadata throughout the codebase. It also introduces new wallet functionalities and modifies some documentation for clarity.

### Detailed summary
- Renamed `unreal` to `unreal-engine` across various files.
- Updated paths and references in `Header.tsx`, `layout.tsx`, and `sidebar.tsx`.
- Changed icon references from `UnrealIcon` to `UnrealEngineIcon`.
- Modified metadata functions to use `createUnrealEngineMetadata`.
- Added new wallet functionalities in `in-app-wallet` and `wallet-handles`.
- Updated documentation in multiple `.mdx` files to reflect changes.
- Deleted obsolete assets and files related to the old `unreal` structure.

> The following files were skipped due to too many changes: `pnpm-lock.yaml`, `apps/portal/src/app/unreal-engine/blueprints/utilities/nodes.ts`, `apps/portal/src/app/unreal-engine/blueprints/in-app-wallet/nodes.ts`, `apps/portal/src/app/unreal/blueprints/smart-wallet/nodes.ts`

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

<!-- end pr-codex -->
2024-10-04 20:37:17 +00:00
ElasticBottle 0f6b881bca docs: update fetching user details endpoint for ecosystems (#4918)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `getUser` functionality in the `thirdweb` SDK by adding support for querying user details via an external wallet address and ecosystem identifiers.

### Detailed summary
- Added support for querying user details using `externalWalletAddress` in `getUser`.
- Updated documentation for `getUser` to include `externalWalletAddress` as a query parameter.
- Modified examples in the documentation to demonstrate querying with `externalWalletAddress`.
- Updated user detail query parameters in documentation to reflect new options.

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

<!-- end pr-codex -->
2024-10-04 19:54:38 +00:00
4dee169c3b Add ecosystem wallet security documentation (#4911)
Signed-off-by: Ian Mukherjee <[email protected]>
Signed-off-by: Joaquim Verges <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
2024-10-05 08:53:52 +13:00
5dfde0f4ec Add guest mode documentation (#4910)
Signed-off-by: Ian Mukherjee <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
2024-10-05 08:16:55 +13:00
MananTank b148fa0d65 Plug in Team settings page UI to API (#4888)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on enhancing the `Team` functionality by adding billing features, updating team settings, and refining the UI components to support new properties such as `billingEmail` and `image`. It also improves the update mechanisms for team attributes.

### Detailed summary
- Added `billingEmail` and `image` fields to the `Team` model.
- Updated the `TeamGeneralSettingsPage` to accept `authToken` instead of `client`.
- Implemented `updateTeam` function to handle team updates.
- Modified UI components to support new fields and update methods.
- Enhanced `FileInput` to handle fallback URLs.
- Refactored `TeamNameFormControl` and `TeamSlugFormControl` to utilize `updateTeamField` for updates.
- Integrated `resolveScheme` for avatar URL handling in `TeamAvatarFormControl`.

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

<!-- end pr-codex -->
2024-10-04 17:36:40 +00:00
MananTank 5c8766b5b6 Remove calls to 0.rpc on deploy page (#4925)
Fixes: DASH-268

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/yNOf1svJ8o3zjO7zQouZ/4d64b356-b831-40e3-96a6-ed686b59a3e9.png)
2024-10-04 17:19:51 +00:00
MananTank 04f826923e Fix Get started with deploying contracts card buttons layout (#4923)
Current:

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/yNOf1svJ8o3zjO7zQouZ/41286158-0065-465b-80a5-f61dd62af7b7.png)

Fixed:

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/yNOf1svJ8o3zjO7zQouZ/be5b23ed-8159-421d-beb0-ca4dfc2f8c12.png)
2024-10-04 15:36:11 +00:00
kien-ngo c935fbf72d [Portal] Fix useChain in migrate docs (#4921)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the TypeScript SDK v5 cheatsheet to reflect changes in the wallet connection methods, specifically updating the references for the `Get Connected Chain` functionality.

### Detailed summary
- Updated the reference for `Get Connected Chain` from [`useSwitchActiveWalletChain()`] to [`useActiveWalletChain()`] in both `page.mdx` files.

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

<!-- end pr-codex -->
2024-10-04 12:57:18 +00:00
Joaquim VergesandGitHub 63d0777e6f feat: add useLinkProfile hook and update profile linking docs + playground (#4906) 2024-10-04 21:18:32 +13:00
MananTank a94f98195b Show active coupon on billing page (#4917)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring and enhancing coupon-related components in the `Billing` section of the dashboard. It involves renaming components, improving props handling, and adding new functionalities for coupon application and management.

### Detailed summary
- Renamed `CouponCard` to `CouponSection` in `Billing/index.tsx`.
- Updated `SettingsCard` to use dynamic class names for buttons.
- Added new stories for `CouponDetailsCardUI` and `ApplyCouponCardUI`.
- Implemented optimistic updates for coupon application and deletion.
- Enhanced `CouponCard` to `ApplyCouponCard` with new props for coupon application.
- Introduced `CouponDetailsCardUI` for displaying active coupon details.
- Improved error handling and loading states in coupon-related components.

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

<!-- end pr-codex -->
2024-10-04 00:24:25 +00:00
kien-ngo 27375af91b [Dashboard] Remove react-icons (6) (#4915)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring components to improve code quality and consistency. It replaces some icon imports with new icons from `lucide-react`, adjusts class names for better styling, and introduces new components like `DotNetIcon` and `UnrealIcon`.

### Detailed summary
- Updated `className` in `airdrop-upload-erc20.tsx`.
- Replaced `FiChevronRight` with `ChevronRightIcon` in `MiniPlayground.tsx`.
- Added `DotNetIcon` and `UnrealIcon` components.
- Updated icon usage in `ConnectSDKCard.tsx` and `SnapshotUpload.tsx`.
- Refactored icons in `claim-conditions-form` and `snapshot-upload.tsx`.
- Adjusted layout and styling in various components for consistency.

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

<!-- end pr-codex -->
2024-10-03 23:43:05 +00:00
arcoraven b2276e9b9f chore: move gas and timeout details to Engine FAQ (#4914)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating the documentation for transaction settings in the `Engine` feature. It clarifies the structure and usage of `txOverrides` for sending native currency and overriding gas settings, including examples and warnings about transaction timeouts.

### Detailed summary
- Changed keys in `txOverrides` from unquoted to quoted strings in the JSON structure.
- Added a section on sending native currency with examples.
- Introduced a section on overriding gas settings with examples.
- Included a warning about setting a timeout for transactions.
- Added a section on specifying transaction timeouts with examples.

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

<!-- end pr-codex -->
2024-10-03 21:56:26 +00:00
MananTank b31ab5a371 Move /connect/account-abstraction to app router (#4896)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on implementing Account Abstraction features in the dashboard, enhancing the user interface, and integrating API key management for smart wallets.

### Detailed summary
- Removed `account-abstraction.tsx`.
- Added `getAASupportedAPIKeys` function to filter API keys for bundler services.
- Created `AccountAbstractionAPIKeysMenu` to manage API key selection.
- Implemented `PageHeader` for account abstraction context.
- Developed `OpChainAlert` to notify users about gas credits.
- Updated `Layout` with SEO metadata.
- Enhanced `SmartWallets` component to utilize a default tab.
- Created `Page` component to handle authentication and API key redirection.
- Added client ID specific page with account and API key validation.

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

<!-- end pr-codex -->
2024-10-03 20:49:27 +00:00
MananTank b82011e764 Move /connect/in-app-wallets to app router (#4894)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `in-app-wallets` feature by adding new components and functionalities, including API key management and layout improvements.

### Detailed summary
- Added `getInAppWalletSupportedAPIKeys` function to fetch and filter API keys.
- Created `Layout` component with footer sections.
- Implemented `InAppWalletsAPIKeysMenu` for API key selection.
- Added `PageHeader` with description and link.
- Enhanced `Page` component to handle redirects and display API keys.
- Updated `EmbeddedWallets` component to use `defaultTab` prop instead of search params.

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

<!-- end pr-codex -->
2024-10-03 20:49:26 +00:00
kien-ngo a7e285a90d [Dashboard] Remove react-icons (5) (#4904)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing icon imports from `react-icons` with `lucide-react` icons across various components in the dashboard application, enhancing the visual consistency and potentially improving performance.

### Detailed summary
- Replaced `FiEye` with `EyeIcon` in `reveal-button.tsx`.
- Replaced `FiCopy` with `CopyIcon` in `LatestEvents.tsx`.
- Replaced `BsLightningCharge` with `ZapIcon` in `GeneralCta.tsx`.
- Replaced `FiCheck` with `CheckIcon` in `address-input.tsx`.
- Replaced `FaXTwitter` with `XIcon` and `SiOpensea` with `OpenseaIcon` in `OpCreditsGrantedModal.tsx`.
- Replaced `FiX` with `XIcon` and caret icons with `ChevronDownIcon`, `ChevronUpIcon` in `phase.tsx`.
- Replaced `FiPlay` with `PlayIcon` and `FaCircleInfo` with `InfoIcon` in `interactive-abi-function.tsx`.
- Replaced `FiInfo` with `InfoIcon` in `list-form.tsx`.
- Replaced navigation icons in `accounts-table.tsx` with `Chevron` icons from `lucide-react`.
- Added `OpenseaIcon` component in `OpenseaIcon.tsx`.

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

<!-- end pr-codex -->
2024-10-03 20:29:57 +00:00
MananTank 615dd1e6a6 Move /connect/analytics to app router (#4893)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `Analytics` section of the dashboard by introducing a new `AnalyticsPageAPIKeysMenu`, updating the `ApiKeysMenu` component to use a more generic type, and improving the handling of API keys for better user experience.

### Detailed summary
- Removed `DashboardConnectAnalytics` from constants.
- Added `AnalyticsPageAPIKeysMenu` to manage API keys.
- Updated `ApiKeysMenu` to use a generic type for `apiKeys`.
- Modified selection logic in `ApiKeysMenu` to use `key` instead of `id`.
- Enhanced page redirection logic based on API keys availability.

> The following files were skipped due to too many changes: `apps/dashboard/tsconfig.tsbuildinfo`

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

<!-- end pr-codex -->
2024-10-03 20:22:47 +00:00
kien-ngo 7cd39f07b4 [Dashboard] Remove react-icons (4) (#4900)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating various components in the dashboard to replace certain icon imports with `lucide-react` icons, enhancing the UI consistency and modernizing the iconography used throughout the application.

### Detailed summary
- Replaced `BiTransferAlt` with `ArrowLeftRightIcon` in `TransactionButton`.
- Replaced `IoChevronBack` with `ChevronLeftIcon` in `TokenIdPage`.
- Replaced `RiCheckboxMultipleBlankLine` with `FileStackIcon` in `BatchLazyMintButton`.
- Replaced `VscDebugDisconnect` with `UnplugIcon` in `MismatchButton`.
- Replaced `FiCopy` with `CopyIcon` in `PermissionsTable`.
- Replaced `FiCheckCircle` and `FiXCircle` with `CircleCheckIcon` and `CircleXIcon` in `VerifyContractModal`.
- Replaced `FiUpload` with `UploadIcon` in `AirdropTab`.
- Updated various components to use `lucide-react` icons instead of `react-icons`.
- Improved layout and styling in `AirdropUpload` and `AirdropTable` components.

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

<!-- end pr-codex -->
2024-10-03 17:18:37 +00:00
kien-ngo 4b80b250b4 [Dashboard] Vote contract proposal drawer (#4899)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the proposal creation UI components, replacing a `Drawer` with a `Sheet` for better user experience, and enhancing the proposal submission process with improved form handling and error management.

### Detailed summary
- Deleted `proposal-form.tsx`.
- Modified `metadata-header.tsx` className for better styling.
- Replaced `Flex` components with `div` for layout in `page.tsx`.
- Refactored `ProposalButton` to use `Sheet` instead of `Drawer`.
- Added form handling with `react-hook-form` in `ProposalButton`.
- Implemented error handling and user feedback with `toast` in the proposal submission process.

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

<!-- end pr-codex -->
2024-10-03 17:11:43 +00:00
MananTank 47f53879f8 Fix APIKey fetch in project layout (#4912)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new function, `getAPIKeyForProjectId`, to streamline the retrieval of API keys for projects. It replaces the previous usage of `getAPIKey` across multiple components, ensuring consistent handling of project IDs.

### Detailed summary
- Added `getAPIKeyForProjectId` function in `getAPIKeys.ts`.
- Replaced calls to `getAPIKey` with `getAPIKeyForProjectId` in:
  - `apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/page.tsx`
  - `apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/pay/page.tsx`
  - `apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/account-abstraction/page.tsx`
  - `apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/in-app-wallets/page.tsx`
  - `apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/account-abstraction/page.tsx`

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

<!-- end pr-codex -->
2024-10-03 16:42:08 +00:00
kien-ngo 6ff85d32c5 [Dashboard] Remove react-icons (3) (#4898)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating icon imports from `react-icons` to `lucide-react` across multiple components, enhancing consistency and potentially improving performance.

### Detailed summary
- Replaced `FiX` with `XIcon` in `SmartWalletsBillingAlert`.
- Replaced `CircleAlert` with `CircleAlertIcon` in `AirdropTable`.
- Replaced `FiUpload` with `UploadIcon` in `IconUpload`.
- Updated `HackathonEarnFooter` to use `SearchIcon`.
- Replaced `BsLightningCharge` with `ZapIcon` in `Community`.
- Replaced `IoAlertCircleOutline` with `CircleAlertIcon` in `AirdropTable`.
- Updated pagination icons in `AirdropTable` to use `Chevron` icons from `lucide-react`.

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

<!-- end pr-codex -->
2024-10-03 16:07:58 +00:00
MananTank 37d62e2b06 Fix Engine /configuration page textarea populated with data (#4908)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `useForm` hook in two components, changing the prop from `defaultValues` to `values`. This change ensures that the form initializes with the provided values directly.

### Detailed summary
- In `cors.tsx`, changed `defaultValues` to `values` in the `useForm` hook.
- In `ip-allowlist.tsx`, changed `defaultValues` to `values` in the `useForm` hook.

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

<!-- end pr-codex -->
2024-10-03 15:55:30 +00:00
kien-ngo 422a725092 [Dashboard] Fix airdrop erc20 scroll issue (#4909)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on modifying the `className` of the `SheetContent` component in the `airdrop-button.tsx` file to improve its styling by adding an `overflow-y-auto` class, allowing for vertical scrolling if the content exceeds the available space.

### Detailed summary
- Updated the `className` of the `SheetContent` component:
  - Added `overflow-y-auto` to enable vertical scrolling.

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

<!-- end pr-codex -->
2024-10-03 14:39:36 +00:00
kien-ngo d1d3fdc732 [Dashboard] Remove react-icons (2) (#4885)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on replacing icon imports from `react-icons` with corresponding icons from `lucide-react` across multiple components, enhancing consistency and potentially reducing bundle size.

### Detailed summary
- Replaced `FiCopy` with `CopyIcon` in `AddressCopyButton`.
- Replaced `MdOutlineAccountBalanceWallet` with `WalletIcon` in `TransactionSimulator`.
- Replaced `FiMoon` and `FiSun` with `MoonIcon` and `SunIcon` in `ColorModeToggle`.
- Replaced `FiTrash` with `Trash2Icon` in `SettingsMetadata`.
- Added `PlusIcon` and `Trash2Icon` in `metadata.tsx`.
- Replaced `FiPlus` with `PlusIcon` in `permissions-editor.tsx`.
- Replaced `BsFillLightningChargeFill` with `ZapIcon` in `contact-us.tsx`.
- Replaced `BsFillLightningChargeFill` with `ZapIcon` in `contracts.tsx`.
- Replaced `IoChevronBack` with `ChevronFirstIcon` in `ContractPublishForm`.
- Replaced `IoChevronBack` with `ChevronLeftIcon` in `BatchLazyMint`.
- Replaced various `Md` icons with `Chevron` icons in `BatchTable`.
- Replaced `Chevron` icons in `airdrop-upload-erc20.tsx`.
- Replaced `FiExternalLink` with `MoveUpRightIcon` in `pricing.tsx`.
- Replaced `IoIosInformationCircleOutline` with `InfoIcon` in `pricing.tsx`.
- Replaced `IoCheckmarkCircle` with `CircleCheckIcon` in `pricing.tsx`.
- Replaced `AiOutlineDollarCircle` with `CircleDollarSignIcon` in `pricing.tsx`.
- Replaced `FiArrowRight` with `MoveRightIcon` in `marketplace-table.tsx`.

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

<!-- end pr-codex -->
2024-10-03 12:29:57 +00:00
kien-ngo a453d96aed [SDK] Unstoppable Domains resolvers (#4905)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on adding support for Unstoppable Domains within the `thirdweb` SDK, including new resolvers for names and addresses, and enhancing functionality through tests and constants.

### Detailed summary
- Added `UD_POLYGON_MAINNET` constant.
- Introduced functions: `resolveName`, `resolveAddress`, `reverseNameOf`, `getMany`, and `namehash`.
- Implemented tests for `resolveName` and `resolveAddress`.
- Added exports for new types and functions in `unstoppable-domains.ts`.

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

<!-- end pr-codex -->
2024-10-03 09:57:36 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
bfe9753be6 Version Packages (#4881)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-03 14:33:47 +13:00
Joaquim VergesandGitHub eeb993df75 feat: optimize zksync contract deployment and bytecode handling (#4902) 2024-10-03 14:09:00 +13:00
ElasticBottle 367a270bba fix: update timeline for GDPR compliance (#4897)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the compliance information regarding GDPR and CCPA in the `page.mdx` file, providing more detailed and accurate descriptions of the data handling practices.

### Detailed summary
- Updated the compliance statement for GDPR and CCPA.
- Changed the text from a general statement about in-app wallets to specify that `thirdweb` complies with GDPR and CCPA frameworks.
- Clarified the timeframe for data deletion requests (30 days for GDPR and 45 for CCPA).

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

<!-- end pr-codex -->
2024-10-03 01:02:51 +00:00
kumaryash90 e91581aec6 Update chain stack type check (#4901)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new property `stackType` across various components and utilities, enhancing the handling of blockchain network configurations and metadata.

### Detailed summary
- Added `stackType` property in `types.ts` for chains.
- Updated `utils.ts` to include `stackType` from data.
- Included `stackType` in `embed-setup.tsx` and `ConfigureNetworkForm.tsx`.
- Modified the `isZkSyncChain` function to use `getChainMetadata` for `stackType` validation.
- Removed the obsolete `getChainStack` function.

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

<!-- end pr-codex -->
2024-10-03 00:17:49 +00:00
ElasticBottle 985c4b0804 fix: add missing partner id for ecosystem wallet (#4886)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the issue of missing `partnerId` when creating an ecosystem wallet in the `thirdweb` package.

### Detailed summary
- Updated `partnerId` in `packages/thirdweb/src/wallets/in-app/web/ecosystem.ts` to use `ecosystem.partnerId`.
- Updated `partnerId` in `packages/thirdweb/src/wallets/in-app/native/ecosystem.ts` to use `createOptions?.partnerId`.

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

<!-- end pr-codex -->
2024-10-02 22:38:54 +00:00
MananTank 9fb5401a93 Add Coupon Card in Billing Page (#4895)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `SettingsBillingPage` component by adding a `teamId` prop to manage billing settings for different teams. It also introduces a new `CouponCard` component that allows users to apply coupon codes with relevant feedback.

### Detailed summary
- Updated `Page` component to pass `teamId` to `SettingsBillingPage`.
- Modified `SettingsBillingPage` to accept `teamId` as a prop.
- Adjusted `Billing` component to use `teamId` in its rendering.
- Introduced `CouponCard` component for applying coupon codes.
- Implemented logic in `CouponCard` to handle coupon submissions and display feedback based on response status.
- Updated `Billing` component to include `CouponCard`.

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

<!-- end pr-codex -->
2024-10-02 21:48:14 +00:00
Joaquim VergesandGitHub e54867550e feat: switch to v2 bundler for all user operations (#4884) 2024-10-03 10:12:43 +13:00
MananTank 514647cb53 Add Billing alerts on /connect layout in app router (#4892)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `BillingAlerts` component by allowing it to accept a `className` prop for better styling flexibility. It also updates the usage of `BillingAlerts` in various components to apply specific padding classes.

### Detailed summary
- Modified `BillingAlerts` to accept an optional `className` prop.
- Updated the `BillingAlerts` usage in `apps/dashboard/src/components/layout/app-shell/index.tsx` to include `className="py-6"`.
- Updated `BillingAlerts` usage in `apps/dashboard/src/app/(dashboard)/dashboard/connect/layout.tsx` to include `className="pb-6"`.
- Adjusted the rendering of `BillingAlertsUI` to apply the `className` prop.

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

<!-- end pr-codex -->
2024-10-02 19:56:29 +00:00
MananTank eb8638e0c2 Spacing fixes on OnboardingGeneral component (#4891)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the layout of the `OnboardingGeneral` and `AccountForm` components by replacing `FocusLock` and `Flex` components with `div` elements, enhancing the structure and styling of the components.

### Detailed summary
- Replaced `<FocusLock>` with `<div>` in `OnboardingGeneral`.
- Changed `<Flex>` to `<div className="flex flex-col gap-4">` in `OnboardingGeneral`.
- Updated `<Flex>` to `<div className={cn("flex w-full", ...)}> ` in `AccountForm`.
- Modified closing tags from `</Flex>` to `</div>` in both components.

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

<!-- end pr-codex -->
2024-10-02 18:45:33 +00:00
MananTank a6f85ac949 Replace react-otp-input with shadcn input-otp (#4889)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new OTP input component using the `input-otp` library, along with related animations and configuration updates. It replaces the existing `react-otp-input` dependency and enhances the onboarding email confirmation process.

### Detailed summary
- Added `input-otp` dependency to `package.json`.
- Removed `react-otp-input` from `package.json`.
- Updated `tailwind.config.js` to include `caret-blink` animation.
- Created new components: `InputOTP`, `InputOTPGroup`, `InputOTPSlot`, `InputOTPSeparator`.
- Refactored `ConfirmEmail.tsx` to utilize the new OTP input components.
- Improved styling and functionality for OTP input slots.

> 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 -->
2024-10-02 17:57:34 +00:00
MananTank 726bbde9ca Add privacyPolicyUrl and termsOfServiceUrl on ConnectEmbed in login page (#4890)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `login` component by adding links for the privacy policy and terms of service.

### Detailed summary
- Added `privacyPolicyUrl` prop with the value `"/privacy"` to the component.
- Added `termsOfServiceUrl` prop with the value `"/tos"` to the component.

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

<!-- end pr-codex -->
2024-10-02 17:46:44 +00:00
MananTank 025c581be6 api server url env cleanup (#4887)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new constant, `API_SERVER_URL`, to centralize the API server URL configuration. It replaces instances of `process.env.NEXT_PUBLIC_THIRDWEB_API_HOST` throughout the codebase, enhancing maintainability and readability.

### Detailed summary
- Added `API_SERVER_URL` in `env.ts`.
- Replaced `process.env.NEXT_PUBLIC_THIRDWEB_API_HOST` with `API_SERVER_URL` in multiple files:
  - `getAccount.ts`
  - `fetchEcosystemList.ts`
  - `fetchEcosystem.ts`
  - `team-members.ts`
  - `get-auth-token/route.ts`
  - `getAPIKeys.ts`
  - `ensure-login/route.ts`
  - `server-proxy/api/[...paths].tsx`
  - `team.ts`
  - `projects.ts`
  - `create-ticket.action.ts`
  - `auth-actions.ts`
  - `utils.ts`
- Updated fetch requests to use `API_SERVER_URL` for consistent API endpoint access.

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

<!-- end pr-codex -->
2024-10-02 17:39:21 +00:00
arcoraven 522968a505 chore: Update version flow updates deployment (#4852)
## Problem solved

Changes the "update Engine version" flow to query the infra backend to perform the version upgrade.

Previously this would ping Slack for a thirdweb staff to update.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the code quality and user interface across various components in the dashboard. It includes updates to placeholders, text content, and the handling of engine updates.

### Detailed summary
- Updated `placeholder` in `ip-allowlist.tsx` to use curly braces.
- Added periods to sentences in `EngineImportPage.tsx` and `CreateEnginePage.tsx`.
- Simplified conditional rendering in `engine-instances-table.tsx`.
- Changed `cloudDeployedAt` to `deploymentId` in `useEngine.ts`.
- Renamed `useEngineUpdateVersion` to `useEngineUpdateServerVersion`.
- Updated fetch method to `PUT` for engine updates.
- Changed variable names for clarity in `EngineVersionBadge.tsx`.
- Updated props in `UpdateVersionModal` to use `latestVersion`.
- Adjusted toast messages for better user feedback during engine updates.

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

<!-- end pr-codex -->
2024-10-02 07:09:16 +00:00
joaquim-verges 454f063f98 refactor: optimize zksync chain detection and add Creator Testnet test (#4883)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring code related to the handling of contract metadata, specifically around bytecode fetching and the integration of `zksync` support. It enhances the clarity and functionality of contract deployment processes.

### Detailed summary
- Removed checks for `compilerType` in multiple files.
- Simplified bytecode fetching by introducing `fetchBytecodeFromCompilerMetadata`.
- Updated contract metadata handling in `fetchDeployMetadata`.
- Adjusted UI components to reflect new metadata structure.
- Added a test for sending transactions on the Creator Testnet.

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

<!-- end pr-codex -->
2024-10-02 03:40:38 +00:00
MananTank 78cbc412ce Migrate Billing related components to tailwind/shadcn - Part 1 (#4879)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily refactors the onboarding and billing components, improving the UI structure and enhancing the modal functionalities. It replaces the `OnboardingTitle` with `TitleAndDescription`, streamlining the code and updating various components for better usability and consistency.

### Detailed summary
- Replaced `<OnboardingTitle>` with `<TitleAndDescription>` in several components.
- Updated `OnboardingModal` to remove redundant `onClose` props.
- Refactored billing alert components to use new UI elements.
- Enhanced the layout of forms and alerts for better UX.
- Improved state management for modal visibility.
- Added new utility functions for account and billing data stubs.
- Updated import statements for consistency and clarity.

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

<!-- end pr-codex -->
2024-10-02 00:07:14 +00:00
kien-ngo 79c50cb311 [Dashboard] Remove react-icons (1) (#4882)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on replacing various icon components with `PlusIcon` and `UploadIcon` from the `lucide-react` library, enhancing the UI consistency across the application.

### Detailed summary
- Replaced `Upload` component with `UploadIcon` in `airdrop-upload-erc20.tsx` and `upload-step.tsx`.
- Updated `FiPlus` icons to `PlusIcon` in multiple components, including `external-links-fieldset.tsx`, `NFTMintButton.tsx`, and more.
- Removed unused `Icon` imports from several files.
- Adjusted icon classes for consistent styling.

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

<!-- end pr-codex -->
2024-10-01 23:46:56 +00:00
kien-ngo 764ee8ca47 [Dashboard] Remove some chakra icons, adjust IpfsUploadButton (#4880)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on UI enhancements and component updates across various files in the dashboard application, including adjustments to icons, button properties, and tooltip components.

### Detailed summary
- Updated `InputRightElement` width from `145px` to `160px`.
- Changed `Tooltip` to `ToolTipLabel` in `OpenSeaPropertyBadge`.
- Modified `leftIcon` rendering in `ConnectPlaygroundButton` and `CodeOptionButton` to use class-based icons.
- Replaced `FiUpload` with `UploadIcon` in `IpfsUploadButton`.
- Swapped `BsFillLightningChargeFill` with `ZapIcon` in `ProductButton`.

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

<!-- end pr-codex -->
2024-10-01 23:46:54 +00:00
jnsdls 783d84467d update dependencies (#4874)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating various dependencies across multiple packages, ensuring compatibility and incorporating improvements.

### Detailed summary
- Updated `turbo` from `2.1.2` to `2.1.3`.
- Updated `@types/react` from `^18.3.8` to `^18.3.10`.
- Updated `tailwindcss` from `3.4.12` to `3.4.13`.
- Updated `@walletconnect/react-native-compat` from `2.13.2` to `2.16.3`.
- Updated `@coinbase/wallet-sdk` from `4.0.4` to `4.1.0`.
- Updated `viem` from `2.21.12` to `2.21.16`.
- Various other dependency updates across multiple packages.

> 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 -->
2024-10-01 22:10:01 +00:00
jnsdls 687a733d4a Add deprecation warnings to dashboard folders (#4878)
### TL;DR

Added warning messages to deprecated folders in the dashboard to prevent further additions.

### What changed?

Added `DO_NOT_ADD_THINGS_HERE.md` files to several deprecated folders within the dashboard's `src` directory. These folders include:

- @3rdweb-sdk
- classes
- contract-ui
- core-ui
- og-lib
- pages
- tw-components

Each file contains a warning message stating that the folder is deprecated and advising developers not to add new content to these locations.

### How to test?

1. Navigate to each of the mentioned folders in the dashboard's `src` directory.
2. Verify that the `DO_NOT_ADD_THINGS_HERE.md` file exists in each folder.
3. Open the files and confirm they contain the correct warning message.

### Why make this change?

This change aims to prevent developers from adding new content to deprecated parts of the dashboard. By placing clear warning messages in these folders, we reduce the risk of introducing new code or features in areas that are scheduled for removal. This helps maintain code quality, reduces technical debt, and supports the ongoing efforts to modernize and streamline the dashboard's structure.
2024-10-01 21:32:00 +00:00
kien-ngo 96daa2654c [SDK] Update docs for claimTo extensions (#4849)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances the documentation for the `claimTo` function across the `ERC1155`, `ERC20`, and `ERC721` extensions by adding usage examples for drops with allowlists, emphasizing the need to specify the claimer address.

### Detailed summary
- Added a "### Basic usage" section to the documentation for `claimTo` in all three extensions.
- Introduced a "### For Drops with allowlists" section explaining the need for the `from` parameter.
- Provided code examples for using `claimTo` with allowlists in `ERC1155`, `ERC20`, and `ERC721`.

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

<!-- end pr-codex -->
2024-10-01 21:08:24 +00:00
kien-ngo a2ce5f56ab [Dashboard] Remove <Code /> component (ez mode) (#4787)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing code readability by replacing instances of the `Code` component from Chakra UI with a new `InlineCode` component, which provides a consistent styling for inline code snippets across various files.

### Detailed summary
- Added `InlineCode` component in `inline-code.tsx`.
- Replaced `Code` with `InlineCode` in multiple components for improved consistency:
  - `ChainValidation`
  - `EngineCorsConfig`
  - `EngineIpAllowlistConfig`
  - `InteractiveAbiFunction`
  - `EngineAccessTokens`
  - `SnapshotUpload`
  - `UploadStep`

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

<!-- end pr-codex -->
2024-10-01 21:03:53 +00:00
kumaryash90 6beec7a35e Check zksync stack (#4869)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `isZkSyncChain` function to be asynchronous and modifying various parts of the codebase to await its result. This change enhances the handling of chain identification, particularly for zkSync-related operations.

### Detailed summary
- Changed `isZkSyncChain` to an async function.
- Updated calls to `isZkSyncChain` to use `await` in several files.
- Modified the logic in `isZkSyncChain` to include additional checks for specific chain IDs.
- Introduced a new async function `getChainStack` for fetching chain stack information.

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

<!-- end pr-codex -->
2024-10-01 20:12:35 +00:00
31f371d065 Superposition Mainnnet Custom Chain Page (#4875)
Co-authored-by: Jonas Daniels <[email protected]>
2024-10-01 12:45:00 -07:00
MananTank fd8674a8a4 Single Header component for App and Pages router (#4877)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the dashboard components, enhancing the UI elements, and improving the overall structure of the codebase. It includes updates to navigation, styling, and the introduction of new components for better functionality.

### Detailed summary
- Deleted unused files: `nav-link.client.tsx`, `headerLinks.ts`, `MobileBurgerMenu.tsx`.
- Updated `cmd-k-search` button styling and icon size.
- Changed import paths in `layout.tsx`.
- Added `DashboardHeaderTabs` component to manage navigation.
- Refactored `DashboardHeader` to streamline layout and include new links.
- Updated `ColorModeToggle` and `CreditsButton` for better UI interaction.
- Enhanced `CreditsItem` component layout and functionality.
- Replaced `TrackedLinkButton` with `NavLink` in `UpgradeButton`.

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

<!-- end pr-codex -->
2024-10-01 19:33:06 +00:00
0xFirekeeper d3b0dc6646 [Portal] Fix Unity link (#4876)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates the links in the `page.mdx` file for the Unity SDK to reflect the correct versioning in the URLs.

### Detailed summary
- Updated the link in the text from `/unity/getting-started` to `/unity/v5/getting-started`.
- Changed the `href` attribute of the `ArticleIconCard` component from `/unity/getting-started` to `/unity/v5/getting-started`.

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

<!-- end pr-codex -->
2024-10-01 19:29:36 +00:00
kien-ngo 98c5fd0b79 [SDK} Skip pack test (#4873)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `createNewPack` test in the `createNewPack.test.ts` file. It enhances the test by ensuring the correct creation and opening of a Pack while managing ERC20 and ERC721 tokens, including minting, approval, and balance checks.

### Detailed summary
- Added a `describe.skip` for `createNewPack` to temporarily skip the test.
- Reformatted the test to ensure proper execution flow.
- Included minting and approval for ERC20 and ERC721 tokens.
- Added assertions to verify balances and pack content after creation.
- Ensured correct metadata checks for the created Pack.

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

<!-- end pr-codex -->
2024-10-01 00:57:50 +00:00
0xFirekeeper 2f11259ccd [Portal] Link new Telegram Unity Template (#4872)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates the `page.mdx` file to modify existing `ArticleCard` entries and add new ones. It enhances the descriptions and removes a duplicate `ArticleCard` for `Pioneer`.

### Detailed summary
- Updated the `description` for the `Take Flight!` and `Blockventure` `ArticleCard` entries.
- Added two new `ArticleCard` entries for `Telegram Mini-App` and `Pioneer`.
- Removed the duplicate `ArticleCard` for `Pioneer`.

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

<!-- end pr-codex -->
2024-10-01 00:47:16 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
97c09003dc Version Packages (#4842)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-01 13:37:54 +13:00
Edward SunandGitHub 5d0505c43c Add purchaseData to transfer transactions (#4871) 2024-10-01 09:14:38 +09:00
Jonas DanielsandGitHub e552fda9e5 fix auth token (#4870) 2024-09-30 16:58:35 -07:00
kien-ngo cddeda4280 [Dashboard] Remove <Stack/> (5) (#4844)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the usage of the `Stack` component from `@chakra-ui/react` to standard HTML elements with Flexbox classes for layout consistency and performance improvements across various components in the dashboard.

### Detailed summary
- Removed `Stack` component and replaced it with `div` elements using Flexbox classes in multiple files.
- Updated `as` prop for `FormControl` elements to use `className` for styling.
- Adjusted various components to improve layout and spacing using Tailwind CSS classes.
- Added `StackProps` to `SelectOptionProps` interface, making it more flexible.
- Ensured consistency in component structure and styling throughout the dashboard.

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

<!-- end pr-codex -->
2024-09-30 23:27:38 +00:00
MananTank cb72f67c92 Fix Contract Type shown in Contracts Table, Fix PublishedBy not showing latest version (#4854)
Fixes DASH-274

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the handling of published contracts in the dashboard by reversing and sorting the list of contracts based on the publisher, prioritizing those from `THIRDWEB_DEPLOYER_ADDRESS`.

### Detailed summary
- In `published-by.tsx`, the list of published contracts is reversed.
- In `cells.tsx`, a new sorted array `publishedContractsFromDeploySorted` is created from the original contracts.
- The sorting prioritizes contracts published by `THIRDWEB_DEPLOYER_ADDRESS`.
- The display name retrieval uses the sorted list instead of the original query.

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

<!-- end pr-codex -->
2024-09-30 23:15:51 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
222964dcbb Bump eslint-plugin-storybook from 0.8.0 to 0.9.0 (#4866)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 16:14:49 -07:00
MananTank ec37c74199 Fix InteractiveAbiFunction component not rendered in published contract page explorer (#4868)
FIXES: DASH-273

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving type safety and handling of published contracts in the dashboard application. It modifies type definitions and enhances the rendering logic for contract functions.

### Detailed summary
- Changed `snippet` type from `Record<CodeEnvironment, any>` to `Partial<Record<CodeEnvironment, any>>` in `formatSnippet`.
- Added a check for `publishedContract` in `layout.tsx` to ensure it exists before proceeding.
- Updated the `ContractFunction` component to enforce required `fn` and optional `contract` props.
- Enhanced rendering logic in `ContractFunctionInner` to display function usage and code snippets based on contract availability.

> The following files were skipped due to too many changes: `apps/dashboard/tsconfig.tsbuildinfo`

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

<!-- end pr-codex -->
2024-09-30 22:57:39 +00:00
kien-ngo 2ac1e86b8f [Dashboard] Remove FTUX (#4851)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on removing the `FTUX` component and related files from the project, simplifying the `Dashboard` component by eliminating conditional rendering based on wallet connection status.

### Detailed summary
- Deleted `FTUX.tsx` and associated files: `shared.ts`, `slides.tsx`, `animations.ts`, `Graphics.tsx`, `ContentContainer.tsx`, and `GraphicContainer.tsx`.
- Removed logic for `connectionStatus` and `showFTUX` from `Dashboard`.
- Streamlined rendering in `Dashboard` by directly displaying `OnboardingSteps`.

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

<!-- end pr-codex -->
2024-09-30 22:49:45 +00:00
kien-ngo bdc5964054 [Dashboard] Remove ListItem (2) (#4850)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on the removal of several files related to the `contract-ui` and `core-ui` components, alongside updates to various components and hooks to include `txChainID` for improved transaction handling.

### Detailed summary
- Deleted multiple files in `contract-ui` and `core-ui`.
- Added `txChainID` prop to `TransactionButton` across various components for transaction context.
- Updated `useWalletNFTs` to accept an object parameter for better clarity.
- Enhanced error handling in API functions.
- Refactored several components to improve code readability and maintainability.

> The following files were skipped due to too many changes: `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/claim-conditions/page.tsx`, `apps/dashboard/src/contract-ui/tabs/claim-conditions/components/claim-conditions.tsx`, `apps/dashboard/src/contract-ui/tabs/permissions/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/page.tsx`, `apps/dashboard/src/components/app-layouts/app.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/NFTCards.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/detectedFeatures/erc4337.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/explorer/page.tsx`, `apps/dashboard/src/contract-ui/tabs/tokens/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/code/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/page.tsx`, `apps/dashboard/src/contract-ui/tabs/shared-components/cancel-tab.tsx`, `apps/dashboard/src/pages/hackathon/readyplayer3.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/PermissionsTable.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/BuildYourApp.tsx`, `apps/dashboard/src/stores/chainStores.tsx`, `apps/dashboard/src/contract-ui/tabs/account/page.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/NFTDetails.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/page.tsx`, `apps/dashboard/src/contract-ui/tabs/accounts/components/accounts-table.tsx`, `apps/dashboard/src/contract-ui/tabs/code/components/code-overview.tsx`, `apps/dashboard/src/stores/SyncStoreToStorage.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/ContractChecklist.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/table.tsx`, `apps/dashboard/src/pages/contact-us.tsx`, `apps/dashboard/src/contract-ui/tabs/embed/components/embed-setup.tsx`, `apps/dashboard/src/components/contract-functions/contract-function.tsx`, `apps/dashboard/src/contract-ui/tabs/events/components/events-feed.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/airdrop-upload.tsx`, `apps/dashboard/src/@/components/blocks/Sidebar.tsx`, `apps/dashboard/src/components/shared/DeprecatedAlert.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/getContractFromParams.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/ConfigureCustomChain.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/Analytics.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/detectedFeatures/claimConditions.ts`, `apps/dashboard/src/contract-ui/tabs/tokens/components/airdrop-upload-erc20.tsx`, `apps/dashboard/src/contract-ui/tabs/settings/page.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/token-id.tsx`, `apps/dashboard/src/pages/hackathon/consumer-crypto.tsx`, `apps/dashboard/src/@/components/blocks/MobileSidebar.tsx`, `apps/dashboard/src/components/custom-contract/contract-header/contract-metadata.tsx`, `apps/dashboard/src/contract-ui/tabs/explorer/page.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/LatestEvents.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/page.tsx`, `apps/dashboard/src/contract-ui/tabs/listings/components/list-form.tsx`, `apps/dashboard/src/components/layout/app-shell/index.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useDashboardContractMetadata.tsx`, `apps/dashboard/src/og-lib/url-utils.ts`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useActiveChainId.tsx`, `apps/dashboard/src/@/components/blocks/charts/area-chart.tsx`, `apps/dashboard/src/contract-ui/components/primary-dashboard-button.tsx`, `apps/dashboard/src/pages/hackathon/earn.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/getContractPageSidebarLinks.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/getContractPageMetadata.ts`, `apps/dashboard/src/contract-ui/tabs/nfts/page.tsx`, `apps/dashboard/src/core-ui/batch-upload/upload-step.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/MarketplaceDetails.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/layout.tsx`, `apps/dashboard/src/components/contract-components/hooks.ts`, `apps/dashboard/src/pages/api/og/contract.tsx`, `apps/dashboard/src/components/configure-networks/ConfigureNetworkForm.tsx`, `apps/dashboard/src/components/custom-contract/contract-header/metadata-header.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts`, `apps/dashboard/src/components/buttons/MismatchButton.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useEngine.ts`

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

<!-- end pr-codex -->
2024-09-30 22:49:44 +00:00
kien-ngoandManan Tank 5fc07f7111 [Dashboard] Remove ListItem (1) and fix some UI issues from the aspect-ratio PR (#4846)
Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

This PR focuses on replacing `List` and `ListItem` components with HTML `<ul>` and `<li>` elements across multiple files to improve semantic HTML structure and potentially enhance accessibility.

- Removed `List` and `ListItem` components in favor of `<ul>` and `<li>` elements in various components.
- Updated `label` in `CreateListingsForm` to use a `Card` with structured `<ul>` content.
- Adjusted lists in `Hackathon`, `HackathonEarn`, and `ContactUs` pages to use `<ul>` and `<li>`.
- Minor styling adjustments for improved layout and alignment.

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

<!-- end pr-codex -->
2024-10-01 03:59:35 +05:30
MananTank 80729e9748 Move contract pages to app router (#4820)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on code cleanup and refactoring, including the removal of deprecated files and the addition of `txChainID` props in various components for better transaction handling.

### Detailed summary
- Deleted multiple unused files in `apps/dashboard/src/contract-ui` and `apps/dashboard/src/core-ui`.
- Added `txChainID` prop to `TransactionButton` in various components for transaction context.
- Updated components to use direct imports and improved overall code structure.
- Enhanced error handling and metadata fetching for contracts.

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/permissions/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/page.tsx`, `apps/dashboard/src/components/app-layouts/app.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/NFTCards.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/detectedFeatures/erc4337.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/explorer/page.tsx`, `apps/dashboard/src/contract-ui/tabs/tokens/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/code/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/page.tsx`, `apps/dashboard/src/contract-ui/tabs/shared-components/cancel-tab.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/PermissionsTable.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/BuildYourApp.tsx`, `apps/dashboard/src/stores/chainStores.tsx`, `apps/dashboard/src/contract-ui/tabs/account/page.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/NFTDetails.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/page.tsx`, `apps/dashboard/src/contract-ui/tabs/accounts/components/accounts-table.tsx`, `apps/dashboard/src/components/contract-functions/contract-function.tsx`, `apps/dashboard/src/contract-ui/tabs/code/components/code-overview.tsx`, `apps/dashboard/src/stores/SyncStoreToStorage.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/ContractChecklist.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/table.tsx`, `apps/dashboard/src/contract-ui/tabs/embed/components/embed-setup.tsx`, `apps/dashboard/src/contract-ui/tabs/listings/components/list-form.tsx`, `apps/dashboard/src/contract-ui/tabs/events/components/events-feed.tsx`, `apps/dashboard/src/@/components/blocks/Sidebar.tsx`, `apps/dashboard/src/components/shared/DeprecatedAlert.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/getContractFromParams.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/ConfigureCustomChain.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/Analytics.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/detectedFeatures/claimConditions.ts`, `apps/dashboard/src/contract-ui/tabs/settings/page.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/token-id.tsx`, `apps/dashboard/src/@/components/blocks/MobileSidebar.tsx`, `apps/dashboard/src/components/custom-contract/contract-header/contract-metadata.tsx`, `apps/dashboard/src/contract-ui/tabs/explorer/page.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/LatestEvents.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/page.tsx`, `apps/dashboard/src/components/layout/app-shell/index.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useDashboardContractMetadata.tsx`, `apps/dashboard/src/og-lib/url-utils.ts`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useActiveChainId.tsx`, `apps/dashboard/src/@/components/blocks/charts/area-chart.tsx`, `apps/dashboard/src/contract-ui/components/primary-dashboard-button.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/getContractPageSidebarLinks.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/getContractPageMetadata.ts`, `apps/dashboard/src/contract-ui/tabs/nfts/page.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/MarketplaceDetails.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/layout.tsx`, `apps/dashboard/src/components/contract-components/hooks.ts`, `apps/dashboard/src/pages/api/og/contract.tsx`, `apps/dashboard/src/components/configure-networks/ConfigureNetworkForm.tsx`, `apps/dashboard/src/components/custom-contract/contract-header/metadata-header.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts`, `apps/dashboard/src/components/buttons/MismatchButton.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useEngine.ts`

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

<!-- end pr-codex -->
2024-09-30 21:43:43 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
8832f87f4a Bump @storybook/addon-interactions from 8.3.2 to 8.3.4 (#4867)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:35:43 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
39a43903ad Bump @aws-sdk/client-lambda from 3.656.0 to 3.659.0 (#4861)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:33:46 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6396729839 Bump @cloudflare/workers-types from 4.20240919.0 to 4.20240925.0 (#4862)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:32:17 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
30fd225538 Bump @walletconnect/sign-client from 2.16.2 to 2.16.3 (#4864)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:31:13 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
931bbd4952 Bump @storybook/react-vite from 8.3.2 to 8.3.4 (#4863)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:23:30 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3202ce105c Bump @storybook/blocks from 8.3.2 to 8.3.4 (#4860)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:19:56 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
36aa3f0937 Bump @storybook/react from 8.3.2 to 8.3.4 (#4855)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 14:05:14 -07:00
MananTank ab43d9426a Fix Code tab not working in playground - revert shiki to 1.16 (#4853)
Fixes CNCT-1958
2024-09-30 18:52:16 +00:00
AmirandGitHub 29938abfe3 Update page.mdx (#4848)
Signed-off-by: Amir <[email protected]>
2024-09-29 21:40:27 -07:00
AmirandGitHub 5bb5a437cd Update page.mdx (#4847)
Signed-off-by: Amir <[email protected]>
2024-09-29 21:14:07 -07:00
kien-ngo 8b681729a1 [Dashboard] Remove <Stack /> (4) (#4843)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring the layout components in various files from using `Stack` to `div` elements with Flexbox classes for better styling and layout control.

### Detailed summary
- Replaced `<Stack>` components with `<div>` using Flexbox classes in multiple files.
- Updated form structures to use `<form>` tags directly instead of wrapping them in `<Stack>`.
- Adjusted spacing and alignment using Flexbox properties.

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

<!-- end pr-codex -->
2024-09-29 18:29:22 +00:00
kien-ngo 6c26012a71 [SDK] Update smart wallet test (#4845)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new `sleep` function in `sleep.ts` for delaying asynchronous operations and replaces existing inline sleep implementations across various files with this unified function.

### Detailed summary
- Added `sleep` function in `packages/thirdweb/src/utils/sleep.ts` for delaying async operations.
- Removed duplicate `sleep` functions from `packages/thirdweb/src/rpc/watchBlockNumber.ts` and `packages/thirdweb/src/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.ts`.
- Updated calls to `sleep` in `packages/thirdweb/src/wallets/smart/smart-wallet-integration-v07.test.ts` and `packages/thirdweb/src/wallets/in-app/web/utils/iFrameCommunication/IframeCommunicator.ts` to use the new function.

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

<!-- end pr-codex -->
2024-09-28 23:11:39 +00:00
kien-ngo 90b5495efb [SDK] Add Pack extensions (#4579)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces new functionalities and enhancements for the `Pack` contract in the `thirdweb` project, including event definitions, deployment options, and methods for managing packs and rewards.

### Detailed summary
- Added `initialize` function to `Pack.json`.
- Exported new types and functions in `deploy-pack.ts`.
- Defined new events and functions in `IPackVRFDirect.json`.
- Created tests for deploying `Pack` contracts.
- Updated changelog with Pack extensions.
- Implemented various methods for managing packs, including `openPack`, `addPackContents`, and `claimRewards`.

> The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/pack/createNewPack.test.ts`, `packages/thirdweb/src/extensions/prebuilts/__generated__/Pack/write/initialize.ts`, `packages/thirdweb/src/extensions/pack/__generated__/IPack/write/createPack.ts`, `packages/thirdweb/src/extensions/pack/createNewPack.ts`

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

<!-- end pr-codex -->
2024-09-28 12:46:54 +00:00
Kien NgoandGitHub 71575afef3 [SDK] Avoid out-of-fund in tests (#4840) 2024-09-28 20:59:40 +12:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
70adb57293 Version Packages (#4841)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-28 20:48:14 +12:00
Kien NgoandGitHub 96fa4102ba [SDK] Avoid IPFS uploads in tests whenever possible (#4824) 2024-09-28 20:26:44 +12:00
Joaquim VergesandGitHub fc56142880 fix: createAndSignUserOp with multiple transactions (#4839) 2024-09-28 20:26:06 +12:00
gregfromstl 842baa0513 [SDK] Fix: ensure optional chains are passed to wc (#4838)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on enhancing the `wallet-connect` functionality by ensuring that optional chains are correctly handled in the wallet connection request process.

### Detailed summary
- Updated the destructuring of the return value from `getChainsToRequest` to include `requiredChain`.
- Changed how `optionalChains` and `chains` are assigned in `connectWC` and `initProvider` functions.
- Modified the return structure of `getChainsToRequest` to include `requiredChain` and `optionalChains`.

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

<!-- end pr-codex -->
2024-09-28 07:51:20 +00:00
jnsdls 601958d5b7 [Add] Framer rewrite for /framer-test route (#4577)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates the `next.config.js` file to enhance security policies and add new redirect paths for Framer.

### Detailed summary
- Updated `style-src` and `font-src` directives to include `vercel.live`, `assets.vercel.com`, and `framerusercontent.com`.
- Added `framerusercontent.com` and `events.framer.com` to the `script-src` directive.
- Introduced `FRAMER_PATHS` for specific redirect paths.
- Added new redirect mappings for Framer paths to `https://landing.thirdweb.com`.

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

<!-- end pr-codex -->
2024-09-27 22:30:41 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
bec828de86 Version Packages (#4822)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-27 15:30:03 -07:00
gregfromstl a576a5b858 [SDK] Test: Adds storage mocks and basic tests (#4833)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces new features and improvements related to file uploads and downloads using IPFS and Arweave, along with enhancements to testing with `msw`. It also updates dependencies and modifies some configurations.

### Detailed summary
- Updated `.gitignore` to include `.aider*`.
- Modified `web-node.ts` to streamline header handling.
- Added `msw` as a dependency in `package.json`.
- Enhanced `download.ts` to better handle request timeouts.
- Implemented `msw` handlers in `storage.ts` for IPFS and Arweave.
- Expanded tests in `download.test.ts` for various download scenarios.
- Added tests in `web-node.test.ts` for file uploads and error handling.

> 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 -->
2024-09-27 22:04:39 +00:00
MananTank 5e3be734a3 Fix line break in engine Allowlisted Domains textarea placeholder (#4835)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `placeholder` prop of the `Textarea` component in the `cors.tsx` file to use a JavaScript expression instead of a string literal.

### Detailed summary
- Changed the `placeholder` prop from a string literal (`"https://example.com\nhttp://localhost:3000"`) to a JavaScript expression (`{"https://example.com\nhttp://localhost:3000"}`) for potentially better handling of the string.

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

<!-- end pr-codex -->
2024-09-27 22:00:05 +00:00
MananTank ce6d873ccc Fix Page crash on Module selection (#4834)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the handling of `selectedModule` in the `ModuleForm.tsx` component by including additional properties for better data management.

### Detailed summary
- Added `selectedModule?.contractId` to the data array.
- Added `selectedModule?.bytecodeHash` to the data array.

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

<!-- end pr-codex -->
2024-09-27 21:39:17 +00:00
gregfromstl bbe75b0bc8 [SDK] Fix: Only request specified wallet connect chains (#4832)
Falls in line with the WC spec and appeases some picky wallets

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing wallet connection issues in the `thirdweb` package, particularly for wallets with limited chain support. It improves handling of optional chains and modifies how chains are requested.

### Detailed summary
- Updated handling of `optionalChains` to default to `[1]` if empty.
- Changed `chains` to be `undefined` if `chainToRequest` is not provided.
- Modified `setRequestedChainsIds` function to accept `chains` as `undefined`.
- Simplified logic for `chainsToRequest` to use `undefined` when no chains are available.

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

<!-- end pr-codex -->
2024-09-27 19:47:31 +00:00
gregfromstl cefa4eb097 [SDK] Docs: fix social profiles docs (#4821)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the method used to retrieve social profiles in the `profiles.ts` file, changing the function name from `getProfiles` to `getSocialProfiles`.

### Detailed summary
- Changed the import statement from `getProfiles` to `getSocialProfiles` from the `thirdweb/social` module.
- Updated the usage of the function in the example to reflect the new function name.

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

<!-- end pr-codex -->
2024-09-27 16:34:01 +00:00
kien-ngo 63ceb2874c [Dashboard] Remove <Stack/> (3) (#4831)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing instances of the `Stack` component from Chakra UI with `div` elements styled using Tailwind CSS classes. This change aims to improve layout consistency across various components in the application.

### Detailed summary
- Replaced `<Stack>` with `<div className="flex ...">` in multiple components for layout consistency.
- Adjusted spacing and alignment properties to match previous `Stack` behavior.
- Updated components in `airdrop-tab.tsx`, `select-option.tsx`, `airdrop-upload.tsx`, and others.

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

<!-- end pr-codex -->
2024-09-27 16:08:38 +00:00
kien-ngo 509c7981ee [Dashboard] Remove <Stack /> (2) (#4830)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on replacing instances of the `Stack` component with `div` elements styled using Tailwind CSS classes, enhancing the layout while maintaining functionality across various components in the dashboard application.

### Detailed summary
- Replaced `<Stack>` with `<div className="flex flex-col gap-X">` in multiple components for consistent styling.
- Updated `spacing` properties to `gap` for better alignment with Tailwind CSS practices.
- Maintained functionality across components such as `PermissionEditor`, `EventsFeedItem`, and various modal dialogs.

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

<!-- end pr-codex -->
2024-09-27 15:54:39 +00:00
kien-ngo 8ea9420cc4 [Dashboard] Remove <Stack /> (1) (#4829)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing instances of the `Stack` component with `div` elements styled with Flexbox classes for layout consistency across various components in the application.

### Detailed summary
- Replaced `Stack` components with `div` elements using Flexbox for layout in multiple files.
- Updated spacing and alignment properties to maintain visual consistency.
- Adjusted modal body structures to use Flexbox for better responsiveness.

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

<!-- end pr-codex -->
2024-09-27 15:48:40 +00:00
kien-ngo 8dda1139dc [Dashboard] Remove default <Stack /> (#4828)
@MananTank here's the source code: https://github.com/chakra-ui/chakra-ui/blob/main/packages/react/src/components/stack/stack.tsx

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing `Stack` components with `div` elements styled with `flex` and `gap` classes across various files for a more consistent layout approach in the UI.

### Detailed summary
- Replaced `Stack` with `div className="flex flex-col gap-2"` in multiple components.
- Updated layout in `airdrop-tab.tsx`, `mint-form.tsx`, `lazy-mint-form.tsx`, `split/page.tsx`, `shared-metadata-form.tsx`, `update-metadata-form.tsx`, `transaction-timeline.tsx`, `NewsletterSection.tsx`, and more.
- Enhanced UI consistency and responsiveness.

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

<!-- end pr-codex -->
2024-09-27 11:21:45 +00:00
kien-ngo a637cab051 [Dashboard] Remove @react-icons/all-files (#4819)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating icon components in the `dashboard` application by replacing `react-icons` with custom SVG icons for improved performance and maintainability.

### Detailed summary
- Removed `@react-icons/all-files` dependency.
- Added new SVG components: `MediumIcon`, `YoutubeIcon`, `TiktokIcon`, `TelegramIcon`, `RedditIcon`, `MetaIcon`, `InstagramIcon`.
- Updated `SupportPage`, `PublisherSocials`, `AppFooter`, and other components to use new icons.

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

<!-- end pr-codex -->
2024-09-27 03:07:36 +00:00
kien-ngo c31f919cd4 [Dashboard] Replace Linkedin icon (#4818)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new `LinkedInIcon` component and replaces instances of the `SiLinkedin` icon with the new `LinkedInIcon` in two files, enhancing the consistency of icon usage across the application.

### Detailed summary
- Created a new `LinkedInIcon` component in `LinkedinIcon.tsx`.
- Replaced `SiLinkedin` with `LinkedInIcon` in `socialLinks.tsx`.
- Replaced `SiLinkedin` with `LinkedInIcon` in `PublisherSocials.tsx`.

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

<!-- end pr-codex -->
2024-09-27 02:41:46 +00:00
kien-ngo ffcd199381 [Dashboard] Replace twitter icon (#4817)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new `XIcon` component and replaces existing Twitter icons in various components with this new icon, enhancing consistency and potentially improving the visual design.

### Detailed summary
- Added a new `XIcon` component in `XIcon.tsx`.
- Replaced `SiTwitter` icon with `XIcon` in:
  - `edit-profile.tsx`
  - `socialLinks.tsx`
  - `PublisherSocials.tsx`

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

<!-- end pr-codex -->
2024-09-27 02:41:43 +00:00
kien-ngo b1d78b1f42 [Dashboard] Replace Discord icon (#4816)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing the usage of the `SiDiscord` icon from `@react-icons/all-files` with a custom `DiscordIcon` component in multiple files, enhancing the icon's integration and potentially improving styling consistency.

### Detailed summary
- Replaced `SiDiscord` icon with `DiscordIcon` in:
  - `edit-profile.tsx`
  - `socialLinks.tsx`
  - `PublisherSocials.tsx`
- Introduced `DiscordIcon` component in `DiscordIcon.tsx` with an SVG representation.

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

<!-- end pr-codex -->
2024-09-27 01:52:10 +00:00
kien-ngo bc348ea953 [Dashboard] Replace Unity icon (#4814)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing instances of the `SiUnity` icon from the `react-icons` library with a new custom `UnityIcon` component across multiple files in the dashboard application.

### Detailed summary
- Added a new `UnityIcon` component in `UnityIcon.tsx`.
- Replaced `SiUnity` with `UnityIcon` in:
  - `ConnectSDKCard.tsx`
  - `ConnectPlaygroundButton.tsx`
  - `CodeOptionButton.tsx`
  - `SupportedPlatformLink.tsx`
  - `CodeSegment.tsx`

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

<!-- end pr-codex -->
2024-09-27 01:24:04 +00:00
kien-ngo 43a24e2ed4 [Dashboard] Replace React icon (#4813)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing the usage of `SiReact` icon with a new custom `ReactIcon` component across several files in the dashboard application.

### Detailed summary
- Added `ReactIcon` component in `apps/dashboard/src/components/icons/brand-icons/ReactIcon.tsx`.
- Replaced `SiReact` with `ReactIcon` in:
  - `ConnectSDKCard.tsx`
  - `ConnectPlaygroundButton.tsx`
  - `CodeOptionButton.tsx`
  - `SupportedPlatformLink.tsx`
  - `CodeSegment.tsx`

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

<!-- end pr-codex -->
2024-09-27 01:24:02 +00:00
kien-ngo 7b40f2e8e4 [Dashboard] Replace JS and TS icons (#4812)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing existing icon imports for `JavaScript` and `TypeScript` with custom icon components, enhancing the visual representation in the application.

### Detailed summary
- Replaced `SiJavascript` with `JavaScriptIcon` in `ConnectPlaygroundButton.tsx`, `CodeOptionButton.tsx`, `CodeSegment.tsx`.
- Replaced `SiTypescript` with `TypeScriptIcon` in `SupportedPlatformLink.tsx`, `ConnectSDKCard.tsx`, `CodeSegment.tsx`.
- Added new components: `JavaScriptIcon.tsx` and `TypeScriptIcon.tsx` for custom icons.

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

<!-- end pr-codex -->
2024-09-27 01:24:00 +00:00
kien-ngo c1d94aec4f [Dashboard] Replace SiGithub (#4811)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on replacing the usage of the `SiGithub` icon from `@react-icons` with a custom `GithubIcon` component across several files in the dashboard application.

### Detailed summary
- Replaced `SiGithub` with `GithubIcon` in:
  - `GameCard.tsx`
  - `app-footer.tsx`
  - `edit-profile.tsx`
  - `socialLinks.tsx`
  - `PublisherSocials.tsx`
- Added `GithubIcon` component in `GithubIcon.tsx` with SVG implementation.

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

<!-- end pr-codex -->
2024-09-27 01:23:58 +00:00
kien-ngo ebd5908d4a [Dashboard] Remove non-branding icons (#4810)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on replacing various `react-icons` with `lucide-react` icons across multiple components, along with some minor adjustments to properties and imports. It aims to standardize icon usage within the codebase.

### Detailed summary
- Removed `IconType` from multiple interfaces in `types.ts` and `AnimatedCLICommand.tsx`.
- Replaced `react-icons` with `lucide-react` icons in `HackathonFooter`, `NFTClaimButton`, and other components.
- Updated icon rendering logic in multiple components for consistency.
- Adjusted imports and usage of icons in `FileInput`, `BatchLazyMint`, and `MismatchButton`.

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

<!-- end pr-codex -->
2024-09-27 01:11:42 +00:00
Edward SunandGitHub 21b032d1b8 Remove text in UI (#4823) 2024-09-26 16:56:46 -07:00
kumaryash90 d0616c4486 Fix Cronos zkevm deployments (#4815)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds support for the `cronos zkevm` by updating the `isZkSyncChain` check to include additional chain IDs for both the testnet and mainnet.

### Detailed summary
- Updated the `isZkSyncChain` function in the file `packages/thirdweb/src/utils/any-evm/zksync/isZkSyncChain.ts`.
- Added chain ID `282` for `cronos zkevm testnet`.
- Added chain ID `388` for `cronos zkevm mainnet`.

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

<!-- end pr-codex -->
2024-09-26 22:13:03 +00:00
MananTank 88db5eaeab Add upload to IPFS on teams & account avatar form fields (#4807)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the account and team settings pages by adding image upload functionality for accounts and teams, updating component imports, and improving layout responsiveness.

### Detailed summary
- Added `updateAccountImage` method to `AccountSettingsPage` and `AccountSettingsPageUI`.
- Introduced `updateTeamImage` method in `TeamGeneralSettingsPage` and `TeamGeneralSettingsPageUI`.
- Changed layout from `min-h-full` to `min-h-screen`.
- Updated import statements to reflect new component names.
- Implemented async image upload functionality with IPFS integration.
- Added error handling for image update methods.

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

<!-- end pr-codex -->
2024-09-26 20:43:18 +00:00
MananTank 09b1c28c09 Replace Avatar placeholders with Avatar components in teams and account layout (#4803)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on updating the account handling in various components to use an `account` object instead of separate email fields, and introduces new avatar components for enhanced visual representation of users and projects.

### Detailed summary
- Replaced `email` with `account` in multiple components.
- Introduced `GradientAvatar` and `ProjectAvatar` components for displaying user and project images.
- Updated story files to showcase new avatar components.
- Added placeholder comments for future image integration.
- Adjusted layout and styling for better alignment with new account structure.

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

<!-- end pr-codex -->
2024-09-26 20:43:14 +00:00
958 changed files with 29965 additions and 19030 deletions
+2 -1
View File
@@ -27,4 +27,5 @@ sitemap*.xml
packages/*/typedoc/*
*storybook.log
storybook-static
storybook-static
.aider*
+3
View File
@@ -21,5 +21,8 @@
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
+4
View File
@@ -60,6 +60,8 @@ module.exports = {
"AspectRatio",
"useToast",
"useClipboard",
"Badge",
"Stack",
// also the types
"ButtonProps",
"BadgeProps",
@@ -71,6 +73,8 @@ module.exports = {
"MenuGroupProps",
"MenuItemProps",
"AspectRatioProps",
"BadgeProps",
"StackProps",
],
message:
'Use the equivalent component from "tw-components" instead.',
+4 -2
View File
@@ -3,7 +3,7 @@
*
*/
async function fetchChainsFromApi() {
const res = await fetch(`https://api.thirdweb.com/v1/chains`, {
const res = await fetch("https://api.thirdweb.com/v1/chains", {
headers: {
"Content-Type": "application/json",
},
@@ -55,7 +55,9 @@ module.exports = {
],
},
exclude: ["/chain/validate"],
transform: async (config, path) => {
transform: async (config, _path) => {
let path = _path;
// ignore og image paths
if (path.includes("_og")) {
return null;
+14 -3
View File
@@ -5,10 +5,10 @@ const ContentSecurityPolicy = `
img-src * data: blob:;
media-src * data: blob:;
object-src 'none';
style-src 'self' 'unsafe-inline' https://vercel.live;
font-src 'self' https://vercel.live https://assets.vercel.com;
style-src 'self' 'unsafe-inline' vercel.live;
font-src 'self' vercel.live assets.vercel.com framerusercontent.com;
frame-src * data:;
script-src 'self' 'unsafe-eval' 'unsafe-inline' 'wasm-unsafe-eval' 'inline-speculation-rules' *.thirdweb.com *.thirdweb-dev.com vercel.live js.stripe.com;
script-src 'self' 'unsafe-eval' 'unsafe-inline' 'wasm-unsafe-eval' 'inline-speculation-rules' *.thirdweb.com *.thirdweb-dev.com vercel.live js.stripe.com framerusercontent.com events.framer.com;
connect-src * data: blob:;
worker-src 'self' blob:;
block-all-mixed-content;
@@ -39,6 +39,13 @@ const securityHeaders = [
const redirects = require("./redirects");
// add framer paths here
const FRAMER_PATHS = [
"/connect/sign-in",
"/contracts/modular-contracts",
"/unlimited-wallets",
];
/**
* @returns {import('next').RemotePattern[]}
*/
@@ -128,6 +135,10 @@ const moduleExports = {
source: "/thirdweb.eth/:path*",
destination: "/deployer.thirdweb.eth/:path*",
},
...FRAMER_PATHS.map((path) => ({
source: path,
destination: `https://landing.thirdweb.com${path}`,
})),
];
},
images: {
+45 -47
View File
@@ -30,45 +30,45 @@
"@emotion/styled": "11.13.0",
"@hookform/resolvers": "^3.9.0",
"@n8tb1t/use-scroll-position": "^2.0.3",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-dialog": "1.1.1",
"@radix-ui/react-dropdown-menu": "^2.1.1",
"@radix-ui/react-hover-card": "^1.1.1",
"@radix-ui/react-alert-dialog": "^1.1.2",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-dialog": "1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-hover-card": "^1.1.2",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.1",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-progress": "^1.1.0",
"@radix-ui/react-radio-group": "^1.2.0",
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-radio-group": "^1.2.1",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tooltip": "1.1.2",
"@react-icons/all-files": "^4.1.0",
"@sentry/nextjs": "8.30.0",
"@shazow/whatsabi": "^0.14.1",
"@stripe/react-stripe-js": "^2.7.3",
"@radix-ui/react-switch": "^1.1.1",
"@radix-ui/react-tooltip": "1.1.3",
"@sentry/nextjs": "8.34.0",
"@shazow/whatsabi": "^0.15.3",
"@stripe/react-stripe-js": "^2.8.1",
"@stripe/stripe-js": "^3.5.0",
"@tanstack/react-query": "5.56.2",
"@tanstack/react-query": "5.59.13",
"@tanstack/react-table": "^8.17.3",
"@thirdweb-dev/service-utils": "workspace:*",
"@vercel/og": "^0.6.2",
"abitype": "1.0.5",
"abitype": "1.0.6",
"chakra-react-select": "^4.7.6",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"color": "^4.2.3",
"compare-versions": "^6.1.0",
"date-fns": "^3.6.0",
"date-fns": "4.1.0",
"flat": "^6.0.1",
"framer-motion": "11.5.6",
"framer-motion": "11.11.8",
"fuse.js": "7.0.0",
"input-otp": "^1.2.4",
"ioredis": "^5.4.1",
"ipaddr.js": "^2.2.0",
"lottie-react": "^2.4.0",
"lucide-react": "0.441.0",
"next": "14.2.13",
"lucide-react": "0.452.0",
"next": "14.2.15",
"next-plausible": "^3.12.0",
"next-seo": "^6.5.0",
"next-themes": "^0.3.0",
@@ -83,49 +83,47 @@
"react-children-utilities": "^2.10.0",
"react-day-picker": "^8.10.1",
"react-dom": "18.3.1",
"react-dropzone": "^14.2.3",
"react-dropzone": "^14.2.9",
"react-hook-form": "7.52.0",
"react-icons": "^5.2.1",
"react-intersection-observer": "^9.10.3",
"react-markdown": "^9.0.1",
"react-otp-input": "^3.1.1",
"react-responsive-carousel": "^3.2.23",
"react-table": "^7.8.0",
"recharts": "^2.12.7",
"recharts": "^2.13.0",
"remark-gfm": "^4.0.0",
"server-only": "^0.0.1",
"sonner": "^1.5.0",
"spdx-correct": "^3.2.0",
"swagger-ui-react": "^5.17.14",
"tailwind-merge": "^2.5.2",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7",
"thirdweb": "workspace:*",
"tiny-invariant": "^1.3.3",
"use-debounce": "^10.0.1",
"use-debounce": "^10.0.4",
"zod": "3.23.8"
},
"devDependencies": {
"@chakra-ui/cli": "^2.4.1",
"@chromatic-com/storybook": "2.0.2",
"@next/bundle-analyzer": "14.2.13",
"@next/eslint-plugin-next": "14.2.13",
"@next/bundle-analyzer": "14.2.15",
"@next/eslint-plugin-next": "14.2.15",
"@playwright/test": "1.47.2",
"@storybook/addon-essentials": "8.3.2",
"@storybook/addon-interactions": "8.3.2",
"@storybook/addon-links": "8.3.2",
"@storybook/addon-onboarding": "8.3.2",
"@storybook/addon-viewport": "8.3.2",
"@storybook/blocks": "8.3.2",
"@storybook/nextjs": "8.3.2",
"@storybook/react": "8.3.2",
"@storybook/test": "8.3.2",
"@storybook/addon-essentials": "8.3.5",
"@storybook/addon-interactions": "8.3.5",
"@storybook/addon-links": "8.3.5",
"@storybook/addon-onboarding": "8.3.5",
"@storybook/addon-viewport": "8.3.5",
"@storybook/blocks": "8.3.5",
"@storybook/nextjs": "8.3.5",
"@storybook/react": "8.3.5",
"@storybook/test": "8.3.5",
"@types/color": "^3.0.6",
"@types/node": "20.14.9",
"@types/papaparse": "^5.3.14",
"@types/pluralize": "^0.0.33",
"@types/qrcode": "^1.5.5",
"@types/react": "^18.3.8",
"@types/react-dom": "^18",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@types/react-table": "^7.7.20",
"@types/spdx-correct": "^3.1.3",
"@types/swagger-ui-react": "^4.18.3",
@@ -134,14 +132,14 @@
"autoprefixer": "^10.4.19",
"checkly": "^4.8.1",
"eslint": "8.57.0",
"eslint-config-biome": "1.8.4",
"eslint-plugin-react-compiler": "0.0.0-experimental-ca16900-20240916",
"eslint-plugin-storybook": "^0.8.0",
"knip": "^5.30.5",
"eslint-config-biome": "1.9.3",
"eslint-plugin-react-compiler": "0.0.0-experimental-fa06e2c-20241014",
"eslint-plugin-storybook": "^0.9.0",
"knip": "^5.33.3",
"next-sitemap": "^4.2.3",
"postcss": "8.4.47",
"storybook": "8.3.2",
"tailwindcss": "3.4.12",
"typescript": "5.6.2"
"storybook": "8.3.5",
"tailwindcss": "3.4.13",
"typescript": "5.6.3"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

+3 -5
View File
@@ -1,10 +1,8 @@
import "server-only";
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
import { API_SERVER_URL } from "@/constants/env";
import { cookies } from "next/headers";
const THIRDWEB_API_HOST =
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
export type Project = {
id: string;
name: string;
@@ -34,7 +32,7 @@ export async function getProjects(teamSlug: string) {
}
const teamsRes = await fetch(
`${THIRDWEB_API_HOST}/v1/teams/${teamSlug}/projects`,
`${API_SERVER_URL}/v1/teams/${teamSlug}/projects`,
{
headers: {
Authorization: `Bearer ${token}`,
@@ -59,7 +57,7 @@ export async function getProject(teamSlug: string, projectSlug: string) {
}
const teamsRes = await fetch(
`${THIRDWEB_API_HOST}/v1/teams/${teamSlug}/projects/${projectSlug}`,
`${API_SERVER_URL}/v1/teams/${teamSlug}/projects/${projectSlug}`,
{
headers: {
Authorization: `Bearer ${token}`,
+8 -13
View File
@@ -1,9 +1,6 @@
import "server-only";
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
import { cookies } from "next/headers";
const THIRDWEB_API_HOST =
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
import { API_SERVER_URL } from "@/constants/env";
import { getAuthToken } from "../../app/api/lib/getAuthToken";
const TeamAccountRole = {
OWNER: "OWNER",
@@ -28,26 +25,24 @@ export type TeamMember = {
};
export async function getMembers(teamSlug: string) {
const cookiesManager = cookies();
const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value;
const token = activeAccount
? cookiesManager.get(COOKIE_PREFIX_TOKEN + activeAccount)?.value
: null;
const token = getAuthToken();
if (!token) {
return [];
return undefined;
}
const teamsRes = await fetch(
`${THIRDWEB_API_HOST}/v1/teams/${teamSlug}/members`,
`${API_SERVER_URL}/v1/teams/${teamSlug}/members`,
{
headers: {
Authorization: `Bearer ${token}`,
},
},
);
if (teamsRes.ok) {
return (await teamsRes.json())?.result as TeamMember[];
}
return [];
return undefined;
}
+7 -9
View File
@@ -1,22 +1,20 @@
import "server-only";
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
import { API_SERVER_URL } from "@/constants/env";
import { cookies } from "next/headers";
const THIRDWEB_API_HOST =
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
export type Team = {
id: string;
name: string;
slug: string;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
bannedAt: string | null;
// image: string; // -> TODO
deletedAt?: string;
bannedAt?: string;
image?: string;
billingPlan: "pro" | "growth" | "free";
billingStatus: "validPayment" | (string & {}); // what's the other value?
// billingEmail: string;
billingEmail: string;
// billingExternalId: string;
// billingType: "STRIPE" | ??
// billingCustomerPayload: ?? | null
@@ -35,7 +33,7 @@ export async function getTeamBySlug(slug: string) {
return null;
}
const teamRes = await fetch(`${THIRDWEB_API_HOST}/v1/teams/${slug}`, {
const teamRes = await fetch(`${API_SERVER_URL}/v1/teams/${slug}`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -57,7 +55,7 @@ export async function getTeams() {
return [];
}
const teamsRes = await fetch(`${THIRDWEB_API_HOST}/v1/teams`, {
const teamsRes = await fetch(`${API_SERVER_URL}/v1/teams`, {
headers: {
Authorization: `Bearer ${token}`,
},
@@ -0,0 +1,15 @@
"use client";
import { useEffect } from "react";
import { setCookie } from "../../stores/SyncStoreToCookies";
export function DashboardTypeCookieSetter(props: {
type: "team" | "old";
}) {
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
setCookie("x-dashboard-type", props.type);
}, [props.type]);
return null;
}
@@ -0,0 +1,89 @@
import type { Meta, StoryObj } from "@storybook/react";
import { useState } from "react";
import { BadgeContainer } from "../../../../stories/utils";
import { Button } from "../../ui/button";
import { GradientAvatar } from "./GradientAvatar";
const meta = {
title: "blocks/Avatars/GradientAvatar",
component: Story,
parameters: {},
} satisfies Meta<typeof Story>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Desktop: Story = {
args: {},
};
function Story() {
return (
<div className="flex flex-col gap-10 p-10">
<p> All images below are set with size-6 className </p>
<BadgeContainer label="No Src, No id - Skeleton">
<GradientAvatar id={undefined} src={undefined} className="size-6" />
</BadgeContainer>
<BadgeContainer label="No Src, id=foo - Skeleton">
<GradientAvatar id={"foo"} src={undefined} className="size-6" />
</BadgeContainer>
<BadgeContainer label="Invalid/Empty Src, id=foo - Gradient">
<GradientAvatar id={"foo"} src={""} className="size-6" />
</BadgeContainer>
<BadgeContainer label="Invalid/Empty Src, id=bar - Gradient">
<GradientAvatar id={"bar"} src={""} className="size-6" />
</BadgeContainer>
<BadgeContainer label="Empty/Invalid Src, No id - default fallback">
<GradientAvatar src="invalid-src" id={undefined} className="size-6" />
</BadgeContainer>
<ToggleTest />
</div>
);
}
function ToggleTest() {
const [data, setData] = useState<undefined | { src: string; id: string }>(
undefined,
);
return (
<div className="relative flex flex-col gap-10 border p-6">
<Button
variant="outline"
onClick={() => {
if (data) {
setData(undefined);
} else {
setData({
id: "foo",
src: "https://picsum.photos/400",
});
}
}}
className="absolute top-6 right-6 inline-flex"
>
Toggle Src
</Button>
<p> Src+ID is: {data ? "set" : "not set"} </p>
<BadgeContainer label="Valid Src">
<GradientAvatar src={data?.src} id={data?.id} className="size-6" />
</BadgeContainer>
<BadgeContainer label="invalid Src">
<GradientAvatar
className="size-6"
src={data ? "invalid-src" : undefined}
id={undefined}
/>
</BadgeContainer>
</div>
);
}
@@ -0,0 +1,58 @@
import { Img } from "@/components/blocks/Img";
import { useMemo } from "react";
import { cn } from "../../../lib/utils";
const gradients = [
["#fca5a5", "#b91c1c"],
["#fdba74", "#c2410c"],
["#fcd34d", "#b45309"],
["#fde047", "#a16207"],
["#a3e635", "#4d7c0f"],
["#86efac", "#15803d"],
["#67e8f9", "#0e7490"],
["#7dd3fc", "#0369a1"],
["#93c5fd", "#1d4ed8"],
["#a5b4fc", "#4338ca"],
["#c4b5fd", "#6d28d9"],
["#d8b4fe", "#7e22ce"],
["#f0abfc", "#a21caf"],
["#f9a8d4", "#be185d"],
["#fda4af", "#be123c"],
];
function getGradientForString(str: string) {
const number = Math.abs(
str.split("").reduce((acc, b, i) => acc + b.charCodeAt(0) * (i + 1), 0),
);
const index = number % gradients.length;
return gradients[index];
}
export function GradientAvatar(props: {
src: string | undefined;
id: string | undefined;
className: string;
}) {
const gradient = useMemo(() => {
if (!props.id) {
return undefined;
}
return getGradientForString(props.id);
}, [props.id]);
return (
<Img
src={props.src}
className={cn("rounded-full", props.className)}
fallback={
gradient ? (
<div
style={{
background: `linear-gradient(45deg, ${gradient[0]} 0%, ${gradient[1]} 100%)`,
}}
/>
) : undefined
}
/>
);
}
@@ -0,0 +1,76 @@
import type { Meta, StoryObj } from "@storybook/react";
import { useState } from "react";
import { BadgeContainer } from "../../../../stories/utils";
import { Button } from "../../ui/button";
import { ProjectAvatar } from "./ProjectAvatar";
const meta = {
title: "blocks/Avatars/ProjectAvatar",
component: Story,
parameters: {},
} satisfies Meta<typeof Story>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Desktop: Story = {
args: {},
};
function Story() {
return (
<div className="flex flex-col gap-10 p-10">
<p> All images below are set with size-6 className </p>
<BadgeContainer label="No Src - Skeleton">
<ProjectAvatar src={undefined} className="size-6" />
</BadgeContainer>
<BadgeContainer label="Invalid/Empty Src - BoxIcon Fallback">
<ProjectAvatar src={""} className="size-6" />
</BadgeContainer>
<ToggleTest />
</div>
);
}
function ToggleTest() {
const [data, setData] = useState<undefined | { src: string; name: string }>(
undefined,
);
return (
<div className="relative flex flex-col gap-10 border p-6">
<Button
variant="outline"
onClick={() => {
if (data) {
setData(undefined);
} else {
setData({
name: "foo",
src: "https://picsum.photos/400",
});
}
}}
className="absolute top-6 right-6 inline-flex"
>
Toggle Src
</Button>
<p> Src+Name is: {data ? "set" : "not set"} </p>
<BadgeContainer label="Valid Src">
<ProjectAvatar src={data?.src} className="size-6" />
</BadgeContainer>
<BadgeContainer label="invalid Src">
<ProjectAvatar
src={data ? "invalid-src" : undefined}
className="size-6"
/>
</BadgeContainer>
</div>
);
}
@@ -0,0 +1,21 @@
import { Img } from "@/components/blocks/Img";
import { BoxIcon } from "lucide-react";
import { cn } from "../../../lib/utils";
export function ProjectAvatar(props: {
src: string | undefined;
className: string | undefined;
}) {
return (
<Img
src={props.src}
className={cn("rounded-lg border border-border", props.className)}
alt={""}
fallback={
<div className="flex items-center justify-center bg-muted/50">
<BoxIcon className="size-[50%] text-muted-foreground" />
</div>
}
/>
);
}
@@ -11,9 +11,12 @@ import {
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { cn } from "../../lib/utils";
export function DangerSettingCard(props: {
title: string;
className?: string;
footerClassName?: string;
description: string;
buttonLabel: string;
buttonOnClick: () => void;
@@ -22,18 +25,31 @@ export function DangerSettingCard(props: {
title: string;
description: string;
};
children?: React.ReactNode;
}) {
return (
<div className="overflow-hidden rounded-lg border border-red-500/70">
<div className="bg-muted/50 px-4 py-6 lg:px-6">
<div
className={cn(
"overflow-hidden rounded-lg border border-red-500/70",
props.className,
)}
>
<div className="px-4 py-6 lg:px-6">
<h3 className="font-semibold text-xl tracking-tight">{props.title}</h3>
<p className="mt-1.5 mb-4 text-foreground text-sm">
{props.description}
</p>
{props.children}
</div>
<div className="flex justify-end border-red-500/70 border-t bg-red-100 px-4 py-4 lg:px-6 dark:bg-red-500/20">
<div
className={cn(
"flex justify-end border-red-500/70 border-t bg-red-100 px-4 py-4 lg:px-6 dark:bg-red-500/20",
props.footerClassName,
)}
>
<Dialog>
<DialogTrigger asChild>
<Button
@@ -46,7 +62,10 @@ export function DangerSettingCard(props: {
</Button>
</DialogTrigger>
<DialogContent>
<DialogContent
className="z-[10001]"
dialogOverlayClassName="z-[10000]"
>
<DialogHeader className="pr-10">
<DialogTitle className="leading-snug">
{props.confirmationDialog.title}
@@ -7,7 +7,7 @@ export function FormFieldSetup(props: {
label: string;
errorMessage: React.ReactNode | undefined;
children: React.ReactNode;
tooltip: React.ReactNode | undefined;
tooltip?: React.ReactNode;
isRequired: boolean;
}) {
return (
@@ -4,25 +4,45 @@ import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import { ChevronDownIcon } from "lucide-react";
import { usePathname } from "next/navigation";
import { useState } from "react";
import { useMemo, useState } from "react";
import { cn } from "../../lib/utils";
import { NavLink } from "../ui/NavLink";
import type { SidebarLink } from "./Sidebar";
import {
RenderSidebarLinks,
type SidebarBaseLink,
type SidebarLink,
} from "./Sidebar";
export function MobileSidebar(props: {
links?: SidebarLink[];
links: SidebarLink[];
footer?: React.ReactNode;
trigger?: React.ReactNode;
triggerClassName?: string;
}) {
const [isOpen, setIsOpen] = useState(false);
const pathname = usePathname();
const activeLink = props.links?.find((link) => {
if (link.exactMatch) {
return link.href === pathname;
const activeLink = useMemo(() => {
function isActive(link: SidebarBaseLink) {
if (link.exactMatch) {
return link.href === pathname;
}
return pathname?.startsWith(link.href);
}
return pathname?.startsWith(link.href);
});
for (const link of props.links) {
if ("group" in link) {
for (const subLink of link.links) {
if (isActive(subLink)) {
return subLink;
}
}
} else {
if (isActive(link)) {
return link;
}
}
}
}, [props.links, pathname]);
const defaultTrigger = (
<Button
@@ -41,7 +61,7 @@ export function MobileSidebar(props: {
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogTrigger asChild>{props.trigger || defaultTrigger}</DialogTrigger>
<DialogContent
className="rounded-t-xl rounded-b-none p-4"
className="no-scrollbar max-h-[80vh] overflow-auto rounded-t-xl rounded-b-none p-4"
dialogCloseClassName="hidden"
onClick={(e) => {
if (e.target instanceof HTMLAnchorElement) {
@@ -49,23 +69,7 @@ export function MobileSidebar(props: {
}
}}
>
<div className="flex flex-col gap-2">
{props.links?.map((link) => {
return (
<Button size="sm" variant="ghost" asChild key={link.href}>
<NavLink
href={link.href}
className="!text-left flex h-auto justify-start gap-2 py-3"
activeClassName="bg-accent"
exactMatch={link.exactMatch}
tracking={link.tracking}
>
{link.label}
</NavLink>
</Button>
);
})}
</div>
<RenderSidebarLinks links={props.links} />
{props.footer}
</DialogContent>
</Dialog>
@@ -0,0 +1,145 @@
"use client";
import { MultiSelect } from "@/components/blocks/multi-select";
import { SelectWithSearch } from "@/components/blocks/select-with-search";
import { Badge } from "@/components/ui/badge";
import { useCallback, useMemo } from "react";
import { useAllChainsData } from "../../../hooks/chains/allChains";
function cleanChainName(chainName: string) {
return chainName.replace("Mainnet", "");
}
type Option = { label: string; value: string };
export function MultiNetworkSelector(props: {
selectedChainIds: number[];
onChange: (chainIds: number[]) => void;
}) {
const { allChains, idToChain } = useAllChainsData();
const options = useMemo(() => {
return allChains.map((chain) => {
return {
label: cleanChainName(chain.name),
value: String(chain.chainId),
};
});
}, [allChains]);
const searchFn = useCallback(
(option: Option, searchValue: string) => {
const chain = idToChain.get(Number(option.value));
if (!chain) {
return false;
}
if (Number.isInteger(Number.parseInt(searchValue))) {
return String(chain.chainId).startsWith(searchValue);
}
return chain.name.toLowerCase().includes(searchValue.toLowerCase());
},
[idToChain],
);
const renderOption = useCallback(
(option: Option) => {
const chain = idToChain.get(Number(option.value));
if (!chain) {
return option.label;
}
return (
<div className="flex justify-between gap-4">
<span className="grow truncate text-left">
{cleanChainName(chain.name)}
</span>
<Badge variant="outline" className="gap-2">
<span className="text-muted-foreground">Chain ID</span>
{chain.chainId}
</Badge>
</div>
);
},
[idToChain],
);
return (
<MultiSelect
searchPlaceholder="Search by Name or Chain Id"
selectedValues={props.selectedChainIds.map(String)}
options={options}
onSelectedValuesChange={(chainIds) => {
props.onChange(chainIds.map(Number));
}}
placeholder="Select Chains"
overrideSearchFn={searchFn}
renderOption={renderOption}
/>
);
}
export function SingleNetworkSelector(props: {
chainId: number | undefined;
onChange: (chainId: number) => void;
}) {
const { allChains, idToChain } = useAllChainsData();
const options = useMemo(() => {
return allChains.map((chain) => {
return {
label: chain.name,
value: String(chain.chainId),
};
});
}, [allChains]);
const searchFn = useCallback(
(option: Option, searchValue: string) => {
const chain = idToChain.get(Number(option.value));
if (!chain) {
return false;
}
if (Number.isInteger(Number.parseInt(searchValue))) {
return String(chain.chainId).startsWith(searchValue);
}
return chain.name.toLowerCase().includes(searchValue.toLowerCase());
},
[idToChain],
);
const renderOption = useCallback(
(option: Option) => {
const chain = idToChain.get(Number(option.value));
if (!chain) {
return option.label;
}
return (
<div className="flex justify-between gap-4">
<span className="grow truncate text-left">{chain.name}</span>
<Badge variant="outline" className="gap-2">
<span className="text-muted-foreground">Chain ID</span>
{chain.chainId}
</Badge>
</div>
);
},
[idToChain],
);
return (
<SelectWithSearch
searchPlaceholder="Search by Name or Chain Id"
value={String(props.chainId)}
options={options}
onValueChange={(chainId) => {
props.onChange(Number(chainId));
}}
placeholder="Select Chain"
overrideSearchFn={searchFn}
renderOption={renderOption}
/>
);
}
@@ -17,6 +17,15 @@ export function SettingsCard(
disabled: boolean;
isPending: boolean;
type?: "submit";
variant?:
| "ghost"
| "default"
| "primary"
| "destructive"
| "outline"
| "secondary";
className?: string;
label?: string;
};
}>,
) {
@@ -58,14 +67,15 @@ export function SettingsCard(
{props.saveButton && !props.noPermissionText && (
<Button
size="sm"
className="gap-2"
className={cn("gap-2", props.saveButton.className)}
onClick={props.saveButton.onClick}
disabled={props.saveButton.disabled || props.saveButton.isPending}
variant="outline"
variant={props.saveButton.variant || "outline"}
type={props.saveButton.type}
>
{props.saveButton.isPending && <Spinner className="size-3" />}
{props.saveButton.isPending ? "Saving" : "Save"}
{props.saveButton.label ||
(props.saveButton.isPending ? "Saving" : "Save")}
</Button>
)}
</div>
@@ -3,7 +3,7 @@ import type React from "react";
import { cn } from "../../lib/utils";
import { NavLink } from "../ui/NavLink";
export type SidebarLink = {
export type SidebarBaseLink = {
href: string;
label: React.ReactNode;
exactMatch?: boolean;
@@ -14,6 +14,13 @@ export type SidebarLink = {
};
};
export type SidebarLink =
| SidebarBaseLink
| {
group: string;
links: SidebarBaseLink[];
};
type SidebarContentProps = {
header?: React.ReactNode;
links: SidebarLink[];
@@ -28,26 +35,45 @@ export function Sidebar(props: SidebarContentProps) {
props.className,
)}
>
<div className="pt-7">
<div className="py-7">
{props.header}
<div className="flex flex-col gap-1">
{props.links?.map((link) => {
const isExternal = link.href.startsWith("http");
return (
<NavLink
key={link.href}
href={link.href}
className="flex items-center gap-2 rounded-md px-3 py-2 text-muted-foreground text-sm hover:bg-muted"
activeClassName="text-foreground"
exactMatch={link.exactMatch}
>
{link.label}
{isExternal && <ExternalLinkIcon className="size-3" />}
</NavLink>
);
})}
<RenderSidebarLinks links={props.links} />
</div>
</div>
</aside>
);
}
export function RenderSidebarLinks(props: { links: SidebarLink[] }) {
return (
<div className="flex flex-col gap-1">
{props.links.map((link, i) => {
if ("group" in link) {
return (
<div className={cn({ "mt-6": i !== 0 })}>
<p className={cn("px-3 py-2 font-medium text-foreground")}>
{link.group}
</p>
<RenderSidebarLinks links={link.links} />
</div>
);
}
const isExternal = link.href.startsWith("http");
return (
<NavLink
key={link.href}
href={link.href}
className="flex items-center gap-2 rounded-md px-3 py-2 text-muted-foreground text-sm hover:bg-muted"
activeClassName="text-foreground"
exactMatch={link.exactMatch}
>
{link.label}
{isExternal && <ExternalLinkIcon className="size-3" />}
</NavLink>
);
})}
</div>
);
}
@@ -1,17 +1,15 @@
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { ThirdwebMiniLogo } from "app/components/ThirdwebMiniLogo";
import { DiscordIcon } from "components/icons/brand-icons/DiscordIcon";
import { GithubIcon } from "components/icons/brand-icons/GithubIcon";
import { InstagramIcon } from "components/icons/brand-icons/InstagramIcon";
import { LinkedInIcon } from "components/icons/brand-icons/LinkedinIcon";
import { RedditIcon } from "components/icons/brand-icons/RedditIcon";
import { TiktokIcon } from "components/icons/brand-icons/TiktokIcon";
import { XIcon } from "components/icons/brand-icons/XIcon";
import { YoutubeIcon } from "components/icons/brand-icons/YoutubeIcon";
import Link from "next/link";
import {
SiDiscord,
SiGithub,
SiInstagram,
SiLinkedin,
SiReddit,
SiTiktok,
SiX,
SiYoutube,
} from "react-icons/si";
type AppFooterProps = {
className?: string;
@@ -35,17 +33,17 @@ export function AppFooter(props: AppFooterProps) {
<div className="flex flex-row gap-3">
<Button size="icon" variant="ghost" asChild className="size-9">
<Link href="https://github.com/thirdweb-dev" target="_blank">
<SiGithub className="size-5 text-muted-foreground" />
<GithubIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
<Button size="icon" variant="ghost" asChild className="size-9">
<Link href="https://www.tiktok.com/@thirdweb" target="_blank">
<SiTiktok className="size-5 text-muted-foreground" />
<TiktokIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
<Button size="icon" variant="ghost" asChild className="size-9">
<Link href="https://www.instagram.com/thirdweb/" target="_blank">
<SiInstagram className="size-5 text-muted-foreground" />
<InstagramIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
<Button size="icon" variant="ghost" asChild className="size-9">
@@ -53,27 +51,27 @@ export function AppFooter(props: AppFooterProps) {
href="hhttps://www.linkedin.com/company/third-web/"
target="_blank"
>
<SiLinkedin className="size-5 text-muted-foreground" />
<LinkedInIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
<Button size="icon" variant="ghost" asChild className="size-9">
<Link href="https://www.youtube.com/@thirdweb_" target="_blank">
<SiYoutube className="size-5 text-muted-foreground" />
<YoutubeIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
<Button size="icon" variant="ghost" asChild className="size-9">
<Link href="https://discord.gg/thirdweb" target="_blank">
<SiDiscord className="size-5 text-muted-foreground" />
<DiscordIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
<Button size="icon" variant="ghost" asChild className="size-9">
<Link href="https://www.reddit.com/r/thirdweb/" target="_blank">
<SiReddit className="size-5 text-muted-foreground" />
<RedditIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
<Button size="icon" variant="ghost" asChild className="size-9">
<Link href="https://x.com/thirdweb" target="_blank">
<SiX className="size-5 text-muted-foreground" />
<XIcon className="size-5 text-muted-foreground" />
</Link>
</Button>
</div>
@@ -1,14 +1,5 @@
"use client";
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import {
type ChartConfig,
ChartContainer,
@@ -18,11 +9,9 @@ import {
ChartTooltipContent,
} from "@/components/ui/chart";
import { useMemo } from "react";
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts";
type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
// metadata
title: string;
description?: string;
// chart config
config: TConfig;
data: Array<Record<keyof TConfig, number> & { time: number | string | Date }>;
@@ -37,73 +26,65 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
) {
const configKeys = useMemo(() => Object.keys(props.config), [props.config]);
return (
<Card>
<CardHeader>
<CardTitle>{props.title}</CardTitle>
{props.description && (
<CardDescription>{props.description}</CardDescription>
)}
</CardHeader>
<CardContent>
<ChartContainer config={props.config} className={props.chartClassName}>
<AreaChart
accessibilityLayer
data={props.data}
margin={{
left: 12,
right: 12,
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey="time"
tickLine={false}
axisLine={false}
tickMargin={8}
tickFormatter={(value) => new Date(value).toLocaleDateString()}
/>
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
<defs>
{configKeys.map((key) => (
<linearGradient
key={key}
id={`fill_${key}`}
x1="0"
y1="0"
x2="0"
y2="1"
>
<stop
offset="5%"
stopColor={`var(--color-${key})`}
stopOpacity={0.8}
/>
<stop
offset="95%"
stopColor={`var(--color-${key})`}
stopOpacity={0.1}
/>
</linearGradient>
))}
</defs>
<div className="rounded-lg border border-border bg-muted/50 px-4 pt-10 pb-4">
<ChartContainer config={props.config} className={props.chartClassName}>
<AreaChart
accessibilityLayer
data={props.data}
margin={{
left: 12,
right: 12,
}}
>
<CartesianGrid vertical={false} />
<XAxis
dataKey="time"
tickLine={false}
axisLine={false}
tickMargin={20}
tickFormatter={(value) => new Date(value).toLocaleDateString()}
/>
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
<defs>
{configKeys.map((key) => (
<Area
<linearGradient
key={key}
dataKey={key}
type="natural"
fill={`url(#fill_${key})`}
fillOpacity={0.4}
stroke={`var(--color-${key})`}
stackId="a"
/>
id={`fill_${key}`}
x1="0"
y1="0"
x2="0"
y2="1"
>
<stop
offset="5%"
stopColor={`var(--color-${key})`}
stopOpacity={0.8}
/>
<stop
offset="95%"
stopColor={`var(--color-${key})`}
stopOpacity={0.1}
/>
</linearGradient>
))}
</defs>
{configKeys.map((key) => (
<Area
key={key}
dataKey={key}
type="natural"
fill={`url(#fill_${key})`}
fillOpacity={0.4}
stroke={`var(--color-${key})`}
stackId="a"
/>
))}
{props.showLegend && (
<ChartLegend content={<ChartLegendContent />} />
)}
</AreaChart>
</ChartContainer>
</CardContent>
</Card>
{props.showLegend && (
<ChartLegend content={<ChartLegendContent />} className="pt-8" />
)}
</AreaChart>
</ChartContainer>
</div>
);
}
@@ -1,3 +1,4 @@
/* eslint-disable no-restricted-syntax */
"use client";
import { Button } from "@/components/ui/button";
@@ -9,7 +10,14 @@ import {
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils";
import { CheckIcon, ChevronDown, SearchIcon, XIcon } from "lucide-react";
import * as React from "react";
import {
forwardRef,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { useShowMore } from "../../lib/useShowMore";
import { ScrollShadow } from "../ui/ScrollShadow/ScrollShadow";
import { Input } from "../ui/input";
@@ -24,6 +32,7 @@ interface MultiSelectProps
selectedValues: string[];
onSelectedValuesChange: (value: string[]) => void;
placeholder: string;
searchPlaceholder?: string;
/**
* Maximum number of items to display. Extra selected items will be summarized.
@@ -32,12 +41,16 @@ interface MultiSelectProps
maxCount?: number;
className?: string;
overrideSearchFn?: (
option: { value: string; label: string },
searchTerm: string,
) => boolean;
renderOption?: (option: { value: string; label: string }) => React.ReactNode;
}
export const MultiSelect = React.forwardRef<
HTMLButtonElement,
MultiSelectProps
>(
export const MultiSelect = forwardRef<HTMLButtonElement, MultiSelectProps>(
(
{
options,
@@ -50,10 +63,10 @@ export const MultiSelect = React.forwardRef<
},
ref,
) => {
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
const [searchValue, setSearchValue] = React.useState("");
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const [searchValue, setSearchValue] = useState("");
const handleInputKeyDown = React.useCallback(
const handleInputKeyDown = useCallback(
(event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === "Enter") {
setIsPopoverOpen(true);
@@ -66,7 +79,7 @@ export const MultiSelect = React.forwardRef<
[selectedValues, onSelectedValuesChange],
);
const toggleOption = React.useCallback(
const toggleOption = useCallback(
(option: string) => {
const newSelectedValues = selectedValues.includes(option)
? selectedValues.filter((value) => value !== option)
@@ -76,7 +89,7 @@ export const MultiSelect = React.forwardRef<
[selectedValues, onSelectedValuesChange],
);
const handleClear = React.useCallback(() => {
const handleClear = useCallback(() => {
onSelectedValuesChange([]);
}, [onSelectedValuesChange]);
@@ -84,7 +97,7 @@ export const MultiSelect = React.forwardRef<
setIsPopoverOpen((prev) => !prev);
};
const clearExtraOptions = React.useCallback(() => {
const clearExtraOptions = useCallback(() => {
const newSelectedValues = selectedValues.slice(0, maxCount);
onSelectedValuesChange(newSelectedValues);
}, [selectedValues, onSelectedValuesChange, maxCount]);
@@ -92,14 +105,46 @@ export const MultiSelect = React.forwardRef<
// show 50 initially and then 20 more when reaching the end
const { itemsToShow, lastItemRef } = useShowMore<HTMLButtonElement>(50, 20);
const optionsToShow = React.useMemo(() => {
const searchValLowercase = searchValue.toLowerCase();
const filteredOptions = options.filter((option) => {
return option.label.toLowerCase().includes(searchValLowercase);
});
const { overrideSearchFn } = props;
return filteredOptions.slice(0, itemsToShow);
}, [options, searchValue, itemsToShow]);
const optionsToShow = useMemo(() => {
const filteredOptions: {
label: string;
value: string;
}[] = [];
const searchValLowercase = searchValue.toLowerCase();
for (let i = 0; i <= options.length - 1; i++) {
if (filteredOptions.length >= itemsToShow) {
break;
}
if (overrideSearchFn) {
if (overrideSearchFn(options[i], searchValLowercase)) {
filteredOptions.push(options[i]);
}
} else {
if (options[i].label.toLowerCase().includes(searchValLowercase)) {
filteredOptions.push(options[i]);
}
}
}
return filteredOptions;
}, [options, searchValue, itemsToShow, overrideSearchFn]);
// scroll to top when options change
const popoverElRef = useRef<HTMLDivElement>(null);
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
const scrollContainer =
popoverElRef.current?.querySelector("[data-scrollable]");
if (scrollContainer) {
scrollContainer.scrollTo({
top: 0,
});
}
}, [searchValue]);
return (
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
@@ -109,7 +154,7 @@ export const MultiSelect = React.forwardRef<
{...props}
onClick={handleTogglePopover}
className={cn(
"flex h-auto min-h-10 w-full items-center justify-between rounded-md border bg-inherit p-3 hover:bg-inherit",
"flex h-auto min-h-10 w-full items-center justify-between rounded-md border border-border bg-inherit p-3 hover:bg-inherit",
className,
)}
>
@@ -119,10 +164,14 @@ export const MultiSelect = React.forwardRef<
<div className="flex flex-wrap items-center gap-1.5">
{selectedValues.slice(0, maxCount).map((value) => {
const option = options.find((o) => o.value === value);
if (!option) {
return null;
}
return (
<ClosableBadge
key={value}
label={option?.label || ""}
label={option.label}
onClose={() => toggleOption(value)}
/>
);
@@ -170,7 +219,7 @@ export const MultiSelect = React.forwardRef<
</Button>
</PopoverTrigger>
<PopoverContent
className="p-0"
className="z-[10001] p-0"
align="center"
sideOffset={10}
onEscapeKeyDown={() => setIsPopoverOpen(false)}
@@ -178,12 +227,13 @@ export const MultiSelect = React.forwardRef<
width: "var(--radix-popover-trigger-width)",
maxHeight: "var(--radix-popover-content-available-height)",
}}
ref={popoverElRef}
>
<div>
{/* Search */}
<div className="relative">
<Input
placeholder="Search"
placeholder={props.searchPlaceholder || "Search"}
value={searchValue}
onChange={(e) => setSearchValue(e.target.value)}
className="!h-auto rounded-b-none border-0 border-border border-b py-4 pl-10 focus-visible:ring-0 focus-visible:ring-offset-0"
@@ -193,7 +243,7 @@ export const MultiSelect = React.forwardRef<
</div>
<ScrollShadow
scrollableClassName="max-h-[350px] p-1"
scrollableClassName="max-h-[min(calc(var(--radix-popover-content-available-height)-60px),350px)] p-1"
className="rounded"
>
{/* List */}
@@ -213,7 +263,7 @@ export const MultiSelect = React.forwardRef<
aria-selected={isSelected}
onClick={() => toggleOption(option.value)}
variant="ghost"
className="flex w-full cursor-pointer justify-start gap-3 rounded-sm px-3 py-2"
className="flex w-full cursor-pointer justify-start gap-3 rounded-sm px-3 py-2 text-left"
ref={
i === optionsToShow.length - 1 ? lastItemRef : undefined
}
@@ -229,7 +279,11 @@ export const MultiSelect = React.forwardRef<
<CheckIcon className="size-4" />
</div>
<span>{option.label}</span>
<div className="min-w-0 grow">
{props.renderOption
? props.renderOption(option)
: option.label}
</div>
</Button>
);
})}
@@ -0,0 +1,69 @@
import type { Meta, StoryObj } from "@storybook/react";
import { useMemo, useState } from "react";
import { BadgeContainer, mobileViewport } from "../../../stories/utils";
import { SelectWithSearch } from "./select-with-search";
const meta = {
title: "blocks/SelectWithSearch",
component: Story,
parameters: {
nextjs: {
appDirectory: true,
},
},
} satisfies Meta<typeof Story>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Desktop: Story = {
args: {},
};
export const Mobile: Story = {
args: {},
parameters: {
viewport: mobileViewport("iphone14"),
},
};
function createList(len: number) {
return Array.from({ length: len }, (_, i) => ({
value: `${i}`,
label: `Item ${i}`,
}));
}
function Story() {
return (
<div className="mx-auto flex w-full max-w-[600px] flex-col gap-6 px-4 py-6">
<VariantTest storyLabel="5 items" listLen={5} />
<VariantTest storyLabel="5000 items" listLen={5000} />
<VariantTest
defaultValue={"3"}
storyLabel="20 items, 3 selected by default"
listLen={20}
/>
</div>
);
}
function VariantTest(props: {
defaultValue?: string;
storyLabel: string;
listLen: number;
}) {
const list = useMemo(() => createList(props.listLen), [props.listLen]);
const [value, setValue] = useState<string | undefined>(props.defaultValue);
return (
<BadgeContainer label={props.storyLabel}>
<SelectWithSearch
value={value}
options={list}
onValueChange={setValue}
placeholder="Select items"
/>
</BadgeContainer>
);
}
@@ -0,0 +1,190 @@
/* eslint-disable no-restricted-syntax */
"use client";
import { Button } from "@/components/ui/button";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { cn } from "@/lib/utils";
import { CheckIcon, ChevronDown, SearchIcon } from "lucide-react";
import React, { useRef, useMemo, useEffect } from "react";
import { useShowMore } from "../../lib/useShowMore";
import { ScrollShadow } from "../ui/ScrollShadow/ScrollShadow";
import { Input } from "../ui/input";
interface SelectWithSearchProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
options: {
label: string;
value: string;
}[];
value: string | undefined;
onValueChange: (value: string) => void;
placeholder: string;
searchPlaceholder?: string;
className?: string;
overrideSearchFn?: (
option: { value: string; label: string },
searchTerm: string,
) => boolean;
renderOption?: (option: { value: string; label: string }) => React.ReactNode;
}
export const SelectWithSearch = React.forwardRef<
HTMLButtonElement,
SelectWithSearchProps
>(
(
{ options, onValueChange, placeholder, className, value, ...props },
ref,
) => {
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
const [searchValue, setSearchValue] = React.useState("");
const selectedOption = useMemo(
() => options.find((option) => option.value === value),
[options, value],
);
// show 50 initially and then 20 more when reaching the end
const { itemsToShow, lastItemRef } = useShowMore<HTMLButtonElement>(50, 20);
const { overrideSearchFn } = props;
const optionsToShow = useMemo(() => {
const filteredOptions: {
label: string;
value: string;
}[] = [];
const searchValLowercase = searchValue.toLowerCase();
for (let i = 0; i <= options.length - 1; i++) {
if (filteredOptions.length >= itemsToShow) {
break;
}
if (overrideSearchFn) {
if (overrideSearchFn(options[i], searchValLowercase)) {
filteredOptions.push(options[i]);
}
} else {
if (options[i].label.toLowerCase().includes(searchValLowercase)) {
filteredOptions.push(options[i]);
}
}
}
return filteredOptions;
}, [options, searchValue, itemsToShow, overrideSearchFn]);
// scroll to top when options change
const popoverElRef = useRef<HTMLDivElement>(null);
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
const scrollContainer =
popoverElRef.current?.querySelector("[data-scrollable]");
if (scrollContainer) {
scrollContainer.scrollTo({
top: 0,
});
}
}, [searchValue]);
return (
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
<PopoverTrigger asChild>
<Button
ref={ref}
{...props}
onClick={() => setIsPopoverOpen(true)}
className={cn(
"flex w-full items-center justify-between rounded-md border border-border bg-inherit p-3 hover:bg-inherit",
className,
)}
>
<div className="flex w-full items-center justify-between">
<span
className={cn(
"text-muted-foreground text-sm",
selectedOption && "text-foreground",
)}
>
{selectedOption?.label || placeholder}
</span>
<ChevronDown className="h-4 cursor-pointer text-muted-foreground" />
</div>
</Button>
</PopoverTrigger>
<PopoverContent
className="z-[10001] p-0"
align="center"
sideOffset={10}
onEscapeKeyDown={() => setIsPopoverOpen(false)}
style={{
width: "var(--radix-popover-trigger-width)",
maxHeight: "var(--radix-popover-content-available-height)",
}}
ref={popoverElRef}
>
<div>
{/* Search */}
<div className="relative">
<Input
placeholder={props.searchPlaceholder || "Search"}
value={searchValue}
onChange={(e) => setSearchValue(e.target.value)}
className="!h-auto rounded-b-none border-0 border-border border-b py-3 pl-10 focus-visible:ring-0 focus-visible:ring-offset-0"
/>
<SearchIcon className="-translate-y-1/2 absolute top-1/2 left-4 size-4 text-muted-foreground" />
</div>
<ScrollShadow
scrollableClassName="max-h-[min(calc(var(--radix-popover-content-available-height)-60px),350px)] p-1"
className="rounded"
>
{/* List */}
<div>
{optionsToShow.length === 0 && (
<div className="flex justify-center py-10">
No results found
</div>
)}
{optionsToShow.map((option, i) => {
const isSelected = value === option.value;
return (
<Button
key={option.value}
role="option"
aria-selected={isSelected}
onClick={() => onValueChange(option.value)}
variant="ghost"
className="flex w-full cursor-pointer justify-start gap-3 rounded-sm px-3 py-2 text-left"
ref={
i === optionsToShow.length - 1 ? lastItemRef : undefined
}
>
<div className="flex size-4 items-center justify-center">
{isSelected && <CheckIcon className="size-4" />}
</div>
<div className="min-w-0 grow">
{props.renderOption
? props.renderOption(option)
: option.label}
</div>
</Button>
);
})}
</div>
</ScrollShadow>
</div>
</PopoverContent>
</Popover>
);
},
);
SelectWithSearch.displayName = "SelectWithSearch";
@@ -125,6 +125,7 @@ export function ScrollShadow(props: {
<div
className={cn("no-scrollbar overflow-auto", props.scrollableClassName)}
ref={scrollableEl}
data-scrollable
>
{props.children}
</div>
@@ -0,0 +1,17 @@
import { cn } from "@/lib/utils";
export function InlineCode({
code,
className,
}: { code: string; className?: string }) {
return (
<code
className={cn(
"inline-block rounded bg-muted px-2 font-mono text-sm",
className,
)}
>
{code}
</code>
);
}
@@ -0,0 +1,72 @@
"use client";
import { OTPInput, OTPInputContext } from "input-otp";
import { Dot } from "lucide-react";
import * as React from "react";
import { cn } from "@/lib/utils";
const InputOTP = React.forwardRef<
React.ElementRef<typeof OTPInput>,
React.ComponentPropsWithoutRef<typeof OTPInput>
>(({ className, containerClassName, ...props }, ref) => (
<OTPInput
ref={ref}
containerClassName={cn(
"flex items-center gap-2 has-[:disabled]:opacity-50",
containerClassName,
)}
className={cn("disabled:cursor-not-allowed", className)}
{...props}
/>
));
InputOTP.displayName = "InputOTP";
const InputOTPGroup = React.forwardRef<
React.ElementRef<"div">,
React.ComponentPropsWithoutRef<"div">
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("flex items-center", className)} {...props} />
));
InputOTPGroup.displayName = "InputOTPGroup";
const InputOTPSlot = React.forwardRef<
React.ElementRef<"div">,
React.ComponentPropsWithoutRef<"div"> & { index: number }
>(({ index, className, ...props }, ref) => {
const inputOTPContext = React.useContext(OTPInputContext);
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
return (
<div
ref={ref}
className={cn(
"relative flex h-10 w-10 items-center justify-center border-input border-y border-r text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
isActive && "z-10 ring-2 ring-ring ring-offset-background",
className,
)}
{...props}
>
{char}
{hasFakeCaret && (
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
<div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
</div>
)}
</div>
);
});
InputOTPSlot.displayName = "InputOTPSlot";
const InputOTPSeparator = React.forwardRef<
React.ElementRef<"div">,
React.ComponentPropsWithoutRef<"div">
>(({ ...props }, ref) => (
// biome-ignore lint/a11y/useFocusableInteractive: <explanation>
<div ref={ref} role="separator" {...props}>
<Dot />
</div>
));
InputOTPSeparator.displayName = "InputOTPSeparator";
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
+1 -1
View File
@@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input
type={type}
className={cn(
"flex h-10 w-full rounded-md border border-input bg-card px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:font-medium file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
"flex h-10 w-full rounded-md border border-input bg-card px-3 py-2 text-sm ring-offset-background selection:bg-foreground selection:text-background file:border-0 file:bg-transparent file:font-medium file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
ref={ref}
+2 -6
View File
@@ -159,12 +159,8 @@ function useUnderline<El extends HTMLElement>() {
setTimeout(() => {
lineEl.style.transition = "transform 0.3s, width 0.3s";
}, 0);
activeTabEl.scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "center",
});
} else if (lineRef.current) {
lineRef.current.style.width = "0px";
}
}
+3
View File
@@ -20,3 +20,6 @@ export const PROD_OR_DEV_URL = isProd ? "thirdweb.com" : "thirdweb-dev.com";
export const DASHBOARD_STORAGE_URL =
process.env.NEXT_PUBLIC_DASHBOARD_UPLOAD_SERVER ||
"https://storage.thirdweb.com";
export const API_SERVER_URL =
process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com";
+2
View File
@@ -1,3 +1,5 @@
"use client";
import { useSyncExternalStore } from "react";
export type Store<T> = {
-5
View File
@@ -40,8 +40,6 @@
/* Others */
--radius: 0.5rem;
--chart-lightness: 50%;
--chart-saturation: 50%;
}
.dark,
@@ -78,9 +76,6 @@
--border: 0 0% 15%;
--ring: 0 0% 30%;
--input: 0 0% 15%;
--chart-lightness: 50%;
--chart-saturation: 50%;
}
}
@@ -0,0 +1,3 @@
# DO NOT ADD NEW THINGS INSIDE THIS FOLDER OR SUB_FOLDERS
This part of the dashboard is deprecated, and we are actively working on removing it. Please do not add new things here. If you need to add new things, please add them to the appropriate folder in the src folder.
@@ -1,9 +1,3 @@
export const networkKeys = {
all: ["network"] as const,
chain: (chainId?: number) => [...networkKeys.all, chainId] as const,
multiChainRegistry: ["multi-chain-registry"] as const,
};
export const accountKeys = {
all: ["account"] as const,
wallet: (walletAddress: string) =>
@@ -1,98 +0,0 @@
import { networkKeys, useDashboardEVMChainId } from "@3rdweb-sdk/react";
import {
type MutationFunction,
type QueryFunction,
type QueryKey,
type UseMutationOptions,
type UseQueryOptions,
type UseQueryResult,
useMutation,
useQuery,
useQueryClient,
} from "@tanstack/react-query";
import { useCallback } from "react";
export function useQueryWithNetwork<
TQueryFnData = unknown,
TError = unknown,
TData = TQueryFnData,
TQueryKey extends QueryKey = QueryKey,
>(
queryKey: TQueryKey,
queryFn: QueryFunction<TQueryFnData, TQueryKey>,
options?: Omit<
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
"queryKey" | "queryFn"
>,
): UseQueryResult<TData, TError> {
const activeChainId = useDashboardEVMChainId();
const mergedOptions: Omit<
UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
"queryKey" | "queryFn"
> = {
...options,
enabled: !!(activeChainId && options?.enabled),
};
const combinedQueryKey = (
networkKeys.chain(activeChainId) as readonly unknown[]
).concat(queryKey) as unknown as TQueryKey;
return useQuery({
...mergedOptions,
queryKey: combinedQueryKey,
queryFn,
});
}
export function useMutationWithInvalidate<
TData = unknown,
TError = unknown,
TVariables = void,
TContext = unknown,
TQueryKey extends QueryKey = QueryKey,
>(
mutationFn: MutationFunction<TData, TVariables>,
options?: Omit<
UseMutationOptions<TData, TError, TVariables, TContext>,
"mutationFn" | "onSuccess"
> & {
onSuccess?: (
data: TData,
variables: TVariables,
context: TContext | undefined,
wrapCacheKeys: (
cacheKeysToInvalidate: TQueryKey[],
// biome-ignore lint/suspicious/noConfusingVoidType: FIX ME
) => Promise<void[]>,
) => Promise<unknown> | undefined;
},
) {
const activeChainId = useDashboardEVMChainId();
const queryClient = useQueryClient();
const invalidate = useCallback(
(cacheKeysToInvalidate: TQueryKey[]) => {
return Promise.all(
cacheKeysToInvalidate.map((cacheKey) => {
return queryClient.invalidateQueries({
queryKey: (
networkKeys.chain(activeChainId) as readonly unknown[]
).concat(cacheKey) as unknown[],
});
}),
);
},
[queryClient, activeChainId],
);
return useMutation({
...options,
mutationFn,
onSuccess: (...args) => {
if (options?.onSuccess) {
options.onSuccess(...args, invalidate);
}
},
});
}
@@ -1,12 +1,4 @@
import {
createContext,
useCallback,
useContext,
useEffect,
useState,
} from "react";
import type { ChainMetadata } from "thirdweb/chains";
import invariant from "tiny-invariant";
export type EVMContractInfo = {
// using null instead of undefined here so that this type can be JSON stringified
@@ -14,78 +6,3 @@ export type EVMContractInfo = {
chainSlug: string;
contractAddress: string;
};
type SetEVMContractInfo = (info: EVMContractInfo) => void;
// Legacy: will be removed with contract page -> app router refactor
// eslint-disable-next-line no-restricted-syntax
const EVMContractInfoContext = createContext<EVMContractInfo | undefined>(
undefined,
);
// Legacy: will be removed with contract page -> app router refactor
// eslint-disable-next-line no-restricted-syntax
const SetEVMContractInfoContext = createContext<SetEVMContractInfo | undefined>(
undefined,
);
// TODO let's move this out of here eventually
export function EVMContractInfoProvider(props: {
children: React.ReactNode;
value?: EVMContractInfo;
}) {
const [value, setValue] = useState<EVMContractInfo | undefined>(props.value);
// keep the state in sync with the props.value
// this is required when route changes and page goes from fallback to actual page
const _setValue = useCallback((info?: EVMContractInfo) => {
setValue((prevValue) => {
if (
prevValue?.chainSlug === info?.chainSlug &&
prevValue?.contractAddress === info?.contractAddress &&
info?.chain === null
) {
return prevValue;
}
return info;
});
}, []);
// no better way right now - this whole file is going away with RSC migration
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
_setValue(props.value);
}, [_setValue, props.value]);
// when we move from rendering the fallback page to the actual page, props.value is correct value but state lags behind with undefined value
// in that case we use the props.value instead of providing undefined and update the state with effect afterwards
// this only happens ONCE, when the page is not yet created on server. once it is created and cached. value will always be defined
const providedValue = value || props.value;
return (
<EVMContractInfoContext.Provider value={providedValue}>
<SetEVMContractInfoContext.Provider value={_setValue}>
{props.children}
</SetEVMContractInfoContext.Provider>
</EVMContractInfoContext.Provider>
);
}
export function useEVMContractInfo() {
return useContext(EVMContractInfoContext);
}
export function useSetEVMContractInfo() {
const setter = useContext(SetEVMContractInfoContext);
invariant(
setter,
"useSetEVMContractInfo must be used inside EVMContractInfoProvider",
);
return setter;
}
// for EVM - get network info from context
export function useDashboardEVMChainId() {
const contractInfo = useEVMContractInfo();
return contractInfo?.chain?.chainId;
}
@@ -7,7 +7,6 @@ import {
import { THIRDWEB_ANALYTICS_API_HOST, THIRDWEB_API_HOST } from "constants/urls";
import invariant from "tiny-invariant";
import { accountKeys, apiKeys, authorizedWallets } from "../cache-keys";
import { useMutationWithInvalidate } from "./query/useQueryWithNetwork";
import { useLoggedInUser } from "./useLoggedInUser";
// FIXME: We keep repeating types, API server should provide them
@@ -67,6 +66,7 @@ export type Account = {
paymentFailureCode: string;
serviceCutoffDate: string;
}[];
// TODO - add image URL
};
interface UpdateAccountInput {
@@ -478,8 +478,8 @@ export function useUpdateAccountPlan(waitForWebhook?: boolean) {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: { plan: string; feedback?: string }) => {
return useMutation({
mutationFn: async (input: { plan: string; feedback?: string }) => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/plan`, {
@@ -505,27 +505,26 @@ export function useUpdateAccountPlan(waitForWebhook?: boolean) {
return json.data;
},
{
onSuccess: async () => {
onSuccess: async () => {
return Promise.all([
// invalidate usage data as limits are different
await queryClient.invalidateQueries({
queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
});
return queryClient.invalidateQueries({
}),
queryClient.invalidateQueries({
queryKey: accountKeys.usage(user?.address as string),
});
},
}),
]);
},
);
});
}
export function useUpdateNotifications() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: UpdateAccountNotificationsInput) => {
return useMutation({
mutationFn: async (input: UpdateAccountNotificationsInput) => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/notifications`, {
@@ -544,14 +543,12 @@ export function useUpdateNotifications() {
return json.data;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
});
},
);
});
}
export function useCreateBillingSession(enabled = false) {
@@ -588,8 +585,8 @@ export function useConfirmEmail() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: ConfirmEmailInput) => {
return useMutation({
mutationFn: async (input: ConfirmEmailInput) => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/confirmEmail`, {
@@ -608,31 +605,29 @@ export function useConfirmEmail() {
return json.data;
},
{
onSuccess: async () => {
// invalidate related cache, since could be relinking account
return Promise.all([
queryClient.invalidateQueries({
queryKey: apiKeys.keys(user?.address as string),
}),
queryClient.invalidateQueries({
queryKey: accountKeys.usage(user?.address as string),
}),
queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
}),
]);
},
onSuccess: async () => {
// invalidate related cache, since could be relinking account
return Promise.all([
queryClient.invalidateQueries({
queryKey: apiKeys.keys(user?.address as string),
}),
queryClient.invalidateQueries({
queryKey: accountKeys.usage(user?.address as string),
}),
queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
}),
]);
},
);
});
}
export function useResendEmailConfirmation() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async () => {
return useMutation({
mutationFn: async () => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(
@@ -654,22 +649,20 @@ export function useResendEmailConfirmation() {
return json.data;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
});
},
);
});
}
export function useCreatePaymentMethod() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (paymentMethodId: string) => {
return useMutation({
mutationFn: async (paymentMethodId: string) => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/paymentMethod`, {
@@ -690,14 +683,12 @@ export function useCreatePaymentMethod() {
return json.data;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: accountKeys.me(user?.address as string),
});
},
);
});
}
export function useApiKeys() {
@@ -760,8 +751,8 @@ export function useUpdateApiKey() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: UpdateKeyInput) => {
return useMutation({
mutationFn: async (input: UpdateKeyInput) => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/keys/${input.id}`, {
@@ -781,22 +772,20 @@ export function useUpdateApiKey() {
return json.data;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: apiKeys.keys(user?.address as string),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: apiKeys.keys(user?.address as string),
});
},
);
});
}
export function useRevokeApiKey() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (id: string) => {
return useMutation({
mutationFn: async (id: string) => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/keys/${id}/revoke`, {
@@ -815,14 +804,12 @@ export function useRevokeApiKey() {
return json.data;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: apiKeys.keys(user?.address as string),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: apiKeys.keys(user?.address as string),
});
},
);
});
}
export const usePolicies = (serviceId?: string) => {
@@ -851,8 +838,11 @@ export const usePolicies = (serviceId?: string) => {
export const useUpdatePolicies = () => {
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: { serviceId: string; data: ApiKeyServicePolicy }) => {
return useMutation({
mutationFn: async (input: {
serviceId: string;
data: ApiKeyServicePolicy;
}) => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/policies`, {
method: "POST",
@@ -870,22 +860,20 @@ export const useUpdatePolicies = () => {
}
return json.data as ApiKeyServicePolicy;
},
{
onSuccess: (_, variables) => {
return queryClient.invalidateQueries({
queryKey: ["policies", variables.serviceId],
});
},
onSuccess: (_, variables) => {
return queryClient.invalidateQueries({
queryKey: ["policies", variables.serviceId],
});
},
);
});
};
export function useRevokeAuthorizedWallet() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (variables: { authorizedWalletId: string }) => {
return useMutation({
mutationFn: async (variables: { authorizedWalletId: string }) => {
invariant(user?.address, "walletAddress is required");
const { authorizedWalletId } = variables;
@@ -909,16 +897,12 @@ export function useRevokeAuthorizedWallet() {
return json.data;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: authorizedWallets.authorizedWallets(
user?.address as string,
),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: authorizedWallets.authorizedWallets(user?.address as string),
});
},
);
});
}
export function useAuthorizedWallets() {
@@ -14,41 +14,52 @@ import { getContractMetadata, name, symbol } from "thirdweb/extensions/common";
export function useDashboardContractMetadata(contract: ThirdwebContract) {
return useQuery({
queryKey: ["contract-metadata-header", contract.chain.id, contract.address],
queryFn: async () => {
const [contractMetadata, _name, _symbol, compilerMetadata] =
await Promise.all([
getContractMetadata({ contract }).catch(() => ({
image: "",
name: "",
symbol: "",
})),
name({ contract }).catch(() => ""),
symbol({ contract }).catch(() => ""),
getCompilerMetadata(contract).catch(() => undefined),
]);
/**
* Handle the case where the contract.thirdweb.com endpoint returns a very long name
* example url: https://contract.thirdweb.com/metadata/324/0x66E298335c5992d599132582De8eaAF75348e6e6
* In that case, we split the solidity name on ":" and take the second part
*/
if (compilerMetadata?.name.includes(":")) {
const _name = compilerMetadata.name.split(":")[1];
if (_name) {
compilerMetadata.name = compilerMetadata.name.split(":")[1];
}
}
const contractName =
contractMetadata?.name || _name || compilerMetadata?.name || "";
const contractSymbol = contractMetadata?.symbol || _symbol || "";
return {
name: contractName,
symbol: contractSymbol,
image: contractMetadata.image || "",
contractType: compilerMetadata?.name || "",
};
},
queryFn: () => fetchDashboardContractMetadata(contract),
});
}
type DashboardContractMetadata = {
name: string;
symbol: string;
image: string;
contractType: string;
};
export async function fetchDashboardContractMetadata(
contract: ThirdwebContract,
): Promise<DashboardContractMetadata> {
const [contractMetadata, _name, _symbol, compilerMetadata] =
await Promise.all([
getContractMetadata({ contract }).catch(() => ({
image: "",
name: "",
symbol: "",
})),
name({ contract }).catch(() => ""),
symbol({ contract }).catch(() => ""),
getCompilerMetadata(contract).catch(() => undefined),
]);
/**
* Handle the case where the contract.thirdweb.com endpoint returns a very long name
* example url: https://contract.thirdweb.com/metadata/324/0x66E298335c5992d599132582De8eaAF75348e6e6
* In that case, we split the solidity name on ":" and take the second part
*/
if (compilerMetadata?.name.includes(":")) {
const _name = compilerMetadata.name.split(":")[1];
if (_name) {
compilerMetadata.name = compilerMetadata.name.split(":")[1];
}
}
const contractName =
contractMetadata?.name || _name || compilerMetadata?.name || "";
const contractSymbol = contractMetadata?.symbol || _symbol || "";
return {
name: contractName,
symbol: contractSymbol,
image: contractMetadata.image || "",
contractType: compilerMetadata?.name || "",
};
}
@@ -1,11 +1,13 @@
"use client";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import type { ResultItem } from "components/engine/system-metrics/components/StatusCodes";
import { THIRDWEB_API_HOST } from "constants/urls";
import type { EngineBackendWalletType } from "lib/engine";
import { useState } from "react";
import { useActiveAccount, useActiveWalletChain } from "thirdweb/react";
import invariant from "tiny-invariant";
import { engineKeys } from "../cache-keys";
import { useMutationWithInvalidate } from "./query/useQueryWithNetwork";
import { useLoggedInUser } from "./useLoggedInUser";
export type EngineTier = "STARTER" | "PREMIUM" | "ENTERPRISE";
@@ -17,7 +19,6 @@ export type EngineInstance = {
name: string;
url: string;
lastAccessedAt: string;
cloudDeployedAt?: string;
status:
| "active"
| "pending"
@@ -25,6 +26,7 @@ export type EngineInstance = {
| "deploying"
| "paymentFailed"
| "deploymentFailed";
deploymentId?: string;
};
// Not checking for null token because the token is required the tanstack useQuery hook
@@ -110,10 +112,16 @@ export function useEngineBackendWallets(instance: string) {
});
}
type EngineFeature =
| "KEYPAIR_AUTH"
| "CONTRACT_SUBSCRIPTIONS"
| "IP_ALLOWLIST"
| "HETEROGENEOUS_WALLET_TYPES";
interface EngineSystemHealth {
status: string;
engineVersion?: string;
features?: string[];
features?: EngineFeature[];
}
export function useEngineSystemHealth(
@@ -137,6 +145,18 @@ export function useEngineSystemHealth(
});
}
// Helper function to check if a feature is supported.
export function useHasEngineFeature(
instanceUrl: string,
feature: EngineFeature,
) {
const query = useEngineSystemHealth(instanceUrl);
return {
query,
isSupported: !!query.data?.features?.includes(feature),
};
}
interface EngineSystemQueueMetrics {
result: {
queued: number;
@@ -187,24 +207,25 @@ export function useEngineLatestVersion() {
}
interface UpdateVersionInput {
engineId: string;
deploymentId: string;
serverVersion: string;
}
export function useEngineUpdateVersion() {
export function useEngineUpdateServerVersion() {
return useMutation({
mutationFn: async (input: UpdateVersionInput) => {
invariant(input.engineId, "engineId is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/engine/update-version`, {
method: "POST",
headers: {
"Content-Type": "application/json",
const res = await fetch(
`${THIRDWEB_API_HOST}/v2/engine/deployments/${input.deploymentId}/infrastructure`,
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
serverVersion: input.serverVersion,
}),
},
body: JSON.stringify({
engineId: input.engineId,
}),
});
);
// we never use the response body
res.body?.cancel();
if (!res.ok) {
@@ -240,27 +261,26 @@ export function useEngineRemoveFromDashboard() {
});
}
export interface RemoveCloudHostedInput {
instanceId: string;
export interface DeleteCloudHostedInput {
deploymentId: string;
reason: "USING_SELF_HOSTED" | "TOO_EXPENSIVE" | "MISSING_FEATURES" | "OTHER";
feedback: string;
}
export function useEngineRemoveCloudHosted() {
export function useEngineDeleteCloudHosted() {
const { user } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({
instanceId,
deploymentId,
reason,
feedback,
}: RemoveCloudHostedInput) => {
}: DeleteCloudHostedInput) => {
const res = await fetch(
`${THIRDWEB_API_HOST}/v1/engine/${instanceId}/remove-cloud-hosted`,
`${THIRDWEB_API_HOST}/v2/engine/deployments/${deploymentId}/infrastructure/delete`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
@@ -397,29 +417,22 @@ export function useEngineTransactions(instance: string, autoUpdate: boolean) {
});
}
type WalletConfig =
| {
type: "local";
}
| {
type: "aws-kms";
awsAccessKeyId: string;
awsSecretAccessKey: string;
awsRegion: string;
}
| {
type: "gcp-kms";
gcpApplicationProjectId: string;
gcpKmsLocationId: string;
gcpKmsKeyRingId: string;
gcpApplicationCredentialEmail: string;
gcpApplicationCredentialPrivateKey: string;
};
export interface WalletConfigResponse {
type: EngineBackendWalletType;
awsAccessKeyId?: string | null;
awsRegion?: string | null;
gcpApplicationProjectId?: string | null;
gcpKmsLocationId?: string | null;
gcpKmsKeyRingId?: string | null;
gcpApplicationCredentialEmail?: string | null;
}
export function useEngineWalletConfig(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery({
return useQuery<WalletConfigResponse>({
queryKey: engineKeys.walletConfig(instance),
queryFn: async () => {
const res = await fetch(`${instance}configuration/wallets`, {
@@ -428,8 +441,7 @@ export function useEngineWalletConfig(instance: string) {
});
const json = await res.json();
return (json.result as WalletConfig) || {};
return json.result;
},
enabled: !!instance && !!token,
});
@@ -570,8 +582,8 @@ export function useEngineAddKeypair(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: AddKeypairInput) => {
return useMutation({
mutationFn: async (input: AddKeypairInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}auth/keypair/add`, {
@@ -587,14 +599,12 @@ export function useEngineAddKeypair(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.keypairs(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.keypairs(instance),
});
},
);
});
}
type RemoveKeypairInput = {
@@ -605,8 +615,8 @@ export function useEngineRemoveKeypair(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: RemoveKeypairInput) => {
return useMutation({
mutationFn: async (input: RemoveKeypairInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}auth/keypair/remove`, {
@@ -622,14 +632,12 @@ export function useEngineRemoveKeypair(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.keypairs(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.keypairs(instance),
});
},
);
});
}
export type EngineRelayer = {
@@ -672,8 +680,8 @@ export function useEngineCreateRelayer(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: CreateRelayerInput) => {
return useMutation({
mutationFn: async (input: CreateRelayerInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}relayer/create`, {
@@ -689,14 +697,12 @@ export function useEngineCreateRelayer(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.relayers(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.relayers(instance),
});
},
);
});
}
type RevokeRelayerInput = {
@@ -707,8 +713,8 @@ export function useEngineRevokeRelayer(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: RevokeRelayerInput) => {
return useMutation({
mutationFn: async (input: RevokeRelayerInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}relayer/revoke`, {
@@ -724,14 +730,12 @@ export function useEngineRevokeRelayer(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.relayers(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.relayers(instance),
});
},
);
});
}
export type UpdateRelayerInput = {
@@ -747,8 +751,8 @@ export function useEngineUpdateRelayer(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: UpdateRelayerInput) => {
return useMutation({
mutationFn: async (input: UpdateRelayerInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}relayer/update`, {
@@ -764,14 +768,12 @@ export function useEngineUpdateRelayer(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.relayers(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.relayers(instance),
});
},
);
});
}
export interface EngineWebhook {
@@ -805,9 +807,6 @@ export function useEngineWebhooks(instance: string) {
// POST REQUESTS
export type SetWalletConfigInput =
| {
type: "local";
}
| {
type: "aws-kms";
awsAccessKeyId: string;
@@ -827,8 +826,8 @@ export function useEngineSetWalletConfig(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: SetWalletConfigInput) => {
return useMutation<WalletConfigResponse, void, SetWalletConfigInput>({
mutationFn: async (input) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}configuration/wallets`, {
@@ -844,17 +843,16 @@ export function useEngineSetWalletConfig(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.walletConfig(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.walletConfig(instance),
});
},
);
});
}
export type CreateBackendWalletInput = {
type: EngineBackendWalletType;
label?: string;
};
@@ -862,8 +860,8 @@ export function useEngineCreateBackendWallet(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: CreateBackendWalletInput) => {
return useMutation({
mutationFn: async (input: CreateBackendWalletInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}backend-wallet/create`, {
@@ -879,14 +877,12 @@ export function useEngineCreateBackendWallet(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.backendWallets(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.backendWallets(instance),
});
},
);
});
}
interface UpdateBackendWalletInput {
@@ -898,8 +894,8 @@ export function useEngineUpdateBackendWallet(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: UpdateBackendWalletInput) => {
return useMutation({
mutationFn: async (input: UpdateBackendWalletInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}backend-wallet/update`, {
@@ -915,42 +911,35 @@ export function useEngineUpdateBackendWallet(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.backendWallets(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.backendWallets(instance),
});
},
);
});
}
export type ImportBackendWalletInput =
| {
awsKmsKeyId: string;
awsKmsArn: string;
}
| {
gcpKmsKeyId: string;
gcpKmsKeyVersionId: string;
}
| {
privateKey?: string;
}
| {
mnemonic?: string;
}
| {
encryptedJson?: string;
password?: string;
};
// The backend determines the wallet imported based on the provided fields.
export type ImportBackendWalletInput = {
label?: string;
awsKmsArn?: string;
gcpKmsKeyId?: string;
gcpKmsKeyVersionId?: string;
privateKey?: string;
mnemonic?: string;
encryptedJson?: string;
password?: string;
};
export function useEngineImportBackendWallet(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: ImportBackendWalletInput) => {
return useMutation({
mutationFn: async (input: ImportBackendWalletInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}backend-wallet/import`, {
@@ -966,22 +955,20 @@ export function useEngineImportBackendWallet(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.backendWallets(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.backendWallets(instance),
});
},
);
});
}
export function useEngineGrantPermissions(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: EngineAdmin) => {
return useMutation({
mutationFn: async (input: EngineAdmin) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}auth/permissions/grant`, {
@@ -997,14 +984,12 @@ export function useEngineGrantPermissions(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.permissions(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.permissions(instance),
});
},
);
});
}
type RevokePermissionsInput = {
@@ -1015,8 +1000,8 @@ export function useEngineRevokePermissions(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: RevokePermissionsInput) => {
return useMutation({
mutationFn: async (input: RevokePermissionsInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}auth/permissions/revoke`, {
@@ -1032,14 +1017,12 @@ export function useEngineRevokePermissions(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.permissions(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.permissions(instance),
});
},
);
});
}
type CreateAccessTokenResponse = AccessToken & {
@@ -1050,8 +1033,8 @@ export function useEngineCreateAccessToken(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async () => {
return useMutation({
mutationFn: async () => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}auth/access-tokens/create`, {
@@ -1067,14 +1050,12 @@ export function useEngineCreateAccessToken(instance: string) {
return json.result as CreateAccessTokenResponse;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.accessTokens(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.accessTokens(instance),
});
},
);
});
}
type RevokeAccessTokenInput = {
@@ -1085,8 +1066,8 @@ export function useEngineRevokeAccessToken(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: RevokeAccessTokenInput) => {
return useMutation({
mutationFn: async (input: RevokeAccessTokenInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}auth/access-tokens/revoke`, {
@@ -1102,14 +1083,12 @@ export function useEngineRevokeAccessToken(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.accessTokens(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.accessTokens(instance),
});
},
);
});
}
type UpdateAccessTokenInput = {
@@ -1121,8 +1100,8 @@ export function useEngineUpdateAccessToken(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: UpdateAccessTokenInput) => {
return useMutation({
mutationFn: async (input: UpdateAccessTokenInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}auth/access-tokens/update`, {
@@ -1138,14 +1117,12 @@ export function useEngineUpdateAccessToken(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.accessTokens(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.accessTokens(instance),
});
},
);
});
}
export type CreateWebhookInput = {
@@ -1158,8 +1135,8 @@ export function useEngineCreateWebhook(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: CreateWebhookInput) => {
return useMutation({
mutationFn: async (input: CreateWebhookInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}webhooks/create`, {
@@ -1175,14 +1152,12 @@ export function useEngineCreateWebhook(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.webhooks(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.webhooks(instance),
});
},
);
});
}
type RevokeWebhookInput = {
@@ -1193,8 +1168,8 @@ export function useEngineRevokeWebhook(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: RevokeWebhookInput) => {
return useMutation({
mutationFn: async (input: RevokeWebhookInput) => {
invariant(instance, "instance is required");
const res = await fetch(`${instance}webhooks/revoke`, {
@@ -1210,14 +1185,12 @@ export function useEngineRevokeWebhook(instance: string) {
return json.result;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.webhooks(instance),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.webhooks(instance),
});
},
);
});
}
type SendTokensInput = {
@@ -1659,14 +1632,17 @@ export function useEngineCreateNotificationChannel(engineId: string) {
const { isLoggedIn } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: CreateNotificationChannelInput) => {
return useMutation({
mutationFn: async (input: CreateNotificationChannelInput) => {
invariant(isLoggedIn, "Must be logged in.");
const res = await fetch(
`${THIRDWEB_API_HOST}/v1/engine/${engineId}/notification-channels`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(input),
},
);
@@ -1677,39 +1653,37 @@ export function useEngineCreateNotificationChannel(engineId: string) {
const json = await res.json();
return json.data as EngineNotificationChannel;
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.notificationChannels(engineId),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.notificationChannels(engineId),
});
},
);
});
}
export function useEngineDeleteNotificationChannel(engineId: string) {
const { isLoggedIn } = useLoggedInUser();
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (notificationChannelId: string) => {
return useMutation({
mutationFn: async (notificationChannelId: string) => {
invariant(isLoggedIn, "Must be logged in.");
const res = await fetch(
`${THIRDWEB_API_HOST}/v1/engine/${engineId}/notification-channels/${notificationChannelId}`,
{ method: "DELETE" },
{
method: "DELETE",
},
);
if (!res.ok) {
throw new Error(`Unexpected status ${res.status}: ${await res.text()}`);
}
res.body?.cancel();
},
{
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.notificationChannels(engineId),
});
},
onSuccess: () => {
return queryClient.invalidateQueries({
queryKey: engineKeys.notificationChannels(engineId),
});
},
);
});
}
@@ -1,3 +1,5 @@
"use client";
import { isLoginRequired } from "@/constants/auth";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { useQuery } from "@tanstack/react-query";
@@ -54,9 +56,7 @@ export function useLoggedInUser(): {
retry: false,
queryFn: async () => {
const searchParams = new URLSearchParams();
if (pathname) {
searchParams.set("pathname", pathname);
}
if (connectedAddress) {
searchParams.set("address", connectedAddress);
}
@@ -74,10 +74,18 @@ export function useLoggedInUser(): {
// legit use-case for now
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
if (query.data?.redirectTo) {
router.replace(query.data.redirectTo);
if (query.data?.isLoggedIn === false) {
// not using useSearchParams hook here to avoid adding Suspense boundaries everywhere this hook is being used
const currentHref = new URL(window.location.href);
const currentPathname = currentHref.pathname;
const currentSearchParams = currentHref.searchParams.toString();
router.replace(
buildLoginPath(
`${currentPathname}${currentSearchParams ? `?${currentSearchParams}` : ""}`,
),
);
}
}, [query.data?.redirectTo, router]);
}, [query.data?.isLoggedIn, router]);
// if we are "disconnected" we are not logged in
if (connectionStatus === "disconnected") {
@@ -133,3 +141,7 @@ export function useLoggedInUser(): {
: null,
};
}
function buildLoginPath(pathname: string | undefined): string {
return `/login${pathname ? `?next=${encodeURIComponent(pathname)}` : ""}`;
}
@@ -1,17 +1,18 @@
import { useQuery } from "@tanstack/react-query";
import type { WalletNFTApiReturn } from "pages/api/wallet/nfts/[chainId]";
import { useQueryWithNetwork } from "./query/useQueryWithNetwork";
export function useWalletNFTs(walletAddress?: string, chainId?: number) {
return useQueryWithNetwork(
["walletNfts", walletAddress],
async () => {
export function useWalletNFTs(params: {
chainId: number;
walletAddress?: string;
}) {
return useQuery({
queryKey: ["walletNfts", params.chainId, params.walletAddress],
queryFn: async () => {
const response = await fetch(
`/api/wallet/nfts/${chainId}?owner=${walletAddress}`,
`/api/wallet/nfts/${params.chainId}?owner=${params.walletAddress}`,
);
return (await response.json()) as WalletNFTApiReturn;
},
{
enabled: !!walletAddress && !!chainId,
},
);
enabled: !!params.walletAddress,
});
}
@@ -0,0 +1,68 @@
"use client";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { CheckIcon, CircleAlertIcon, RotateCcwIcon } from "lucide-react";
import { useState } from "react";
import { ConfigureNetworks } from "../../../../../components/configure-networks/ConfigureNetworks";
import { addChainOverrides } from "../../../../../stores/chainStores";
export function ConfigureCustomChain(props: {
chainSlug: string;
}) {
const { chainSlug } = props;
const isSlugNumber = Number.isInteger(Number.parseInt(chainSlug));
const [isConfigured, setIsConfigured] = useState(false);
if (isConfigured) {
return (
<div className="mx-auto max-w-[600px] py-10">
<Alert variant="info">
<CheckIcon className="size-5" />
<AlertTitle>Network Configured Successfully</AlertTitle>
</Alert>
<div className="h-6" />
<Button
onClick={() => window.location.reload()}
className="w-full gap-2"
>
<RotateCcwIcon className="size-4" />
Reload Page to Continue
</Button>
</div>
);
}
return (
<div className="mx-auto max-w-[600px] py-10">
<Alert variant="warning">
<CircleAlertIcon className="size-5" />
<AlertTitle>
No Chain found with {isSlugNumber ? "chain ID" : "slug"}{" "}
{`"${chainSlug}"`}
</AlertTitle>
<AlertDescription>
Configure a chain with {isSlugNumber ? "chain ID" : "slug"}{" "}
{`"${chainSlug}"`} to continue
</AlertDescription>
</Alert>
<div className="h-6" />
<div className="rounded-lg border border-border">
<ConfigureNetworks
prefillSlug={isSlugNumber ? undefined : chainSlug}
prefillChainId={isSlugNumber ? chainSlug : undefined}
onNetworkAdded={(network) => {
if (
chainSlug === network.slug ||
chainSlug === `${network.chainId}`
) {
addChainOverrides(network);
setIsConfigured(true);
}
}}
editChain={undefined}
/>
</div>
</div>
);
}
@@ -8,13 +8,7 @@ import {
} from "@chakra-ui/react";
import { useMemo } from "react";
import { type NFT, ZERO_ADDRESS } from "thirdweb";
import {
Card,
Heading,
Text,
TrackedLink,
type TrackedLinkProps,
} from "tw-components";
import { Card, TrackedLink, type TrackedLinkProps } from "tw-components";
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
type NFTWithContract = NFT & { contractAddress: string; chainId: number };
@@ -83,18 +77,20 @@ export const NFTCards: React.FC<NFTCardsProps> = ({
/>
</Skeleton>
</div>
<Flex p={4} pb={3} gap={3} direction="column">
<Flex p={4} pb={3} gap={1} direction="column">
<Skeleton w={!isPending ? "100%" : "50%"} isLoaded={!isPending}>
<Heading size="label.md">{token.metadata.name}</Heading>
<h2 className="font-semibold tracking-tight">
{token.metadata.name}
</h2>
</Skeleton>
<SkeletonText isLoaded={!isPending}>
<Text noOfLines={3}>
<p className="line-clamp-3 text-muted-foreground text-sm">
{token.metadata.description ? (
token.metadata.description
) : (
<i>No description</i>
)}
</Text>
</p>
</SkeletonText>
</Flex>
</Card>
@@ -0,0 +1,49 @@
import * as ERC20Ext from "thirdweb/extensions/erc20";
import * as ERC721Ext from "thirdweb/extensions/erc721";
import * as ERC1155Ext from "thirdweb/extensions/erc1155";
export function isERC721ClaimConditionsSupported(functionSelectors: string[]) {
return [
// reads
ERC721Ext.isGetClaimConditionByIdSupported(functionSelectors),
ERC721Ext.isGetActiveClaimConditionIdSupported(functionSelectors),
ERC721Ext.isGetClaimConditionsSupported(functionSelectors),
ERC721Ext.isGetActiveClaimConditionSupported(functionSelectors),
// writes
ERC721Ext.isSetClaimConditionsSupported(functionSelectors),
ERC721Ext.isResetClaimEligibilitySupported(functionSelectors),
].every(Boolean);
}
export function isERC20ClaimConditionsSupported(functionSelectors: string[]) {
return [
// reads
ERC20Ext.isGetClaimConditionByIdSupported(functionSelectors),
ERC20Ext.isGetActiveClaimConditionIdSupported(functionSelectors),
ERC20Ext.isGetClaimConditionsSupported(functionSelectors),
ERC20Ext.isGetActiveClaimConditionSupported(functionSelectors),
// writes
ERC20Ext.isSetClaimConditionsSupported(functionSelectors),
ERC20Ext.isResetClaimEligibilitySupported(functionSelectors),
].every(Boolean);
}
function isERC1155ClaimConditionsSupported(functionSelectors: string[]) {
return [
// reads
ERC1155Ext.isGetClaimConditionByIdSupported(functionSelectors),
ERC1155Ext.isGetClaimConditionsSupported(functionSelectors),
ERC1155Ext.isGetActiveClaimConditionSupported(functionSelectors),
// writes
ERC1155Ext.isSetClaimConditionsSupported(functionSelectors),
ERC1155Ext.isResetClaimEligibilitySupported(functionSelectors),
].every(Boolean);
}
export function isClaimConditionsSupported(functionSelectors: string[]) {
return (
isERC721ClaimConditionsSupported(functionSelectors) ||
isERC20ClaimConditionsSupported(functionSelectors) ||
isERC1155ClaimConditionsSupported(functionSelectors)
);
}
@@ -0,0 +1,26 @@
import * as ERC4337Ext from "thirdweb/extensions/erc4337";
export function isAccountFactoryContract(functionSelectors: string[]) {
return [
ERC4337Ext.isGetAllAccountsSupported(functionSelectors),
ERC4337Ext.isGetAccountsSupported(functionSelectors),
ERC4337Ext.isTotalAccountsSupported(functionSelectors),
ERC4337Ext.isGetAccountsOfSignerSupported(functionSelectors),
ERC4337Ext.isPredictAccountAddressSupported(functionSelectors),
].every(Boolean);
}
export function isAccountContract(functionSelectors: string[]) {
return ERC4337Ext.isValidateUserOpSupported(functionSelectors);
}
export function isAccountPermissionsSupported(functionSelectors: string[]) {
return [
ERC4337Ext.isGetAllActiveSignersSupported(functionSelectors),
ERC4337Ext.isGetAllAdminsSupported(functionSelectors),
ERC4337Ext.isGetAllSignersSupported(functionSelectors),
ERC4337Ext.isIsActiveSignerSupported(functionSelectors),
ERC4337Ext.isIsAdminSupported(functionSelectors),
ERC4337Ext.isAddAdminSupported(functionSelectors),
].every(Boolean);
}
@@ -0,0 +1,17 @@
import * as MarketplaceExt from "thirdweb/extensions/marketplace";
export function isDirectListingSupported(functionSelectors: string[]) {
return [
MarketplaceExt.isCreateListingSupported(functionSelectors),
MarketplaceExt.isCancelListingSupported(functionSelectors),
MarketplaceExt.isBuyFromListingSupported(functionSelectors),
].every(Boolean);
}
export function isEnglishAuctionSupported(functionSelectors: string[]) {
return [
MarketplaceExt.isCreateAuctionSupported(functionSelectors),
MarketplaceExt.isCancelAuctionSupported(functionSelectors),
MarketplaceExt.isBidInAuctionSupported(functionSelectors),
].every(Boolean);
}
@@ -0,0 +1,11 @@
import {
isGetInstalledModulesSupported,
isInstallModuleSupported,
} from "thirdweb/modules";
export function isModularCoreContract(functionSelectors: string[]) {
return [
isGetInstalledModulesSupported(functionSelectors),
isInstallModuleSupported(functionSelectors),
].every(Boolean);
}
@@ -0,0 +1,21 @@
import * as PermissionsExt from "thirdweb/extensions/permissions";
export function isPermissionsSupported(functionSelectors: string[]) {
return [
PermissionsExt.isGetRoleAdminSupported(functionSelectors),
PermissionsExt.isGrantRoleSupported(functionSelectors),
PermissionsExt.isHasRoleSupported(functionSelectors),
PermissionsExt.isRenounceRoleSupported(functionSelectors),
PermissionsExt.isRevokeRoleSupported(functionSelectors),
].every(Boolean);
}
export function isPermissionsEnumerableSupported(functionSelectors: string[]) {
return (
isPermissionsSupported(functionSelectors) &&
[
PermissionsExt.isGetRoleMemberSupported(functionSelectors),
PermissionsExt.isGetRoleMemberCountSupported(functionSelectors),
].every(Boolean)
);
}
@@ -0,0 +1,14 @@
import { isERC20 as isERC20_ERC20 } from "thirdweb/extensions/erc20";
import { isGetNFTSupported as isGetNFTSupported_ERC721 } from "thirdweb/extensions/erc721";
import { isGetNFTSupported as isGetNFTSupported_ERC1155 } from "thirdweb/extensions/erc1155";
export function supportedERCs(functionSelectors: string[]) {
const isERC721 = isGetNFTSupported_ERC721(functionSelectors);
const isERC1155 = isGetNFTSupported_ERC1155(functionSelectors);
const isERC20 = isERC20_ERC20(functionSelectors);
return {
isERC721,
isERC1155,
isERC20,
};
}
@@ -0,0 +1,70 @@
import { getThirdwebClient } from "@/constants/thirdweb.server";
import { mapV4ChainToV5Chain } from "contexts/map-chains";
import { cookies } from "next/headers";
import { TW_LOCAL_CHAIN_STORE } from "stores/storageKeys";
import { getAddress, getContract, isAddress } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { fetchChain } from "utils/fetchChain";
import { getAuthToken } from "../../../../../api/lib/getAuthToken";
export async function getContractPageParamsInfo(params: {
contractAddress: string;
chain_id: string;
}) {
const contractAddress = getCheckSummedAddress(params.contractAddress);
const chainSlugOrId = params.chain_id;
let chainMetadata: ChainMetadata | null = null;
try {
chainMetadata = await fetchChain(chainSlugOrId);
} catch {
// move on
}
if (!chainMetadata) {
const cookieStore = cookies();
const localChainStoreValue = cookieStore.get(TW_LOCAL_CHAIN_STORE)?.value;
if (localChainStoreValue) {
try {
const chains = JSON.parse(decodeURIComponent(localChainStoreValue));
if (typeof chains === "object" && Array.isArray(chains)) {
const chainOverrides = chains as ChainMetadata[];
const chain = chainOverrides.find(
(c) =>
c.slug === chainSlugOrId ||
c.chainId === Number.parseInt(chainSlugOrId),
);
if (chain) {
chainMetadata = chain;
}
}
} catch {
// noop
}
}
}
if (!chainMetadata) {
return undefined;
}
// attempt to get the auth token
const token = getAuthToken();
const contract = getContract({
address: contractAddress,
// eslint-disable-next-line no-restricted-syntax
chain: mapV4ChainToV5Chain(chainMetadata),
// if we have the auth token pass it into the client
client: getThirdwebClient(token || undefined),
});
return {
chainMetadata,
contract,
};
}
function getCheckSummedAddress(address: string) {
return isAddress(address) ? getAddress(address) : address;
}
@@ -0,0 +1,97 @@
import { resolveFunctionSelectors } from "lib/selectors";
import type { ThirdwebContract } from "thirdweb";
import { contractType as getContractType } from "thirdweb/extensions/thirdweb";
import {
isERC20ClaimConditionsSupported,
isERC721ClaimConditionsSupported,
} from "./detectedFeatures/claimConditions";
import {
isAccountContract,
isAccountFactoryContract,
isAccountPermissionsSupported,
} from "./detectedFeatures/erc4337";
import {
isDirectListingSupported,
isEnglishAuctionSupported,
} from "./detectedFeatures/marketplace";
import { isModularCoreContract } from "./detectedFeatures/modular";
import {
isPermissionsEnumerableSupported,
isPermissionsSupported,
} from "./detectedFeatures/permissions";
import { supportedERCs } from "./detectedFeatures/supportedERCs";
import { type EmbedTypeToShow, getEmbedTypeToShow } from "./getEmbedTypeToShow";
import { isAnalyticsSupportedForChain } from "./isAnalyticsSupportedForChain";
export type ContractPageMetadata = {
supportedERCs: {
isERC721: boolean;
isERC1155: boolean;
isERC20: boolean;
};
isDirectListingSupported: boolean;
isEnglishAuctionSupported: boolean;
isPermissionsSupported: boolean;
isVoteContract: boolean;
isPermissionsEnumerableSupported: boolean;
isModularCore: boolean;
embedType: EmbedTypeToShow;
isAnalyticsSupported: boolean;
isSplitSupported: boolean;
isERC721ClaimConditionsSupported: boolean;
isERC20ClaimConditionsSupported: boolean;
isAccountFactory: boolean;
isAccount: boolean;
isAccountPermissionsSupported: boolean;
functionSelectors: string[];
};
export async function getContractPageMetadata(
contract: ThirdwebContract,
): Promise<ContractPageMetadata> {
const [
functionSelectorsResult,
isAnalyticsSupportedResult,
contractTypeResult,
] = await Promise.allSettled([
resolveFunctionSelectors(contract),
isAnalyticsSupportedForChain(contract.chain.id),
getContractType({ contract }),
]);
const functionSelectors =
functionSelectorsResult.status === "fulfilled"
? functionSelectorsResult.value
: [];
const isAnalyticsSupported =
isAnalyticsSupportedResult.status === "fulfilled"
? isAnalyticsSupportedResult.value
: true;
const contractType =
contractTypeResult.status === "fulfilled" ? contractTypeResult.value : null;
return {
supportedERCs: supportedERCs(functionSelectors),
isDirectListingSupported: isDirectListingSupported(functionSelectors),
isEnglishAuctionSupported: isEnglishAuctionSupported(functionSelectors),
isPermissionsSupported: isPermissionsSupported(functionSelectors),
isPermissionsEnumerableSupported:
isPermissionsEnumerableSupported(functionSelectors),
isModularCore: isModularCoreContract(functionSelectors),
embedType: getEmbedTypeToShow(functionSelectors),
isAnalyticsSupported: isAnalyticsSupported,
isSplitSupported: contractType === "Split",
isVoteContract: contractType === "VoteERC20",
isERC721ClaimConditionsSupported:
isERC721ClaimConditionsSupported(functionSelectors),
isERC20ClaimConditionsSupported:
isERC20ClaimConditionsSupported(functionSelectors),
isAccountFactory: isAccountFactoryContract(functionSelectors),
isAccount: isAccountContract(functionSelectors),
isAccountPermissionsSupported:
isAccountPermissionsSupported(functionSelectors),
functionSelectors,
};
}
@@ -0,0 +1,157 @@
import type { SidebarBaseLink, SidebarLink } from "@/components/blocks/Sidebar";
import type { ContractPageMetadata } from "./getContractPageMetadata";
type SidebarBaseLinkWithHide = SidebarBaseLink & {
hide?: boolean;
};
export function getContractPageSidebarLinks(data: {
metadata: ContractPageMetadata;
contractAddress: string;
chainSlug: string;
}) {
const layoutPrefix = `/${data.chainSlug}/${data.contractAddress}`;
const generalLinks: SidebarBaseLinkWithHide[] = [
{
label: "Overview",
href: layoutPrefix,
exactMatch: true,
},
{
label: "Modules",
href: `${layoutPrefix}/modules`,
hide: !data.metadata.isModularCore,
exactMatch: true,
},
{
label: "Code Snippets",
href: `${layoutPrefix}/code`,
exactMatch: true,
},
{
label: "Explorer",
href: `${layoutPrefix}/explorer`,
exactMatch: true,
},
{
label: "Events",
href: `${layoutPrefix}/events`,
exactMatch: true,
},
{
label: "Embed",
href: `${layoutPrefix}/embed`,
hide: data.metadata.embedType === null,
exactMatch: true,
},
{
label: "Analytics",
href: `${layoutPrefix}/analytics`,
hide: !data.metadata.isAnalyticsSupported,
exactMatch: true,
},
{
label: "Settings",
href: `${layoutPrefix}/settings`,
exactMatch: true,
},
{
label: "Sources",
href: `${layoutPrefix}/sources`,
exactMatch: true,
},
];
const extensionsLinks: SidebarBaseLinkWithHide[] = [
{
label: "NFTs",
href: `${layoutPrefix}/nfts`,
hide:
!data.metadata.supportedERCs.isERC721 &&
!data.metadata.supportedERCs.isERC1155,
},
{
label: "Tokens",
href: `${layoutPrefix}/tokens`,
hide: !data.metadata.supportedERCs.isERC20,
exactMatch: true,
},
{
label: "Direct Listings",
href: `${layoutPrefix}/direct-listings`,
hide: !data.metadata.isDirectListingSupported,
exactMatch: true,
},
{
label: "English Auctions",
href: `${layoutPrefix}/english-auctions`,
hide: !data.metadata.isEnglishAuctionSupported,
exactMatch: true,
},
{
label: "Balances",
href: `${layoutPrefix}/split`,
hide: !data.metadata.isSplitSupported,
exactMatch: true,
},
{
label: "Proposals",
href: `${layoutPrefix}/proposals`,
hide: !data.metadata.isVoteContract,
exactMatch: true,
},
{
label: "Claim Conditions",
href: `${layoutPrefix}/claim-conditions`,
hide: !(
data.metadata.isERC721ClaimConditionsSupported ||
data.metadata.isERC20ClaimConditionsSupported
),
exactMatch: true,
},
{
label: "Accounts",
href: `${layoutPrefix}/accounts`,
hide: !data.metadata.isAccountFactory,
exactMatch: true,
},
{
label: "Balance",
href: `${layoutPrefix}/account`,
hide: !data.metadata.isAccount,
exactMatch: true,
},
{
label: "Account Permissions",
href: `${layoutPrefix}/account-permissions`,
hide: !data.metadata.isAccountPermissionsSupported,
exactMatch: true,
},
{
label: "Permissions",
href: `${layoutPrefix}/permissions`,
exactMatch: true,
hide: !data.metadata.isPermissionsSupported,
},
];
const extensionsToShow = extensionsLinks.filter((l) => !l.hide);
const generalLinksToShow = generalLinks.filter((l) => !l.hide);
const sidebarLinks: SidebarLink[] = [
{
group: "General",
links: generalLinksToShow,
},
];
if (extensionsToShow.length > 0) {
sidebarLinks.push({
group: "Extensions",
links: extensionsToShow,
});
}
return sidebarLinks;
}
@@ -0,0 +1,40 @@
import { isClaimConditionsSupported } from "./detectedFeatures/claimConditions";
import {
isDirectListingSupported,
isEnglishAuctionSupported,
} from "./detectedFeatures/marketplace";
import { supportedERCs } from "./detectedFeatures/supportedERCs";
export type EmbedTypeToShow =
| "marketplace-v3"
| "erc20"
| "erc1155"
| "erc721"
| null;
export function getEmbedTypeToShow(
functionSelectors: string[],
): EmbedTypeToShow {
const { isERC1155, isERC20, isERC721 } = supportedERCs(functionSelectors);
if (
isEnglishAuctionSupported(functionSelectors) &&
isDirectListingSupported(functionSelectors)
) {
return "marketplace-v3";
}
if (isClaimConditionsSupported(functionSelectors)) {
if (isERC721) {
return "erc721";
}
if (isERC1155) {
return "erc1155";
}
if (isERC20) {
return "erc20";
}
}
return null;
}
@@ -0,0 +1,35 @@
import { isProd } from "@/constants/env";
export async function isAnalyticsSupportedForChain(
chainId: number,
): Promise<boolean> {
try {
if (!process.env.CHAINSAW_API_KEY) {
throw new Error("Missing CHAINSAW_API_KEY env var");
}
const res = await fetch(
`https://chainsaw.${isProd ? "thirdweb" : "thirdweb-dev"}.com/service/chains/${chainId}`,
{
method: "GET",
headers: {
"content-type": "application/json",
// pass the shared secret
"x-service-api-key": process.env.CHAINSAW_API_KEY || "",
},
},
);
if (!res.ok) {
// assume not supported if we get a non-200 response
return false;
}
const { data } = await res.json();
return data;
} catch (e) {
console.error("Error checking if analytics is supported for chain", e);
}
return false;
}
@@ -1,10 +1,9 @@
import { WalletAddress } from "@/components/blocks/wallet-address";
import { useDashboardEVMChainId } from "@3rdweb-sdk/react";
import { Flex, SimpleGrid, useBreakpointValue } from "@chakra-ui/react";
import { formatDistance } from "date-fns/formatDistance";
import { useAllChainsData } from "hooks/chains/allChains";
import { useActiveAccount } from "thirdweb/react";
import { Badge, Card, Heading, Text } from "tw-components";
import { useAllChainsData } from "../../../../hooks/chains/allChains";
export type AccountSignerType = {
signer: string;
@@ -15,13 +14,16 @@ export type AccountSignerType = {
};
interface AccountSignerProps {
item: AccountSignerType;
contractChainId: number;
}
export const AccountSigner: React.FC<AccountSignerProps> = ({ item }) => {
export const AccountSigner: React.FC<AccountSignerProps> = ({
item,
contractChainId,
}) => {
const address = useActiveAccount()?.address;
const chainId = useDashboardEVMChainId();
const { idToChain } = useAllChainsData();
const chain = chainId ? idToChain.get(chainId) : undefined;
const chain = contractChainId ? idToChain.get(contractChainId) : undefined;
const isMobile = useBreakpointValue({ base: true, md: false });
const {
isAdmin,
@@ -1,3 +1,5 @@
"use client";
import type { ThirdwebContract } from "thirdweb";
import { getAllActiveSigners, getAllAdmins } from "thirdweb/extensions/erc4337";
import { useReadContract } from "thirdweb/react";
@@ -31,7 +33,11 @@ export const AccountSigners: React.FC<AccountSignersProps> = ({ contract }) => {
return (
<div className="flex flex-col gap-6">
{data.map((item) => (
<AccountSigner key={item.signer} item={item} />
<AccountSigner
key={item.signer}
item={item}
contractChainId={contract.chain.id}
/>
))}
</div>
);
@@ -0,0 +1,34 @@
import { notFound, redirect } from "next/navigation";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { AccountSigners } from "./components/account-signers";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract } = info;
const { isAccountPermissionsSupported } =
await getContractPageMetadata(contract);
if (!isAccountPermissionsSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return (
<div>
<h1 className="mb-4 font-semibold text-2xl tracking-tight">
Account Signers
</h1>
<AccountSigners contract={contract} />
</div>
);
}
@@ -1,20 +1,22 @@
import { useDashboardEVMChainId } from "@3rdweb-sdk/react";
"use client";
import type { ThirdwebContract } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { Heading } from "tw-components";
import { useAllChainsData } from "../../../hooks/chains/allChains";
import { AccountBalance } from "./components/account-balance";
import { DepositNative } from "./components/deposit-native";
import { NftsOwned } from "./components/nfts-owned";
interface AccountPageProps {
contract: ThirdwebContract;
chainMetadata: ChainMetadata;
}
export const AccountPage: React.FC<AccountPageProps> = ({ contract }) => {
const { idToChain } = useAllChainsData();
const chainId = useDashboardEVMChainId();
const chain = chainId ? idToChain.get(chainId) : undefined;
const symbol = chain?.nativeCurrency.symbol || "Native Token";
export const AccountPage: React.FC<AccountPageProps> = ({
contract,
chainMetadata,
}) => {
const symbol = chainMetadata.nativeCurrency.symbol || "Native Token";
return (
<div className="flex flex-col gap-6">
@@ -26,11 +28,11 @@ export const AccountPage: React.FC<AccountPageProps> = ({ contract }) => {
<Heading size="title.sm">Deposit {symbol}</Heading>
</div>
{chain && (
{chainMetadata && (
<DepositNative
address={contract.address}
symbol={symbol}
chain={chain}
chain={chainMetadata}
/>
)}
@@ -1,3 +1,5 @@
"use client";
import { useSplitBalances } from "@3rdweb-sdk/react/hooks/useSplit";
import { SimpleGrid, Stat, StatLabel, StatNumber } from "@chakra-ui/react";
import type { ThirdwebContract } from "thirdweb";
@@ -3,12 +3,12 @@
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { Input } from "@chakra-ui/react";
import { TransactionButton } from "components/buttons/TransactionButton";
import { useV5DashboardChain } from "lib/v5-adapter";
import { type ChangeEvent, useState } from "react";
import type { StoredChain } from "stores/chainStores";
import { prepareTransaction, toWei } from "thirdweb";
import { useSendAndConfirmTransaction } from "thirdweb/react";
import { Card } from "tw-components";
import { useV5DashboardChain } from "../../../../lib/v5-adapter";
import type { StoredChain } from "../../../../stores/chainStores";
interface DepositNativeProps {
address: string;
@@ -46,6 +46,7 @@ export const DepositNative: React.FC<DepositNativeProps> = ({
value={amount}
/>
<TransactionButton
txChainID={v5Chain.id}
transactionCount={1}
isLoading={isPending}
isDisabled={
@@ -1,17 +1,19 @@
"use client";
import { useWalletNFTs } from "@3rdweb-sdk/react";
import { NFTCards } from "contract-ui/tabs/overview/components/NFTCards";
import type { ThirdwebContract } from "thirdweb";
import { Text } from "tw-components";
import { NFTCards } from "../../_components/NFTCards";
interface NftsOwnedProps {
contract: ThirdwebContract;
}
export const NftsOwned: React.FC<NftsOwnedProps> = ({ contract }) => {
const { data: walletNFTs, isPending: isWalletNFTsLoading } = useWalletNFTs(
contract.address,
contract.chain.id,
);
const { data: walletNFTs, isPending: isWalletNFTsLoading } = useWalletNFTs({
chainId: contract.chain.id,
walletAddress: contract.address,
});
const nfts = walletNFTs?.result || [];
const error = walletNFTs?.error;
@@ -0,0 +1,26 @@
import { notFound, redirect } from "next/navigation";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { AccountPage } from "./AccountPage";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract, chainMetadata } = info;
const { isAccount } = await getContractPageMetadata(contract);
if (!isAccount) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <AccountPage contract={contract} chainMetadata={chainMetadata} />;
}
@@ -1,3 +1,5 @@
"use client";
import { ButtonGroup, Flex } from "@chakra-ui/react";
import type { ThirdwebContract } from "thirdweb";
import { Heading, TrackedLinkButton } from "tw-components";
@@ -1,15 +1,17 @@
import { useDashboardEVMChainId } from "@3rdweb-sdk/react";
import { Flex, Icon, IconButton, Select, Skeleton } from "@chakra-ui/react";
"use client";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { Flex, IconButton, Select, Skeleton } from "@chakra-ui/react";
import { createColumnHelper } from "@tanstack/react-table";
import { TWTable } from "components/shared/TWTable";
import { useRouter } from "next/router";
import { useMemo, useState } from "react";
import { useChainSlug } from "hooks/chains/chainSlug";
import {
MdFirstPage,
MdLastPage,
MdNavigateBefore,
MdNavigateNext,
} from "react-icons/md";
ChevronFirstIcon,
ChevronLastIcon,
ChevronLeftIcon,
ChevronRightIcon,
} from "lucide-react";
import { useMemo, useState } from "react";
import type { ThirdwebContract } from "thirdweb";
import { getAccounts, totalAccounts } from "thirdweb/extensions/erc4337";
import { useReadContract } from "thirdweb/react";
@@ -39,8 +41,8 @@ type AccountsTableProps = {
};
export const AccountsTable: React.FC<AccountsTableProps> = ({ contract }) => {
const router = useRouter();
const network = useDashboardEVMChainId();
const router = useDashboardRouter();
const chainSlug = useChainSlug(contract.chain.id);
const [currentPage, setCurrentPage] = useState(0);
// default page size of 25
@@ -90,7 +92,7 @@ export const AccountsTable: React.FC<AccountsTableProps> = ({ contract }) => {
isPending={accountsQuery.isPending}
isFetched={accountsQuery.isFetched}
onRowClick={(row) => {
router.push(`/${network}/${row.account}`);
router.push(`/${chainSlug}/${row.account}`);
}}
/>
{/* pagination */}
@@ -99,13 +101,13 @@ export const AccountsTable: React.FC<AccountsTableProps> = ({ contract }) => {
<IconButton
isDisabled={totalAccountsQuery.isPending}
aria-label="first page"
icon={<Icon as={MdFirstPage} />}
icon={<ChevronFirstIcon className="size-4" />}
onClick={() => setCurrentPage(0)}
/>
<IconButton
isDisabled={totalAccountsQuery.isPending || !canPreviousPage}
aria-label="previous page"
icon={<Icon as={MdNavigateBefore} />}
icon={<ChevronLeftIcon className="size-4" />}
onClick={() => {
setCurrentPage((curr) => {
if (curr > 0) {
@@ -128,7 +130,7 @@ export const AccountsTable: React.FC<AccountsTableProps> = ({ contract }) => {
<IconButton
isDisabled={totalAccountsQuery.isPending || !canNextPage}
aria-label="next page"
icon={<Icon as={MdNavigateNext} />}
icon={<ChevronRightIcon className="size-4" />}
onClick={() =>
setCurrentPage((curr) => {
if (curr < totalPages - 1) {
@@ -141,7 +143,7 @@ export const AccountsTable: React.FC<AccountsTableProps> = ({ contract }) => {
<IconButton
isDisabled={totalAccountsQuery.isPending || !canNextPage}
aria-label="last page"
icon={<Icon as={MdLastPage} />}
icon={<ChevronLastIcon className="size-4" />}
onClick={() => setCurrentPage(totalPages - 1)}
/>
@@ -1,3 +1,5 @@
"use client";
import { Tooltip } from "@chakra-ui/react";
import { TransactionButton } from "components/buttons/TransactionButton";
import type { ThirdwebContract } from "thirdweb";
@@ -69,6 +71,7 @@ export const CreateAccountButton: React.FC<CreateAccountButtonProps> = ({
return (
<TransactionButton
txChainID={contract.chain.id}
colorScheme="primary"
onClick={() => {
const tx = ERC4337Ext.createAccount({
@@ -0,0 +1,26 @@
import { notFound, redirect } from "next/navigation";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { AccountsPage } from "./AccountsPage";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract } = info;
const { isAccountFactory } = await getContractPageMetadata(contract);
if (!isAccountFactory) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <AccountsPage contract={contract} />;
}
@@ -17,7 +17,6 @@ import type { UseQueryResult } from "@tanstack/react-query";
import {
type AnalyticsQueryParams,
type TotalQueryResult,
useAnalyticsSupportedForChain,
useEventsAnalytics,
useFunctionsAnalytics,
useLogsAnalytics,
@@ -51,26 +50,6 @@ export const ContractAnalyticsPage: React.FC<ContractAnalyticsPageProps> = ({
window?.scrollTo({ top: 0, behavior: "smooth" });
}, []);
const analyticsSupported = useAnalyticsSupportedForChain(contract.chain.id);
if (analyticsSupported.isPending) {
// TODO build a skeleton for this
return <div>Loading...</div>;
}
if (!analyticsSupported.data) {
return (
<Alert status="warning" borderRadius="md" mb={4}>
<AlertIcon />
<AlertTitle>Analytics is not supported for this chain.</AlertTitle>
<AlertDescription>
Analytics support is rolling out to additional chains. Please check
back later.
</AlertDescription>
</Alert>
);
}
return (
<Flex direction="column" gap={6}>
{contract && (
@@ -0,0 +1,25 @@
import { notFound, redirect } from "next/navigation";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
import { ContractAnalyticsPage } from "./ContractAnalyticsPage";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { isAnalyticsSupported } = await getContractPageMetadata(info.contract);
if (!isAnalyticsSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <ContractAnalyticsPage contract={info.contract} />;
}
@@ -0,0 +1,32 @@
import { notFound, redirect } from "next/navigation";
import { ClaimConditions } from "../../../../../../contract-ui/tabs/claim-conditions/components/claim-conditions";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract } = info;
const {
isERC20ClaimConditionsSupported,
isERC721ClaimConditionsSupported,
supportedERCs,
} = await getContractPageMetadata(contract);
if (!isERC20ClaimConditionsSupported && !isERC721ClaimConditionsSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return (
<ClaimConditions contract={contract} isERC20={supportedERCs.isERC20} />
);
}
@@ -0,0 +1,44 @@
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { CircleAlertIcon } from "lucide-react";
import { notFound } from "next/navigation";
import { resolveContractAbi } from "thirdweb/contract";
import { CodeOverview } from "../../../../../../contract-ui/tabs/code/components/code-overview";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract, chainMetadata } = info;
try {
const abi = await resolveContractAbi(contract);
return (
<CodeOverview
abi={abi}
contractAddress={contract.address}
chainId={contract.chain.id}
/>
);
} catch {
return (
<Alert variant="destructive">
<CircleAlertIcon className="size-5" />
<AlertTitle>Failed to resolve contract ABI</AlertTitle>
<AlertDescription>
Please verify that contract address is correct and deployed on "
{chainMetadata.name}" chain.
</AlertDescription>
</Alert>
);
}
}
@@ -0,0 +1,27 @@
import { notFound, redirect } from "next/navigation";
import { ContractDirectListingsPage } from "../../../../../../contract-ui/tabs/direct-listings/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { isDirectListingSupported } = await getContractPageMetadata(
info.contract,
);
if (!isDirectListingSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <ContractDirectListingsPage contract={info.contract} />;
}
@@ -0,0 +1,25 @@
import { notFound, redirect } from "next/navigation";
import { EmbedSetup } from "../../../../../../contract-ui/tabs/embed/components/embed-setup";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { embedType } = await getContractPageMetadata(info.contract);
if (embedType === null) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <EmbedSetup contract={info.contract} ercOrMarketplace={embedType} />;
}
@@ -0,0 +1,27 @@
import { notFound, redirect } from "next/navigation";
import { ContractEnglishAuctionsPage } from "../../../../../../contract-ui/tabs/english-auctions/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { isEnglishAuctionSupported } = await getContractPageMetadata(
info.contract,
);
if (!isEnglishAuctionSupported) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <ContractEnglishAuctionsPage contract={info.contract} />;
}
@@ -0,0 +1,18 @@
import { notFound } from "next/navigation";
import { EventsFeed } from "../../../../../../contract-ui/tabs/events/components/events-feed";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
return <EventsFeed contract={info.contract} />;
}
@@ -0,0 +1,37 @@
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { CircleAlertIcon } from "lucide-react";
import { notFound } from "next/navigation";
import { resolveContractAbi } from "thirdweb/contract";
import { ContractExplorerPage } from "../../../../../../contract-ui/tabs/explorer/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract, chainMetadata } = info;
try {
const abi = await resolveContractAbi(contract);
return <ContractExplorerPage contract={contract} abi={abi} />;
} catch {
return (
<Alert variant="destructive">
<CircleAlertIcon className="size-5" />
<AlertTitle>Failed to resolve contract ABI</AlertTitle>
<AlertDescription>
Please verify that contract address is correct and deployed on "
{chainMetadata.name}" chain.
</AlertDescription>
</Alert>
);
}
}
@@ -0,0 +1,122 @@
import { ChakraProviderSetup } from "@/components/ChakraProviderSetup";
import { SidebarLayout } from "@/components/blocks/SidebarLayout";
import { ContractMetadata } from "components/custom-contract/contract-header/contract-metadata";
import { DeprecatedAlert } from "components/shared/DeprecatedAlert";
import { PrimaryDashboardButton } from "contract-ui/components/primary-dashboard-button";
import type { Metadata } from "next";
import { getContractMetadata } from "thirdweb/extensions/common";
import { resolveFunctionSelectors } from "../../../../../lib/selectors";
import { shortenIfAddress } from "../../../../../utils/usedapp-external";
import { ConfigureCustomChain } from "./ConfigureCustomChain";
import { supportedERCs } from "./_utils/detectedFeatures/supportedERCs";
import { getContractPageParamsInfo } from "./_utils/getContractFromParams";
import { getContractPageMetadata } from "./_utils/getContractPageMetadata";
import { getContractPageSidebarLinks } from "./_utils/getContractPageSidebarLinks";
export default async function Layout(props: {
params: {
contractAddress: string;
chain_id: string;
};
children: React.ReactNode;
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
return <ConfigureCustomChain chainSlug={props.params.chain_id} />;
}
const { contract, chainMetadata } = info;
const contractPageMetadata = await getContractPageMetadata(contract);
const sidebarLinks = getContractPageSidebarLinks({
chainSlug: chainMetadata.slug,
contractAddress: contract.address,
metadata: contractPageMetadata,
});
return (
<ChakraProviderSetup>
<SidebarLayout sidebarLinks={sidebarLinks}>
<div className="border-border border-b pb-8">
<div className="flex flex-col gap-4 ">
<div className="flex flex-col justify-between gap-4 md:flex-row">
<ContractMetadata contract={contract} chain={chainMetadata} />
<PrimaryDashboardButton
contractAddress={contract.address}
chain={contract.chain}
contractInfo={{
chain: chainMetadata,
chainSlug: chainMetadata.slug,
contractAddress: contract.address,
}}
/>
</div>
<DeprecatedAlert chain={chainMetadata} />
</div>
</div>
<div className="h-8" />
<div className="pb-10">{props.children}</div>
</SidebarLayout>
</ChakraProviderSetup>
);
}
export async function generateMetadata({
params,
}: {
params: {
contractAddress: string;
chain_id: string;
};
}): Promise<Metadata> {
try {
const info = await getContractPageParamsInfo(params);
if (!info) {
throw new Error();
}
const [functionSelectors, contractMetadata] = await Promise.all([
resolveFunctionSelectors(info.contract),
getContractMetadata({
contract: info.contract,
}),
]);
if (contractMetadata.name === null) {
throw new Error();
}
const { isERC1155, isERC20, isERC721 } = supportedERCs(functionSelectors);
const contractDisplayName = `${contractMetadata.name}${
contractMetadata.symbol ? ` (${contractMetadata.symbol})` : ""
}`;
const cleanedChainName = info?.chainMetadata?.name
.replace("Mainnet", "")
.replace("Testnet", "")
.trim();
const title = `${contractDisplayName} | ${cleanedChainName} Smart Contract`;
let description = "";
if (isERC721 || isERC1155) {
description = `View tokens, source code, transactions, balances, and analytics for the ${contractDisplayName} smart contract on ${cleanedChainName}.`;
} else if (isERC20) {
description = `View ERC20 tokens, transactions, balances, source code, and analytics for the ${contractDisplayName} smart contract on ${cleanedChainName}`;
} else {
description = `View tokens, transactions, balances, source code, and analytics for the ${contractDisplayName} smart contract on ${cleanedChainName}`;
}
return {
title: title,
description: description,
};
} catch {
return {
title: `${shortenIfAddress(params.contractAddress)} | ${params.chain_id}`,
description: `View tokens, transactions, balances, source code, and analytics for the smart contract on Chain ID ${params.chain_id}`,
};
}
}
@@ -0,0 +1,25 @@
import { notFound, redirect } from "next/navigation";
import { ContractEditModulesPage } from "../../../../../../contract-ui/tabs/manage/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { isModularCore } = await getContractPageMetadata(info.contract);
if (!isModularCore) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <ContractEditModulesPage contract={info.contract} />;
}
@@ -0,0 +1,42 @@
import { notFound, redirect } from "next/navigation";
import { TokenIdPage } from "../../../../../../../contract-ui/tabs/nfts/components/token-id";
import { getContractPageParamsInfo } from "../../_utils/getContractFromParams";
import { getContractPageMetadata } from "../../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
tokenId: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract } = info;
const { supportedERCs } = await getContractPageMetadata(contract);
if (!supportedERCs.isERC721 && !supportedERCs.isERC1155) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
if (!isOnlyNumbers(props.params.tokenId)) {
// redirect to nfts index page
redirect(`/${props.params.chain_id}/${props.params.contractAddress}/nfts`);
}
return (
<TokenIdPage
contract={contract}
isErc721={supportedERCs.isERC721}
tokenId={props.params.tokenId}
/>
);
}
function isOnlyNumbers(str: string) {
return /^\d+$/.test(str);
}
@@ -0,0 +1,35 @@
import { notFound, redirect } from "next/navigation";
import { ContractNFTPage } from "../../../../../../contract-ui/tabs/nfts/page";
import { resolveFunctionSelectors } from "../../../../../../lib/selectors";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract } = info;
const { supportedERCs } = await getContractPageMetadata(contract);
if (!supportedERCs.isERC721 && !supportedERCs.isERC1155) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
const functionSelectors = await resolveFunctionSelectors(contract);
return (
<ContractNFTPage
contract={contract}
isErc721={supportedERCs.isERC721}
functionSelectors={functionSelectors}
/>
);
}
@@ -1,27 +1,60 @@
/* eslint-disable @next/next/no-img-element */
import { isProd } from "@/constants/env";
import { ImageResponse } from "@vercel/og";
import type { NextRequest } from "next/server";
import { ContractOG } from "og-lib/url-utils";
import { getContractMetadata } from "thirdweb/extensions/common";
import { getContractPageParamsInfo } from "./_utils/getContractFromParams";
export function shortenString(str: string) {
return `${str.substring(0, 7)}...${str.substring(str.length - 5)}`;
}
export const runtime = "edge";
// Make sure the font exists in the specified path:
export const config = {
runtime: "edge",
export const size = {
width: 1200,
height: 630,
};
const inter400_ = fetch(
new URL("og-lib/fonts/inter/400.ttf", import.meta.url),
).then((res) => res.arrayBuffer());
const inter500_ = fetch(
new URL("og-lib/fonts/inter/500.ttf", import.meta.url),
).then((res) => res.arrayBuffer());
const inter700_ = fetch(
new URL("og-lib/fonts/inter/700.ttf", import.meta.url),
).then((res) => res.arrayBuffer());
export default async function Image({
params,
}: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
try {
const info = await getContractPageParamsInfo(params);
if (!info) {
throw new Error();
}
const contractMetadata = await getContractMetadata({
contract: info.contract,
});
if (contractMetadata.name === null) {
throw new Error();
}
const contractDisplayName = `${contractMetadata.name}${
contractMetadata.symbol ? ` (${contractMetadata.symbol})` : ""
}`;
return contractOGImageTemplate({
displayName: contractDisplayName,
contractAddress: info.contract.address,
chainName: info.chainMetadata.name,
logo: contractMetadata.image,
});
} catch {
return contractOGImageTemplate({
contractAddress: params.contractAddress,
chainName: params.chain_id,
});
}
}
function shortenString(str: string) {
return `${str.substring(0, 7)}...${str.substring(str.length - 5)}`;
}
const OgBrandIcon: React.FC = () => (
// biome-ignore lint/a11y/noSvgWithoutTitle: not needed
@@ -60,9 +93,8 @@ const OgBrandIcon: React.FC = () => (
</svg>
);
const MAX_LENGTH = 50;
function textShortener(text: string) {
const MAX_LENGTH = 50;
const words = [];
let currentLength = 0;
let shortened = false;
@@ -108,12 +140,21 @@ function replaceAnyIpfsUrlWithGateway(url: string) {
return url;
}
export default async function handler(req: NextRequest) {
if (req.method !== "GET") {
return new Response("Method not allowed", { status: 405 });
}
const contractData = ContractOG.fromUrl(new URL(req.url));
async function contractOGImageTemplate(params: {
logo?: string;
displayName?: string;
contractAddress: string;
chainName: string;
}) {
const inter400_ = fetch(
new URL("../../../../../og-lib/fonts/inter/400.ttf", import.meta.url),
).then((res) => res.arrayBuffer());
const inter500_ = fetch(
new URL("../../../../../og-lib/fonts/inter/500.ttf", import.meta.url),
).then((res) => res.arrayBuffer());
const inter700_ = fetch(
new URL("../../../../../og-lib/fonts/inter/700.ttf", import.meta.url),
).then((res) => res.arrayBuffer());
const [inter400, inter500, inter700] = await Promise.all([
inter400_,
@@ -121,6 +162,10 @@ export default async function handler(req: NextRequest) {
inter700_,
]);
const title =
(params.displayName ? textShortener(params.displayName) : "") ||
shortenString(params.contractAddress);
return new ImageResponse(
<div
tw="w-full h-full flex justify-center py-8 px-8 "
@@ -133,31 +178,33 @@ export default async function handler(req: NextRequest) {
<div tw="flex flex-col my-auto w-full">
{/* if we have a logo render it */}
{contractData.logo && (
{params.logo && (
<img
alt=""
tw="w-50 h-50 rounded-lg mb-8 flex mx-auto"
src={replaceAnyIpfsUrlWithGateway(contractData.logo)}
src={replaceAnyIpfsUrlWithGateway(params.logo)}
/>
)}
{contractData.displayName &&
contractData.displayName !== contractData.contractAddress ? (
{params.displayName && params.displayName !== params.contractAddress ? (
<h3
tw="text-2xl font-bold flex text-center my-0 mb-4 mx-auto"
style={{
color: "#626262",
}}
>
{shortenString(contractData.contractAddress)}
{shortenString(params.contractAddress)}
</h3>
) : null}
<h1 tw="text-6xl text-white font-bold flex text-center my-0 mx-auto">
{textShortener(contractData.displayName) ||
shortenString(contractData.contractAddress)}
</h1>
{title && (
<h1 tw="text-6xl text-white font-bold flex text-center my-0 mx-auto">
{title}
</h1>
)}
<h2 tw="text-4xl text-white opacity-80 font-medium flex text-center my-0 mt-10 mx-auto">
{contractData.chainName}
{params.chainName}
</h2>
</div>
@@ -1,4 +1,5 @@
import { Flex, GridItem, SimpleGrid } from "@chakra-ui/react";
"use client";
import { PublishedBy } from "components/contract-components/shared/published-by";
import type { ThirdwebContract } from "thirdweb";
import { AnalyticsOverview } from "./components/Analytics";
@@ -18,6 +19,8 @@ interface ContractOverviewPageProps {
isErc1155: boolean;
isErc20: boolean;
isPermissionsEnumerable: boolean;
chainSlug: string;
isAnalyticsSupported: boolean;
}
const TRACKING_CATEGORY = "contract_overview";
@@ -30,22 +33,28 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
hasEnglishAuctions,
hasDirectListings,
isPermissionsEnumerable,
chainSlug,
isAnalyticsSupported,
}) => {
return (
<SimpleGrid columns={{ base: 1, xl: 10 }} gap={20}>
<GridItem as={Flex} colSpan={{ xl: 7 }} direction="column" gap={16}>
<div className="flex flex-col gap-8 lg:flex-row">
<div className="flex flex-col gap-16">
<ContractChecklist
isErc721={isErc721}
isErc1155={isErc1155}
isErc20={isErc20}
contract={contract}
chainSlug={chainSlug}
/>
<AnalyticsOverview
contractAddress={contract.address}
chainId={contract.chain.id}
trackingCategory={TRACKING_CATEGORY}
/>
{isAnalyticsSupported && (
<AnalyticsOverview
contractAddress={contract.address}
chainId={contract.chain.id}
trackingCategory={TRACKING_CATEGORY}
chainSlug={chainSlug}
/>
)}
{(hasEnglishAuctions || hasDirectListings) && (
<MarketplaceDetails
@@ -53,31 +62,44 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
trackingCategory={TRACKING_CATEGORY}
hasEnglishAuctions={hasEnglishAuctions}
hasDirectListings={hasDirectListings}
chainSlug={chainSlug}
/>
)}
{(isErc1155 || isErc721) && (
<NFTDetails
contract={contract}
trackingCategory={TRACKING_CATEGORY}
isErc721={isErc721}
chainSlug={chainSlug}
/>
)}
{isErc20 && <TokenDetails contract={contract} />}
<LatestEvents
contract={contract}
trackingCategory={TRACKING_CATEGORY}
chainSlug={chainSlug}
/>
{isPermissionsEnumerable && (
<PermissionsTable
contract={contract}
trackingCategory={TRACKING_CATEGORY}
chainSlug={chainSlug}
/>
)}
<BuildYourApp trackingCategory={TRACKING_CATEGORY} />
</GridItem>
<GridItem colSpan={{ xl: 3 }} as={Flex} direction="column" gap={6}>
<BuildYourApp
trackingCategory={TRACKING_CATEGORY}
chainSlug={chainSlug}
contractAddress={contract.address}
/>
</div>
<div className="shrink-0 lg:w-[300px]">
<PublishedBy contract={contract} />
</GridItem>
</SimpleGrid>
</div>
</div>
);
};
@@ -1,8 +1,6 @@
import { ThirdwebAreaChart } from "@/components/blocks/charts/area-chart";
import { Button } from "@/components/ui/button";
import { useTabHref } from "contract-ui/utils";
import {
useAnalyticsSupportedForChain,
useLogsAnalytics,
useTransactionAnalytics,
useUniqueWalletsAnalytics,
@@ -16,15 +14,15 @@ interface AnalyticsOverviewProps {
chainId: number;
contractAddress: string;
trackingCategory: string;
chainSlug: string;
}
export const AnalyticsOverview: React.FC<AnalyticsOverviewProps> = ({
chainId,
contractAddress,
trackingCategory,
chainSlug,
}) => {
const analyticsSupported = useAnalyticsSupportedForChain(chainId);
const trackEvent = useTrack();
const [startDate] = useState(
(() => {
@@ -35,32 +33,29 @@ export const AnalyticsOverview: React.FC<AnalyticsOverviewProps> = ({
);
const [endDate] = useState(new Date());
const analyticsHref = useTabHref("analytics");
if (!analyticsSupported.data) {
return null;
}
return (
<div className="relative">
<Button
asChild
className="absolute top-4 right-6 flex flex-row items-center gap-1"
size="sm"
variant="outline"
onClick={() => {
trackEvent({
category: trackingCategory,
action: "click",
label: "view_all_analytics",
});
}}
>
<Link href={analyticsHref}>
<span>View All</span>
<ArrowRightIcon className="size-4" />
</Link>
</Button>
<div className="mb-4 flex items-center justify-between gap-4">
<h2 className="font-semibold text-2xl tracking-tight">Analytics</h2>
<Button
asChild
className="gap-1"
size="sm"
variant="outline"
onClick={() => {
trackEvent({
category: trackingCategory,
action: "click",
label: "view_all_analytics",
});
}}
>
<Link href={`/${chainSlug}/${contractAddress}/analytics`}>
<span>View All</span>
<ArrowRightIcon className="size-4" />
</Link>
</Button>
</div>
<OverviewAnalytics
chainId={chainId}
@@ -107,7 +102,6 @@ function OverviewAnalytics(props: ChartProps) {
return (
<ThirdwebAreaChart
title="Analytics"
config={{
wallets: {
label: "Unique Wallets",
@@ -7,26 +7,21 @@ import {
} from "@chakra-ui/react";
import { ChakraNextImage as Image } from "components/Image";
import { PRODUCTS } from "components/product-pages/common/nav/data";
import { useTabHref } from "contract-ui/utils";
import {
Card,
Heading,
Text,
TrackedLink,
type TrackedLinkProps,
} from "tw-components";
import { Card, Text, TrackedLink, type TrackedLinkProps } from "tw-components";
const RENDERED_PRODUCTS = ["sdk", "storage", "ui-components", "auth"];
interface BuildYourAppProps {
trackingCategory: TrackedLinkProps["category"];
contractAddress: string;
chainSlug: string;
}
export const BuildYourApp: React.FC<BuildYourAppProps> = ({
trackingCategory,
contractAddress,
chainSlug,
}) => {
const codeHref = useTabHref("code");
return (
<Card
px={{ base: 4, md: 8 }}
@@ -37,13 +32,15 @@ export const BuildYourApp: React.FC<BuildYourAppProps> = ({
>
<SimpleGrid {...{ columns: { base: 1, md: 2 } }} gap={8}>
<GridItem as={Flex} direction="column" gap={4}>
<Heading size="label.lg">Build your app</Heading>
<h2 className="font-semibold text-2xl tracking-tight">
Build your app
</h2>
<Text size="body.md">
<LinkOverlay
as={TrackedLink}
category={trackingCategory}
label="build_your_app"
href={codeHref}
href={`/${chainSlug}/${contractAddress}/code`}
color="blue.500"
>
Learn more
@@ -1,6 +1,8 @@
import { AdminOnly } from "@3rdweb-sdk/react/components/roles/admin-only";
import { useIsMinter } from "@3rdweb-sdk/react/hooks/useContractRoles";
import { StepsCard } from "components/dashboard/StepsCard";
import { useTabHref } from "contract-ui/utils";
import { useContractFunctionSelectors } from "contract-ui/hooks/useContractFunctionSelectors";
import Link from "next/link";
import { useMemo } from "react";
import type { ThirdwebContract } from "thirdweb";
import * as ERC20Ext from "thirdweb/extensions/erc20";
@@ -9,15 +11,13 @@ import * as ERC1155Ext from "thirdweb/extensions/erc1155";
import * as ERC4337Ext from "thirdweb/extensions/erc4337";
import { getAccounts } from "thirdweb/extensions/erc4337";
import { useReadContract } from "thirdweb/react";
import { Link, Text } from "tw-components";
import { AdminOnly } from "../../../../@3rdweb-sdk/react/components/roles/admin-only";
import { useContractFunctionSelectors } from "../../../hooks/useContractFunctionSelectors";
interface ContractChecklistProps {
contract: ThirdwebContract;
isErc721: boolean;
isErc1155: boolean;
isErc20: boolean;
chainSlug: string;
}
type Step = {
@@ -44,13 +44,14 @@ function Inner({
isErc20,
isErc721,
functionSelectors,
chainSlug,
}: ContractChecklistProps & {
functionSelectors: string[];
}) {
const nftHref = useTabHref("nfts");
const tokenHref = useTabHref("tokens");
const accountsHref = useTabHref("accounts");
const claimConditionsHref = useTabHref("claim-conditions");
const nftHref = `/${chainSlug}/${contract.address}/nfts`;
const tokenHref = `/${chainSlug}/${contract.address}/tokens`;
const accountsHref = `/${chainSlug}/${contract.address}/accounts`;
const claimConditionsHref = `/${chainSlug}/${contract.address}/claim-conditions`;
const erc721Claimed = useReadContract(ERC721Ext.getTotalClaimedSupply, {
contract: contract,
@@ -176,13 +177,16 @@ function Inner({
steps.push({
title: "First NFT uploaded",
children: (
<Text size="body.sm">
<p className="text-muted-foreground text-sm">
Head to the{" "}
<Link href={nftHref} color="blue.500">
<Link
href={nftHref}
className="text-link-foreground hover:text-foreground"
>
NFTs tab
</Link>{" "}
to upload your NFT metadata.
</Text>
</p>
),
// can be either 721 or 1155
completed: (nftsQuery.data?.length || 0) > 0,
@@ -193,13 +197,16 @@ function Inner({
steps.push({
title: "Set NFT Metadata",
children: (
<Text size="label.sm">
<p className="text-muted-foreground text-sm">
Head to the{" "}
<Link href={nftHref} color="blue.500">
<Link
href={nftHref}
className="text-link-foreground hover:text-foreground"
>
NFTs tab
</Link>{" "}
to set your NFT metadata.
</Text>
</p>
),
completed: !!sharedMetadataQuery?.data,
});
@@ -209,14 +216,17 @@ function Inner({
steps.push({
title: "Set Claim Conditions",
children: (
<Text size="label.sm">
<p className="text-muted-foreground text-sm">
Head to the{" "}
<Link href={claimConditionsHref} color="blue.500">
<Link
href={claimConditionsHref}
className="text-link-foreground hover:text-foreground"
>
Claim Conditions tab
</Link>{" "}
to set your claim conditions. Users will be able to claim your drop
only if a claim phase is active.
</Text>
</p>
),
completed:
(claimConditions.data?.length || 0) > 0 ||
@@ -228,7 +238,9 @@ function Inner({
steps.push({
title: "First NFT claimed",
children: (
<Text size="label.sm">No NFTs have been claimed so far.</Text>
<p className="text-muted-foreground text-sm">
No NFTs have been claimed so far.
</p>
),
completed: (erc721Claimed.data || 0n) > 0n,
});
@@ -238,7 +250,9 @@ function Inner({
steps.push({
title: "First token claimed",
children: (
<Text size="label.sm">No tokens have been claimed so far.</Text>
<p className="text-muted-foreground text-sm">
No tokens have been claimed so far.
</p>
),
completed: (erc20Supply.data || 0n) > 0n,
});
@@ -248,13 +262,16 @@ function Inner({
steps.push({
title: "First token minted",
children: (
<Text size="label.sm">
<p className="text-muted-foreground text-sm">
Head to the{" "}
<Link href={tokenHref} color="blue.500">
<Link
href={tokenHref}
className="text-link-foreground hover:text-foreground"
>
token tab
</Link>{" "}
to mint your first token.
</Text>
</p>
),
completed: (erc20Supply.data || 0n) > 0n,
});
@@ -264,13 +281,16 @@ function Inner({
steps.push({
title: "First NFT minted",
children: (
<Text size="label.sm">
<p className="text-muted-foreground text-sm">
Head to the{" "}
<Link href={nftHref} color="blue.500">
<Link
href={nftHref}
className="text-link-foreground hover:text-foreground"
>
NFTs tab
</Link>{" "}
to mint your first token.
</Text>
</p>
),
// can be either 721 or 1155
completed: (nftsQuery.data?.length || 0) > 0,
@@ -281,13 +301,16 @@ function Inner({
steps.push({
title: "First account created",
children: (
<Text size="label.sm">
<p className="text-muted-foreground text-sm">
Head to the{" "}
<Link href={accountsHref} color="blue.500">
<Link
href={accountsHref}
className="text-link-foreground hover:text-foreground"
>
Accounts tab
</Link>{" "}
to create your first account.
</Text>
</p>
),
completed: (accounts.data?.length || 0) > 0,
});
@@ -297,13 +320,16 @@ function Inner({
steps.push({
title: "NFTs revealed",
children: (
<Text size="label.sm">
<p className="text-muted-foreground text-sm">
Head to the{" "}
<Link href={nftHref} color="blue.500">
<Link
href={nftHref}
className="text-link-foreground hover:text-foreground"
>
NFTs tab
</Link>{" "}
to reveal your NFTs.
</Text>
</p>
),
// This is always false because if there are batches to reveal, the step doesn't show.
completed: false,
@@ -6,18 +6,15 @@ import {
Box,
ButtonGroup,
Flex,
Icon,
List,
SimpleGrid,
Spinner,
Stack,
Tooltip,
} from "@chakra-ui/react";
import { useTabHref } from "contract-ui/utils";
import { AnimatePresence, motion } from "framer-motion";
import { useClipboard } from "hooks/useClipboard";
import { CopyIcon } from "lucide-react";
import { useState } from "react";
import { FiCopy } from "react-icons/fi";
import { toast } from "sonner";
import type { ThirdwebContract } from "thirdweb";
import {
@@ -34,23 +31,22 @@ import { shortenString } from "utils/usedapp-external";
interface LatestEventsProps {
trackingCategory: TrackedLinkProps["category"];
contract: ThirdwebContract;
chainSlug: string;
}
export const LatestEvents: React.FC<LatestEventsProps> = ({
contract,
trackingCategory,
chainSlug,
}) => {
const [autoUpdate] = useState(true);
const eventsHref = useTabHref("events");
const eventsHref = `/${chainSlug}/${contract.address}/events`;
const allEvents = useActivity(contract, autoUpdate);
return (
<Flex gap={6} flexDirection="column">
<Flex align="center" justify="space-between" w="full">
<Heading flexShrink={0} size="title.sm">
Latest Events
</Heading>
<h2 className="font-semibold text-2xl tracking-tight">Latest Events</h2>
<TrackedLink
category={trackingCategory}
label="view_all_events"
@@ -95,7 +91,12 @@ export const LatestEvents: React.FC<LatestEventsProps> = ({
) : null}
<AnimatePresence initial={false}>
{allEvents?.slice(0, 3).map((e) => (
<EventsFeedItem key={e.transactionHash} transaction={e} />
<EventsFeedItem
key={e.transactionHash}
transaction={e}
contractAddress={contract.address}
chainSlug={chainSlug}
/>
))}
</AnimatePresence>
</List>
@@ -106,12 +107,17 @@ export const LatestEvents: React.FC<LatestEventsProps> = ({
interface EventsFeedItemProps {
transaction: InternalTransaction;
contractAddress: string;
chainSlug: string;
}
const EventsFeedItem: React.FC<EventsFeedItemProps> = ({ transaction }) => {
const EventsFeedItem: React.FC<EventsFeedItemProps> = ({
transaction,
contractAddress,
chainSlug,
}) => {
const { onCopy } = useClipboard(transaction.transactionHash);
const href = useTabHref("events");
const eventsHref = `/${chainSlug}/${contractAddress}/events`;
return (
<div>
@@ -151,7 +157,7 @@ const EventsFeedItem: React.FC<EventsFeedItemProps> = ({ transaction }) => {
_last={{ borderBottomWidth: 0 }}
>
<Box gridColumn="span 3">
<Stack direction="row" align="center" spacing={3}>
<div className="flex flex-row items-center gap-3">
<Tooltip
p={0}
bg="transparent"
@@ -172,13 +178,13 @@ const EventsFeedItem: React.FC<EventsFeedItemProps> = ({ transaction }) => {
toast.info("Transaction hash copied.");
}}
>
<Icon as={FiCopy} boxSize={3} />
<CopyIcon className="size-3" />
</Button>
</Tooltip>
<Text fontFamily="mono" noOfLines={1}>
{shortenString(transaction.transactionHash)}
</Text>
</Stack>
</div>
</Box>
<ButtonGroup
@@ -191,7 +197,7 @@ const EventsFeedItem: React.FC<EventsFeedItemProps> = ({ transaction }) => {
>
{transaction.events.slice(0, 2).map((e, idx) => (
// biome-ignore lint/suspicious/noArrayIndexKey: FIXME
<LinkButton key={idx} href={`${href}?event=${e.eventName}`}>
<LinkButton key={idx} href={`${eventsHref}?event=${e.eventName}`}>
<Text color="whiteBg" fontWeight="600" isTruncated>
{e.eventName}
</Text>
@@ -1,14 +1,8 @@
import { WalletAddress } from "@/components/blocks/wallet-address";
import {
Flex,
GridItem,
SimpleGrid,
Skeleton,
SkeletonText,
useBreakpointValue,
} from "@chakra-ui/react";
import { Badge } from "@/components/ui/badge";
import { SkeletonContainer } from "@/components/ui/skeleton";
import { TrackedLinkTW } from "@/components/ui/tracked-link";
import { ListingStatsV3 } from "contract-ui/tabs/listings/components/listing-stats";
import { useTabHref } from "contract-ui/utils";
import { useMemo } from "react";
import type { ThirdwebContract } from "thirdweb";
import {
@@ -21,7 +15,6 @@ import {
} from "thirdweb/extensions/marketplace";
import { useReadContract } from "thirdweb/react";
import { min } from "thirdweb/utils";
import { Badge, Card, Heading, Text, TrackedLink } from "tw-components";
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
type ListingData =
@@ -43,13 +36,15 @@ type ListingData =
type ListingCardsSectionProps = {
contract: ThirdwebContract;
trackingCategory: string;
chainSlug: string;
};
const DirectListingCards: React.FC<ListingCardsSectionProps> = ({
trackingCategory,
contract,
chainSlug,
}) => {
const directListingsHref = useTabHref("direct-listings");
const directListingsHref = `/${chainSlug}/${contract.address}/direct-listings`;
const countQuery = useReadContract(totalListings, { contract });
const listingsQuery = useReadContract(getAllListings, {
contract,
@@ -83,25 +78,25 @@ const DirectListingCards: React.FC<ListingCardsSectionProps> = ({
return (
<>
<Flex align="center" justify="space-between" w="full">
<Heading size="label.lg">Direct Listings</Heading>
<TrackedLink
<div className="flex w-full items-center justify-between">
<h2 className="font-semibold text-2xl tracking-tight">
Direct Listing
</h2>
<TrackedLinkTW
category={trackingCategory}
label="view_all_direct_listings"
color="blue.400"
_light={{
color: "blue.600",
}}
gap={4}
className="text-link-foreground hover:text-foreground"
href={directListingsHref}
>
View all -&gt;
</TrackedLink>
</Flex>
</TrackedLinkTW>
</div>
<ListingCards
listings={listings}
isPending={listingsQuery.isPending}
trackingCategory={trackingCategory}
chainSlug={chainSlug}
contractAddress={contract.address}
/>
</>
);
@@ -110,8 +105,9 @@ const DirectListingCards: React.FC<ListingCardsSectionProps> = ({
const EnglishAuctionCards: React.FC<ListingCardsSectionProps> = ({
trackingCategory,
contract,
chainSlug,
}) => {
const englishAuctionsHref = useTabHref("english-auctions");
const englishAuctionsHref = `/${chainSlug}/${contract.address}/english-auctions`;
const countQuery = useReadContract(totalAuctions, { contract });
const auctionsQuery = useReadContract(getAllAuctions, {
contract,
@@ -145,25 +141,25 @@ const EnglishAuctionCards: React.FC<ListingCardsSectionProps> = ({
return (
<>
<Flex align="center" justify="space-between" w="full">
<Heading size="label.lg">English Auctions</Heading>
<TrackedLink
<div className="flex w-full items-center justify-between">
<h2 className="font-semibold text-2xl tracking-tight">
English Auctions
</h2>
<TrackedLinkTW
category={trackingCategory}
label="view_all_english_auctions"
color="blue.400"
_light={{
color: "blue.600",
}}
gap={4}
className="text-link-foreground hover:text-foreground"
href={englishAuctionsHref}
>
View all -&gt;
</TrackedLink>
</Flex>
</TrackedLinkTW>
</div>
<ListingCards
listings={auctions}
isPending={auctionsQuery.isPending}
trackingCategory={trackingCategory}
chainSlug={chainSlug}
contractAddress={contract.address}
/>
</>
);
@@ -174,6 +170,7 @@ interface MarketplaceDetailsVersionProps {
trackingCategory: string;
hasEnglishAuctions: boolean;
hasDirectListings: boolean;
chainSlug: string;
}
export const MarketplaceDetails: React.FC<MarketplaceDetailsVersionProps> = ({
@@ -181,28 +178,33 @@ export const MarketplaceDetails: React.FC<MarketplaceDetailsVersionProps> = ({
trackingCategory,
hasDirectListings,
hasEnglishAuctions,
chainSlug,
}) => {
return (
<Flex gap={6} flexDirection="column">
<Heading size="title.sm">Listings</Heading>
<div className="flex flex-col gap-6">
<h2 className="font-semibold text-2xl tracking-tight">Listings</h2>
<ListingStatsV3
contract={contract}
hasDirectListings={hasDirectListings}
hasEnglishAuctions={hasEnglishAuctions}
/>
{hasDirectListings && contract && (
{hasDirectListings && (
<DirectListingCards
contract={contract}
trackingCategory={trackingCategory}
chainSlug={chainSlug}
/>
)}
{hasEnglishAuctions && contract && (
{hasEnglishAuctions && (
<EnglishAuctionCards
contract={contract}
trackingCategory={trackingCategory}
chainSlug={chainSlug}
/>
)}
</Flex>
</div>
);
};
@@ -239,89 +241,116 @@ interface ListingCardsProps {
isPending: boolean;
trackingCategory: string;
isMarketplaceV1?: boolean;
chainSlug: string;
contractAddress: string;
}
const ListingCards: React.FC<ListingCardsProps> = ({
listings,
isPending,
isMarketplaceV1,
trackingCategory,
chainSlug,
contractAddress,
}) => {
const isMobile = useBreakpointValue({ base: true, md: false });
listings = isPending
? Array.from({ length: isMobile ? 2 : 3 }).map((_, idx) =>
dummyMetadata(idx),
)
: listings.slice(0, isMobile ? 2 : 3);
? Array.from({ length: 3 }).map((_, idx) => dummyMetadata(idx))
: listings.slice(0, 3);
const directListingsHref = useTabHref("direct-listings");
const englishAuctionsHref = useTabHref("english-auctions");
const directListingsHref = `/${chainSlug}/${contractAddress}/direct-listings`;
const englishAuctionsHref = `/${chainSlug}/${contractAddress}/english-auctions`;
return (
<SimpleGrid gap={{ base: 3, md: 6 }} columns={{ base: 2, md: 3 }}>
<div className="grid grid-cols-2 gap-3 md:grid-cols-3 md:gap-6 max-sm:[&>*:nth-child(n+3)]:hidden">
{listings.map((listing, index) => (
<GridItem
<div
className="relative rounded-lg border border-border bg-muted/50 hover:border-foreground hover:bg-muted"
key={`${listing.creatorAddress}-${index}`}
as={TrackedLink}
category={trackingCategory}
href={
listing.type === "direct-listing"
? directListingsHref
: englishAuctionsHref
}
_hover={{ opacity: 0.75, textDecoration: "none" }}
>
<Card p={0} position="relative">
<div className="relative aspect-square w-full overflow-hidden rounded-xl">
<Skeleton isLoaded={!isPending}>
<NFTMediaWithEmptyState
metadata={listing.asset.metadata}
requireInteraction
width="100%"
height="100%"
/>
</Skeleton>
</div>
<Flex p={4} pb={3} gap={1} direction="column">
<Skeleton w={!isPending ? "100%" : "50%"} isLoaded={!isPending}>
<Heading size="label.md">{listing.asset.metadata.name}</Heading>
</Skeleton>
{isMarketplaceV1 && (
<SkeletonText isLoaded={!isPending}>
<Text size="body.sm">
{listing.type === "direct-listing"
? "Direct Listing"
: "English Auction"}
</Text>
</SkeletonText>
)}
<div className="relative aspect-square w-full overflow-hidden rounded-lg">
{/* Image */}
<SkeletonContainer
loadedData={isPending ? undefined : listing.asset.metadata}
skeletonData={listing.asset.metadata}
className="block h-full w-full"
render={(v) => {
return (
<NFTMediaWithEmptyState
metadata={v}
requireInteraction
width="100%"
height="100%"
/>
);
}}
/>
</div>
<Text size="body.sm" mt={4}>
Seller
</Text>
<SkeletonText isLoaded={!isPending}>
<WalletAddress address={listing.creatorAddress} />
</SkeletonText>
<SkeletonText
as={Badge}
background="backgroundHighlight"
isLoaded={!isPending}
skeletonHeight={3.5}
noOfLines={1}
position="absolute"
rounded="lg"
size="body.xs"
p={2}
top={2}
right={2}
<div className="flex flex-col gap-1 p-4 pb-3">
{/* Card Link + Title */}
<SkeletonContainer
loadedData={isPending ? undefined : listing.asset.metadata.name}
skeletonData="Listing Title"
render={(v) => (
<TrackedLinkTW
category={trackingCategory}
className="before:absolute before:inset-0"
href={
listing.type === "direct-listing"
? directListingsHref
: englishAuctionsHref
}
>
{v}
</TrackedLinkTW>
)}
/>
{isMarketplaceV1 && (
<SkeletonContainer
className="self-start"
loadedData={
isPending
? undefined
: listing.type === "direct-listing"
? "Direct Listing"
: "English Auction"
}
skeletonData={listing.type}
render={(v) => (
<p className="text-muted-foreground text-sm">{v}</p>
)}
/>
)}
<SkeletonContainer
loadedData={isPending ? undefined : listing.creatorAddress}
skeletonData={listing.creatorAddress}
className="mt-4"
render={(v) => (
<div>
<p className="text-muted-foreground text-sm">Seller</p>
<WalletAddress
className="relative z-[1] self-start"
address={v}
/>
</div>
)}
/>
{!isPending && (
<Badge
variant="outline"
className="absolute top-2 right-2 bg-background py-1.5"
>
<b>{listing.currencyValue.displayValue}</b>{" "}
{listing.currencyValue.symbol}
</SkeletonText>
</Flex>
</Card>
</GridItem>
<p className="line-clamp-1">
<b>{listing.currencyValue.displayValue}</b>{" "}
{listing.currencyValue.symbol}
</p>
</Badge>
)}
</div>
</div>
))}
</SimpleGrid>
</div>
);
};
@@ -1,25 +1,26 @@
import { Flex, useBreakpointValue } from "@chakra-ui/react";
import { useTabHref } from "contract-ui/utils";
import type { ThirdwebContract } from "thirdweb";
import * as ERC721 from "thirdweb/extensions/erc721";
import * as ERC1155 from "thirdweb/extensions/erc1155";
import { useReadContract } from "thirdweb/react";
import { Heading, TrackedLink, type TrackedLinkProps } from "tw-components";
import { NFTCards } from "./NFTCards";
import { TrackedLink, type TrackedLinkProps } from "tw-components";
import { NFTCards } from "../../_components/NFTCards";
interface NFTDetailsProps {
contract: ThirdwebContract;
trackingCategory: TrackedLinkProps["category"];
isErc721: boolean;
chainSlug: string;
}
export const NFTDetails: React.FC<NFTDetailsProps> = ({
contract,
trackingCategory,
isErc721,
chainSlug,
}) => {
const isMobile = useBreakpointValue({ base: true, md: false });
const nftsHref = useTabHref("nfts");
const nftsHref = `/${chainSlug}/${contract.address}/nfts`;
const nftQuery = useReadContract(
isErc721 ? ERC721.getNFTs : ERC1155.getNFTs,
@@ -38,7 +39,7 @@ export const NFTDetails: React.FC<NFTDetailsProps> = ({
return displayableNFTs.length === 0 && !nftQuery.isPending ? null : (
<Flex direction="column" gap={{ base: 3, md: 6 }}>
<Flex align="center" justify="space-between" w="full">
<Heading size="title.sm">NFT Details</Heading>
<h2 className="font-semibold text-2xl tracking-tight">NFT Details</h2>
<TrackedLink
category={trackingCategory}
label="view_all_nfts"
@@ -1,18 +1,10 @@
import {
Box,
Flex,
Icon,
List,
SimpleGrid,
Stack,
Tag,
Tooltip,
} from "@chakra-ui/react";
import { useTabHref } from "contract-ui/utils";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { Box, Flex, List, SimpleGrid, Tag } from "@chakra-ui/react";
import { getAllRoleMembers } from "contract-ui/hooks/permissions";
import { AnimatePresence, motion } from "framer-motion";
import { useClipboard } from "hooks/useClipboard";
import { CopyIcon } from "lucide-react";
import { useMemo } from "react";
import { FiCopy } from "react-icons/fi";
import { toast } from "sonner";
import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
import { useReadContract } from "thirdweb/react";
@@ -25,22 +17,22 @@ import {
type TrackedLinkProps,
} from "tw-components";
import { shortenIfAddress } from "utils/usedapp-external";
import { getAllRoleMembers } from "../../../hooks/permissions";
interface PermissionsTableProps {
contract: ThirdwebContract;
trackingCategory: TrackedLinkProps["category"];
chainSlug: string;
}
export const PermissionsTable: React.FC<PermissionsTableProps> = ({
contract,
trackingCategory,
chainSlug,
}) => {
const allRoleMembers = useReadContract(getAllRoleMembers, {
contract,
});
const permissionsHref = useTabHref("permissions");
const permissionsHref = `/${chainSlug}/${contract.address}/permissions`;
const members = useMemo(() => {
return (
Object.entries(allRoleMembers.data || {}).reduce(
@@ -62,9 +54,7 @@ export const PermissionsTable: React.FC<PermissionsTableProps> = ({
return (
<Flex gap={6} flexDirection="column">
<Flex align="center" justify="space-between" w="full">
<Heading flexShrink={0} size="title.sm">
Permissions
</Heading>
<h2 className="font-semibold text-2xl tracking-tight">Permissions</h2>
<TrackedLink
category={trackingCategory}
label="view_all_permissions"
@@ -166,17 +156,8 @@ const PermissionsItem: React.FC<PermissionsItemProps> = ({ data }) => {
_last={{ borderBottomWidth: 0 }}
>
<Box gridColumn="span 2">
<Stack direction="row" align="center" spacing={3}>
<Tooltip
p={0}
bg="transparent"
boxShadow="none"
label={
<Card py={2} px={4} bgColor="backgroundHighlight">
<Text size="label.sm">Copy address to clipboard</Text>
</Card>
}
>
<div className="flex flex-row items-center gap-3">
<ToolTipLabel label="Copy address to clipboard">
<Button
size="sm"
bg="transparent"
@@ -185,13 +166,13 @@ const PermissionsItem: React.FC<PermissionsItemProps> = ({ data }) => {
toast.info("Address copied.");
}}
>
<Icon as={FiCopy} boxSize={3} />
<CopyIcon className="size-3" />
</Button>
</Tooltip>
</ToolTipLabel>
<Text fontFamily="mono" noOfLines={1}>
{shortenIfAddress(data.member)}
</Text>
</Stack>
</div>
</Box>
<Box gridColumn="span 1" />
@@ -1,6 +1,5 @@
import { TokenSupply } from "contract-ui/tabs/tokens/components/supply";
import type { ThirdwebContract } from "thirdweb";
import { Heading } from "tw-components";
interface TokenDetailsProps {
contract: ThirdwebContract;
@@ -10,7 +9,7 @@ export const TokenDetails: React.FC<TokenDetailsProps> = ({ contract }) => {
return (
<div className="flex flex-col gap-6">
<div className="flex w-full flex-row items-center justify-between">
<Heading size="title.sm">Token Details</Heading>
<h2 className="font-semibold text-2xl tracking-tight">Token Details</h2>
</div>
<TokenSupply contract={contract} />
</div>
@@ -0,0 +1,36 @@
import { notFound } from "next/navigation";
import { getContractPageParamsInfo } from "./_utils/getContractFromParams";
import { getContractPageMetadata } from "./_utils/getContractPageMetadata";
import { ContractOverviewPage } from "./overview/ContractOverviewPage";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract, chainMetadata } = info;
const contractPageMetadata = await getContractPageMetadata(contract);
return (
<ContractOverviewPage
contract={contract}
hasDirectListings={contractPageMetadata.isDirectListingSupported}
hasEnglishAuctions={contractPageMetadata.isEnglishAuctionSupported}
isErc1155={contractPageMetadata.supportedERCs.isERC1155}
isErc20={contractPageMetadata.supportedERCs.isERC20}
isErc721={contractPageMetadata.supportedERCs.isERC721}
isPermissionsEnumerable={
contractPageMetadata.isPermissionsEnumerableSupported
}
chainSlug={chainMetadata.slug}
isAnalyticsSupported={contractPageMetadata.isAnalyticsSupported}
/>
);
}
@@ -0,0 +1,29 @@
import { notFound } from "next/navigation";
import { ContractPermissionsPage } from "../../../../../../contract-ui/tabs/permissions/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { contract } = info;
const { isPermissionsEnumerableSupported } =
await getContractPageMetadata(contract);
return (
<ContractPermissionsPage
contract={contract}
chainSlug={info.chainMetadata.slug}
detectedPermissionEnumerable={isPermissionsEnumerableSupported}
/>
);
}
@@ -0,0 +1,25 @@
import { notFound, redirect } from "next/navigation";
import { ContractProposalsPage } from "../../../../../../contract-ui/tabs/proposals/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { isVoteContract } = await getContractPageMetadata(info.contract);
if (!isVoteContract) {
redirect(`/${props.params.chain_id}/${props.params.contractAddress}`);
}
return <ContractProposalsPage contract={info.contract} />;
}
@@ -0,0 +1,42 @@
import { notFound } from "next/navigation";
import * as CommonExt from "thirdweb/extensions/common";
import { ContractSettingsPage } from "../../../../../../contract-ui/tabs/settings/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
const { functionSelectors } = await getContractPageMetadata(info.contract);
return (
<ContractSettingsPage
contract={info.contract}
isContractMetadataSupported={[
CommonExt.isGetContractMetadataSupported(functionSelectors),
CommonExt.isSetContractMetadataSupported(functionSelectors),
].every(Boolean)}
isPrimarySaleSupported={[
CommonExt.isPrimarySaleRecipientSupported(functionSelectors),
CommonExt.isSetPrimarySaleRecipientSupported(functionSelectors),
].every(Boolean)}
isRoyaltiesSupported={[
CommonExt.isGetDefaultRoyaltyInfoSupported(functionSelectors),
CommonExt.isSetDefaultRoyaltyInfoSupported(functionSelectors),
].every(Boolean)}
isPlatformFeesSupported={[
CommonExt.isGetPlatformFeeInfoSupported(functionSelectors),
CommonExt.isSetPlatformFeeInfoSupported(functionSelectors),
].every(Boolean)}
/>
);
}
@@ -0,0 +1,18 @@
import { notFound } from "next/navigation";
import { ContractSourcesPage } from "../../../../../../contract-ui/tabs/sources/page";
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
export default async function Page(props: {
params: {
contractAddress: string;
chain_id: string;
};
}) {
const info = await getContractPageParamsInfo(props.params);
if (!info) {
notFound();
}
return <ContractSourcesPage contract={info.contract} />;
}

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