Compare commits

...
Author SHA1 Message Date
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
f47aa61915 Version Packages (#4263)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-25 11:22:32 +12:00
gregfromstl a0aea23e74 Set default auth mode to prevent double popup (#4274)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR fixes a conflict between popup and window authentication modes on Firefox.

### Detailed summary
- Set the default authentication mode to "popup" if not specified
- Ensure popup authentication mode is used when not explicitly defined

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

<!-- end pr-codex -->
2024-08-24 21:08:40 +00:00
1405598e7e adding api for pay direct transfers (#4224)
Co-authored-by: Joaquim Verges <[email protected]>
Co-authored-by: Edward Sun <[email protected]>
Co-authored-by: Edward Sun <[email protected]>
2024-08-23 23:45:23 +00:00
MananTank 120d61f410 Use formatNumber util for showing token balances (#4269)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update UI components to display wallet balances with up to 5 decimal places.

### Detailed summary
- Updated `formatTokenBalance` function to use `formatNumber` with 5 decimal places
- Added `formatNumber` function to format numbers with specified decimal places
- Updated balance display in UI components to use `formatNumber` with conditional decimal places based on the value

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

<!-- end pr-codex -->
2024-08-23 22:12:08 +00:00
jnsdls 2973ba1f54 [Update] Make bundle ID regex case-insensitive (#4268)
BLOCKED BY: https://github.com/thirdweb-dev/api-server/pull/1019
2024-08-23 21:00:49 +00:00
Alec AnanianandGitHub 7a2de70310 react: add hideSwitchWallet param to wallet details modal (#4267) 2024-08-23 13:37:51 -07:00
gregfromstl 659cb03eea [Docs] Feature: Automatically unroll function inputs and outputs (#4236)
## Problem solved

Previously we made no attempt to unroll function inputs and outputs in the docs. This made things difficult to quickly scan since every function has a typed input and output object you would have to navigate to.

This PR is a first attempt at basic unrolling functionality of these typed inputs and outputs.

Before:
<img width="929" alt="Screenshot 2024-08-21 at 3 20 24 PM" src="https://github.com/user-attachments/assets/e73eae8b-98b5-40c9-8f63-f17e3a0a63d7">

After:
<img width="933" alt="Screenshot 2024-08-21 at 3 20 49 PM" src="https://github.com/user-attachments/assets/b5d8d847-9c70-45ec-aaf6-95b4215b3418">

As an additional readability bonus, the input and output sections now start as an open accordion.

Note: There are still improvements to be made especially on functions with more complex types. These functions' interfaces should be simplified in future versions.

## Next Steps
Future features should add nested input descriptions (supported by typedoc but not `typedoc-better-json`). Future SDK versions should use simpler, explicitly typed inputs and outputs to simplify the unrolling process (and easier LSP support for users).

## To Test
Open the preview URL, click around to various functions and inspect the parameter and return types

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates transaction handling and TypeScript documentation rendering.

### Detailed summary
- Added `fetchDocBySlug` function to fetch TypeScript docs by slug
- Modified `SendTransactionOptions` to use interface instead of type
- Updated TypeScript documentation rendering to include interface docs for return types and parameter types

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

<!-- end pr-codex -->
2024-08-23 18:24:48 +00:00
jnsdls 8128d127ce [Update] Refine billing alert messages and usage limit notifications (#4266) 2024-08-23 17:55:29 +00:00
MananTank d401a13cdc Add Storybook in Dashboard (#4265)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to integrate Storybook into the project, configure Storybook addons, and create a Button component story.

### Detailed summary
- Added Storybook configuration files for setup
- Integrated Storybook for UI component development
- Created a story for the Button component with light and dark themes
- Updated package.json with Storybook dependencies

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

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

<!-- end pr-codex -->
2024-08-23 17:08:31 +00:00
gregfromstl 41fbdafcf7 [TS SDK] Feature: Add account overload to signMessage (#4250)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances the `signMessage` function in the `thirdweb` package by adding support to pass an account for signing messages, in addition to a private key.

### Detailed summary
- Added overload to `signMessage` to accept an account for signing messages
- Updated `signMessage` function to handle both private key and account options
- Updated tests to cover new account signing functionality

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

<!-- end pr-codex -->
2024-08-23 16:29:04 +00:00
MananTank 44e8e7bce2 Buy Fiat Currency selection updates in Pay UI (#4244)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces support for Japanese Yen (JPY) as a fiat currency option in the Pay UI.

### Detailed summary
- Added JPY as a supported fiat currency
- Updated currency selection UI components
- Added JPYIcon for visual representation
- Implemented default currency selection based on user's location

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

<!-- end pr-codex -->
2024-08-23 06:10:06 +00:00
jnsdls 201a4b3b8f [Update] Refine billing alerts based on account status and usage limits (#4261) 2024-08-23 05:59:32 +00:00
jnsdls 716a4d8c26 [Update] Expand CSP for style-src and font-src to include Vercel domains (#4262)
tl;dr: https://vercel.com/docs/workflow-collaboration/vercel-toolbar/managing-toolbar#using-a-content-security-policy
2024-08-23 05:54:30 +00:00
jnsdls 9a86559c36 [Update] Enhance billing alerts based on account plan and usage limits (#4259)
<!-- start pr-codex -->

## PR-Codex overview
This PR adds conditional alerts based on user's usage and plan in the billing section.

### Detailed summary
- Added `isFreePlan` and `isGrowthPlan` constants based on user's plan
- Updated conditions to show alerts based on usage limits and plan
- Included specific messages for different scenarios and plans

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

<!-- end pr-codex -->
2024-08-23 05:22:14 +00:00
jnsdls 3853e17656 [Refactor] Update useQuery implementation and remove unused imports (#4258) 2024-08-23 03:05:51 +00:00
jnsdls ac2bb59fa0 [Refactor] Update useQuery implementation across multiple hooks (#4257) 2024-08-23 01:20:48 +00:00
Jonas DanielsandGitHub 14696d32fc [Update] Enhance ContractOverviewPage component rendering (#4256) 2024-08-22 17:26:29 -07:00
jnsdls dc903ae029 [Refactor] Update account count fetching using thirdweb hooks (#4255)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to refactor the `sdk.ts` file by removing unused imports and simplifying the `getThirdwebSDK` function.

### Detailed summary
- Removed unused imports and type declarations in `sdk.ts`
- Simplified the `getThirdwebSDK` function parameters
- Improved performance by optimizing the `sdkKey` calculation
- Removed signer update logic in `getThirdwebSDK`
- Refactored `account-cell.tsx` by updating imports and using `thirdweb` library functions
- Updated `useAccountCount` function to use `getContract` and `useReadContract` from `thirdweb` library

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

<!-- end pr-codex -->
2024-08-23 00:14:01 +00:00
FirekeeperandGitHub be03c28b5d .NET 1.5.0 / Unity 5.0.0-beta.4 Docs (#4199) 2024-08-22 17:07:53 -07:00
kien-ngo bdf9507de8 [Dashboard] Overview page (#4222)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates various components in the contract UI to use the `useContract` hook and `ThirdwebContract` type for better contract handling.

### Detailed summary
- Updated components to use `useContract` hook and `ThirdwebContract` type
- Removed unnecessary imports and code duplication
- Refactored contract-related logic for improved readability

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/overview/components/ContractChecklist.tsx`

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

<!-- end pr-codex -->
2024-08-22 23:48:19 +00:00
edwardysun 86d2bafd72 Remove Coming Soon on Pay webhooks dashboard event type (#4254)
## Problem solved

Removes "Coming Soon" badge - confusing UI

<!-- start pr-codex -->

---

## PR-Codex overview
This PR removes the `Badge` component from the `CreateWebhookButton` in `webhooks.client.tsx`.

### Detailed summary
- Removed the `Badge` component from the form field in the `CreateWebhookButton`.
- Updated the `FormLabel` to remove the "Coming Soon" text.
- Adjusted the `Select` component with a default value and placeholder.

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

<!-- end pr-codex -->
2024-08-22 23:42:58 +00:00
MananTank 6b9bfb6ec7 Connect Playground UI tweaks (#4252)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to optimize the sidebar, improve accordion behavior, and enhance UI components.

### Detailed summary
- Removed unnecessary class from `Sidebar` component
- Adjusted styling in `page.tsx` for responsiveness
- Added functionality to close other accordions when one is opened
- Updated dependencies and added animations to `CustomAccordion`

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

<!-- end pr-codex -->
2024-08-22 23:38:14 +00:00
MananTank 8a618d7bd3 Migrate Mini connect playground to v5 in connect landing page (#4249)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates wallet functionality in the dashboard:

### Detailed summary
- Updated wallet options and social login methods
- Improved theme selection and modal size handling
- Removed unused components and assets

> The following files were skipped due to too many changes: `apps/dashboard/src/components/wallets/ConnectWalletMiniPlayground/MiniPlayground.tsx`

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

<!-- end pr-codex -->
2024-08-22 23:01:26 +00:00
jnsdls e97412bec8 [Refactor] Replace BigNumber with native BigInt operations (#4248)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The PR focuses on refactoring and optimizing Solidity-related functions and updating contract-related hooks and queries for ERC721 and ERC1155 in the dashboard.

### Detailed summary
- Refactored `calculateIntMinValues` and `calculateIntMaxValues` functions for better performance.
- Updated contract-related hooks and queries for ERC721 and ERC1155 in `ContractChecklist.tsx`.
- Replaced `BigNumber` with `BigInt` for improved handling of integer values.

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

<!-- end pr-codex -->
2024-08-22 22:47:30 +00:00
jnsdls 626072cc0d remove unused code (#4247)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to remove unused files, update dependencies, and refactor code structure.

### Detailed summary
- Removed unused files related to maps, gas estimator, and components
- Refactored `useHeightObserver` function
- Updated dependencies like `@tanstack/react-query` and `@stripe/react-stripe-js`
- Removed unused code related to contract code snippets and event handling
- Updated package versions and removed `idb-keyval` dependency

> 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-08-22 22:21:14 +00:00
kien-ngo 5d6b1e1d0a [Dashboard] Migrate type: ProfileMetadata + ProfileMetadataInput (#4109)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates import paths for `ProfileMetadata` and `ProfileMetadataInput` to `constants/schemas`.

### Detailed summary
- Updated import paths for `ProfileMetadata` and `ProfileMetadataInput` to `constants/schemas` in multiple files.
- Added `ProfileSchemaInput` and `ProfileSchemaOutput` in `schemas.ts`.
- Updated type-casting in `fetchPublisherProfile` function.
- Changed parameter type in `useEditProfileMutation` function.

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

<!-- end pr-codex -->
2024-08-22 21:52:16 +00:00
jnsdls b1323ea211 [Refactor] Update useQuery implementation in API hooks (#4246)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to refactor API query functions in the dashboard app to use `useQuery` with explicit query keys and query functions.

### Detailed summary
- Refactored `useApiChains` and `useFeatureContractCodeSnippetQuery` to use `useQuery` with specified query keys and query functions.
- Updated API query functions to be more explicit and maintainable.

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

<!-- end pr-codex -->
2024-08-22 21:45:56 +00:00
jnsdls cbbb414141 [Refactor] Remove query persistence and update import paths (#4245) 2024-08-22 21:33:55 +00:00
MananTank 0417ab45f1 Remove connect playground in dashboard (#4243)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update links and paths related to the Connect Wallet Playground feature.

### Detailed summary
- Updated links to direct to `https://playground.thirdweb.com/connect/sign-in/button`
- Removed references to the deleted Connect Wallet Playground feature
- Updated sidebar and navigation links
- Updated redirects to new playground URL

> The following files were skipped due to too many changes: `apps/dashboard/src/components/wallets/ConnectWalletMiniPlayground/MiniPlayground.tsx`, `pnpm-lock.yaml`

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

<!-- end pr-codex -->
2024-08-22 21:09:21 +00:00
kien-ngo c49bbd3389 [Dashboard] Remove ethers from list-form (#4241)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the CreateListingsForm component in the listings tab to handle auction creation with improved currency handling.

### Detailed summary
- Refactored currency handling for auction creation
- Added `toUnits` and `toWei` functions
- Imported `decimals` from `thirdweb/extensions/erc20`
- Updated auction creation logic to handle different currencies

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

<!-- end pr-codex -->
2024-08-22 20:55:15 +00:00
kien-ngo f192875547 [Dashboard] Remove bignumber-input since it is for Claim phase v1 (#4242)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to remove the `WaitingTimeInput` component from the `ClaimConditionsPhase` component and related imports.

### Detailed summary
- Deleted `WaitingTimeInput` component import and usage in `ClaimConditionsPhase`
- Removed `WaitingTimeInput` component from the conditional rendering based on `isClaimPhaseV1`

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

<!-- end pr-codex -->
2024-08-22 20:43:49 +00:00
MananTank 55bf1ad5a3 Add Storybook for SDK (#4230)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to add Storybook configuration, update dependencies, and improve story components.

### Detailed summary
- Added Storybook configuration for `storybook` and `build-storybook`
- Updated dependencies for Storybook addons and Vite
- Improved story components for `ConnectButton` and `PayEmbed`
- Defined absolute paths in Storybook config for addons
- Added global CSS styling for Storybook preview
- Created utility functions for story client and wallet adapter

> 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-08-22 16:36:54 +00:00
kien-ngo 01dd80fad9 [Dashboard] Hide AnnouncementBanner for Onchain Olympics [Merge after Aug 21] (#4176)
Merge this PR after Aug 21 🙏
2024-08-22 09:38:41 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
279d81ec35 Version Packages (#4223)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-22 18:43:24 +12:00
joaquim-verges d93ec63cd7 fix(inApp): fix passkeyDomain prop not being respected on login web (#4239)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the passkey domain issue in the authentication process.

### Detailed summary
- Updated `types.ts` to remove optional domain object
- Modified `web-connector.ts` to use `passkeyDomain` instead of domain object for `rp` properties

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

<!-- end pr-codex -->
2024-08-22 05:01:31 +00:00
joaquim-verges a7f4484702 smart wallet dev tests (#4226)
## Problem solved

Adding a small test preset for dev to test smart wallet dev infra

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to add support for running tests in a test environment and to enhance smart wallet functionality.

### Detailed summary
- Added support for running tests in a test environment
- Updated smart wallet functionality for policy tests
- Modified fetch logic for `localhost` and `test` environments

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

<!-- end pr-codex -->
2024-08-22 04:45:29 +00:00
gregfromstl b38308d893 [TS SDK] Feature: Enable external redirect authentication for electron support (#4237)
Adds the ability to pass a `redirectUrl` and `redirectExternally` boolean to `authenticate`. This will allow electron apps to authenticate with in-app wallet social auth.

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces a new authentication mode "window" and enables external redirects for electron support.

### Detailed summary
- Added a new authentication mode "window" for in-app authentication
- Enabled external redirects for electron support
- Updated authentication modes in various files
- Updated authentication methods to support new mode and redirect URL

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

<!-- end pr-codex -->
2024-08-22 04:40:30 +00:00
MananTank 7ef1c721ef Update Playground (#4178)
Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

This PR introduces new authentication features, refactors UI components, adds redirect functionality, and enhances code formatting.

- Added new authentication features
- Refactored UI components
- Added redirect functionality
- Enhanced code formatting

> The following files were skipped due to too many changes: `apps/playground-web/src/app/providers.tsx`, `apps/playground-web/src/components/ui/input.tsx`, `apps/playground-web/src/app/connect/sign-in/components/types.ts`, `apps/playground-web/src/components/ui/CustomRadioGroup.tsx`, `apps/playground-web/package.json`, `apps/playground-web/src/components/ui/CopyButton.tsx`, `packages/thirdweb/src/react/web/ui/ConnectWallet/WalletSelector.tsx`, `apps/playground-web/src/components/code/RenderCode.tsx`, `apps/playground-web/src/components/code/code.client.tsx`, `apps/playground-web/src/app/connect/sign-in/components/CollapsibleSection.tsx`, `apps/playground-web/src/components/ui/checkbox.tsx`, `apps/playground-web/src/app/AppSidebar.tsx`, `apps/playground-web/src/components/ui/DynamicHeight.tsx`, `apps/playground-web/src/components/ui/switch.tsx`, `apps/playground-web/src/components/code/code-example.tsx`, `apps/playground-web/src/components/blocks/APIHeader.tsx`, `apps/playground-web/src/app/layout.tsx`, `apps/playground-web/src/components/code/code.tsx`, `apps/playground-web/src/components/ui/radio-group.tsx`, `packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx`, `apps/playground-web/src/app/connect/sign-in/components/LocaleFormControl.tsx`, `apps/playground-web/src/components/ui/button.tsx`, `apps/playground-web/src/components/ui/scroll-area.tsx`, `apps/playground-web/src/app/connect/sign-in/embed/page.tsx`, `apps/playground-web/src/app/connect/sign-in/headless/page.tsx`, `apps/playground-web/src/components/ui/tooltip.tsx`, `apps/playground-web/src/components/ui/CustomAccordion.tsx`, `apps/playground-web/src/app/MobileHeader.tsx`, `apps/playground-web/src/app/connect/sign-in/button/page.tsx`, `apps/playground-web/public/thirdweb.svg`, `apps/playground-web/src/app/connect/sign-in/components/InAppWalletFormGroup.tsx`, `apps/playground-web/src/app/globals.css`, `apps/playground-web/src/app/connect/auth/page.tsx`, `apps/playground-web/src/app/connect/pay/page.tsx`, `apps/playground-web/src/components/ui/ScrollShadow/ScrollShadow.tsx`, `apps/playground-web/src/app/connect/in-app-wallet/page.tsx`, `apps/playground-web/src/app/connect/blockchain-api/page.tsx`, `apps/playground-web/src/app/connect/account-abstraction/page.tsx`, `apps/playground-web/src/app/connect/sign-in/components/WalletsSelection.tsx`, `pnpm-lock.yaml`, `apps/playground-web/src/components/ui/sidebar.tsx`, `apps/playground-web/src/app/connect/sign-in/components/CodeGen.tsx`, `apps/playground-web/src/app/connect/sign-in/components/ColorFormGroup.tsx`, `apps/playground-web/src/components/ui/select.tsx`, `apps/playground-web/src/app/connect/sign-in/button/RightSection.tsx`, `apps/playground-web/src/app/connect/sign-in/button/LeftSection.tsx`

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

<!-- end pr-codex -->
2024-08-22 01:14:22 +05:30
MananTank c48a0b1105 Remove collapse toggle from Trusted Forwards form control in deploy page (#4231)
FIXES: DASH-167
2024-08-21 17:37:16 +00:00
kien-ngo 6b9b3efb51 [Dashboard] Account page v5 (#4219)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the contract UI components to use the latest contract data and improve the account creation process.

### Detailed summary
- Updated `useRouteConfig.tsx` to conditionally render `LazyContractAccountsPage`
- Refactored `CreateAccountButton.tsx` to use `ThirdwebContract`
- Modified `page.tsx` to use `ThirdwebContract` and `ExtensionDetectedState` types

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

<!-- end pr-codex -->
2024-08-21 17:14:01 +00:00
kien-ngo 654cbbaa2e [Dashboard] Permission page to v5 (#4218)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to implement a feature that detects and handles permissions enumerable in contracts.

### Detailed summary
- Added detection and handling of `PermissionsEnumerable` feature in contracts
- Updated components to utilize the detected `PermissionsEnumerable` flag
- Refactored and optimized contract permission handling logic

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

<!-- end pr-codex -->
2024-08-21 17:13:58 +00:00
Joe-ThirdwebandGitHub 88bbbd5a01 Joe - Chainlist Page update 0gLabs (#4233) 2024-08-21 10:10:51 -07:00
kien-ngo 0c2fd4db98 [Dashboard] Remove ethers from int-input (#4234)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR replaces `parseEther` with `toWei` in `SolidityIntInput` component for input conversion.

### Detailed summary
- Replaced `parseEther` with `toWei` for input conversion
- Updated import from `thirdweb`
- Removed unused import of `useCallback`
- Updated `Button` import from `tw-components`

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

<!-- end pr-codex -->
2024-08-21 17:02:45 +00:00
kien-ngo 2c37732984 [SDK] Fix abi param parsing (#4229)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to enhance the parsing functionality for Solidity types in the contract UI components and transaction handling.

### Detailed summary
- Added parsing logic for `string` type in `parseAbiParams`
- Improved handling of different data types in contract transactions
- Added test cases for parsing `string` and `number` in contract transactions

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

<!-- end pr-codex -->
2024-08-21 17:02:36 +00:00
MananTank 783e448e2e Stricter correctness rules in biome (#4216)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to remove unnecessary error handling blocks in various catch statements.

### Detailed summary
- Removed error variable from catch blocks in multiple files.
- Simplified catch blocks to just `catch {}` where error handling was not required.

> The following files were skipped due to too many changes: `apps/dashboard/src/utils/fetchChain.ts`, `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts`, `packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts`, `packages/thirdweb/src/auth/verify-hash.ts`, `packages/thirdweb/src/contract/verification/constructor-params.ts`, `apps/wallet-ui/src/components/NftModal.tsx`, `apps/playground-web/src/components/in-app-wallet/connect-button.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/ChainOverviewSection.tsx`, `packages/thirdweb/src/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.ts`, `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/WalletConnectReceiverScreen.tsx`, `apps/dashboard/src/contract-ui/components/solidity-inputs/helpers.ts`, `packages/service-utils/src/core/api.ts`, `apps/playground-web/src/components/in-app-wallet/sponsored-tx.tsx`, `apps/playground-web/src/components/account-abstraction/sponsored-tx.tsx`, `apps/playground-web/src/app/connect/auth/page.tsx`, `apps/dashboard/src/components/contract-components/hooks.ts`, `packages/thirdweb/src/wallets/in-app/native/helpers/auth/middleware.ts`, `apps/dashboard/src/lib/sdk.ts`, `apps/playground-web/src/app/page.tsx`, `apps/dashboard/src/contexts/configured-chains.tsx`, `legacy_packages/unity-js-bridge/src/thirdweb-bridge.ts`, `packages/thirdweb/src/cli/commands/generate/generate.ts`

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

<!-- end pr-codex -->
2024-08-21 09:56:04 +00:00
MananTank 6c87d7ba3a Add useHookAtTopLevel rule in biome and fix lint errors (#4213)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to address linting issues related to the use of hooks at the top level in various components.

### Detailed summary
- Added `correctness` rule in `biome.json` for `useHookAtTopLevel`
- Added error handling and comments for `useQuery` in `useReadContract` functions
- Refactored `RNImage.tsx` to use `useMemo` for image handling
- Improved error handling in `ViewNFTs.tsx` for `fetchNFTs` function

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

<!-- end pr-codex -->
2024-08-21 01:11:23 +00:00
kien-ngo 6b8bde1abf [Dashboard] Replace useSDKChainId (#4217)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor hook dependencies in the dashboard component to use `useDashboardEVMChainId` instead of `useSDKChainId`.

### Detailed summary
- Updated imports to use `useDashboardEVMChainId` from `@3rdweb-sdk/react`
- Replaced all instances of `useSDKChainId` with `useDashboardEVMChainId`

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

<!-- end pr-codex -->
2024-08-21 00:40:41 +00:00
kien-ngo 81b33c7d7c [Dashboard] useContractEvents to v5 (#4215)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates event handling in the dashboard by refactoring components, adding type definitions, and improving event filtering.

### Detailed summary
- Refactored components to handle events using `ThirdwebContract` type
- Added type definitions for `InternalTransaction` and `PreparedEvent`
- Improved event filtering and handling in `useActivity` and `EventsFeed`
- Updated `LatestEvents` and `ContractEventsPage` components to use `ThirdwebContract` type

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/events/components/events-feed.tsx`

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

<!-- end pr-codex -->
2024-08-21 00:40:40 +00:00
kien-ngo e37ac839b2 [Dashboard] claim-condition page (#4208)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update claim conditions for ERC721, ERC1155, and ERC20 contracts.

### Detailed summary
- Updated claim condition tabs for ERC721, ERC1155, and ERC20 contracts
- Added detection of new claim conditions for different contract types
- Refactored components to use updated contract information

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

<!-- end pr-codex -->
2024-08-21 00:24:22 +00:00
kien-ngo 462e1fd2aa [Dashboard] chore: remove getErc (1155) (#4207)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the `useNFTDrawerTabs` function in the `useNftDrawerTabs.tsx` file to use `isERC1155` instead of `erc1155` for better clarity.

### Detailed summary
- Refactored references from `erc1155` to `isERC1155` for clarity
- Updated `contractAddress` and `chainId` values to use `contract` object properties instead of `erc1155`

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

<!-- end pr-codex -->
2024-08-20 23:58:29 +00:00
kien-ngo b4d8be4f91 [Dashboard] Remove some stuff from claim-condition-form (#4206)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the Claim Conditions Form component to use the `useReadContract` hook and `decimals` extension from `thirdweb/extensions/erc20`.

### Detailed summary
- Replaced `useTokenDecimals` with `useReadContract` for token decimals retrieval
- Added `decimals` import from `thirdweb/extensions/erc20`
- Added `useReadContract` import from `thirdweb/react`

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

<!-- end pr-codex -->
2024-08-20 23:57:54 +00:00
kien-ngo 15b7e8cfb8 [Dashboard] Remove type UploadProgressEvent (#4205)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to re-export `UploadProgressEvent` type and import it in `batch-lazy-mint-button.tsx`.

### Detailed summary
- Re-exported `UploadProgressEvent` type from `progress-box.tsx`
- Imported `UploadProgressEvent` in `batch-lazy-mint-button.tsx`

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

<!-- end pr-codex -->
2024-08-20 23:57:52 +00:00
kien-ngo 886094fbac [Dashboard] Migrate /code page to v5 (#4204)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR improves contract code rendering in the dashboard.

### Detailed summary
- Updated rendering logic for contract code in various components
- Added type `AbiType` for compatibility
- Refactored `ContractCodePage` to use `ThirdwebContract` instead of `contractAddress`

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

<!-- end pr-codex -->
2024-08-20 22:36:27 +00:00
gregandGitHub 0a1bce8fa8 FIX: In-App Metadata Image Display (#4214) 2024-08-20 15:19:37 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3ccfa981a8 chore(deps): bump @sentry/nextjs from 8.9.2 to 8.26.0 (#4182)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-20 15:10:32 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
fb96e83081 chore(deps-dev): bump tailwindcss from 3.4.4 to 3.4.10 (#4183)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-20 14:57:14 -07:00
Jonas DanielsandGitHub 9768b0c0b7 [Refactor] Update account plan management and remove trial-related logic (#4221) 2024-08-20 14:55:26 -07:00
Jonas DanielsandGitHub 2312f61329 [Update] Replace abuse redirect with email link (#4220) 2024-08-20 14:54:50 -07:00
Jonas DanielsandGitHub 042439aab9 [Refactor] Remove Twitter handles from ambassadors list (#4209) 2024-08-20 14:54:04 -07:00
kien-ngo 0368ee538e [Dashboard] Add useDashboardOwnedNFTs hook (#4203)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the `quantityOwned` type in the NFTs types, add a new hook for getting owned NFTs, and make adjustments in the Create Listings Form component.

### Detailed summary
- Updated `quantityOwned` type to `bigint` in NFTs types.
- Added `useDashboardOwnedNFTs` hook for fetching owned NFTs.
- Adjusted logic in Create Listings Form component for using the new hook and contract handling.

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

<!-- end pr-codex -->
2024-08-20 21:37:09 +00:00
gregfromstl c6d4aef91b Revert "Dashboard: Allow more domains (#4192)" (#4212)
This reverts commit 4bf8296546.

## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the domain validation logic in `validations.ts` to allow only "localhost" as a domain prefix.

### Detailed summary
- Updated domain validation to allow only "localhost" as a domain prefix.

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

<!-- end pr-codex -->
2024-08-20 21:15:09 +00:00
kien-ngo 86c953f18e [Dashboard] Remove useContract from Explorer page (#4202)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update contract-related components and hooks to use `ThirdwebContract` instead of `SmartContract`.

### Detailed summary
- Updated components and hooks to use `ThirdwebContract` instead of `SmartContract`
- Added conditional rendering based on contract and ABI availability
- Removed unnecessary imports and code snippets

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

<!-- end pr-codex -->
2024-08-20 20:33:38 +00:00
MananTank 4ce4072031 Hide Buy Funds section on testnet chain pages (#4210)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds a conditional rendering for a `FaucetSection` component based on the `chain.testnet` value in the `page.tsx` file of the `chainPage` in the dashboard.

### Detailed summary
- Added conditional rendering for `FaucetSection` based on `chain.testnet` value
- Renamed "Buy Funds" to "Faucet / Buy Funds"
- Updated rendering logic for `FaucetSection` and `BuyFundsSection` based on `chain.testnet` and service availability

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

<!-- end pr-codex -->
2024-08-20 20:18:41 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
bd42363602 Version Packages (#4175)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-20 11:27:36 -07:00
gregfromstl 42cdc3a2bc UI Cleanup (#4191)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the connect modal styles and adds support for wallet authentication in the authentication flow.

### Detailed summary
- Updated connect modal styles
- Added support for wallet authentication
- Modified styles for various UI components
- Added a new component for copying addresses
- Improved wallet image rendering based on wallet type

> The following files were skipped due to too many changes: `packages/thirdweb/src/wallets/custom/smart/image.ts`, `packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx`

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

<!-- end pr-codex -->
2024-08-20 17:52:34 +00:00
MananTank 4abf7a7f25 Fix Conditionally rendered hook error in Buy with Fiat flow (#4211)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing a conditionally rendered hook error when buying funds using fiat.

### Detailed summary
- Added a new `onPostOnrampSuccess` function to handle successful post onramp swap
- Changed the logic to report fiat status instead of post onramp swap status after successful swap

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

<!-- end pr-codex -->
2024-08-20 17:31:14 +00:00
kien-ngo 8b0fd13adb [Dashboard] Sources page to v5 (#4201)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update contract-related components and hooks, resolve ABI types, and improve UX in the dashboard.

### Detailed summary
- Updated components and hooks related to contracts
- Resolved ABI types with `abitype`
- Improved UX in the dashboard by updating sources display

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

<!-- end pr-codex -->
2024-08-20 17:11:57 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
20bd3aa399 chore(deps): bump tailwind-merge from 2.4.0 to 2.5.2 (#4189)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-20 10:10:48 -07:00
joaquim-verges fcfd22c01e feat(adapters): add documentation for wagmi and privy integration (#4198)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the usage of adapters in the thirdweb SDK for compatibility with different libraries.

### Detailed summary
- Updated adapter names in sidebar links
- Added new adapters in sidebar
- Modified the conversion process for ethers5 and ethers6 adapters
- Added examples for using thirdweb SDK with wagmi and privy

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

<!-- end pr-codex -->
2024-08-20 16:54:22 +00:00
kien-ngo 8dc23e376e [Dashboard] Fix import path (#4200)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the dashboard contract UI tabs page by removing unused imports and refactoring some dependencies.

### Detailed summary
- Removed unused import `thirdwebClient`
- Refactored dependencies related to `3rdweb-sdk/react` and `3rdweb-dev/react`

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

<!-- end pr-codex -->
2024-08-20 10:12:12 +00:00
Kien NgoandGitHub 542f97dc4b [Dashboard] Migrate useContractSources to v5 (#4145) 2024-08-20 21:04:19 +12:00
kien-ngo 46ca21d128 [Dashboard] Explorer page to v5 (#4174)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to enhance contract function interaction by integrating V5 features and updating contract call handling.

### Detailed summary
- Added `useV5DashboardChain` and `getContract` from `lib/v5-adapter` and `thirdweb` respectively
- Updated `ContractFunction` component to use V5 contract and handle contract calls
- Updated `InteractiveAbiFunction` component to use `ThirdwebContract` and improve contract call handling

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

<!-- end pr-codex -->
2024-08-20 08:45:43 +00:00
kien-ngo 551349cbc6 [Dashboard] envs clean-up (#4170)
- [x] Remove a lof of duplicated instances of `ThirdwebClient` & env variables across multiple files
- [x] There's only 1 main ThirdwebClient from now on which can be imported from `lib/thirdweb-client`. It can switch between clientId and secretKey depends on the environment
- [x] All env variables like `DASHBOARD_THIRDWEB_CLIENT_ID`, `DASHBOARD_THIRDWEB_SECRET_KEY`, `isProd` etc. now live inside `@/constants/env`

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates import paths and constants related to the `thirdwebClient` and `isProd` across multiple files.

### Detailed summary
- Updated import paths for `thirdwebClient` and `isProd`
- Replaced `constants/rpc` with `constants/env`
- Removed unused imports and constants

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/overview/page.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/airdrop-tab.tsx`, `apps/dashboard/src/components/app-layouts/app.tsx`, `apps/dashboard/src/components/app-layouts/provider-setup.tsx`, `apps/dashboard/src/contract-ui/tabs/manage/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/opengraph-image.tsx`, `apps/dashboard/src/lib/sdk.ts`, `apps/dashboard/src/@/constants/client.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/components/server/chain-icon.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/tx/[txHash]/page.tsx`, `apps/dashboard/src/pages/api/moralis/balances.ts`

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

<!-- end pr-codex -->
2024-08-20 07:55:31 +00:00
gregfromstl 4bf8296546 Dashboard: Allow more domains (#4192)
Requested for electron app domains

<!-- start pr-codex -->

---

## PR-Codex overview
This PR loosens the domain validation in `validations.ts` to allow cases where strict validation was causing issues.

### Detailed summary
- Loosened domain validation to allow cases where strict validation was too limiting
- Updated the condition to check if the domain includes ":" instead of splitting it

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

<!-- end pr-codex -->
2024-08-20 07:34:44 +00:00
Joaquim VergesandGitHub 7efef7d9e1 feat(pay): show pay modal when insufficient balance for gas cost (#4194) 2024-08-20 19:29:52 +12:00
kien-ngo 4d85aa56c6 [Dashboard] Fix types for contract published version (#4197)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `publish.tsx` and `index.tsx` files to handle cases where `version` is undefined by defaulting to "latest".

### Detailed summary
- In `publish.tsx`, added a default value of "latest" if `v` is undefined in the `SelectItem` component.
- In `index.tsx`, changed the `version` type from `string` to `string | undefined` and added a default value of "latest" if `version` is undefined when constructing the `PublishedContractOG` object.

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

<!-- end pr-codex -->
2024-08-20 07:18:40 +00:00
Jonas DanielsandGitHub decc1a56d2 [Fix] Handle optional versions in contract publishing (#4196) 2024-08-19 21:57:27 -07:00
joaquim-verges a60db3a057 feat(adapters): add documentation and examples for ethers5, ethers6, and viem adapters (#4195)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to introduce adapters for converting between Thirdweb and ethers.js/viem objects.

### Detailed summary
- Added `ethers5Adapter` and `ethers6Adapter` for Thirdweb to ethers.js conversion
- Added `viemAdapter` for Thirdweb to viem conversion
- Convert Thirdweb accounts, contracts, clients to ethers.js/viem and vice versa

> The following files were skipped due to too many changes: `packages/thirdweb/src/adapters/viem.ts`

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

<!-- end pr-codex -->
2024-08-20 04:51:32 +00:00
Jonas DanielsandGitHub 377f176b10 [Refactor] Replace max with min function and update import paths (#4193) 2024-08-19 20:08:13 -07:00
joaquim-verges 5ead75e41a fix(dashboard): update Expo Starter repo URL (#4190)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the repository link in the Expo Starter template from `node-starter` to `expo-starter`.

### Detailed summary
- Updated repository link from "https://github.com/thirdweb-example/node-starter" to "https://github.com/thirdweb-example/expo-starter".

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

<!-- end pr-codex -->
2024-08-20 00:32:31 +00:00
MananTank 8836c27b8d Fix Table loading spinner position (#4187)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds a `className="relative"` to various `TableContainer` components in different files for improved styling consistency.

### Detailed summary
- Added `className="relative"` to `TableContainer` in `contract-table/index.tsx`
- Added `className="relative"` to `TableContainer` in `contract-table-v2/index.tsx`
- Added `className="relative"` to `TableContainer` in `deployed-contracts.tsx`
- Added `className="relative"` to `TableContainer` in `table.tsx`
- Added `className="relative"` to `TableContainer` in `marketplace-table.tsx`

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

<!-- end pr-codex -->
2024-08-20 00:04:50 +00:00
kien-ngo cbd6fd87d0 [SDK] Update Lens test (#4188)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating a test in `resolveAddress.test.ts` to run only if a secret key is provided.

### Detailed summary
- Updated test to run only if `process.env.TW_SECRET_KEY` is provided.

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

<!-- end pr-codex -->
2024-08-19 21:51:35 +00:00
kien-ngo ef9cc55b69 [Dashboard] Remove v4 code on some Marketplace components
(#4128)

## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR exposes `max()` and `min()` utility methods for bigints and updates marketplace-related components to use these methods for better handling of large numbers.

### Detailed summary
- Exposes `max()` and `min()` utility methods for bigints in `thirdweb/utils`
- Updates components in `dashboard` related to marketplace to use `max()` and `min()` for handling large numbers efficiently

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/overview/components/MarketplaceDetails.tsx`

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

<!-- end pr-codex -->
2024-08-19 20:06:26 +00:00
kien-ngo 15899ea231 [Dashboard] Fix styling for no-image NFT (#4181)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the styling of the `NFTMedia` component by adding explicit `width` and `height` properties.

### Detailed summary
- Added inline styles for `width` and `height` based on `props`
- Updated `className` to include `border-border` class

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

<!-- end pr-codex -->
2024-08-19 19:47:32 +00:00
kien-ngo bd4669984d [Portal] Update some docs (#4177)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to introduce gasless transaction configurations and transaction annotations.

### Detailed summary
- Added gasless transaction configurations for Engine, OpenZeppelin, and Biconomy providers
- Introduced transaction annotations for Engine, OpenZeppelin, and gasless options
- Updated transaction button components to include transaction annotations
- Exposed GaslessOptions type for gasless transactions configuration

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

<!-- end pr-codex -->
2024-08-19 19:29:55 +00:00
MananTank fb799ccb6d Move publish metadata spinner inside form, show error message (#4180)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds an error message display for failed metadata fetch in the `CustomContractForm` component.

### Detailed summary
- Added error message display for failed metadata fetch
- Imported `InfoIcon` component
- Removed conditional rendering for loading spinner outside the form provider block

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

<!-- end pr-codex -->
2024-08-19 18:24:20 +00:00
kien-ngo c8f7a68225 [Dashboard] (partial) useContract removal (#4111)
Slowly moving everything upward. This PR mainly focuses on removing `useContract` from the page level (`page.tsx` files)

Routes to test:
- [x] direct listings page
- [x] english auction page
- [x] Split contract page
- [x] Contract account page
- [x] contract settings page
- [x] contract token page

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update various components to use `ThirdwebContract` instead of `contractAddress` and `chainId`.

### Detailed summary
- Update components to use `ThirdwebContract` instead of `contractAddress` and `chainId`
- Replace `useContract` calls with `contract.address`
- Import `ThirdwebContract` type for type checking

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/shared-components/marketplace-table.tsx`, `apps/dashboard/src/contract-ui/tabs/shared-components/cancel-tab.tsx`, `apps/dashboard/src/contract-ui/tabs/shared-components/listing-drawer.tsx`, `apps/dashboard/src/contract-ui/tabs/english-auctions/components/table.tsx`, `apps/dashboard/src/contract-ui/tabs/direct-listings/components/table.tsx`, `apps/dashboard/src/contract-ui/tabs/english-auctions/page.tsx`, `apps/dashboard/src/contract-ui/tabs/direct-listings/page.tsx`, `apps/dashboard/src/contract-ui/tabs/split/page.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/page.tsx`, `apps/dashboard/src/contract-ui/tabs/shared-components/list-button.tsx`, `apps/dashboard/src/contract-ui/tabs/account-permissions/page.tsx`, `apps/dashboard/src/contract-ui/tabs/embed/page.tsx`, `apps/dashboard/src/contract-ui/tabs/settings/page.tsx`, `apps/dashboard/src/contract-ui/tabs/account/page.tsx`, `apps/dashboard/src/contract-ui/tabs/tokens/page.tsx`, `apps/dashboard/src/contract-ui/hooks/useRouteConfig.tsx`

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

<!-- end pr-codex -->
2024-08-19 18:12:53 +00:00
gregfromstl 246701d615 Wallet Linking UI (#4124)
https://github.com/user-attachments/assets/abf70934-8070-4844-8f15-8db6ec40c116

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds the ability to link a wallet in the Connect UI.

### Detailed summary
- Added a new `linkWallet` field in locale types for various languages
- Updated UI components to support linking a wallet
- Introduced `WalletAuth` component for wallet authentication
- Modified wallet selection behavior in `WalletSelector` component

> The following files were skipped due to too many changes: `packages/thirdweb/src/react/web/ui/ConnectWallet/WalletSelector.tsx`, `packages/thirdweb/src/react/web/wallets/shared/PassKeyLogin.tsx`, `packages/thirdweb/src/react/web/wallets/in-app/WalletAuth.tsx`

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

<!-- end pr-codex -->
2024-08-19 17:01:20 +00:00
Joaquim VergesandGitHub cb591aa6af feat(pay): only show pay modal if the active account doesnt have enough funds (#4172) 2024-08-19 21:15:54 +12:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
09927f3ac5 Version Packages (#4162)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-19 20:17:56 +12:00
gregfromstl 7778063458 Improve Blobbie Appearance (#4173)
Blobbies now select from a subset of predefined colors to form a basic radial gradient form the bottom right corner.

![image](https://github.com/user-attachments/assets/5b708533-506d-417d-ac49-2356aa0a2247)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the appearance of the Blobbie avatar in the ConnectWallet feature of `thirdweb`.

### Detailed summary
- Updated Blobbie appearance with unique gradient colors based on address
- Replaced complex color pairing logic with predefined color options
- Simplified Blobbie rendering logic for better performance

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

<!-- end pr-codex -->
2024-08-19 06:17:43 +00:00
Joaquim VergesandGitHub 574ff0295d feat(dashboard): update apple-app-site-association for universal links (#4171) 2024-08-19 11:54:40 +12:00
kien-ngo a43907e2df [SDK] resolveAddress for Lens handles (#4150)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to enhance the `Lens` extension in the `thirdweb` package by adding the ability to resolve addresses and handle crypto transactions efficiently.

### Detailed summary
- Added `resolveAddress` function for handling crypto transactions with lens handles
- Updated contract addresses and overrides for Lens smart contracts
- Created tests for `resolveAddress` function to ensure correct address resolution

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

<!-- end pr-codex -->
2024-08-18 23:10:46 +00:00
kien-ngo f6d6c86ec0 [Dashboard] Fix ENS resolve issue (#4168)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `thirdwebClient` configuration in `thirdweb-client.ts` to include a `secretKey` option if `DASHBOARD_THIRDWEB_SECRET_KEY` is defined.

### Detailed summary
- Updated `thirdwebClient` configuration to include `secretKey` if `DASHBOARD_THIRDWEB_SECRET_KEY` is defined
- Added conditional logic for `secretKey` presence

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

<!-- end pr-codex -->
2024-08-18 22:21:10 +00:00
Joaquim VergesandGitHub 23041c013f feat(dashboard): add apple universal link association (#4169) 2024-08-19 10:04:20 +12:00
kien-ngo 43f9319ac7 [SDK] Add GaslessOptions to useSendAndConfirmTransaction (#4165)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to add Gasless transaction support for the `sendTransaction` and `sendAndConfirmTransaction` functions, as well as for the `useSendTransaction` and `useSendAndConfirmTransaction` hooks.

### Detailed summary
- Added `GaslessOptions` support to `sendTransaction`
- Introduced Gasless usage with `thirdweb Engine` in various transaction-related functions and hooks
- Added `GaslessOptions` configuration to `useSendTransaction` and `useSendAndConfirmTransaction` hooks
- Updated documentation and examples to showcase Gasless transaction usage

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

<!-- end pr-codex -->
2024-08-18 10:05:37 +00:00
kien-ngo fc8daaa2bc [Dashboard] Remove ethers.js (#4163)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on exporting a utility method `isBytes` and updating types to `bigint`.

### Detailed summary
- Exported `isBytes` utility method
- Updated `nextTokenIdToMint` type to `bigint`
- Updated imports for `isAddress`, `isBytes`, and `isHex`
- Refactored display balance calculations to use `toTokens` function

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/nfts/components/batch-lazy-mint-button.tsx`

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

<!-- end pr-codex -->
2024-08-18 07:04:05 +00:00
kien-ngo 9133b45700 [Dashboard] useVote to v5 (#4154)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates TypeScript documentation and refactors Vote-related components for clarity and consistency.

### Detailed summary
- Updated TypeScript documentation for `ProposalVoteInfo`
- Refactored `VoteButton` and `DelegateButton` components to use `ThirdwebContract`
- Improved display of voting token decimals in `Proposal` component

> The following files were skipped due to too many changes: `apps/dashboard/src/@3rdweb-sdk/react/hooks/useVote.ts`

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

<!-- end pr-codex -->
2024-08-18 05:02:05 +00:00
kien-ngo 44c78f4643 [Dashboard] useRemoveContractMutation to v5 + minor cleanups (#4155)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to refactor gasless transaction handling in the Dashboard by centralizing contract addresses and relayer URLs.

### Detailed summary
- Introduced `MULTICHAIN_REGISTRY_CONTRACT` constant for contract address
- Centralized relayer URL and forwarder address in `DASHBOARD_ENGINE_RELAYER_URL` and `DASHBOARD_FORWARDER_ADDRESS`
- Updated functions to use centralized constants for contract addresses and relayer URLs

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

<!-- end pr-codex -->
2024-08-18 03:55:32 +00:00
kien-ngo 7aee37b10f [Dashboard] Replace useSDKChainId with useDashboardEVMChainId (#4144)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to replace the usage of `useSDKChainId` with `useDashboardEVMChainId` in multiple components for better compatibility and functionality.

### Detailed summary
- Replaced `useSDKChainId` with `useDashboardEVMChainId` in multiple components.
- Updated imports and dependencies accordingly.
- Improved compatibility and functionality for the dashboard.

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

<!-- end pr-codex -->
2024-08-18 03:43:32 +00:00
kien-ngo 23a665bdaa [Dashboard] Remove v4 type: OptionalPropertiesInput (#4158)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to update the type definition for `attributes` in the `IPropertyFieldValues` interface.

### Detailed summary
- Updated `OptionalPropertiesInput` type definition to be a key-value pair object
- Changed `attributes` type in `IPropertyFieldValues` interface to use the updated type definition

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

<!-- end pr-codex -->
2024-08-18 03:32:30 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
9e46b5b94e Version Packages (#4121)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-18 12:37:18 +12:00
gregfromstl e0dcc64256 Fix connect button border in firefox (#4160)
Corrects an issue with the border visibility in firefox by explicitly specifying the div height

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the connect button border issue on Firefox browser.

### Detailed summary
- Added `height: "50px"` to the button style in `Details.tsx` for proper display on Firefox.

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

<!-- end pr-codex -->
2024-08-18 00:03:46 +00:00
gregfromstl f0d6e343ee Adds EIP-1271 Signature Validation Fallback (#4156)
This PR EIP-1271 fallback for smart contract validation since not all chains support the deployless call used in 6792 flow.

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to fix smart contract wallet signature validation on older chains.

### Detailed summary
- Updated the prompt text for signing in on the wallet UI
- Added a fallback to EIP1271 validation for chains not supporting eth_call simulation
- Introduced a new function `verifyEip1271Signature` for EIP1271 signature validation

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

<!-- end pr-codex -->
2024-08-17 23:43:45 +00:00
gregfromstl cf4443a9eb Improve Blobbie Algo (#4159)
![image](https://github.com/user-attachments/assets/cfc34112-3b94-4125-8aba-4a065d7c9ec2)
![image](https://github.com/user-attachments/assets/9daf26b0-fde8-4a77-bebf-a77f94d444f2)
![image](https://github.com/user-attachments/assets/91c4ceb1-c3c0-4be6-a654-d233b699495a)
![image](https://github.com/user-attachments/assets/7a298ad2-7fa4-4967-a7ea-7e9ec2fcf7be)

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to improve the Blobbie algorithm for generating unique gradient avatars based on provided addresses.

### Detailed summary
- Updated color calculation logic for better color pairing
- Removed unused `nearestColor` function
- Refactored color and position calculations for Blobbie avatar
- Adjusted ellipse positions and sizes for better visual representation

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

<!-- end pr-codex -->
2024-08-17 23:12:15 +00:00
gregfromstl 355795a2d4 Fix text wrapping on connect button (#4157)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing text wrapping on the Connect Button in the `Details.tsx` file.

### Detailed summary
- Added `whiteSpace: "nowrap"` to prevent text wrapping
- Updated styles for better button display

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

<!-- end pr-codex -->
2024-08-17 19:37:43 +00:00
kien-ngo 5fda794569 [SDK] Add more VoteERC20 extensions (for Dashboard) (#4139)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR exposes ERC20Vote extensions and adds more Vote contract extensions.

### Detailed summary
- Exposed ERC20Vote extensions
- Added more Vote contract extensions
- Updated types for vote and proposal states
- Implemented functions for proposal existence, execution, and voting counts

> The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/vote/read/getAll.ts`

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

<!-- end pr-codex -->
2024-08-17 12:28:02 +00:00
kien-ngo 93b3bad783 [SDK] Expose thirdweb extensions (for Dashboard) (#4149)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to export contracts related to Publisher, Multichain Registry, and Contract Factory functionalities.

### Detailed summary
- Added Publisher contract exports for reading and writing operations
- Added Multichain Registry exports for reading and writing operations
- Added Contract Factory export for deploying proxies

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

<!-- end pr-codex -->
2024-08-17 12:02:02 +00:00
Joaquim VergesandGitHub f5952621ab feat(wallet): handle eth_sendTransaction when doing zksync direct deploys (#4153) 2024-08-17 23:52:10 +12:00
kien-ngo 1d9f4e5e3e [Dashboard] MismatchButton to v5 (#4152)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview

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

<!-- end pr-codex -->
2024-08-17 10:01:56 +00:00
gregfromstl 2e99057f90 feat(wallet-ui): initial app (#3478)
1. Created a new `.env.example` file specifying the `NEXT_PUBLIC_ROOT_DOMAIN` variable.
2. Updated `.gitignore` to include `.env*.local` instead of `.env*`.
3. Modified the `Layout` component in `[ecosystem]/layout.tsx` to accept `children` and `params` properties and display the ecosystem and children elements.
4. Updated the `Page` component in `[ecosystem]/page.tsx` to return a simple `div` with the text `Page`.
5. Added a new `middleware.ts` file to handle dynamic routing based on the request host, matching all paths except for specific routes (e.g., `/api`, `/_next`, `/_static`). Rewrites the URL to point to either the root application or the appropriate ecosystem dynamic route.

---

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on adding ecosystem-related features and improving UI components.

### Detailed summary
- Added `Ecosystem` and token types
- Updated `biome.json` schema
- Implemented revalidate function
- Added NFT loading and card components
- Updated environment variables
- Improved layout and metadata handling
- Added new UI components like `Skeleton`, `Label`, and `Input`
- Enhanced client and ecosystem API integration

> The following files were skipped due to too many changes: `apps/wallet-ui/src/lib/chains.ts`, `apps/wallet-ui/src/components/ui/sonner.tsx`, `apps/wallet-ui/src/components/ConnectButton.tsx`, `apps/wallet-ui/src/app/[ecosystem]/login/page.tsx`, `apps/wallet-ui/src/app/[ecosystem]/(ui)/layout.tsx`, `apps/wallet-ui/src/components/ui/badge.tsx`, `apps/wallet-ui/src/components/ui/popover.tsx`, `apps/wallet-ui/src/middleware.ts`, `apps/wallet-ui/src/lib/assets/erc20.ts`, `apps/wallet-ui/src/components/ui/button.tsx`, `apps/wallet-ui/src/components/NftCard.tsx`, `apps/wallet-ui/src/components/NftGallery.tsx`, `apps/wallet-ui/src/lib/auth.ts`, `apps/wallet-ui/src/lib/assets/erc721.ts`, `apps/wallet-ui/src/app/[ecosystem]/(ui)/wallet/[address]/layout.tsx`, `apps/wallet-ui/src/util/simplehash.ts`, `apps/wallet-ui/src/components/ChainCombobox.tsx`, `apps/wallet-ui/src/components/TransactionToastProvider.tsx`, `apps/wallet-ui/src/app/globals.css`, `apps/wallet-ui/src/components/ChainIcon.tsx`, `apps/wallet-ui/src/components/ui/dialog.tsx`, `apps/wallet-ui/src/components/ui/form.tsx`, `apps/wallet-ui/src/components/ui/command.tsx`, `apps/wallet-ui/src/components/NftModal.tsx`, `pnpm-lock.yaml`

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

<!-- end pr-codex -->
2024-08-17 08:08:48 +00:00
gregfromstl 13764f1abb Connect UI Profile Image Improvements (#4126)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on cosmetic improvements to the Connect UI, introduces Blobbie component for unique avatars, and updates button styles and sizes.

### Detailed summary
- Increased `minWidth` of `TransactionButton` to 165px
- Updated `defaultButtonTitle` in `en.ts`
- Added `Blobbie` component for unique avatars
- Updated button styles and sizes in `ConnectButton.tsx`
- Added `shortenAddress` import in `wallet.ts`
- Updated styles in `Details.tsx` and `DetailsModal`

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

<!-- end pr-codex -->
2024-08-17 08:03:28 +00:00
iuwqyir 997c3945a7 export usageEventSchema and UsageEvent (#4147)
## Problem solved

Almost the same as https://github.com/thirdweb-dev/js/pull/4122. Made a new PR, because hadn't setup commit signing for graphite, so it failed to merge

Exports the Zod schema for usage events. This way it can be used for validate the message before sending it to the usage tracker queue.
Moved it under core because it is not tied to worker logic and can be used outside workers.
Also exported `UsageEvent` and `usageEventSchema` under node, because I think core is not exported

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to export `usageEventSchema` for Cloudflare worker and define `UsageEvent` schema for node.

### Detailed summary
- Exported `usageEventSchema` for Cloudflare worker and defined `UsageEvent` schema for node
- Added detailed schema for usage events with various optional fields

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

<!-- end pr-codex -->
2024-08-16 21:15:34 +00:00
MananTank 2bf2e1eec4 Update Engine page header (#4125)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces UI improvements to the Engine page layout, including new components, styling updates, and a modal for updating the Engine version.

### Detailed summary
- Added `CopyTextButton`, `Button`, and `Separator` components
- Updated styling and structure of the Engine page layout
- Implemented a modal for updating the Engine version
- Added new icons and components for UI enhancements

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

<!-- end pr-codex -->
2024-08-16 20:37:12 +00:00
MananTank 9b3725a56e Migrate Engine list UI to shadcn/tailwind (#4123)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances UI components in the dashboard app.

### Detailed summary
- Updated tooltip styling in `tooltip.tsx`.
- Refactored dropdown menu in `dropdown-menu.tsx`.
- Improved table UI with dropdown menus in `TWTable.tsx`.
- Implemented modals for editing and removing engine instances in `engine-instances-table.tsx`.

> The following files were skipped due to too many changes: `apps/dashboard/src/components/engine/engine-instances-table.tsx`

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

<!-- end pr-codex -->
2024-08-16 20:37:11 +00:00
MananTank beafe43f46 Move Engine import from Modal to /dashboard/engine/import (#4119)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the Engine sidebar component and improve error handling in Engine pages.

### Detailed summary
- Refactored `EngineSidebar` component
- Improved error handling with `PageLoading` and `EngineErrorPage`
- Added import functionality for Engine instances

> The following files were skipped due to too many changes: `apps/dashboard/src/pages/dashboard/engine/import.tsx`

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

<!-- end pr-codex -->
2024-08-16 20:37:11 +00:00
Winston YeoandGitHub 214a74c36a chore: add authentication method to usage tracking (#4146) 2024-08-16 20:17:57 +00:00
MananTank d0e3c4defc Fix hydration error in markdown renderer + property and ts cleanup (#4141)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR refactors the `MarkdownRenderer` component in `published-contract`.

### Detailed summary
- Refactored heading components (`h1`, `h2`, `h3`, `h4`, `h5`, `h6`) to remove explicit `any` type
- Refactored `a`, `code`, `p`, `table`, `th`, `td`, `ul`, `ol`, `li` components to use cleaned props without `node`

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

<!-- end pr-codex -->
2024-08-16 18:30:57 +00:00
MananTank 0cdf34ea98 Move Engine pages from client Router to Pages Router (#4113)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR upgrades Engine navigation links, adds new pages for Engine management, and refactors list styling.

### Detailed summary
- Updated Engine navigation links
- Added new pages for Engine management
- Refactored list styling in components

> The following files were skipped due to too many changes: `apps/dashboard/src/components/engine/engine-instances-table.tsx`, `apps/dashboard/src/pages/dashboard/engine/create.tsx`, `apps/dashboard/src/components/engine/EnginePageLayout.tsx`, `apps/dashboard/src/components/engine/engine-list.tsx`

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

<!-- end pr-codex -->
2024-08-16 15:45:43 +00:00
MananTank b1632a3df1 Add force-dynamic declaration for pages using cookies - fix sentry errors (#4140)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to add a new export `dynamic = "force-dynamic"` in three files due to the usage of `cookies()`.

### Detailed summary
- Added `export const dynamic = "force-dynamic"` in `page.tsx` under `dashboard/connect/pay`
- Added `export const dynamic = "force-dynamic"` in `page.tsx` under `dashboard/connect/ecosystem`
- Added `export const dynamic = "force-dynamic"` in `layout.tsx` under `dashboard/connect/ecosystem/[slug]/(active)`

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

<!-- end pr-codex -->
2024-08-16 15:34:13 +00:00
jnsdls d3f43a757b [Optimize] Add CI optimization step using Graphite action (#4115)
tl;dr: https://graphite.dev/docs/stacking-and-ci#reducing-ci-runs-for-github-actions

<!-- start pr-codex -->

---

## PR-Codex overview
This PR optimizes the CI workflow by adding a step to skip unnecessary processes based on a condition.

### Detailed summary
- Added `optimize_ci` job with skip condition
- Updated `build`, `lint`, `test`, `e2e`, and `size` jobs to depend on `optimize_ci` and skip if condition is met

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

<!-- end pr-codex -->
2024-08-15 21:22:24 +00:00
gregfromstl 825352476c fix: throw when no encryption key (#4120)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing security by throwing an error when no encryption key is provided for custom authentication.

### Detailed summary
- Added error throwing when encryption key is missing for custom JWT authentication
- Added error throwing when encryption key is missing for custom auth endpoint authentication

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

<!-- end pr-codex -->
2024-08-15 21:17:20 +00:00
arcoraven 8caa095a67 fix: update transaction drawer labels (#4118)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to enhance transaction details display in the dashboard by adding support for effective gas price calculation and showing additional information like account address and block number.

### Detailed summary
- Added `effectiveGasPrice` field to calculate transaction fee
- Displayed account address and linked to explorer
- Differentiated recipient address and contract address
- Showed transaction value in tokens and symbol
- Linked block number to explorer

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

<!-- end pr-codex -->
2024-08-15 19:22:51 +00:00
jnsdls 997e1197e9 analytics overhaul (#4107)
<!-- start pr-codex -->

## PR-Codex overview
This PR enhances blockchain analytics in the dashboard. It introduces support for analytics on specific chains and updates chart components for better visualization.

### Detailed summary
- Added `CHAINSAW_API_KEY` environment variable for contract analytics
- Updated chart components for better visualization
- Improved analytics support for specific chains
- Refactored chart styling for better UI/UX

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/overview/components/Analytics.tsx`, `apps/dashboard/src/contract-ui/tabs/analytics/page.tsx`

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

<!-- end pr-codex -->
2024-08-15 15:29:50 +00:00
Jonas DanielsandGitHub c9ac25fe3f Version Packages (#4114) 2024-08-15 07:38:54 -07:00
Wyatt MufsonandGitHub 79260c8cd0 Add new auth fields for redirect (#4099) 2024-08-15 07:30:59 -07:00
MananTank cf8badbc46 Move Network Configuration Form+Modal to shadcn/tailwind (#4105)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates various UI components for consistency and usability.

### Detailed summary
- Updated styling for `ClaimConditionsForm`, `CustomChainRenderer`, `ToolTipLabel`, `RpcInput`, `ChainIdInput`, `TooltipBox`, `ConfigureNetworkModal`, `ResetClaimEligibility`, `NetworkIdInput`, `IconUpload`, and `ConfigureNetworks`.
- Replaced `TooltipBox` with `ToolTipLabel` and `CircleHelpIcon`.
- Added `Input` from `@/components/ui/input`.
- Removed unnecessary imports.
- Replaced `Modal` components with `Dialog` and `DialogContent`.
- Used `toast` for error notifications.
- Updated button styling and functionality.

> The following files were skipped due to too many changes: `apps/dashboard/src/components/configure-networks/ConfigureNetworks.tsx`, `apps/dashboard/src/pages/[chain_id]/[...paths].tsx`, `apps/dashboard/src/components/configure-networks/ConfigureNetworkForm.tsx`

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

<!-- end pr-codex -->
2024-08-15 05:59:21 +00:00
MananTank 09e4d80b89 Show Top Progress Bar on navigation initiated using useRouter hook (#4097)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates Next.js navigation usage in the dashboard app to `useDashboardRouter` from `@/lib/DashboardRouter`.

### Detailed summary
- Replaces `useRouter` with `useDashboardRouter` in multiple files
- Adds `DashboardRouterTopProgressBar` component import in layout files
- Introduces `useDashboardRouter` import in various components
- Defines `createStore` function in `@/lib/reactive.ts`

> The following files were skipped due to too many changes: `apps/dashboard/src/@/lib/DashboardRouter.tsx`

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

<!-- end pr-codex -->
2024-08-15 05:48:22 +00:00
kien-ngo 1edd6c7e4c embed-setup.tsx to v5 (#4108)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to enhance the Contract Embed feature by integrating with `thirdwebClient` and `useV5DashboardChain`.

### Detailed summary
- Added `thirdwebClient` and `useV5DashboardChain` for contract setup
- Updated `contract` type to `ThirdwebContract`
- Refactored `buildIframeSrc` function to use `ThirdwebContract` properties

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

<!-- end pr-codex -->
2024-08-15 05:37:15 +00:00
kien-ngo 588f19639f [Dashboard] ContractMetadata settings to v5 (#4100)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates the SettingsMetadata component in the contract UI to handle contract data more efficiently.

### Detailed summary
- Refactored the SettingsMetadata component to use ThirdwebContract type
- Updated schema imports and data handling
- Removed unnecessary dependencies and functions

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

<!-- end pr-codex -->
2024-08-15 05:26:34 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
f2c12781ef Version Packages (#4044)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-15 17:14:31 +12:00
kien-ngo 9d7d513d37 [Dashboard] PrimarySaleRecipient to v5 (#4098)
<!-- start pr-codex -->

## PR-Codex overview
This PR focuses on updating the contract UI settings for primary sale recipient address handling.

### Detailed summary
- Updated handling of primary sale recipient address in contract settings UI
- Refactored usage of Thirdweb SDK functions
- Added error handling for invalid recipient address
- Improved transaction handling and form reset functionality

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

<!-- end pr-codex -->
2024-08-15 01:11:20 +00:00
kien-ngo 10de2712dd [Dashboard] Remove useClaimNFT; use erc1155/claimTo (#4102)
The component in this PR is meant for Edition Drop only

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the `ClaimTab` component to support ERC1155 contracts and improve transaction handling.

### Detailed summary
- Renamed `ClaimTab` component to `ClaimTabERC1155`.
- Updated `ClaimTabERC1155` to work with ERC1155 contracts.
- Improved transaction handling in `ClaimTabERC1155`.
- Removed unnecessary imports and updated dependencies.

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

<!-- end pr-codex -->
2024-08-15 00:59:13 +00:00
gregfromstl 0ca1a79342 feat: cleanup ui (#4092)
- Reduced border radius on buttons
- Reduced connected button size
- Removed layout shift between connected and unconnected states
- Remove Rainbow from default wallets (replaced with Rabby)

https://github.com/user-attachments/assets/334f09d5-46d1-40e3-8b3a-5937771f277c

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on UI cosmetic improvements for wallet-related components.

### Detailed summary
- Added `io.rabby` wallet
- Adjusted padding and borderRadius in various components
- Modified button sizes and styles
- Updated wallet image sizes and text styles

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

<!-- end pr-codex -->
2024-08-15 00:44:18 +00:00
kien-ngo be344ac8c4 [Dashboard] Migration Royalties to v5 (#4051)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `SettingsRoyalties` component to use new contract and royalty information and improves error handling during royalty settings updates.

### Detailed summary
- Updated `SettingsRoyalties` component to use new contract and royalty information
- Improved error handling during royalty settings updates
- Replaced `thirdweb` imports with `sonner` and `thirdweb/react`
- Refactored default royalty info handling and transaction mutation logic

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

<!-- end pr-codex -->
2024-08-15 00:26:39 +00:00
754ad99cfd Feat: Transaction Simulator (#3715)
Co-authored-by: Kien Ngo <[email protected]>
Co-authored-by: Manan Tank <[email protected]>
2024-08-14 17:24:31 -07:00
MananTank d6e4898458 Add Pay success tracking (#4103)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances payment tracking in `MismatchButton` and `PayModalButton` components.

### Detailed summary
- Added tracking events for payment attempts and successes in `MismatchButton` and `PayModalButton`
- Utilized `useTrack` hook for event tracking
- Improved event tracking for different payment types and statuses

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

<!-- end pr-codex -->
2024-08-14 21:37:11 +00:00
YashandGitHub 191fb3a3a6 Modular contracts - rename extensions to modules (#3969) 2024-08-14 21:35:36 +00:00
MananTank 03a809a33f Add onPurchaseSuccess callback for Pay (#4101)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds `onPurchaseSuccess` callback to various components and hooks in the codebase, triggering when a user completes a purchase using thirdweb pay.

### Detailed summary
- Added `onPurchaseSuccess` callback to `PayEmbed`, `ConnectButton`, `TransactionButton`, and `useSendTransaction`
- Updated props in multiple components to include `onSuccess` callback parameter
- Added type definitions for `BuyWithCryptoStatus` and `BuyWithFiatStatus`
- Implemented logic to call `onSuccess` callback upon successful purchase completion

> The following files were skipped due to too many changes: `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx`

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

<!-- end pr-codex -->
2024-08-14 21:05:41 +00:00
kien-ngo 874ef7af4e [Dashboard] Hide ERC721 Claim button if viewing ERC1155 Drop (#4104)
For Edition Drop we have a dedicated ClaimTabERC1155 inside each Edition's page
2024-08-14 20:10:11 +00:00
joaquim-verges ef9c7df220 feat(native): add passkey support in connect UI (#4077)
## Problem solved

Added passkey UI in connect for react native

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces passkey login support in React Native.

### Detailed summary
- Updated colors in the design system
- Added passkey domain logic
- Improved wallet loading components
- Added passkey authentication screen
- Updated wallet icons and images

> The following files were skipped due to too many changes: `packages/thirdweb/src/react/native/ui/connect/InAppWalletUI.tsx`

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

<!-- end pr-codex -->
2024-08-14 19:44:37 +00:00
joaquim-verges a640a1e147 feat(inapp): add passkey authentication for native clients (#4022)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces support for `passkeyDomain` in in-app wallets, updates error handling in signup screens, and improves storage handling.

### Detailed summary
- Added `passkeyDomain` support in in-app wallets
- Updated error handling in signup screens
- Improved storage handling for in-app wallets

> The following files were skipped due to too many changes: `packages/thirdweb/src/wallets/in-app/web/utils/Storage/LocalStorage.ts`, `packages/thirdweb/src/utils/bytecode/cbor-decode.ts`, `packages/thirdweb/package.json`, `packages/thirdweb/src/wallets/wallet-connect/receiver/session-store.test.ts`, `pnpm-lock.yaml`, `packages/thirdweb/src/wallets/in-app/native/native-connector.ts`, `packages/thirdweb/src/wallets/in-app/web/lib/web-connector.ts`, `packages/thirdweb/src/wallets/in-app/core/authentication/passkeys.ts`, `packages/thirdweb/src/wallets/in-app/native/auth/passkeys.ts`, `packages/thirdweb/src/wallets/in-app/web/lib/auth/passkeys.ts`

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

<!-- end pr-codex -->
2024-08-14 19:44:35 +00:00
kien-ngo 52678e02a8 [Dashboard] use MediaRenderer for contract's avatar (#4095)
- [x] Contract metadata header now uses <MediaRenderer /> instead of <Image/>
This way is works with videos and it gets rid of that weird border-radius bug (see image)

<img width="324" alt="image" src="https://github.com/user-attachments/assets/a57f95c1-eb45-4e6f-8121-0d10358c7c6b">

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the `MetadataHeader` component in the custom-contract folder by replacing the `resolveScheme` function with `MediaRenderer` for image rendering.

### Detailed summary
- Replaced `resolveScheme` with `MediaRenderer` for image rendering
- Updated image rendering logic with additional props
- Removed unused imports and variables

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

<!-- end pr-codex -->
2024-08-14 14:04:07 +00:00
MananTank b9ed7535a4 Fix Connection with Safe using WalletConnect Link (#4091)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the connection with Safe using WalletConnect link.

### Detailed summary
- Added support for Safe supported chains in WalletConnect
- Updated chain selection logic based on walletId
- Included specific chains for Safe connection

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

<!-- end pr-codex -->
2024-08-14 11:39:29 +00:00
Joaquim VergesandGitHub 70d4a5a3db fix(dashboard): fix wrong 'version' prop import (#4096) 2024-08-14 21:51:56 +12:00
jnsdls ea28704a04 [Refactor] Remove unused functions and improve faucet validation (#4093) 2024-08-14 00:50:22 +00:00
jnsdls 814024ae24 [Chore] Remove unused 'amount' field from FaucetButton component and claim route (#4090)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the testnet faucet claim route to fix issues related to the amount handling.

### Detailed summary
- Removed `amount` from request payload
- Updated amount handling in the faucet claim route to always transfer 0.01
- Improved error handling and response consistency

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

<!-- end pr-codex -->
2024-08-13 23:11:24 +00:00
joaquim-verges 9d3fa73da7 feat(dashboard): bring zksync signer back to direct deploys (#4089)
## Problem solved

for direct deploys, right now go back to the zksync ethers signer wrapper - will implement it properly inside account v5
2024-08-13 22:14:05 +00:00
jnsdls fea4a4afe8 [Fix] Remove unused loginRequired prop from MismatchButton component (#4088)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates the `MismatchButton.tsx` component in the dashboard app.

### Detailed summary
- Updated `CustomConnectWallet` component with new props
- Removed `loginRequired={false}` prop from `CustomConnectWallet` usage

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

<!-- end pr-codex -->
2024-08-13 22:00:38 +00:00
Phillip HoandGitHub 2e16f9ecef chore: Add queue metrics to dashboard (#4075) 2024-08-13 21:59:34 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1032bc7cc4 chore(deps): bump @stripe/react-stripe-js from 2.7.2 to 2.7.3 (#4063)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 13:02:34 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
7e6d1decfc chore(deps-dev): bump react-native from 0.74.2 to 0.74.5 (#4061)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 12:48:51 -07:00
jnsdls 73b2c512ce [Chore] Add temporary redirect for /gas to /explore and remove GasPage component (#4087) 2024-08-13 18:14:18 +00:00
MananTank 13cda91d10 Remove sign-in requirement for TransactionButton (#4086)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `MismatchButton` component in the dashboard by adding the `loginRequired` prop to `CustomConnectWallet`.

### Detailed summary
- Added `loginRequired={false}` prop to `CustomConnectWallet` in `MismatchButton.tsx`

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

<!-- end pr-codex -->
2024-08-13 17:58:37 +00:00
MananTank e91421a252 Fix isLoggedin auth action (#4085)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the authentication logic in `auth-actions.ts` to check for a matching creatorWalletAddress in the JSON data.

### Detailed summary
- Updated condition to check for `creatorWalletAddress` in JSON data instead of `address`.

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

<!-- end pr-codex -->
2024-08-13 17:45:31 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
74c6bca538 chore(deps): bump @hookform/resolvers from 3.6.0 to 3.9.0 (#4064)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-13 10:45:02 -07:00
MananTank 23beb9d263 Add validation for NFT claim amount to be integer (#4080)
## Problem solved

Short description of the bug fixed or feature added
2024-08-13 17:21:15 +00:00
jnsdls 69657377f4 [Fix] Lower faucet amount to 0.01 (#4084) 2024-08-13 16:48:33 +00:00
MananTank 9db4b293a5 dynamically import onboarding components - reduce Stripe errors and bundle size (#4081)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the codebase by implementing lazy loading for onboarding components to improve performance.

### Detailed summary
- Implemented lazy loading for onboarding components
- Added `LazyOnboardingBilling` component for billing
- Updated multiple files to use lazy loading for onboarding components

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

<!-- end pr-codex -->
2024-08-13 16:37:26 +00:00
MananTank 867d2dae8a Fix useLayoutEffect warnings (#4079)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the usage of `useLayoutEffect` to `useIsomorphicLayoutEffect` for consistent server-side rendering compatibility.

### Detailed summary
- Replaces `useLayoutEffect` with `useIsomorphicLayoutEffect` in multiple files
- Ensures consistent rendering behavior across client and server side

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

<!-- end pr-codex -->
2024-08-13 16:26:34 +00:00
MananTank cb27dafca7 Do not show "No Funds" Modal when switch chain is required (#4083)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to handle a specific condition `networksMismatch` before executing the button's `onClick` functionality.

### Detailed summary
- Added a condition to check for `networksMismatch` before executing the button's `onClick` functionality.
- Stored the event reference in `eventRef.current` when `networksMismatch` is true.

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

<!-- end pr-codex -->
2024-08-13 16:21:33 +00:00
kien-ngo 6b7eedeecb [Dash] various small updates and fixes (#4076)
- [x] Fix clipboard value for the [copy button] inside /explorer page
- [x] Better handling for some edge cases where the contract's compilation target is a very long string
- [x] Instead of displaying "Custom" for non-thirdweb contracts, display the contract type based on the compilation target

<hr />

Before:
<img width="1241" alt="image" src="https://github.com/user-attachments/assets/397cc15f-5941-4a5c-ae11-cae5a7a7fbde">

After:
<img width="830" alt="image" src="https://github.com/user-attachments/assets/2a353e9c-04c8-4d6d-b15f-c26b7f423213">

<hr />

Before:
<img width="665" alt="image" src="https://github.com/user-attachments/assets/93465f35-d3c4-466c-b9cd-ab905c4fc6f1">

After:
<img width="667" alt="image" src="https://github.com/user-attachments/assets/24c59796-913d-42a4-95a2-2a63e6e726c3">

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to enhance how contract metadata is displayed in the dashboard.

### Detailed summary
- Improved handling of long contract names from the thirdweb endpoint
- Updated the display of contract type in the contract table
- Refactored the usage of contract metadata in different components

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

<!-- end pr-codex -->
2024-08-13 07:16:13 +00:00
MananTank 53da850397 Fix Various "couldn't be rendered statically" errors in Sentry (#4067)
TLDR; is - In the Chain landing page, we don't really care about filtering the popular contracts - so I removed so we can statically render the chain page,

Added force-dynamic for /popular and /trending pages where we allow filtering by search params

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to implement dynamic rendering using searchParams and improve sorting functionality in the dashboard pages.

### Detailed summary
- Implemented dynamic rendering using `searchParams`
- Updated sorting functionality in trending pages
- Refactored `searchParams` in components
- Removed unnecessary imports

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

<!-- end pr-codex -->
2024-08-13 04:11:48 +00:00
kien-ngo de1bd6e903 [Dashboard] Fix contract query key (#4073)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the `useDashboardContractMetadata` hook to use a more descriptive query key and improve code readability.

### Detailed summary
- Refactored the query key to include contract metadata details
- Improved code readability by restructuring the Promise.all block
- Updated the return object format for consistency

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

<!-- end pr-codex -->
2024-08-13 03:56:15 +00:00
ff7f61c038 Dustin/treasure chain page update (#4072)
Co-authored-by: Jonas Daniels <[email protected]>
2024-08-12 20:26:37 -07:00
FirekeeperandGitHub 2408a7f9ed Docs - .NET 1.4.0 // Unity 5.0.0-beta.3 (#4071) 2024-08-12 20:25:49 -07:00
98bb37c1a1 chore(deps-dev): bump @swc-node/register from 1.10.0 to 1.10.9 (#4060)
Co-authored-by: dependabot <[email protected]>
2024-08-12 20:24:21 -07:00
gregfromstl 3c32b99b3a refactor(thirdweb): update siwe interface (#4045)
<!-- start pr-codex -->

## PR-Codex overview
This PR updates the SIWE interface to include a new `wallet` authentication option and refactors related methods for consistency.

### Detailed summary
- Added `wallet` as a new authentication option
- Updated interface methods to support `wallet` authentication
- Refactored SIWE-related functions for consistency

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

<!-- end pr-codex -->
2024-08-13 02:36:29 +00:00
kien-ngo e5a046ecdd [Dashboard] Fix missing contract metadata (#4070)
- [x] Remove duplicated formatCompilerMetadata method
- [x] Add getCompilerMetadata method to the SDK
- [x] Add a custom hook for Dashboard for fetching basic contract metadata (useDashboardContractMetadata)

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to add a contract utility method `getCompilerMetadata()` and update contract metadata handling in the dashboard.

### Detailed summary
- Added `getCompilerMetadata()` utility method to fetch and format compiler metadata
- Updated contract metadata handling in the dashboard components
- Added `useDashboardContractMetadata` hook for fetching contract metadata in the dashboard

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

<!-- end pr-codex -->
2024-08-13 02:07:44 +00:00
kien-ngo 237f5faf42 [Dashboard] Migrate PlatformFees to v5 (#4050)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to migrate zod schemas from SDK v4 to a new location for form validations in the dashboard.

### Detailed summary
- Migrated zod schemas for PlatformFees and Royalties from SDK v4 to `schemas.ts`
- Updated `page.tsx` and `platform-fees.tsx` to use the new zod schemas and adapt to the changes in the SDK
- Refactored form validations and platform fee settings handling in `platform-fees.tsx`

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

<!-- end pr-codex -->
2024-08-13 01:50:49 +00:00
gregandGitHub ad2588b5de chore: fix deploy-split test (#4068) 2024-08-12 18:49:52 -07:00
kien-ngo db8695d0e8 [Dashboard]: Migrate major NFT features to v5 (#3998)
# High level changes
- `mint-form.tsx` is "over-abstracted" (not sure if that's the right word) - it's being used for too many different NFT features, making the code hard-to-migrate.
- solution: breaking it down to different component which makes it much easier to remove v4 code

# to test
- [x] UpdateMetadataForm
  - [x] Drop contracts
  - [x] Collection contracts
- [x] SharedMetadataForm
- [x] NFTMintForm
- [x] LazyMintForm

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces NFT extensions for ERC721 and ERC1155 contracts, adds a new `updateTokenURI` function, and updates components for NFT minting and metadata management.

### Detailed summary
- Added NFT extension with `updateTokenURI` function for ERC721 and ERC1155 contracts
- Updated components for NFT minting and metadata management

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/permissions/components/contract-permission.tsx`, `packages/thirdweb/src/extensions/erc721/write/updateTokenURI.ts`, `packages/thirdweb/src/extensions/erc1155/write/updateTokenURI.ts`, `apps/dashboard/src/contract-ui/tabs/nfts/components/shared-metadata-form.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/lazy-mint-form.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/update-metadata-form.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/mint-form.tsx`

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

<!-- end pr-codex -->
2024-08-13 00:27:22 +00:00
MananTank 2d4a5c3384 Update Deploy modal (#4057)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the custom contract deployment process by introducing a new `DeployStatusModal` component.

### Detailed summary
- Added `DeployStatusModal` component for custom contract deployment status tracking
- Refactored `useCustomContractDeployMutation` to use `DeployStatusModal`
- Removed `DeployModalProvider` component and related context logic

> The following files were skipped due to too many changes: `apps/dashboard/src/components/contract-components/contract-deploy-form/deploy-context-modal.tsx`

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

<!-- end pr-codex -->
2024-08-13 00:06:43 +00:00
Joaquim VergesandGitHub dbf3873aaf feat(dashboard): add handle_all_urls relation to assetlinks.json for Android app link verification (#4069) 2024-08-13 12:06:09 +12:00
MananTank b15aa4cdff Add Deploy button link on the Contract Card (#4066)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to add a deploy button with a rocket icon to the ContractCard component in the Explore section.

### Detailed summary
- Added `RocketIcon` and deploy button to `ContractCard`
- Adjusted styling of `ContractCard` component for better layout
- Linked deploy button to deployment page with `Link`

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

<!-- end pr-codex -->
2024-08-12 23:31:51 +00:00
gregfromstl 689b8dc160 test: fix split tests (#4065)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates test descriptions in the `split` extension to run only if a secret key is present, enhancing security.

### Detailed summary
- Updated test descriptions to run only if a secret key is present
- Renamed test suites for `getAllRecipientsAddresses`, `getAllRecipientsPercentages`, and `getRecipientSplitPercentage`

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

<!-- end pr-codex -->
2024-08-12 22:40:18 +00:00
gregfromstl 218355bf95 docs: fix multi auth jsdocs (#4056)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates documentation comments in `useProfiles.ts` and `profiles.ts` for clarity.

### Detailed summary
- Updated description comments in `profiles.ts` for clarity and consistency.
- Added `@wallet` tag to indicate in-app wallet-specific methods.
- Removed redundant descriptions to improve readability.

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

<!-- end pr-codex -->
2024-08-12 22:01:39 +00:00
9be0a2fe85 Update Startup program page layout (#4058)
Co-authored-by: Ginessi <[email protected]>
Co-authored-by: Manan Tank <[email protected]>
2024-08-12 14:49:03 -07:00
gregfromstl 22b335b1f2 chore: delete solutions page (#4059)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to restructure the directory layout by deleting specific files and updating URL redirects related to gaming solutions.

### Detailed summary
- Deleted `page.mdx`, `layout.tsx`, and `sidebar.tsx` in `solutions` directory
- Removed images `unreal.png` and `preview.png` in `gaming/assets`
- Deleted `page.mdx` in `gaming/overview` directory
- Updated URL redirects for `/gaming`, `/solutions`, and `/solutions/gaming`
- Redirected `/gaming` to `/`
- Redirected `/solutions` to `/`
- Redirected `/solutions/gaming` to `/`
- Updated redirect from `/signature-minting` to `/contracts/design-docs/signature-mint`
- Updated reference from `/references/typescript/v5/embeddedWallet` to `/references/typescript/v5/inAppWallet`

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

<!-- end pr-codex -->
2024-08-12 20:57:30 +00:00
MananTank dfbaeb1c3d [dashboard] Fix chains fetch failture in localhost (#4053)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to simplify the API request in the `useApi.ts` file by removing unnecessary headers and changing the request method to GET.

### Detailed summary
- Removed unnecessary headers from the API request
- Changed the request method to GET

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

<!-- end pr-codex -->
2024-08-12 20:46:03 +00:00
MananTank dc99b88cac Fix Chainlist can't be rendered statically error in sentry (#4054)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds a `dynamic` export to force the page as dynamic for determining table/grid view based on viewport.

### Detailed summary
- Added `dynamic` export to force page as dynamic
- Updated comments to explain the purpose of the `dynamic` export

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

<!-- end pr-codex -->
2024-08-12 19:13:27 +00:00
Phillip HoandGitHub 66906dbef3 chore: Engine v2-beta in docs (#4049) 2024-08-12 10:04:29 -07:00
gregfromstl 7a68e3b8ed fix(react): switch chains for SIWE (#4047)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating authentication logic to switch to the proper chain before signing payloads.

### Detailed summary
- Updated `getLoginPayload` to include `chainId` parameter
- Added logic to switch to the correct chain before signing payloads
- Updated initialization of `thirdwebAuth` to handle chain switching
- Imported `getCachedChain` function in `useSiweAuth.ts`

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

<!-- end pr-codex -->
2024-08-12 05:34:36 +00:00
gregfromstl cb4b6fde85 fix(playground): do not attempt to decode nonexistent jwt (#4046)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update how the authentication result is retrieved in the `GatedContentPreview` function.

### Detailed summary
- Refactored the authentication result retrieval logic to handle `jwt?.value` more efficiently.
- Updated the conditional check for `authResult` to account for the new retrieval logic.

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

<!-- end pr-codex -->
2024-08-12 05:01:02 +00:00
kien-ngo 141fd53759 [Dashboard/SDK] Add more Split extensions and remove Split v4 code from Dashboard (#4033)
<!-- start pr-codex -->

## PR-Codex overview
This PR adds more functionality to the `Split` contract extensions, including deploying the `Split` contract, reading recipient addresses and percentages, and testing these features.

### Detailed summary
- Added more Split contract extensions
- Updated `deploys.ts` with new exports for deploying Split contract
- Updated `split.ts` with new exports for reading recipient addresses and percentages
- Modified `page.tsx` to display contract balance using `getContract`
- Added new files for reading recipient addresses and percentages
- Updated `account-balance.tsx` to use `getContract` and `useSplitBalances`
- Added tests for getting all recipient addresses and percentages
- Added functionality to get recipient split percentage and corresponding tests

> The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/split/__generated__/Split/read/totalShares.ts`, `apps/dashboard/src/contract-ui/tabs/split/components/distribute-button.tsx`, `packages/thirdweb/test/src/test-contracts.ts`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useSplit.ts`, `packages/thirdweb/src/extensions/prebuilts/deploy-split.ts`, `packages/thirdweb/src/extensions/prebuilts/__generated__/Split/write/initialize.ts`, `apps/dashboard/src/contract-ui/tabs/split/page.tsx`

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

<!-- end pr-codex -->
2024-08-11 22:17:38 +00:00
joaquim-verges 478d843975 feat(dashboard): add apple-app-site-association for iOS app link verification (#4043)
## Problem solved

for passkeys on ios

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `apple-app-site-association` and `assetlinks.json` files in the dashboard public directory to include specific app and web credentials information.

### Detailed summary
- Added `webcredentials` for specific app in `apple-app-site-association`
- Updated `sha256_cert_fingerprints` in `assetlinks.json`

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

<!-- end pr-codex -->
2024-08-11 22:11:13 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
386fe1ce68 Version Packages (#4042)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-11 12:38:36 -07:00
jnsdls 539bdab403 [Refactor] Remove unused Bun availability check in CLI bin file (#4040)
FIXES: https://github.com/thirdweb-dev/js/issues/3991
2024-08-11 19:13:39 +00:00
jnsdls 0e3cb1338b [Hotfix] Remove async modifier from TrendingContractSection in trending-table.tsx (#4041)
FIXES: DASH-128
2024-08-11 19:02:09 +00:00
34cdd4ce95 feat(dashboard): add assetlinks.json for Android app link verification (#4039)
Co-authored-by: joaquim-verges <[email protected]>
2024-08-11 11:18:22 -07:00
Jonas DanielsandGitHub c31617436c [Chore] Remove unused 'faucet' service from chain logic (#4038) 2024-08-11 01:31:34 -07:00
Jonas DanielsandGitHub 40fbe9abb9 [Feature] Refactor chain services handling in API calls (#4037) 2024-08-11 00:08:15 -07:00
Nick PapadakisandGitHub 74e005214d Update page.mdx (#4036)
Signed-off-by: Nick Papadakis <[email protected]>
2024-08-10 20:54:45 -07:00
LubovandGitHub 1c48c20785 Update page.mdx (#4035)
Signed-off-by: Lubov <[email protected]>
2024-08-10 21:28:38 +12:00
gregfromstl 7befc61b70 Unreal 1.1 Docs (#3917)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to enhance the Thirdweb Unreal SDK documentation by adding detailed information about Blueprint system, signers, runtime settings, and common enums.

### Detailed summary
- Added documentation for Blueprint Overview, ThirdwebSigner, ThirdwebRuntimeSettings, and ThirdwebCommon.
- Updated sidebar links and icons.
- Updated tsconfig.json with consistent casing.
- Added Getting Started guide with integration steps and images.

> The following files were skipped due to too many changes: `apps/portal/src/app/unreal/thirdweb-wallet-handle/page.mdx`, `apps/portal/src/app/unreal/thirdweb-subsystem/page.mdx`, `apps/portal/src/app/unreal/thirdweb/page.mdx`, `apps/portal/src/app/unreal/page.mdx`, `apps/portal/src/app/unreal/thirdweb-function-library/page.mdx`

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

<!-- end pr-codex -->
2024-08-10 03:42:49 +00:00
MananTank 6b4503a91c Deploy form layout updates, Fix faucet claim condition (#4030)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the logic for checking if a user can claim in the testnet faucet, adds a new React switch component, refactors common form fieldsets, and improves UI components.

### Detailed summary
- Updated `canClaim` logic in testnet faucet route
- Added `@radix-ui/react-switch` component
- Refactored common form fieldsets into `Fieldset` component
- Improved UI components and form field layouts

> The following files were skipped due to too many changes: `apps/dashboard/src/components/contract-components/contract-deploy-form/platform-fee-fieldset.tsx`, `pnpm-lock.yaml`, `apps/dashboard/src/components/contract-components/contract-deploy-form/trusted-forwarders-fieldset.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/split-fieldset.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/custom-contract.tsx`

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

<!-- end pr-codex -->
2024-08-09 22:04:48 +00:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
0fe38b9210 Version Packages (#3987)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-09 14:51:07 -07:00
Alec AnanianandGitHub c953c3f4c8 feat(react): add enabled param to useWalletBalance hook (#4032) 2024-08-09 14:38:14 -07:00
MananTank 1a71de0983 Fix broken Contract metadata image (#4031)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to enhance the `MetadataHeader` component by adding a new function `resolveScheme` to handle image URIs with a thirdweb client.

### Detailed summary
- Added `resolveScheme` function import from `thirdweb/storage`
- Modified `src` attribute in `Image` component to use `resolveScheme` for handling image URIs

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

<!-- end pr-codex -->
2024-08-09 21:09:32 +00:00
gregfromstl b0494f6eb4 fix(wallet): fix SIWE auth in ecosystem wallets (#4029)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing SIWE authentication in ecosystem wallets.

### Detailed summary
- Added `ecosystem` parameter to SIWE authentication functions
- Updated SIWE authentication logic to include `ecosystem` parameter

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

<!-- end pr-codex -->
2024-08-09 20:15:32 +00:00
MananTank fe9e9c7ba3 Show No Funds modal with Faucet/Pay options for TransactionButton (#4025)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates components related to the testnet faucet functionality and improves the UI/UX of the dashboard.

### Detailed summary
- Added a new `CanClaimResponseType` type for claim eligibility status
- Updated styles and logic for the `FaucetButton` component
- Improved tooltip functionality with a new `ToolTipLabel` component
- Added a new dialog component and updated styles for `MismatchButton`

> The following files were skipped due to too many changes: `apps/dashboard/src/components/buttons/MismatchButton.tsx`

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

<!-- end pr-codex -->
2024-08-09 19:05:45 +00:00
FirekeeperandGitHub d41dc9a632 Force legacy 248, 9372, 841, 842 (#4020) 2024-08-09 12:04:18 -07:00
Jonas DanielsandGitHub 4c659a1d82 fix account signer crash (#4028) 2024-08-09 12:03:26 -07:00
gregfromstl b56f21b87d chore: upgrade viem to 2.19.3 and cleanup redundant imports (#4023)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The PR updates `viem` to version 2.19.3 and removes a constant from `constants.ts`.

### Detailed summary
- Updated `viem` dependency to version 2.19.3
- Removed `universalSignatureValidatorAbi` constant from `constants.ts`

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

<!-- end pr-codex -->
2024-08-09 18:10:23 +00:00
MananTank 4d49a7c228 add type='button' as default to shadcn button component (#4026)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds a conditional `type` property to the `button` component based on the component type.

### Detailed summary
- Added `btnOnlyProps` variable to conditionally set `type` property for button component based on the component type.

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

<!-- end pr-codex -->
2024-08-09 17:50:33 +00:00
GWSzeto d8569fbd1f added back in build for cli (#4024)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to enhance the build process for smart contracts in the portal app by adding a new build command with options for detecting and compiling contracts.

### Detailed summary
- Added a new `Build` section in `page.mdx`
- Introduced a `Build` command to compile smart contracts
- Provided usage instructions and options for the `Build` command

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

<!-- end pr-codex -->
2024-08-09 17:42:37 +00:00
MananTank ed7d153cf6 Update Error Handler Modal UI (#4017)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the styling and functionality of error handling components in the dashboard.

### Detailed summary
- Updated styling and functionality of error handling components
- Added `CopyAddressFormControl` component
- Improved error message copying functionality
- Updated dialog structure and content
- Added support link button in the error dialog

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

<!-- end pr-codex -->
2024-08-09 17:37:42 +00:00
MananTank a3c0be4f40 Update Deploy Form Header UI (#4016)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to add a share button feature for contracts, enabling users to share contract links easily.

### Detailed summary
- Added `shareLink` function to enable sharing contract links
- Updated `ShareButton` component to use `toast` from `sonner`
- Modified UI to include a share button for contracts
- Improved version selection functionality for contracts

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

<!-- end pr-codex -->
2024-08-09 17:31:27 +00:00
kien-ngo c31f25c51e Add Vote extensions (#3993)
- This will be a part of the Dashboard migration to v5
- The changes in modular extensions are probably because whoever added the extensions, was not using the latest generate script (Joaquim modified it to include erc20Value)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds `erc20Value` functionality to various contract extensions in the `thirdweb` package.

### Detailed summary
- Added `erc20Value` functionality to multiple contract extensions in the `thirdweb` package.

> The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/modular/__generated__/BatchMetadataERC1155/write/uploadMetadata.ts`, `packages/thirdweb/src/extensions/modular/__generated__/RoyaltyERC721/write/setDefaultRoyaltyInfo.ts`, `packages/thirdweb/src/extensions/modular/__generated__/RoyaltyERC1155/write/setDefaultRoyaltyInfo.ts`, `packages/thirdweb/src/extensions/modular/__generated__/RoyaltyERC721/write/setRoyaltyInfoForToken.ts`, `packages/thirdweb/src/extensions/modular/__generated__/RoyaltyERC1155/write/setRoyaltyInfoForToken.ts`, `packages/thirdweb/src/extensions/modular/__generated__/DelayedRevealBatchMetadataERC721/write/reveal.ts`, `packages/thirdweb/src/extensions/modular/__generated__/MintableERC20/write/completeOwnershipHandover.ts`, `packages/thirdweb/src/extensions/modular/__generated__/ClaimableERC1155/write/setClaimConditionByTokenId.ts`, `packages/thirdweb/src/extensions/modular/__generated__/OpenEditionMetadataERC721/write/setSharedMetadata.ts`, `packages/thirdweb/src/extensions/modular/__generated__/OpenEditionMetadataERC1155/write/setSharedMetadata.ts`, `packages/thirdweb/src/extensions/modular/__generated__/DelayedRevealBatchMetadataERC721/write/uploadMetadata.ts`, `packages/thirdweb/src/extensions/vote/read/quorumNumeratorByBlockNumber.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/token.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/votingDelay.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/votingPeriod.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/COUNTING_MODE.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/proposalIndex.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/BALLOT_TYPEHASH.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/proposalThreshold.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/quorumDenominator.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/getAllProposals.ts`, `packages/thirdweb/scripts/generate/abis/vote/Vote.json`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/state.ts`, `packages/thirdweb/src/exports/extensions/vote.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/quorum.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/proposals.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/hasVoted.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/getVotes.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/proposalDeadline.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/proposalSnapshot.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/proposalVotes.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/setVotingDelay.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/castVote.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/getVotesWithParams.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/setVotingPeriod.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/relay.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/read/hashProposal.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/setProposalThreshold.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/updateQuorumNumerator.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/propose.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/execute.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/castVoteWithReason.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/castVoteBySig.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/castVoteWithReasonAndParams.ts`, `packages/thirdweb/src/extensions/vote/__generated__/Vote/write/castVoteWithReasonAndParamsBySig.ts`

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

<!-- end pr-codex -->
2024-08-09 01:38:27 +00:00
kien-ngo 5367eed3b6 Split extensions (#3995)
This will be a part of the Dashboard migration to v5 (Split page)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds Split contract extensions for Thirdweb, enabling token-specific functions like distribute and release.

### Detailed summary
- Added new Split contract extensions for token-specific operations
- Included functions like distributeByToken, totalReleasedByToken, releasableByToken
- Updated existing functions to support tokenAddress parameter

> The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/split/__generated__/Split/read/totalReleased.ts`, `packages/thirdweb/src/extensions/split/__generated__/Split/read/payee.ts`, `packages/thirdweb/src/extensions/split/__generated__/Split/read/shares.ts`, `packages/thirdweb/src/extensions/split/__generated__/Split/read/released.ts`, `packages/thirdweb/src/extensions/split/__generated__/Split/read/releasable.ts`, `packages/thirdweb/src/extensions/split/__generated__/Split/write/release.ts`

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

<!-- end pr-codex -->
2024-08-09 01:23:19 +00:00
kien-ngo 1586d774df Dashboard: Migrate account-signer to v5 (#4019)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to update the account permissions feature in the dashboard.

### Detailed summary
- Added `thirdwebClient` and `useV5DashboardChain` for contract handling
- Updated `AccountSigners` component to fetch admins and signers
- Refactored `AccountSigner` component for better data handling

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

<!-- end pr-codex -->
2024-08-09 01:11:51 +00:00
YashandGitHub 0aeeccd42a Fix add to dashboard for zksync (#4007) 2024-08-08 18:05:49 -07:00
MananTank 4a807e41e8 Fix stretched chain icons (#4018)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the `ChainIcon` component to use the `cn` utility function for handling class names.

### Detailed summary
- Imported `cn` utility function
- Updated class name handling in `ChainIcon` component to use `cn` function for better readability and maintainability

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

<!-- end pr-codex -->
2024-08-09 00:32:09 +00:00
gregfromstl 05cee23bbb fix(wallet): resolve issues with native AutoConnect and URL token retrieval (#4015)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to fix the native AutoConnect feature in the `thirdweb` package by checking if the code is running in a web environment.

### Detailed summary
- Added a check for `window?.location` to ensure code is running in a web environment before fetching a URL token.

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

<!-- end pr-codex -->
2024-08-09 00:11:49 +00:00
gregfromstl bbb4f1c53f feat(react): multi-auth UI (#3870)
## Problem solved

Short description of the bug fixed or feature added

## Changes made

- [ ] Public API changes: list the public API changes made if any
- [ ] Internal API changes: explain the internal logic changes

## How to test

- [ ] Automated tests: link to unit test file
- [ ] Manual tests: step by step instructions on how to test

## Contributor NFT

Paste in your wallet address below and we will airdrop you a special NFT when your pull request is merged.

```Address: ```

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds account linking functionality, SIWE authentication, and profile management features to the Connect UI in `thirdweb`.

### Detailed summary
- Added account linking to Connect UI
- Introduced `useProfiles` hook for fetching linked profiles
- Updated UI components and locales for profile management
- Enhanced authentication options with SIWE
- Improved wallet icons and authentication methods

> The following files were skipped due to too many changes: `packages/thirdweb/src/react/web/ui/ConnectWallet/icons/AddUserIcon.tsx`, `packages/thirdweb/src/react/web/wallets/shared/oauthSignIn.ts`, `packages/thirdweb/src/wallets/ecosystem/types.ts`, `packages/thirdweb/src/wallets/in-app/core/authentication/types.ts`, `packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.tsx`, `packages/thirdweb/src/react/web/ui/ConnectWallet/icons/MultiUserIcon.tsx`, `packages/thirdweb/src/wallets/in-app/web/lib/auth/oauth.ts`, `packages/thirdweb/src/wallets/in-app/core/authentication/getLoginPath.ts`, `packages/thirdweb/src/react/web/wallets/ecosystem/EcosystemWalletFormUI.tsx`, `packages/thirdweb/src/wallets/in-app/core/authentication/linkAccount.ts`, `packages/thirdweb/src/react/core/hooks/others/useProfiles.ts`, `packages/thirdweb/src/react/web/ui/components/WalletImage.tsx`, `packages/thirdweb/src/react/web/wallets/ecosystem/EcosystemWalletConnectUI.tsx`, `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.tsx`, `packages/thirdweb/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx`, `packages/thirdweb/src/react/web/wallets/in-app/InAppWalletFormUI.tsx`, `packages/thirdweb/src/wallets/in-app/core/authentication/siwe.ts`, `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkProfileScreen.tsx`, `packages/thirdweb/src/wallets/in-app/web/lib/auth/otp.ts`, `packages/thirdweb/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx`, `packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx`, `packages/thirdweb/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.tsx`, `packages/thirdweb/src/react/web/wallets/shared/SocialLogin.tsx`, `packages/thirdweb/src/wallets/in-app/web/lib/web-connector.ts`, `packages/thirdweb/src/wallets/in-app/native/native-connector.ts`, `packages/thirdweb/src/react/web/wallets/shared/PassKeyLogin.tsx`, `packages/thirdweb/src/react/web/wallets/shared/OTPLoginUI.tsx`, `packages/thirdweb/src/wallets/in-app/native/auth/native-auth.ts`

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

<!-- end pr-codex -->
2024-08-08 23:37:35 +00:00
gregfromstl f74d52369f feat(thirdweb): headless multi-auth (#3797)
### TL;DR

Wallets can now add additional profiles to an account. Once added, any connected profile can be used to access the same wallet. This feature allows multiple profiles such as Google and Discord to be linked to a single wallet.

### What changed?

- Introduced a new method `linkProfile` to connect additional profiles to an existing wallet
- Added backend logic to handle profile linking and retrieval of linked profiles
- Minor modifications in types and export statements
- Updated embedded wallet URL to `localhost:3000`

### How to test?

1. Connect a wallet using one strategy (e.g., Google)
2. Use the `linkProfile` method to add another profile (e.g., Discord)
3. Verify both profiles can access the same wallet
4. Retrieve all linked profiles using the `getProfiles` method and verify the details

### Why make this change?

This change provides more flexibility and convenience to users by allowing them to link multiple profiles to a single wallet. It enhances user experience by providing multiple avenues for wallet access.

---

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates authentication types and imports across different wallet-related files.

### Detailed summary
- Updated imports and types in authentication-related files
- Replaced `type.js` with `types.js` in multiple files
- Added `Profile` type in `authentication/types.ts`
- Updated functions from `authenticate` to `connect` in multiple files

> The following files were skipped due to too many changes: `.changeset/green-wombats-rest.md`, `packages/thirdweb/src/wallets/in-app/native/auth/native-auth.ts`, `packages/thirdweb/src/wallets/in-app/core/interfaces/connector.ts`, `packages/thirdweb/src/wallets/in-app/web/lib/auth/abstract-login.ts`, `packages/thirdweb/src/wallets/in-app/native/native-connector.ts`, `packages/thirdweb/src/wallets/in-app/core/wallet/profiles.ts`, `packages/thirdweb/src/wallets/in-app/core/wallet/in-app-core.ts`, `packages/thirdweb/src/wallets/in-app/core/authentication/linkAccount.ts`, `packages/thirdweb/src/wallets/in-app/web/lib/web-connector.ts`, `packages/thirdweb/src/wallets/in-app/web/lib/auth/iframe-auth.ts`, `packages/thirdweb/src/wallets/in-app/web/lib/auth/base-login.ts`, `packages/thirdweb/src/extensions/marketplace/english-auctions/english-auctions.test.ts`, `packages/thirdweb/src/extensions/marketplace/direct-listings/direct-listings.test.ts`

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

<!-- end pr-codex -->
2024-08-08 23:37:32 +00:00
kien-ngo 419873a3c6 [Hotfix] ethers v5 adapter (#4014)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to make a small fix in the `ethers5.ts` adapter by replacing the `chainId` parameter with a predefined chain value.

### Detailed summary
- Replaced `chainId` with a predefined chain value in the `fromEthersContract` function in `ethers5.ts` adapter.

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

<!-- end pr-codex -->
2024-08-08 21:53:52 +00:00
gregfromstl 357a03aa8f test(smart-wallet): update tests to run sequentially and improve admin check (#4011)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update the test suite for SmartWallet integration by making adjustments to the expectations related to event logs.

### Detailed summary
- Updated expectations for event logs in tests
- Changed `expect` assertions to use `logs.some` method for checking conditions

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

<!-- end pr-codex -->
2024-08-08 21:27:49 +00:00
kien-ngo 164dbed673 Dashboard v5 Aug 07 run (#3988)
# High-level changes
- [x] ContractMetadata section now fully on v5
- [x] Moved some code of the ClaimCondition section to v5
- [x] Removed claimCondition utils methods -> used the inner logics directly to avoid importing types from v4 packages
- [x] Forcefully hard-coded some types in v4 that are not in v5
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update contract metadata handling and claim condition detection.

### Detailed summary
- Updated `ContractMetadata` component to use `ThirdwebContract`
- Improved claim condition detection in various components
- Refactored claim condition form components for better functionality

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/claim-conditions/components/claim-conditions-form/phase.tsx`

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

<!-- end pr-codex -->
2024-08-08 21:08:10 +00:00
6ccb6be3a0 Joe plume additions (#4013)
Signed-off-by: Joe-Thirdweb <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
2024-08-08 13:58:13 -07:00
MananTank 7cba594046 Fix "All Wallets" not shown by default in Pay UI when trying to connect a new wallet (#4008)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the issue where "All Wallets" were not shown by default in the Pay UI when connecting a new wallet.

### Detailed summary
- Modified `BuyScreen.tsx` to ensure "All Wallets" are shown by default in the Pay UI
- Updated the logic for displaying recommended wallets and wallet options

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

<!-- end pr-codex -->
2024-08-08 20:32:37 +00:00
gregfromstl d48cd13d53 test(thirdweb): skip deployModularCore tests dependent on TW_SECRET_KEY (#4012)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR skips the test `deployModularCore` in `deploy-modular-core.test.ts`.

### Detailed summary
- Skips the test `deployModularCore` in `deploy-modular-core.test.ts` by changing `describe.runIf` to `describe.skip`

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

<!-- end pr-codex -->
2024-08-08 19:33:05 +00:00
MananTank ae83544c3a Move CMD+K search to shadcn/tailwind, clamp search result title to 2 lines (#4010)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor the search functionality in the `CmdKSearch` component by introducing a new dialog UI for searching contracts.

### Detailed summary
- Added a new dialog UI for searching contracts
- Replaced Chakra UI components with custom UI components
- Updated search functionality with new design and features

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

<!-- end pr-codex -->
2024-08-08 19:20:31 +00:00
GWSzeto a996b54323 updated from modules to extensions in the build sidebar (#4009)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to update the file `sidebar.tsx` in the contracts app to replace references to "modules" with "extensions" for clarity and consistency.

### Detailed summary
- Replaced all occurrences of `modulesSlug` with `extensionsSlug` for better naming
- Updated links and names to reflect the change from "Modules" to "Extensions"

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

<!-- end pr-codex -->
2024-08-08 18:23:05 +00:00
BahadorandGitHub 91317dcba3 Update page.mdx (#4000)
Signed-off-by: Bahador <[email protected]>
2024-08-08 10:38:53 -07:00
MananTank e6ac1cc802 [dashboard] No sign-in required for /dashboard/connect/playground page (#4002)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the middleware and user hook in the dashboard app to use a new `isLoginRequired` function for checking logged-in paths.

### Detailed summary
- Added `isLoginRequired` function in `constants/auth.ts`
- Updated middleware to use `isLoginRequired` function
- Updated user hook to use `isLoginRequired` function

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

<!-- end pr-codex -->
2024-08-08 17:20:36 +00:00
MananTank 3649e3994a [dash] deploy form layout + various UI updates/fixes (#3994)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update various UI components and layouts across different pages in the dashboard app.

### Detailed summary
- Updated styling for `nav-link.client.tsx` and `color-mode-toggle.tsx`
- Refactored layout in `publish/[...paths].tsx`
- Removed `MobileMenu` import in `chain-header.tsx`
- Added `Sidebar` component in `layout.tsx` and `chainPage/layout.tsx`
- Updated UI components in `BurgerMenuButton.tsx` and `publish.tsx`

> The following files were skipped due to too many changes: `apps/dashboard/src/components/pages/publish.tsx`

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

<!-- end pr-codex -->
2024-08-08 13:11:45 +00:00
gregfromstl dd7d28c44f fix(ts): migrate serializeTransaction and universalSignatureValidatorByteCode to viem (#3997)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to enhance the `serializeTransaction` interface in the `thirdweb` package to include a separate signature input while maintaining backwards compatibility.

### Detailed summary
- Improved `serializeTransaction` interface in `thirdweb` package
- Added separate signature input while maintaining backwards compatibility
- Updated dependencies in `crypto/package.json`
- Updated `package.json` in `thirdweb`
- Updated `typesVersions` in `package.json` of `thirdweb`
- Updated imports in `verify-hash.ts`
- Updated exports in `package.json` of `thirdweb`
- Updated types and functions in `serialize-transaction.test.ts`
- Updated types and functions in `serialize-transaction.ts`

> The following files were skipped due to too many changes: `packages/thirdweb/src/transaction/serialize-transaction.ts`, `pnpm-lock.yaml`

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

<!-- end pr-codex -->
2024-08-08 08:35:05 +00:00
Jonas DanielsandGitHub b58a0e531f [Chore] Unify import statements in chain definition files (#3999) 2024-08-07 23:24:40 -07:00
2b4629b505 Added Fraxtal and Mode Testnets to the chain-definitions (#3996)
Signed-off-by: Jonas Daniels <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
2024-08-07 21:42:16 -07:00
MananTank 698b8dbb97 allow useActiveWalletChain direct usage in dashboard (#3990)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to replace the usage of `useDashboardActiveWalletChain` with `useActiveWalletChain` for consistency and clarity.

### Detailed summary
- Replaced `useDashboardActiveWalletChain` with `useActiveWalletChain` in multiple files for consistent usage.
- Removed unnecessary imports of `useDashboardActiveWalletChain`.
- Updated functions and components to use `useActiveWalletChain` for better readability and understanding.

> The following files were skipped due to too many changes: `apps/dashboard/src/components/buttons/MismatchButton.tsx`

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

<!-- end pr-codex -->
2024-08-08 01:19:05 +00:00
MananTank a4bc285cb7 Sync Chain object changes to Connection manager and wallets from UI components (#3989)
* When `chain` or `chains` prop passed to UI components like `ConnectButton` , `ConnectEmbed` etc are updated - make sure that those chain makes their way to connection manager ( useActiveWalletChain ) and to all the wallets ( getChain )

This is mainly for dashboard - where users can modify the chains and we need to update the chain objects when that's done

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates wallet adapters to use cached chain objects for improved performance.

### Detailed summary
- Added `getCachedChainIfExists` function to retrieve cached chain objects.
- Updated `getChain` method in wallet adapters to use cached chains.
- Removed unnecessary `cacheChains` function calls.
- Added `useConnectionManager` hook to manage defined chains store.

> The following files were skipped due to too many changes: `packages/thirdweb/src/react/native/ui/connect/ConnectButton.tsx`, `packages/thirdweb/src/wallets/manager/index.ts`

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

<!-- end pr-codex -->
2024-08-08 01:19:01 +00:00
GWSzeto 7c2f616dfe renamed from extension to module for modular contracts (#3985)
<!-- start pr-codex -->

## PR-Codex overview
The focus of this PR is to remove numerous contract pages and assets related to ERC standards and extensions.

### Detailed summary
- Deleted multiple contract pages and assets related to ERC standards and extensions
- Renamed "extensions" to "modules" in contract descriptions and comments

> The following files were skipped due to too many changes: `apps/portal/src/app/contracts/modular-contracts/core-contracts/erc-20/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/core-contracts/erc-1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-20/misc/transferableERC20/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-721/misc/transferableERC721/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-1155/misc/transferableERC1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-1155/metadata/simpleMetadataERC1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-20/minting/mintableERC20/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-721/metadata/batchMetadataERC721/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-1155/metadata/batchMetadataERC1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-1155/metadata/openEditionMetadataERC1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-721/minting/mintableERC721/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-1155/minting/mintableERC1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-721/metadata/openEditionMetadataERC721/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-20/minting/claimableERC20/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-721/minting/claimableERC721/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-1155/minting/claimableERC1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-721/metadata/delayedRevealBatchMetadataERC721/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/how-it-works/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-721/misc/royaltyERC721/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/extension-contracts/erc-1155/misc/royaltyERC1155/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/overview/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/modular-contracts/page.mdx`, `apps/portal/src/app/contracts/modular-contracts/get-started/page.mdx`, `apps/portal/src/app/contracts/sidebar.tsx`

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

<!-- end pr-codex -->
2024-08-07 19:15:43 +00:00
4d0e00a7c4 Add Abstract testnet to ZK Sync chain checks (#3986)
Co-authored-by: Jonas Daniels <[email protected]>
2024-08-07 11:18:54 -07:00
kien-ngo e3220d4a8d Dashboard v5: Remove v4 code (#3982)
High-level changes:
- [x] useAdmin migrated to v5
- [x] useAdminOrSelf migrated to v5
- [x] ERC20 mint form to v5
2024-08-07 16:12:49 +00:00
FirekeeperandGitHub 68e0aa2d90 Unity v5 initial docs (#3958) 2024-08-06 21:24:56 -07:00
MananTank ce00999e95 cleanup-imports (#3983)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates import paths to use absolute imports and removes unnecessary imports.

### Detailed summary
- Updated import paths to use absolute imports (`@/lib/utils`, `@/components/ui`, `@/components/pagination-buttons`, etc.)
- Removed unnecessary imports from various files

> The following files were skipped due to too many changes: `apps/dashboard/src/pages/grant/superchain.tsx`, `apps/dashboard/src/pages/open-source.tsx`, `apps/dashboard/src/@/components/color-mode-toggle.tsx`, `apps/dashboard/src/pages/learn/index.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/Payouts.tsx`, `apps/dashboard/src/components/homepage/sections/PricingEngine.tsx`, `apps/dashboard/src/lib/vercel-utils.ts`, `apps/dashboard/src/components/color-mode/color-mode-toggle.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PayNewCustomers.tsx`, `apps/dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/[slug]/(active)/hooks/use-ecosystem.ts`, `apps/dashboard/src/components/pay/PayConfig.tsx`, `apps/dashboard/src/components/explore/publisher/index.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts`, `apps/dashboard/src/pages/template/[id].tsx`, `apps/dashboard/src/contract-ui/tabs/english-auctions/components/table.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useLoggedInUser.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/page.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/server/chainlist-card.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/trusted-forwarders-fieldset.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PaymentsSuccessRate.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/contract-metadata-fieldset.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/chainlist/components/server/chainlist-row.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/sidebar-content.tsx`, `apps/dashboard/src/app/login/auth-actions.ts`, `apps/dashboard/src/pages/api/moralis/balances.ts`, `apps/dashboard/src/pages/404.tsx`, `apps/dashboard/src/pages/hackathon/earn.tsx`, `apps/dashboard/src/components/landing-pages/layout.tsx`, `apps/dashboard/src/pages/hackathon/consumer-crypto.tsx`, `apps/dashboard/src/pages/_app.tsx`, `apps/dashboard/src/pages/index.tsx`, `apps/dashboard/src/pages/hackathon/readyplayer3.tsx`, `apps/dashboard/src/pages/community/ambassadors.tsx`, `apps/dashboard/src/contract-ui/tabs/manage/components/getExtensionInstalledParams.ts`, `apps/dashboard/src/components/engine/overview/backend-wallets-table.tsx`, `apps/dashboard/src/components/product-pages/common/ProductPage.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PayCustomersTable.tsx`, `apps/dashboard/src/components/cmd-k-search/index.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useEngine.ts`, `apps/dashboard/src/components/buttons/TransactionButton.tsx`, `apps/dashboard/src/components/pages/publish.tsx`, `apps/dashboard/src/components/onboarding/Steps.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/PayAnalytics.tsx`, `apps/dashboard/src/contract-ui/tabs/manage/page.tsx`, `apps/dashboard/src/components/pay/PayAnalytics/components/PaymentHistory.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/custom-contract.tsx`, `apps/dashboard/src/app/(dashboard)/trending/components/trending-table.tsx`, `apps/dashboard/src/contract-ui/tabs/settings/components/metadata.tsx`, `apps/dashboard/src/components/selects/CustomChainRenderer.tsx`, `apps/dashboard/src/components/selects/NetworkSelectorButton.tsx`

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

<!-- end pr-codex -->
2024-08-07 01:29:48 +00:00
MananTank 347c4de046 Update deploy form layout (#3938)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update various text labels and add a new sidebar component for contracts in the dashboard.

### Detailed summary
- Updated text labels for wallet addresses in different contract settings
- Added a new `ContractsSidebar` component to the dashboard
- Updated styling for file upload components
- Modified form field labels and descriptions for contract settings

> The following files were skipped due to too many changes: `apps/dashboard/src/components/contract-components/contract-deploy-form/contract-metadata-fieldset.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/custom-contract.tsx`

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

<!-- end pr-codex -->
2024-08-07 01:29:45 +00:00
MananTank 48eb472645 Move deploy form outside the drawer to a page (#3936)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update components related to publishing contracts, including adding deployment functionality and improving UI elements.

### Detailed summary
- Updated `NetworkSelectorButton` to handle deployment theme
- Added deployment functionality in `PublishPage`
- Enhanced `ShareButton` UI and functionality
- Improved UI elements in `TrustedForwardersFieldset`
- Updated `PublishWithVersionPage` with deployment logic and UI enhancements

> The following files were skipped due to too many changes: `apps/dashboard/src/components/pages/publish.tsx`

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

<!-- end pr-codex -->
2024-08-07 00:45:27 +00:00
Jonas DanielsandGitHub 6530e41948 [Chore] Update turbo dependency to version 2.0.12 (#3979) 2024-08-06 16:19:11 -07:00
MananTank 06bc0c1ed4 Preserve Chain overrides in dashboard + enable editing / adding new chains in CustomConnectWallet button (#3972)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update chain-related functions and improve chain handling in various components.

### Detailed summary
- Updated chain-related functions in multiple files
- Improved chain handling in components and SDK contexts
- Refactored chain mapping and RPC URL retrieval functions

> The following files were skipped due to too many changes: `apps/dashboard/src/middleware.ts`, `apps/dashboard/src/components/contract-components/import-contract/modal.tsx`, `apps/dashboard/src/components/smart-wallets/AccountFactories/factory-contracts.tsx`, `apps/dashboard/.eslintrc.js`, `apps/dashboard/src/contract-ui/tabs/shared-components/cancel-tab.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useRegistry.ts`, `apps/dashboard/src/contract-ui/tabs/account/components/deposit-native.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx`, `apps/dashboard/src/contract-ui/tabs/shared-components/list-button.tsx`, `apps/dashboard/src/components/contract-components/contract-deploy-form/index.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/hooks/useEngine.ts`, `apps/dashboard/src/hooks/useContractAbiItems.ts`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/layout.tsx`, `apps/dashboard/src/pages/api/moralis/balances.ts`, `apps/dashboard/src/contract-ui/tabs/direct-listings/components/table.tsx`, `apps/dashboard/src/contract-ui/tabs/settings/components/platform-fees.tsx`, `apps/dashboard/src/contract-ui/tabs/settings/components/primary-sale.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/mint-form.tsx`, `apps/dashboard/src/contract-ui/tabs/english-auctions/components/table.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/mint-supply-tab.tsx`, `apps/dashboard/src/contract-ui/tabs/settings/components/royalties.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/claim-tab.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/airdrop-tab.tsx`, `apps/dashboard/src/contract-ui/tabs/tokens/components/mint-button.tsx`, `apps/dashboard/src/contract-ui/tabs/accounts/page.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/burn-tab.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/mint-button.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/chain-header.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/add-chain-to-wallet.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/lazy-mint-button.tsx`, `apps/dashboard/src/components/buttons/TransactionButton.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/transfer-tab.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/reveal-button.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/batch-lazy-mint-button.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/reveal-form.tsx`, `apps/dashboard/src/contract-ui/tabs/tokens/components/claim-form.tsx`, `apps/dashboard/src/contract-ui/tabs/nfts/components/shared-metadata-button.tsx`, `apps/dashboard/src/contract-ui/tabs/manage/page.tsx`, `apps/dashboard/src/components/app-layouts/app.tsx`, `apps/dashboard/src/components/engine/contract-subscription/contract-subscriptions-table.tsx`, `apps/dashboard/src/components/selects/NetworkSelectorButton.tsx`, `apps/dashboard/src/components/app-layouts/provider-setup.tsx`, `apps/dashboard/src/contract-ui/tabs/overview/components/MarketplaceDetails.tsx`, `apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/tx/[txHash]/page.tsx`, `apps/dashboard/src/contract-ui/tabs/settings/components/metadata.tsx`, `apps/dashboard/src/components/app-layouts/providers.tsx`, `apps/dashboard/src/contract-ui/tabs/split/page.tsx`, `apps/dashboard/src/@3rdweb-sdk/react/components/connect-wallet/index.tsx`, `apps/dashboard/src/pages/[chain_id]/[...paths].tsx`, `apps/dashboard/src/lib/v5-adapter.ts`, `apps/dashboard/src/components/buttons/MismatchButton.tsx`, `apps/dashboard/src/components/contract-components/hooks.ts`

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

<!-- end pr-codex -->
2024-08-06 22:47:21 +00:00
Jonas DanielsandGitHub ccc3a2d2c8 speed up docs (#3967) 2024-08-06 15:44:36 -07:00
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
deb704a084 Version Packages (#3966)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-06 15:26:32 -07:00
dc86fa2e6e updated pay interface for onramp + gas (#3894)
Signed-off-by: Jonas Daniels <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
2024-08-06 15:16:49 -07:00
Aryan MalikandGitHub 64d1b79b61 fix: update import statement for smartWallet in smart-wallet.ts (#3968) 2024-08-06 15:09:37 -07:00
gregfromstl f4e84e099a test(ts): adds test case for signMessage (#3978)
### TL;DR

Added a new test case to `sign-message.test.ts` to verify the signature generated by the `signMessage` function when provided with a specific message and private key.

### What changed?

The test file `sign-message.test.ts` in the `thirdweb` package has been updated to include a new test case that checks the signature generated by the `signMessage` function.

### How to test?

Run the test suite for the `thirdweb` package to ensure all tests, including the new one, pass correctly.

### Why make this change?

To enhance test coverage and ensure that the `signMessage` function generates the expected signature when given specific inputs.

---
2024-08-06 21:39:57 +00:00
jnsdls b9807f001b [Feature] Add analytics tracking to FaucetButton component (#3977)
### TL;DR

Added analytics tracking to the `FaucetButton` component.

### What changed?

Integrated `useTrack` hook to capture and track events (attempt, success, error) for claiming funds via the FaucetButton. Updated error handling for clarity.

### How to test?

1. Deploy the dashboard.
2. Navigate to the FaucetButton component.
3. Attempt to claim funds and observe tracking behavior in the configured analytics dashboard.

### Why make this change?

To gain better insights into how users interact with the FaucetButton and to capture relevant events for analysis.

---
2024-08-06 21:10:38 +00:00
gregfromstl 358a7577c1 fix(wallet): resolve wallet adapter info retrieval issue (#3976) 2024-08-06 20:54:38 +00:00
kien-ngo c05a94d985 Dashboard: Delete Marketplace v2 listing page (#3975)
- [x] Marketplace v2 is very outdated
- [x] Marketplace v3 is out for over 2 years
- [x] After the _incident_, people should be on v3 now
- [x] This also helps remove more sdk v4 code

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to refactor and clean up the contract UI listings components.

### Detailed summary
- Removed unused components from listings page
- Updated route configuration for listings
- Refactored ListingStats component
- Updated imports and dependencies

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

<!-- end pr-codex -->
2024-08-06 20:49:05 +00:00
ianandGitHub ab5d6bcfe2 New Pay Guides + Sidebar Structure (#3970) 2024-08-06 13:11:00 -07:00
d7e59305bd upstream viem tweaks (#3934)
Co-authored-by: greg <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
2024-08-06 10:48:48 -07:00
Jonas DanielsandGitHub edb86b9728 [Chore] Update CI badge link in README.md (#3973) 2024-08-06 10:45:44 -07:00
Jonas DanielsandGitHub 23c1cfa283 [Test] Conditionally run toSerializableTransaction tests based on TW_SECRET_KEY environment variable (#3965) 2024-08-06 00:12:22 -07:00
Jonas DanielsandGitHub 9944f9d731 [Chore] Remove benchmark job from CI workflow (#3964) 2024-08-06 00:10:33 -07:00
jnsdls 2e3c5e9dbd [Fix] Handle account switching inside connected wallet for SIWE auth (#3963)
FIXES: #3912

### TL;DR
This PR fixes the handling of account switching within a connected wallet in Sign-In with Ethereum (SIWE) authentication states.

### What changed?
- Updated the `isLoggedIn` function to accept an `address` argument and added more checks to validate the JWT and the associated address.
- Pass `account` as a new parameter to `useSiweAuth` to ensure the correct account is handled.
- Removed experimental server external packages from `next.config.mjs`.
- Removed `@shikijs/twoslash` dependency from `package.json`.

### How to test?
1. Switch accounts within a connected wallet and ensure the SIWE authentication state updates correctly.
2. Verify that the application runs without errors related to the removed experimental packages and dependencies.

### Why make this change?
To ensure better account management and state consistency within the SIWE authentication framework, and to remove unused or experimental configurations for better stability and performance.

---

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing account switching in SIWE authentication states.

### Detailed summary
- Updated functions to include `account` parameter for SIWE authentication
- Changed login and authentication logic
- Added `getAuthResult` function for server-side auth
- Updated dependencies and imports

> 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-08-06 06:53:24 +00:00
gregfromstl 206b825d7c fix(portal): update prefix URL in EditPage component (#3962)
Updated the GitHub edit URL prefix in the EditPage component from 'https://github.com/thirdweb-dev/docs-v2/edit/main/src/app' to 'https://github.com/thirdweb-dev/js/edit/main/apps/portal/src/app'.

---

## Problem solved

Short description of the bug fixed or feature added
2024-08-06 06:33:23 +00:00
gregfromstl 584aa7a5fe test(thirdweb): add condition to serialize-transaction eip1559 test based on TW_SECRET_KEY (#3955)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on adding a conditional test suite for the `eip1559` function based on the presence of a secret key.

### Detailed summary
- Conditionally runs the `eip1559` test suite based on the presence of `TW_SECRET_KEY` environment variable.

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

<!-- end pr-codex -->
2024-08-06 05:29:27 +00:00
kien-ngo 2500be36e7 Dashboard v5: Aug 05 updates (#3942)
### High level changes
- [x] Deleted `apps/dashboard/src/components/contract-tabs/code/ContractCode.tsx` - doesn't seem to be used anywhere
- [x] Uninstall v4's react-core and wallets packages
- [x] Rename some components's names to make it clear that they are for ERC20 only (`mint-form-erc20`)
- [x] `useTxNotifications` now only accepts v5 contract

### Tested areas
- [x] ERC20 mintTo button
- [x] CreateListingButton (minor change but need to test anyway)
- [x] ContractSidebar.tsx

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update contract-related components and dependencies.

### Detailed summary
- Updated `CreateListingButton` props in different tab pages
- Added `contractV5` variable in multiple components
- Updated dependencies and removed unused ones

> The following files were skipped due to too many changes: `apps/dashboard/src/contract-ui/tabs/nfts/components/batch-lazy-mint-button.tsx`, `apps/dashboard/src/core-ui/batch-upload/batch-lazy-mint.tsx`, `apps/dashboard/src/contract-ui/tabs/shared-components/list-button.tsx`, `apps/dashboard/src/hooks/useTxNotifications.ts`, `apps/dashboard/src/core-ui/sidebar/detail-page.tsx`, `apps/dashboard/src/contexts/error-handler.tsx`, `apps/dashboard/src/contract-ui/tabs/tokens/components/mint-form.tsx`

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

<!-- end pr-codex -->
2024-08-06 05:18:27 +00:00
gregfromstl b7daefb394 fix(app): update header texts and contract address (#3956)
### TL;DR
Updates various UI headings in the payment-related pages and updates the NFT contract address in the transaction button component.

### What changed?
- Updated headings in `pay/page.tsx`:
  - 'Fund wallets' to 'Top Up'
  - 'Direct Payments' to 'Commerce'
  - 'Onchain Payments' to 'Transactions'
- Changed NFT contract address in `transaction-button.tsx` from `0x96B30d36f783c7BC68535De23147e2ce65788e93` to `0x827c1c3889923015C1FC31BF677D00FbE6F01D52`.

### How to test?
1. Navigate to the payment page and verify that the headings are updated.
2. Ensure that the transactions are working correctly with the new contract address.

### Why make this change?
The updates are intended to enhance user comprehension and ensure the correct NFT contract is being used.

---

## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to update text and component names related to payment transactions in the playground web app.

### Detailed summary
- Updated the `nftContract` address in `transaction-button.tsx`
- Changed "Fund wallets" to "Top Up" in `page.tsx`
- Renamed "Direct Payments" to "Commerce"
- Replaced "Onchain Payments" with "Transactions"

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

<!-- end pr-codex -->
2024-08-06 05:14:51 +00:00
ianandGitHub 9eeb69e3dd Add direct payments guide and webhooks documentation (#3957) 2024-08-05 22:10:43 -07:00
2e963137fb Updating Aleph Zero and Lumia chainlist (#3960)
Co-authored-by: Jonas Daniels <[email protected]>
2024-08-05 22:04:23 -07:00
kien-ngo 0ae539f384 Docs: Update locale table (#3959)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the language codes for French and Korean in the sign-in customization page.

### Detailed summary
- Updated language code for French to `fr_FR`
- Updated language code for Korean to `ko_KR`

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

<!-- end pr-codex -->
2024-08-06 03:13:25 +00:00
gregfromstl dce096fba4 chore: remove faulty test (#3954)
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
This PR skips unit tests requiring a secret key and updates a URL in the downloadMock function.

### Detailed summary
- Skips unit tests in claimERC20, claimERC721, and claimERC1155 if no secret key available
- Updated URL in `downloadMock` function in `storage.ts`

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

<!-- end pr-codex -->
2024-08-06 00:07:45 +00:00
1650 changed files with 45680 additions and 71624 deletions
+22 -26
View File
@@ -19,7 +19,21 @@ env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
optimize_ci:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- name: Optimize CI
id: check_skip
uses: withgraphite/graphite-ci-action@main
with:
graphite_token: ${{ secrets.GRAPHITE_OMTIMIZE_TOKEN }}
build:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
runs-on: ubuntu-latest
name: Build Packages
steps:
@@ -33,6 +47,8 @@ jobs:
run: pnpm build:packages
lint:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Lint Packages
runs-on: ubuntu-latest
@@ -51,6 +67,8 @@ jobs:
- run: pnpm lint
test:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Unit Tests
runs-on: ubuntu-latest
@@ -77,6 +95,8 @@ jobs:
verbose: true
e2e:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: E2E Tests
runs-on: ubuntu-latest
@@ -142,35 +162,11 @@ jobs:
echo "Bundling failed"
exit 1
fi
benchmark:
# cannot run benchmarks on merge group
if: github.event_name != 'merge_group'
timeout-minutes: 15
name: "Benchmarks"
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1
with:
cache: false
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: "pnpm bench"
size:
needs: optimize_ci
# only run on pull requests
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: "Size"
runs-on: ubuntu-latest
+19
View File
@@ -27,7 +27,20 @@ env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
optimize_ci:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check_skip.outputs.skip }}
steps:
- name: Optimize CI
id: check_skip
uses: withgraphite/graphite-ci-action@main
with:
graphite_token: ${{ secrets.GRAPHITE_OMTIMIZE_TOKEN }}
build:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
runs-on: ubuntu-latest
name: Build Packages
steps:
@@ -41,6 +54,8 @@ jobs:
run: pnpm build:legacy_packages
lint:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Lint Packages
runs-on: ubuntu-latest
@@ -54,6 +69,8 @@ jobs:
- run: pnpm lint:legacy
test:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: Unit Tests
runs-on: ubuntu-latest
@@ -74,6 +91,8 @@ jobs:
verbose: true
e2e:
needs: optimize_ci
if: needs.optimize_ci.outputs.skip == 'false'
timeout-minutes: 15
name: E2E Tests
runs-on: ubuntu-latest
-75
View File
@@ -1,75 +0,0 @@
# On the Version Packages branch
# Generate and Commit the Typedoc JSON files and the Snippets JSON files
name: Commit Release Artifacts
on:
push:
branches:
- changeset-release/main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# cancel any previous runs if they were started before this one
cancel-in-progress: true
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }}
jobs:
release-artifacts:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
# bun setup is required, because pnpm typdoc will run pnpm build and some packages uses bun for build
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.35
- name: Install
uses: ./.github/composite-actions/install
- name: Build
run: pnpm build
- name: Typedoc
run: pnpm typedoc
- name: Generate Docs
run: |
cd legacy_packages/sdk
pnpm generate-docs
cd ../react-core
pnpm generate-docs
cd ../react
pnpm generate-docs
cd ../..
- name: Generate Snippets
run: pnpm generate-snippets
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git status
git add legacy_packages/react/typedoc/documentation.json.gz
git add legacy_packages/react-core/typedoc/documentation.json.gz
git add legacy_packages/react-native/typedoc/documentation.json.gz
git add legacy_packages/sdk/typedoc/documentation.json.gz
git add legacy_packages/storage/typedoc/documentation.json.gz
git add legacy_packages/wallets/typedoc/documentation.json.gz
git add packages/thirdweb/typedoc/documentation.json.gz
git add snippets/feature_snippets_react.json
git add snippets/feature_snippets_sdk.json
git add snippets/snippets.json
git commit -m "Commit Release Artifacts [skip ci]"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+7
View File
@@ -26,3 +26,10 @@ codecov
# Remove sitemap files (generated at build time)
sitemap*.xml
# typedoc
legacy_packages/*/typedoc/*
packages/*/typedoc/*
*storybook.log
storybook-static
+3
View File
@@ -18,5 +18,8 @@
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
+3
View File
@@ -40,6 +40,9 @@ NEXT_PUBLIC_STRIPE_KEY=
NEXT_PUBLIC_STRIPE_PAYMENT_METHOD_CFG_ID=
# Needed for contract analytics / blockchain data information
CHAINSAW_API_KEY=
#
# Private (server)
#
+22
View File
@@ -5,6 +5,7 @@ module.exports = {
"plugin:import/typescript",
"plugin:@next/next/recommended",
"plugin:promise/recommended",
"plugin:storybook/recommended"
],
rules: {
"react-compiler/react-compiler": "error",
@@ -15,6 +16,21 @@ module.exports = {
message:
'Are you *sure* you need to use "useEffect" here? If you loading any async function prefer using "useQuery".',
},
{
selector: "CallExpression[callee.name='defineChain']",
message:
"Use useV5DashboardChain instead if you are using it inside a component",
},
{
selector: "CallExpression[callee.name='defineDashboardChain']",
message:
"Use useV5DashboardChain instead if you are using it inside a component",
},
{
selector: "CallExpression[callee.name='mapV4ChainToV5Chain']",
message:
"Use useV5DashboardChain instead if you are using it inside a component",
},
],
"no-restricted-imports": [
"error",
@@ -65,6 +81,12 @@ module.exports = {
message:
"Import from `@chakra-ui/react` instead of `@chakra-ui/menu`.",
},
{
name: "next/navigation",
importNames: ["useRouter"],
message:
'Use `import { useDashboardRouter } from "@/lib/DashboardRouter";` instead',
},
],
},
],
+32
View File
@@ -0,0 +1,32 @@
import type { StorybookConfig } from "@storybook/nextjs";
import { dirname, join } from "node:path";
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): string {
return dirname(require.resolve(join(value, "package.json")));
}
const config: StorybookConfig = {
stories: ["../src/**/*.stories.tsx"],
addons: [
getAbsolutePath("@storybook/addon-onboarding"),
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@chromatic-com/storybook"),
getAbsolutePath("@storybook/addon-interactions"),
],
framework: {
name: getAbsolutePath("@storybook/nextjs"),
options: {},
},
refs: {
"@chakra-ui/react": {
disable: true,
},
},
staticDirs: ["../public"],
};
export default config;
+37
View File
@@ -0,0 +1,37 @@
import type { Preview } from "@storybook/react";
import "@/styles/globals.css";
import { Inter as interFont } from "next/font/google";
// biome-ignore lint/correctness/noUnusedImports: <explanation>
import React from "react";
import { cn } from "../src/@/lib/utils";
// Note: Wrapping the Stoy with AppRouterProviders makes the storybook server time SUPER SLOW
// so let's just not have it there - all stories should be independent from context anyway and just rely on props
const fontSans = interFont({
subsets: ["latin"],
variable: "--font-sans",
});
const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
decorators: [
(Story) => {
return (
<div className={cn("font-sans antialiased", fontSans.variable)}>
<Story />
</div>
);
},
],
};
export default preview;
+2 -2
View File
@@ -5,8 +5,8 @@ const ContentSecurityPolicy = `
img-src * data: blob:;
media-src * data: blob:;
object-src 'none';
style-src 'self' 'unsafe-inline';
font-src 'self';
style-src 'self' 'unsafe-inline' https://vercel.live;
font-src 'self' https://vercel.live https://assets.vercel.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 pg.paper.xyz portal.usecontext.io;
connect-src * data: blob:;
+21 -20
View File
@@ -18,7 +18,9 @@
"build:analyze": "ANALYZE=true pnpm run build",
"knip": "knip",
"playwright": "playwright test",
"update-checkly": "npx checkly deploy"
"update-checkly": "npx checkly deploy",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@chakra-ui/react": "^2.8.2",
@@ -27,7 +29,7 @@
"@coinbase/onchainkit": "^0.14.2",
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.5",
"@hookform/resolvers": "^3.6.0",
"@hookform/resolvers": "^3.9.0",
"@n8tb1t/use-scroll-position": "^2.0.3",
"@radix-ui/react-alert-dialog": "^1.1.1",
"@radix-ui/react-aspect-ratio": "^1.0.3",
@@ -40,23 +42,20 @@
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-toggle": "^1.1.0",
"@radix-ui/react-toggle-group": "^1.1.0",
"@radix-ui/react-tooltip": "1.1.2",
"@react-icons/all-files": "^4.1.0",
"@sentry/nextjs": "^8.8.0",
"@stripe/react-stripe-js": "^2.7.2",
"@sentry/nextjs": "^8.26.0",
"@stripe/react-stripe-js": "^2.7.3",
"@stripe/stripe-js": "^3.5.0",
"@tanstack/query-async-storage-persister": "^4.36.1",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-persist-client": "^4.36.1",
"@tanstack/react-table": "^8.17.3",
"@thirdweb-dev/react": "workspace:*",
"@thirdweb-dev/react-core": "workspace:*",
"@thirdweb-dev/sdk": "workspace:*",
"@thirdweb-dev/service-utils": "workspace:*",
"@thirdweb-dev/storage": "workspace:*",
"@thirdweb-dev/wallets": "workspace:*",
"@vercel/og": "^0.6.2",
"abitype": "1.0.5",
"chakra-react-select": "^4.7.6",
@@ -69,7 +68,6 @@
"flat": "^6.0.1",
"framer-motion": "^11.2.12",
"fuse.js": "7.0.0",
"idb-keyval": "^6.2.1",
"ioredis": "^5.4.1",
"ipaddr.js": "^2.2.0",
"lottie-react": "^2.4.0",
@@ -83,13 +81,11 @@
"pluralize": "^8.0.0",
"posthog-js": "1.128.3",
"posthog-js-opensource": "npm:[email protected]",
"prettier": "^3.3.2",
"prism-react-renderer": "^2.3.1",
"prismjs": "^1.29.0",
"qrcode": "^1.5.3",
"react": "18.3.1",
"react-children-utilities": "^2.10.0",
"react-confetti": "^6.1.0",
"react-day-picker": "^8.10.1",
"react-dom": "18.3.1",
"react-dropzone": "^14.2.3",
@@ -107,7 +103,7 @@
"sonner": "^1.5.0",
"spdx-correct": "^3.2.0",
"swagger-ui-react": "^5.17.14",
"tailwind-merge": "^2.4.0",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"thirdweb": "workspace:*",
"tiny-invariant": "^1.3.3",
@@ -118,9 +114,18 @@
},
"devDependencies": {
"@chakra-ui/cli": "^2.4.1",
"@chromatic-com/storybook": "^1.5.0",
"@next/bundle-analyzer": "^14.2.4",
"@next/eslint-plugin-next": "^14.2.4",
"@playwright/test": "^1.44.1",
"@playwright/test": "1.44.1",
"@storybook/addon-essentials": "^8.2.9",
"@storybook/addon-interactions": "^8.2.9",
"@storybook/addon-links": "^8.2.9",
"@storybook/addon-onboarding": "^8.2.9",
"@storybook/blocks": "^8.2.9",
"@storybook/nextjs": "^8.2.9",
"@storybook/react": "^8.2.9",
"@storybook/test": "^8.2.9",
"@types/color": "^3.0.6",
"@types/node": "20.14.9",
"@types/papaparse": "^5.3.14",
@@ -135,21 +140,17 @@
"@typescript-eslint/parser": "7.14.1",
"autoprefixer": "^10.4.19",
"checkly": "^4.7.0",
"dotenv": "^16.4.5",
"eslint": "8.57.0",
"eslint-config-biome": "^1.7.3",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-inclusive-language": "^2.2.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.2.0",
"eslint-plugin-react": "7.34.3",
"eslint-plugin-react-compiler": "0.0.0-experimental-51a85ea-20240601",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.8.0",
"knip": "^5.23.1",
"next-sitemap": "^4.2.3",
"next-unused": "^0.0.6",
"tailwindcss": "^3.4.4",
"storybook": "^8.2.9",
"tailwindcss": "^3.4.10",
"typescript": "5.5.4"
},
"next-unused": {
@@ -0,0 +1,30 @@
{
"applinks": {
"apps": ["XYHGSFAMHX.com.thirdweb.demo"],
"details": [
{
"appIDs": ["XYHGSFAMHX.com.thirdweb.demo"],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL with a fragment that equals no_universal_links and instructs the system not to open it as a universal link."
},
{
"/": "/mobile-wallet-protocol",
"comment": "Matches any URL with a path that starts with /mobile-wallet-protocol for coinbase wallet mobile redirects."
},
{
"/": "/dashboard/*",
"exclude": true,
"comment": "no universal link for dashboard"
}
]
}
]
},
"webcredentials": {
"apps": ["XYHGSFAMHX.com.thirdweb.demo"]
},
"appclips": {}
}
@@ -0,0 +1,15 @@
[
{
"relation": [
"delegate_permission/common.handle_all_urls",
"delegate_permission/common.get_login_creds"
],
"target": {
"namespace": "android_app",
"package_name": "com.thirdweb.demo",
"sha256_cert_fingerprints": [
"40:EB:0D:96:57:F3:D8:1F:BA:87:B8:E4:26:E0:3A:DB:C8:35:96:A8:A2:B2:55:F0:B1:64:F1:39:F8:6F:7E:EB"
]
}
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

+16 -9
View File
@@ -119,11 +119,6 @@ function redirects() {
destination: "/template/erc721",
permanent: false,
},
{
source: "/abuse",
destination: "https://forms.gle/v9UJtHbVw8fXypcd7",
permanent: false,
},
{
source: "/create-api-key",
destination: "/dashboard/settings/api-keys",
@@ -136,12 +131,17 @@ function redirects() {
},
{
source: "/dashboard/connect",
destination: "/dashboard/connect/playground",
destination: "/dashboard/connect/in-app-wallets",
permanent: false,
},
{
source: "/dashboard/connect/playground",
destination: "https://playground.thirdweb.com/connect/sign-in/button",
permanent: false,
},
{
source: "/dashboard/wallet",
destination: "/dashboard/connect/playground",
destination: "https://playground.thirdweb.com/connect/sign-in/button",
permanent: false,
},
{
@@ -166,7 +166,7 @@ function redirects() {
},
{
source: "/dashboard/wallets",
destination: "/dashboard/connect/playground",
destination: "https://playground.thirdweb.com/connect/sign-in/button",
permanent: false,
},
{
@@ -186,7 +186,7 @@ function redirects() {
},
{
source: "/dashboard/wallets/connect",
destination: "/dashboard/connect/playground",
destination: "https://playground.thirdweb.com/connect/sign-in/button",
permanent: false,
},
{
@@ -282,6 +282,13 @@ function redirects() {
"https://support.thirdweb.com/troubleshooting-errors/7Y1BqKNvtLdBv5fZkRZZB3/issue-linking-device-on-the-authorization-page-via-thirdweb-cli/cn9LRA3ax7XCP6uxwRYdvx",
permanent: false,
},
// temporary redirect gas -> explore page
{
source: "/gas",
destination: "/explore",
permanent: false,
},
];
}
@@ -0,0 +1,49 @@
"use client";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import { MenuIcon } from "lucide-react";
import { useState } from "react";
import { NavLink } from "../ui/NavLink";
export function BurgerMenuButton(props: {
links?: { href: string; label: React.ReactNode }[];
footer?: React.ReactNode;
}) {
const [isOpen, setIsOpen] = useState(false);
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogTrigger asChild>
<Button size="icon" variant="outline">
<MenuIcon strokeWidth={1} />
</Button>
</DialogTrigger>
<DialogContent
className="p-6 rounded-xl"
dialogCloseClassName="hidden"
onClick={(e) => {
if (e.target instanceof HTMLAnchorElement) {
setIsOpen(false);
}
}}
>
<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 justify-start flex gap-2 h-auto py-3"
activeClassName="bg-accent"
>
{link.label}
</NavLink>
</Button>
);
})}
</div>
{props.footer}
</DialogContent>
</Dialog>
);
}
@@ -0,0 +1,33 @@
import type React from "react";
import { cn } from "../../lib/utils";
import { NavLink } from "../ui/NavLink";
export type SidebarContentProps = {
header?: React.ReactNode;
links?: { href: string; label: React.ReactNode }[];
className?: string;
};
export function Sidebar(props: SidebarContentProps) {
return (
<aside
className={cn("w-[240px] flex-shrink-0 hidden lg:block", props.className)}
>
<div className="sticky top-0 pt-8">
{props.header}
<div className="flex flex-col border-l-2 border-border">
{props.links?.map((link) => (
<NavLink
key={link.href}
href={link.href}
className="text-sm py-1.5 pl-4 text-muted-foreground hover:text-foreground border-l-2 ml-[-2px] border-transparent hover:border-foreground transition-colors"
activeClassName="text-foreground border-link-foreground"
>
{link.label}
</NavLink>
))}
</div>
</div>
</aside>
);
}
@@ -1,5 +1,6 @@
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { ThirdwebMiniLogo } from "app/components/ThirdwebMiniLogo";
import Link from "next/link";
import {
SiDiscord,
@@ -11,7 +12,6 @@ import {
SiX,
SiYoutube,
} from "react-icons/si";
import { ThirdwebMiniLogo } from "../../../app/components/ThirdwebMiniLogo";
type AppFooterProps = {
className?: string;
@@ -0,0 +1,109 @@
"use client";
import { Area, AreaChart, CartesianGrid, XAxis } from "recharts";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import {
type ChartConfig,
ChartContainer,
ChartLegend,
ChartLegendContent,
ChartTooltip,
ChartTooltipContent,
} from "@/components/ui/chart";
import { useMemo } from "react";
export type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
// metadata
title: string;
description?: string;
// chart config
config: TConfig;
data: Array<Record<keyof TConfig, number> & { time: number | string | Date }>;
showLegend?: boolean;
// chart className
chartClassName?: string;
};
export function ThirdwebAreaChart<TConfig extends ChartConfig>(
props: ThirdwebAreaChartProps<TConfig>,
) {
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>
{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>
);
}
@@ -0,0 +1,91 @@
"use client";
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import {
type ChartConfig,
ChartContainer,
ChartLegend,
ChartLegendContent,
ChartTooltip,
ChartTooltipContent,
} from "@/components/ui/chart";
import { useMemo } from "react";
export type ThirdwebBarChartProps<TConfig extends ChartConfig> = {
// metadata
title: string;
description?: string;
// chart config
config: TConfig;
data: Array<Record<keyof TConfig, number> & { time: number | string | Date }>;
showLegend?: boolean;
variant?: "stacked" | "grouped";
// chart className
chartClassName?: string;
};
export function ThirdwebBarChart<TConfig extends ChartConfig>(
props: ThirdwebBarChartProps<TConfig>,
) {
const configKeys = useMemo(() => Object.keys(props.config), [props.config]);
// if there are more than 4 keys then we should stack them by default
const variant =
props.variant || configKeys.length > 4 ? "stacked" : "grouped";
return (
<Card>
<CardHeader>
<CardTitle>{props.title}</CardTitle>
{props.description && (
<CardDescription>{props.description}</CardDescription>
)}
</CardHeader>
<CardContent>
<ChartContainer config={props.config} className={props.chartClassName}>
<BarChart accessibilityLayer data={props.data}>
<CartesianGrid vertical={false} />
<XAxis
dataKey="time"
tickLine={false}
axisLine={false}
tickMargin={10}
tickFormatter={(value) => new Date(value).toLocaleDateString()}
/>
<ChartTooltip content={<ChartTooltipContent hideLabel />} />
{props.showLegend && (
<ChartLegend content={<ChartLegendContent />} />
)}
{configKeys.map((key, idx) => (
<Bar
key={key}
dataKey={key}
// if stacked then they should all be the same stackId
// if grouped then they should all be unique stackId (so the key works great)
stackId={variant === "stacked" ? "a" : key}
fill={`var(--color-${key})`}
// if stacked then we need to figure out the radius based on the index in the array
// if grouped then we can just use the same radius for all
radius={
variant === "stacked"
? idx === 0
? [0, 0, 4, 4]
: idx === configKeys.length - 1
? [4, 4, 0, 0]
: [0, 0, 0, 0]
: [4, 4, 4, 4]
}
/>
))}
</BarChart>
</ChartContainer>
</CardContent>
</Card>
);
}
@@ -1,10 +1,9 @@
"use client";
import { Button } from "@/components/ui/button";
import { ClientOnly } from "components/ClientOnly/ClientOnly";
import { Moon, Sun } from "lucide-react";
import { useTheme } from "next-themes";
import * as React from "react";
import { ClientOnly } from "../../components/ClientOnly/ClientOnly";
import { Skeleton } from "./ui/skeleton";
export function ColorModeToggle() {
@@ -0,0 +1,46 @@
import { Highlight } from "prism-react-renderer";
import { cn } from "../../lib/utils";
import { CopyButton } from "./CopyButton";
import { Card } from "./card";
interface CodeBlockProps {
code: string;
language?: string;
className?: string;
canCopy?: boolean;
}
export const CodeBlock = ({
code,
language = "sh",
canCopy = true,
}: CodeBlockProps) => {
return (
<Highlight code={code} language={language}>
{({ className, tokens, getLineProps, getTokenProps }) => (
<Card className={className}>
{canCopy && (
<CopyButton text={code} className="float-right p-2 m-2" />
)}
<div
className={cn(
"block font-mono text-sm whitespace-pre-wrap p-4 overflow-auto",
className,
)}
>
{tokens.map((line, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: index IS the key here
<div {...getLineProps({ line, key: i })} key={i}>
{line.map((token, key) => (
// biome-ignore lint/suspicious/noArrayIndexKey: index IS the key here
<span {...getTokenProps({ token, key })} key={key} />
))}
</div>
))}
</div>
</Card>
)}
</Highlight>
);
};
@@ -10,9 +10,9 @@ import {
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import type { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import type { VariantProps } from "class-variance-authority";
import type React from "react";
import { cn } from "../../lib/utils";
export interface ConfirmationDialogProps
extends VariantProps<typeof buttonVariants> {
@@ -1,6 +1,6 @@
"use client";
import { cn } from "../../lib/utils";
import { cn } from "@/lib/utils";
import { CopyTextButton } from "./CopyTextButton";
export function CopyAddressButton(props: {
@@ -1,8 +1,8 @@
"use client";
import { cn } from "@/lib/utils";
import { CheckIcon, CopyIcon } from "lucide-react";
import { useState } from "react";
import { cn } from "../../lib/utils";
import { Button } from "./button";
import { ToolTipLabel } from "./tooltip";
@@ -1,8 +1,8 @@
"use client";
import { cn } from "@/lib/utils";
import { CheckIcon, CopyIcon } from "lucide-react";
import { useState } from "react";
import { cn } from "../../lib/utils";
import { Button } from "./button";
import { ToolTipLabel } from "./tooltip";
@@ -23,10 +23,15 @@ export function CopyTextButton(props: {
}) {
const [isCopied, setIsCopied] = useState(false);
const copyButton = isCopied ? (
<CheckIcon className={cn("size-3 text-green-500", props.iconClassName)} />
<CheckIcon
className={cn("size-3 text-green-500 shrink-0", props.iconClassName)}
/>
) : (
<CopyIcon
className={cn("size-3 text-muted-foreground", props.iconClassName)}
className={cn(
"size-3 text-muted-foreground shrink-0",
props.iconClassName,
)}
/>
);
@@ -47,13 +52,13 @@ export function CopyTextButton(props: {
>
{props.copyIconPosition === "right" ? (
<>
{props.textToShow}
<span className="truncate min-w-0"> {props.textToShow} </span>
{copyButton}
</>
) : (
<>
{copyButton}
{props.textToShow}
<span className="truncate min-w-0"> {props.textToShow} </span>
</>
)}
</Button>
@@ -1,7 +1,8 @@
"use client";
import { useIsomorphicLayoutEffect } from "@/lib/useIsomorphicLayoutEffect";
import type React from "react";
import { useLayoutEffect, useRef, useState } from "react";
import { useRef, useState } from "react";
export function DynamicHeight(props: {
children: React.ReactNode;
@@ -33,11 +34,11 @@ export function DynamicHeight(props: {
);
}
export function useHeightObserver() {
function useHeightObserver() {
const elementRef = useRef<HTMLDivElement>(null);
const [height, setHeight] = useState<number | undefined>();
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
const element = elementRef.current;
if (!element) {
return;
@@ -0,0 +1,25 @@
.unorderedList,
.orderedList {
@apply pl-5 leading-relaxed list-none text-secondary-foreground;
}
.unorderedList > li {
@apply pb-1 pl-2 list-disc;
}
.orderedList > li {
@apply pb-1 pl-2 list-decimal;
}
.unorderedList > li::marker {
@apply text-muted-foreground !m-0 text-left;
}
.orderedList > li::marker {
@apply text-muted-foreground text-left;
}
.unorderedList > li:hover::marker,
.orderedList > li:hover::marker {
@apply text-foreground;
}
@@ -0,0 +1,9 @@
import styles from "./List.module.css";
export function UnorderedList(props: { children?: React.ReactNode }) {
return <ul className={styles.unorderedList}>{props.children}</ul>;
}
export function OrderedList(props: { children?: React.ReactNode }) {
return <ul className={styles.orderedList}>{props.children}</ul>;
}
@@ -1,7 +1,8 @@
"use client";
import { useIsomorphicLayoutEffect } from "@/lib/useIsomorphicLayoutEffect";
import { cn } from "@/lib/utils";
import { useLayoutEffect, useRef } from "react";
import { useRef } from "react";
import styles from "./ScrollShadow.module.css";
export function ScrollShadow(props: {
@@ -17,7 +18,7 @@ export function ScrollShadow(props: {
const shadowRightEl = useRef<HTMLDivElement>(null);
const wrapperEl = useRef<HTMLDivElement>(null);
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
const content = scrollableEl.current;
const shadowTop = shadowTopEl.current;
const shadowBottom = shadowBottomEl.current;
+1 -1
View File
@@ -10,7 +10,7 @@ const alertVariants = cva(
variant: {
default: "bg-background text-foreground",
destructive:
"bg-destructive/10 border-destructive/50 dark:border-destructive [&>svg]:text-destructive",
"bg-destructive/30 border-destructive/50 dark:border-destructive [&>svg]:text-destructive",
info: "bg-primary/10 border-primary/50 dark:border-primary [&>svg]:text-primary",
warning:
"bg-warning/10 border-warning/50 dark:border-warning [&>svg]:text-warning",
@@ -44,10 +44,13 @@ export interface ButtonProps
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
const btnOnlyProps =
Comp === "button" ? { type: "button" as const } : undefined;
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...btnOnlyProps}
{...props}
/>
);
+1 -1
View File
@@ -9,7 +9,7 @@ const Card = React.forwardRef<
<div
ref={ref}
className={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
"rounded-lg border border-border bg-card text-card-foreground shadow-sm",
className,
)}
{...props}
+1 -1
View File
@@ -283,7 +283,7 @@ const ChartLegendContent = React.forwardRef<
<div
ref={ref}
className={cn(
"flex items-center justify-center gap-4",
"flex items-center justify-center gap-4 overflow-x-auto",
verticalAlign === "top" ? "pb-3" : "pt-3",
className,
)}
@@ -36,7 +36,7 @@ export function CheckboxWithLabel(props: {
return (
<label
className={cn(
"flex gap-2 items-center text-secondary-foreground text-sm cursor-pointer select-none",
"flex gap-2 items-start text-secondary-foreground text-sm cursor-pointer select-none [&>button]:mt-0.5",
props.className,
)}
>
@@ -41,7 +41,7 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-300 rounded-lg border-border",
"fixed grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-300 rounded-t-xl md:rounded-lg border-border",
// on mobile - put the dialog at the bottom of the screen, animate - slide up and fade in
"bottom-0 left-0 right-0",
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
@@ -47,7 +47,7 @@ const DropdownMenuSubContent = React.forwardRef<
<DropdownMenuPrimitive.SubContent
ref={ref}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
@@ -65,7 +65,7 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
@@ -75,7 +75,7 @@ const SelectContent = React.forwardRef<
<SelectPrimitive.Content
ref={ref}
className={cn(
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className,
@@ -0,0 +1,29 @@
"use client";
import * as SwitchPrimitives from "@radix-ui/react-switch";
import * as React from "react";
import { cn } from "@/lib/utils";
const Switch = React.forwardRef<
React.ElementRef<typeof SwitchPrimitives.Root>,
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-foreground data-[state=unchecked]:bg-input",
className,
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
)}
/>
</SwitchPrimitives.Root>
));
Switch.displayName = SwitchPrimitives.Root.displayName;
export { Switch };
+6 -3
View File
@@ -1,6 +1,9 @@
"use client";
import { useIsomorphicLayoutEffect } from "@/lib/useIsomorphicLayoutEffect";
import { cn } from "@/lib/utils";
import Link from "next/link";
import { useCallback, useLayoutEffect, useRef, useState } from "react";
import { cn } from "../../lib/utils";
import { useCallback, useRef, useState } from "react";
import { ScrollShadow } from "./ScrollShadow/ScrollShadow";
import { Button } from "./button";
@@ -126,7 +129,7 @@ function useUnderline<El extends HTMLElement>() {
setActiveTabEl(el);
}, []);
useLayoutEffect(() => {
useIsomorphicLayoutEffect(() => {
if (activeTabEl && containerRef.current && lineRef.current) {
const containerRect = containerRef.current.getBoundingClientRect();
const lineEl = lineRef.current;
@@ -31,7 +31,7 @@ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
export function ToolTipLabel(props: {
children: React.ReactNode;
label: string | undefined;
label: React.ReactNode;
rightIcon?: React.ReactNode;
leftIcon?: React.ReactNode;
}) {
@@ -47,7 +47,7 @@ export function ToolTipLabel(props: {
</TooltipTrigger>
<TooltipContent
sideOffset={10}
className="max-w-[300px] leading-relaxed"
className="max-w-[400px] leading-relaxed whitespace-normal"
>
<div className="p-2 text-sm flex items-center gap-1.5">
{props.leftIcon}
+5 -1
View File
@@ -1,4 +1,4 @@
export const LOGGED_IN_ONLY_PATHS = [
const LOGGED_IN_ONLY_PATHS = [
// anything that _starts_ with /dashboard is logged in only
"/dashboard",
// anything that _starts_ with /cli is logged in only
@@ -6,3 +6,7 @@ export const LOGGED_IN_ONLY_PATHS = [
"/support",
// TODO: add any other logged in only paths here
];
export function isLoginRequired(pathname: string) {
return LOGGED_IN_ONLY_PATHS.some((path) => pathname.startsWith(path));
}
+28 -9
View File
@@ -1,11 +1,30 @@
import {
DASHBOARD_THIRDWEB_CLIENT_ID,
DASHBOARD_THIRDWEB_SECRET_KEY,
IPFS_GATEWAY_URL,
} from "@/constants/env";
import { createThirdwebClient } from "thirdweb";
import { DASHBOARD_THIRDWEB_CLIENT_ID, IPFS_GATEWAY_URL } from "./env";
export const thirdwebClient = createThirdwebClient({
clientId: DASHBOARD_THIRDWEB_CLIENT_ID,
config: {
storage: {
gatewayUrl: IPFS_GATEWAY_URL,
},
},
});
export const thirdwebClient = createThirdwebClient(
DASHBOARD_THIRDWEB_SECRET_KEY
? {
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
config: {
storage: {
gatewayUrl: IPFS_GATEWAY_URL,
},
},
}
: {
clientId: DASHBOARD_THIRDWEB_CLIENT_ID,
config: {
storage: {
gatewayUrl: IPFS_GATEWAY_URL,
},
},
},
);
/**
* DO NOT ADD ANYTHING TO THIS FILE IF YOU ARE NOT ABSOLUTELY SURE IT IS OK
*/
+6
View File
@@ -10,3 +10,9 @@ export const IPFS_GATEWAY_URL =
export const THIRDWEB_ENGINE_FAUCET_WALLET =
process.env.NEXT_PUBLIC_THIRDWEB_ENGINE_FAUCET_WALLET || "";
export const isProd =
(process.env.VERCEL_ENV || process.env.NEXT_PUBLIC_VERCEL_ENV) ===
"production";
export const PROD_OR_DEV_URL = isProd ? "thirdweb.com" : "thirdweb-dev.com";
@@ -0,0 +1,139 @@
"use client";
// eslint-disable-next-line no-restricted-imports
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import {
Suspense,
useEffect,
useMemo,
useRef,
useState,
useSyncExternalStore,
} from "react";
import { createStore } from "./reactive";
// Using useDashboardRouter instead of useRouter gives us a nice progress bar on top of the page when navigating using router.push or router.replace
// using a store instead of context to avoid triggering re-renders on root component
export const LoadingRouteHref = createStore<string | undefined>(undefined);
export function useDashboardRouter() {
const router = useRouter();
return useMemo(() => {
return {
...router,
replace(href: string, options?: { scroll?: boolean }) {
LoadingRouteHref.setValue(href);
router.replace(href, options);
},
push(href: string, options?: { scroll?: boolean }) {
LoadingRouteHref.setValue(href);
router.push(href, options);
},
};
}, [router]);
}
function useRouterLoadingStatus() {
const loadingHref = useSyncExternalStore(
LoadingRouteHref.subscribe,
LoadingRouteHref.getValue,
LoadingRouteHref.getValue,
);
const pathname = usePathname();
const searchParams = useSearchParams();
const searchParamsStr = searchParams?.toString();
const routerHref = pathname + (searchParamsStr ? `?${searchParamsStr}` : "");
const isLoading = loadingHref && loadingHref !== routerHref;
// reset loading on route load
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
if (!isLoading) {
LoadingRouteHref.setValue(undefined);
}
}, [isLoading]);
return isLoading;
}
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
// Render this on root
function DashboardRouterTopProgressBarInner() {
const isLoading = useRouterLoadingStatus();
const [progress, setProgress] = useState(0);
const progressStartedRef = useRef(false);
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
if (!isLoading) {
setProgress(0);
progressStartedRef.current = false;
return;
}
if (progressStartedRef.current) {
return;
}
let isMounted = true;
progressStartedRef.current = true;
async function updateProgressBar(progress: number, delay: number) {
if (!isMounted) {
if (!isLoading) {
setProgress(100);
}
return;
}
setProgress(progress);
await wait(delay);
// increase progress by 10% of the remaining progress
// increase the delay by 5% to slow down number of updates for slower progress
updateProgressBar(progress + (100 - progress) / 10, delay * 1.05);
}
async function startEffect() {
// if the loading state remains for atleast 500ms start the progress bar
await wait(500);
if (isMounted) {
updateProgressBar(0, 100);
}
}
startEffect();
return () => {
isMounted = false;
};
}, [isLoading]);
const width = isLoading ? progress : 100;
return (
<span
className="block fixed top-0 h-[2px] bg-blue-500"
style={{
opacity: isLoading ? "100" : "0",
width: `${width}%`,
transition: width === 0 ? "none" : "width 0.2s ease, opacity 0.3s ease",
zIndex: "100000000",
pointerEvents: "none",
}}
/>
);
}
// need to wrap with suspense because of useSearchParams usage
export function DashboardRouterTopProgressBar() {
return (
<Suspense fallback={null}>
<DashboardRouterTopProgressBarInner />
</Suspense>
);
}
+47
View File
@@ -0,0 +1,47 @@
export type Store<T> = {
getValue(): T;
setValue(newValue: T): void;
subscribe(listener: () => void): () => void;
};
/**
* Create a reactive value store
* @param initialValue - The initial value to store
* @example
* ```ts
* const store = createStore(0);
* ```
* @returns A store object
* @internal
*/
export function createStore<T>(initialValue: T): Store<T> {
type Listener = () => void;
const listeners = new Set<Listener>();
let value = initialValue;
const notify = () => {
for (const listener of listeners) {
listener();
}
};
return {
getValue() {
return value;
},
setValue(newValue: T) {
if (newValue === value) {
return;
}
value = newValue;
notify();
},
subscribe(listener: Listener) {
listeners.add(listener);
return () => {
listeners.delete(listener);
};
},
};
}
+17
View File
@@ -0,0 +1,17 @@
import { toast } from "sonner";
// if browser supports sharing use native sharing - use that, else just copy to clipboard + show toast
export async function shareLink(_data: ShareData) {
const data = { ..._data, url: _data.url || window.location.href };
if (
"canShare" in navigator &&
navigator.canShare &&
navigator.canShare(data)
) {
await navigator.share(data);
} else {
await navigator.clipboard.writeText(data.url);
toast.info("URL copied to clipboard");
}
}
@@ -0,0 +1,4 @@
import { useEffect, useLayoutEffect } from "react";
export const useIsomorphicLayoutEffect =
typeof window !== "undefined" ? useLayoutEffect : useEffect;
+15 -10
View File
@@ -3,7 +3,8 @@
@tailwind utilities;
@layer base {
:root {
:root,
[data-theme="light"] {
/* bg - neutral */
--background: 0 0% 100%;
--secondary: 0 0% 97%;
@@ -44,7 +45,8 @@
--radius: 0.5rem;
}
.dark {
.dark,
[data-theme="dark"] {
/* bg - neutral */
--background: 0 0% 4.5%;
--secondary: 0 0% 6.5%;
@@ -94,19 +96,22 @@
/* shadcn charts */
@layer base {
:root {
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
}
.dark {
--chart-1: 220 70% 50%;
--chart-2: 160 60% 45%;
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
/* below is ai generated based on the initial */
--chart-6: 200 65% 50%;
--chart-7: 120 70% 45%;
--chart-8: 45 75% 55%;
--chart-9: 260 60% 60%;
--chart-10: 0 70% 50%;
--chart-11: 180 60% 50%;
--chart-12: 100 65% 55%;
--chart-13: 360 70% 55%;
--chart-14: 240 65% 50%;
--chart-15: 80 60% 50%;
}
}
@@ -90,8 +90,10 @@ export const engineKeys = {
health: (instance: string) =>
[...engineKeys.all, instance, "health"] as const,
latestVersion: () => [...engineKeys.all, "latestVersion"] as const,
metrics: (engineId: string) =>
[...engineKeys.all, engineId, "metrics"] as const,
systemMetrics: (engineId: string) =>
[...engineKeys.all, engineId, "systemMetrics"] as const,
queueMetrics: (engineId: string) =>
[...engineKeys.all, engineId, "queueMetrics"] as const,
};
export const contractKeys = {
@@ -3,20 +3,23 @@
import { Spinner } from "@/components/ui/Spinner/Spinner";
import { Button } from "@/components/ui/button";
import { thirdwebClient } from "@/constants/client";
import { useSupportedChains } from "@thirdweb-dev/react";
import { getSDKTheme } from "app/components/sdk-component-theme";
import { CustomChainRenderer } from "components/selects/CustomChainRenderer";
import { mapV4ChainToV5Chain } from "contexts/map-chains";
import { useTrack } from "hooks/analytics/useTrack";
import { useSupportedChains } from "hooks/chains/configureChains";
import {
useAddRecentlyUsedChainId,
useRecentlyUsedChains,
} from "hooks/chains/recentlyUsedChains";
import { useSetIsNetworkConfigModalOpen } from "hooks/networkConfigModal";
import { useTheme } from "next-themes";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useCallback, useMemo } from "react";
import { type Chain, defineChain } from "thirdweb";
import type { Chain } from "thirdweb";
import { AutoConnect, ConnectButton, useConnectModal } from "thirdweb/react";
import { getSDKTheme } from "../../../../app/components/sdk-component-theme";
import { useFavoriteChains } from "../../hooks/useFavoriteChains";
import { useLoggedInUser } from "../../hooks/useLoggedInUser";
import { popularChains } from "../popularChains";
@@ -34,16 +37,16 @@ export const CustomConnectWallet = (props: {
const t = theme === "light" ? "light" : "dark";
const allv4Chains = useSupportedChains();
const favChainsQuery = useFavoriteChains();
const setIsNetworkConfigModalOpen = useSetIsNetworkConfigModalOpen();
const allChains = useMemo(() => {
return allv4Chains.map((c) => defineChain(c));
return allv4Chains.map(mapV4ChainToV5Chain);
}, [allv4Chains]);
const chainSections = useMemo(() => {
return [
{
label: "Favorites",
chains: favChainsQuery.data.map(defineChain),
chains: favChainsQuery.data.map(mapV4ChainToV5Chain),
},
{
label: "Popular",
@@ -51,7 +54,7 @@ export const CustomConnectWallet = (props: {
},
{
label: "Recent",
chains: recentChainsv4.map(defineChain),
chains: recentChainsv4.map(mapV4ChainToV5Chain),
},
];
}, [recentChainsv4, favChainsQuery.data]);
@@ -63,7 +66,7 @@ export const CustomConnectWallet = (props: {
if (isLoading) {
return (
<>
<div className="w-[144px] h-[48px] bg-muted border rounded-lg flex items-center justify-center">
<div className="w-[144px] h-[48px] bg-muted border border-border rounded-lg flex items-center justify-center">
<Spinner className="size-4" />
</div>
{/* need autoconnect here so that we actually connect */}
@@ -123,8 +126,10 @@ export const CustomConnectWallet = (props: {
onSwitch(chain) {
addRecentlyUsedChainId(chain.id);
},
// TODO: bring this back when it works reliably
// renderChain: CustomChainRenderer,
renderChain: CustomChainRenderer,
onCustomClick: () => {
setIsNetworkConfigModalOpen(true);
},
},
}}
/>
@@ -2,11 +2,11 @@ import {
useIsAdmin,
useIsAdminOrSelf,
} from "@3rdweb-sdk/react/hooks/useContractRoles";
import type { ValidContractInstance } from "@thirdweb-dev/sdk";
import type { ThirdwebContract } from "thirdweb";
import type { ComponentWithChildren } from "types/component-with-children";
interface AdminOnlyProps {
contract?: ValidContractInstance;
contract: ThirdwebContract;
fallback?: JSX.Element;
}
@@ -22,7 +22,9 @@ export const AdminOnly: ComponentWithChildren<AdminOnlyProps> = ({
return <>{children}</>;
};
interface AdminOrSelfOnlyProps extends AdminOnlyProps {
interface AdminOrSelfOnlyProps {
contract: ThirdwebContract;
fallback?: JSX.Element;
/**
* The address of the account to check against
*/
@@ -1,56 +1,70 @@
import { useContract, useContractEvents } from "@thirdweb-dev/react";
import type { ContractEvent } from "@thirdweb-dev/sdk";
import { type AbiEvent, formatAbiItem } from "abitype";
import { useMemo } from "react";
import {
type PreparedEvent,
type ThirdwebContract,
prepareEvent,
} from "thirdweb";
import { useContractEvents } from "thirdweb/react";
import { useResolveContractAbi } from "./useResolveContractAbi";
interface InternalTransaction {
transactionHash: ContractEvent["transaction"]["transactionHash"];
blockNumber: ContractEvent["transaction"]["blockNumber"];
events: ContractEvent[];
export interface InternalTransaction {
transactionHash: string;
blockNumber: bigint;
events: Array<{
logIndex: number;
address: string;
eventName: string;
args: readonly unknown[] | Record<string, unknown>;
}>;
}
export function useActivity(contractAddress?: string, autoUpdate?: boolean) {
// const provider = useProvider();
const contractQuery = useContract(contractAddress);
export function useActivity(contract: ThirdwebContract, autoUpdate?: boolean) {
const abiQuery = useResolveContractAbi(contract);
const eventsQuery = useContractEvents(contractQuery.contract, undefined, {
subscribe: autoUpdate,
queryFilter: {
fromBlock: -20000,
},
// Get all the PreprareEvents from the contract abis
const events: PreparedEvent<AbiEvent>[] = useMemo(() => {
const eventsItems = (abiQuery.data || []).filter((o) => o.type === "event");
const eventSignatures = eventsItems.map((event) => formatAbiItem(event));
return eventSignatures.map((signature) =>
prepareEvent({ signature: signature as `event ${string}` }),
);
}, [abiQuery.data]);
const eventsQuery = useContractEvents({
contract,
events,
blockRange: 20000,
watch: autoUpdate,
});
return useMemo(() => {
if (!eventsQuery.data) {
return [];
}
const obj = eventsQuery.data.slice(0, 100).reduce(
(acc, curr) => {
if (acc[curr.transaction.transactionHash]) {
acc[curr.transaction.transactionHash].events.push(curr);
acc[curr.transaction.transactionHash].events.sort(
// biome-ignore lint/suspicious/noExplicitAny: FIXME
(a: any, b: any) => b.transaction.logIndex - a.transaction.logIndex,
if (acc[curr.transactionHash]) {
acc[curr.transactionHash].events.push(curr);
acc[curr.transactionHash].events.sort(
(a, b) => b.logIndex - a.logIndex,
);
if (
acc[curr.transaction.transactionHash].blockNumber >
curr.transaction.blockNumber
) {
acc[curr.transaction.transactionHash].blockNumber =
curr.transaction.blockNumber;
if (acc[curr.transactionHash].blockNumber > curr.blockNumber) {
acc[curr.transactionHash].blockNumber = curr.blockNumber;
}
} else {
acc[curr.transaction.transactionHash] = {
transactionHash: curr.transaction.transactionHash,
blockNumber: curr.transaction.blockNumber,
acc[curr.transactionHash] = {
transactionHash: curr.transactionHash,
blockNumber: curr.blockNumber,
events: [curr],
};
}
return acc;
},
{} as Record<string, InternalTransaction>,
);
return Object.values(obj).sort((a, b) => b.blockNumber - a.blockNumber);
return Object.values(obj).sort((a, b) =>
a.blockNumber > b.blockNumber ? -1 : 1,
);
}, [eventsQuery.data]);
}
@@ -4,9 +4,9 @@ import {
useQuery,
useQueryClient,
} from "@tanstack/react-query";
import { THIRDWEB_API_HOST } from "constants/urls";
import type { ChainMetadata } from "thirdweb/chains";
import invariant from "tiny-invariant";
import { THIRDWEB_API_HOST } from "../../../constants/urls";
import { accountKeys, apiKeys, authorizedWallets } from "../cache-keys";
import { useMutationWithInvalidate } from "./query/useQueryWithNetwork";
import { useLoggedInUser } from "./useLoggedInUser";
@@ -73,7 +73,6 @@ export type Account = {
interface UpdateAccountInput {
name?: string;
email?: string;
plan?: AccountPlan;
linkWallet?: boolean;
subscribeToUpdates?: boolean;
onboardSkipped?: boolean;
@@ -271,9 +270,9 @@ interface UseAccountInput {
export function useAccount({ refetchInterval }: UseAccountInput = {}) {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
accountKeys.me(user?.address as string),
async () => {
return useQuery({
queryKey: accountKeys.me(user?.address as string),
queryFn: async () => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/me`, {
method: "GET",
headers: {
@@ -288,19 +287,17 @@ export function useAccount({ refetchInterval }: UseAccountInput = {}) {
return json.data as Account;
},
{
enabled: !!user?.address && isLoggedIn,
refetchInterval: refetchInterval ?? false,
},
);
enabled: !!user?.address && isLoggedIn,
refetchInterval: refetchInterval ?? false,
});
}
export function useAccountUsage() {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
accountKeys.usage(user?.address as string),
async () => {
return useQuery({
queryKey: accountKeys.usage(user?.address as string),
queryFn: async () => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/usage`, {
method: "GET",
headers: {
@@ -315,16 +312,16 @@ export function useAccountUsage() {
return json.data as UsageBillableByService;
},
{ enabled: !!user?.address && isLoggedIn },
);
enabled: !!user?.address && isLoggedIn,
});
}
export function useAccountCredits() {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
accountKeys.credits(user?.address as string),
async () => {
return useQuery({
queryKey: accountKeys.credits(user?.address as string),
queryFn: async () => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/credits`, {
method: "GET",
@@ -347,16 +344,19 @@ export function useAccountCredits() {
return credits;
},
{ enabled: !!user?.address && isLoggedIn },
);
enabled: !!user?.address && isLoggedIn,
});
}
export function useWalletStats(clientId: string | undefined) {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
accountKeys.walletStats(user?.address as string, clientId as string),
async () => {
return useQuery({
queryKey: accountKeys.walletStats(
user?.address as string,
clientId as string,
),
queryFn: async () => {
const res = await fetch(
`${THIRDWEB_API_HOST}/v1/account/wallets?clientId=${clientId}`,
{
@@ -375,8 +375,8 @@ export function useWalletStats(clientId: string | undefined) {
return json.data as WalletStats;
},
{ enabled: !!clientId && !!user?.address && isLoggedIn },
);
enabled: !!clientId && !!user?.address && isLoggedIn,
});
}
export function useUpdateAccount() {
@@ -419,7 +419,7 @@ export function useUpdateAccountPlan(waitForWebhook?: boolean) {
const queryClient = useQueryClient();
return useMutationWithInvalidate(
async (input: { plan: string; feedback?: string; useTrial?: boolean }) => {
async (input: { plan: string; feedback?: string }) => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(`${THIRDWEB_API_HOST}/v1/account/plan`, {
@@ -495,9 +495,9 @@ export function useUpdateNotifications() {
export function useCreateBillingSession(enabled = false) {
const { user } = useLoggedInUser();
return useQuery(
accountKeys.billingSession(user?.address as string),
async () => {
return useQuery({
queryKey: accountKeys.billingSession(user?.address as string),
queryFn: async () => {
invariant(user?.address, "walletAddress is required");
const res = await fetch(
@@ -518,8 +518,8 @@ export function useCreateBillingSession(enabled = false) {
return json.data;
},
{ enabled },
);
enabled,
});
}
export function useConfirmEmail() {
@@ -637,9 +637,9 @@ export function useCreatePaymentMethod() {
export function useApiKeys() {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
apiKeys.keys(user?.address as string),
async () => {
return useQuery({
queryKey: apiKeys.keys(user?.address as string),
queryFn: async () => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/keys`, {
method: "GET",
@@ -654,8 +654,8 @@ export function useApiKeys() {
}
return json.data as ApiKey[];
},
{ enabled: !!user?.address && isLoggedIn },
);
enabled: !!user?.address && isLoggedIn,
});
}
export function useCreateApiKey() {
@@ -885,9 +885,9 @@ export function useRevokeAuthorizedWallet() {
export function useAuthorizedWallets() {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
authorizedWallets.authorizedWallets(user?.address as string),
async () => {
return useQuery({
queryKey: authorizedWallets.authorizedWallets(user?.address as string),
queryFn: async () => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/authorized-wallets`, {
method: "GET",
@@ -903,8 +903,9 @@ export function useAuthorizedWallets() {
return json.data as AuthorizedWallet[];
},
{ enabled: !!user?.address && isLoggedIn, cacheTime: 0 },
);
enabled: !!user?.address && isLoggedIn,
cacheTime: 0,
});
}
/**
@@ -913,12 +914,7 @@ export function useAuthorizedWallets() {
export async function fetchChainsFromApi() {
// always fetch from prod for chains for now
// TODO: re-visit this
const res = await fetch("https://api.thirdweb.com/v1/chains", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
const res = await fetch("https://api.thirdweb.com/v1/chains");
const json = await res.json();
if (json.error) {
@@ -929,7 +925,10 @@ export async function fetchChainsFromApi() {
}
export function useApiChains() {
return useQuery(["all-chains"], async () => {
return fetchChainsFromApi();
return useQuery({
queryKey: ["all-chains"],
queryFn: () => {
return fetchChainsFromApi();
},
});
}
@@ -1,76 +1,31 @@
import {
type ContractWithRoles,
type RolesForContract,
useContractType,
useRoleMembers,
} from "@thirdweb-dev/react";
import type { ValidContractInstance } from "@thirdweb-dev/sdk";
import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
import { hasRole } from "thirdweb/extensions/permissions";
import { useActiveAccount, useReadContract } from "thirdweb/react";
import type { RequiredParam } from "utils/types";
function isContractWithRoles(
contract: RequiredParam<ValidContractInstance>,
): contract is ContractWithRoles {
if (contract && "roles" in contract) {
return true;
}
return false;
}
function useIsAccountRole<TContract extends ContractWithRoles>(
role: RolesForContract<TContract>[number],
contract: RequiredParam<TContract>,
account: RequiredParam<string>,
): boolean {
const contractHasRoles = isContractWithRoles(contract);
const { data } = useRoleMembers(contract, role);
if (contractHasRoles === false) {
return false;
}
if (data?.includes(ZERO_ADDRESS)) {
return true;
}
return !!(account && data?.includes(account));
}
export function useIsAdmin<TContract extends ValidContractInstance>(
contract: RequiredParam<TContract>,
) {
export function useIsAdmin(contract: ThirdwebContract) {
const address = useActiveAccount()?.address;
const { data: contractType } = useContractType(contract?.getAddress());
const { data: userIsAdmin, isError } = useReadContract(hasRole, {
contract,
targetAccountAddress: address ?? "",
role: "admin",
queryOptions: { enabled: !!address },
});
const contractHasRoles = isContractWithRoles(contract);
const isAccountRole = useIsAccountRole(
"admin",
contractHasRoles ? contract : undefined,
address,
);
if (contractType === "custom") {
return true;
}
return isAccountRole;
// If the request results in an error, it's likely that the contract is a non-thirdweb contract
// in that case we return `true` anyway
return userIsAdmin || isError;
}
export function useIsAdminOrSelf<TContract extends ValidContractInstance>(
contract: RequiredParam<TContract>,
export function useIsAdminOrSelf(
contract: ThirdwebContract,
self: RequiredParam<string>,
) {
const address = useActiveAccount()?.address;
const { data: contractType } = useContractType(contract?.getAddress());
const isAdmin = useIsAdmin(contract);
if (address === self) {
return true;
}
if (contractType === "custom") {
return true;
}
return isAdmin;
}
@@ -0,0 +1,54 @@
import { useQuery } from "@tanstack/react-query";
import type { ThirdwebContract } from "thirdweb";
import { getCompilerMetadata } from "thirdweb/contract";
import { getContractMetadata, name, symbol } from "thirdweb/extensions/common";
/**
* Fetch the contract metadata for Dashboard
*
* If the contract itself doesn't implement the metadata extension,
* we try to fall back to:
* 1. name(), symbol()
* 2. our API endpoint
*/
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 || "",
};
},
});
}
@@ -0,0 +1,41 @@
import { useQuery } from "@tanstack/react-query";
import type { NFT, ThirdwebContract } from "thirdweb";
import {
getOwnedNFTs as getOwnedERC721,
isERC721,
} from "thirdweb/extensions/erc721";
import { getOwnedNFTs as getOwnedERC1155 } from "thirdweb/extensions/erc1155";
import invariant from "tiny-invariant";
/**
* This hook is currently used for getting owned NFTs for Create DirectListing/English Auction
* It should only be used if our indexing solutions don't support the current network
*/
export function useDashboardOwnedNFTs({
contract,
owner,
disabled,
}: { owner?: string; contract?: ThirdwebContract; disabled?: boolean }) {
return useQuery({
queryKey: [
"owned-nfts",
contract?.chain.id || "",
contract?.address || "",
owner || "",
],
queryFn: async (): Promise<NFT[]> => {
invariant(contract, "Contract is required");
invariant(owner, "owner address is required");
const is721 = await isERC721({ contract });
if (is721) {
return getOwnedERC721({
contract,
owner,
});
}
// Else default to 1155
return getOwnedERC1155({ contract, address: owner });
},
enabled: !!contract && !!owner && !disabled,
});
}
@@ -25,12 +25,12 @@ export type EmbeddedWalletUser = {
export function useEmbeddedWallets(clientId: string) {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
embeddedWalletsKeys.embeddedWallets(
return useQuery({
queryKey: embeddedWalletsKeys.embeddedWallets(
user?.address as string,
clientId as string,
),
async () => {
queryFn: async () => {
const res = await fetch(
`${THIRDWEB_EWS_API_HOST}/api/thirdweb/embedded-wallet?clientId=${clientId}&lastAccessedAt=0`,
{
@@ -46,6 +46,6 @@ export function useEmbeddedWallets(clientId: string) {
return json.walletUsers as EmbeddedWalletUser[];
},
{ enabled: !!user?.address && isLoggedIn && !!clientId },
);
enabled: !!user?.address && isLoggedIn && !!clientId,
});
}
@@ -1,9 +1,9 @@
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 { useState } from "react";
import { useActiveAccount, useActiveWalletChain } from "thirdweb/react";
import invariant from "tiny-invariant";
import type { ResultItem } from "../../../components/engine/system-metrics/components/StatusCodes";
import { engineKeys } from "../cache-keys";
import { useMutationWithInvalidate } from "./query/useQueryWithNetwork";
import { useLoggedInUser } from "./useLoggedInUser";
@@ -55,9 +55,9 @@ const getEngineRequestHeaders = (token: string | null): HeadersInit => {
export function useEngineInstances() {
const { user, isLoggedIn } = useLoggedInUser();
return useQuery(
engineKeys.instances(user?.address as string),
async (): Promise<EngineInstance[]> => {
return useQuery({
queryKey: engineKeys.instances(user?.address as string),
queryFn: async (): Promise<EngineInstance[]> => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/engine`, {
method: "GET",
});
@@ -79,8 +79,8 @@ export function useEngineInstances() {
};
});
},
{ enabled: !!user?.address && isLoggedIn },
);
enabled: !!user?.address && isLoggedIn,
});
}
// GET Requests
@@ -100,9 +100,9 @@ export type BackendWallet = {
export function useEngineBackendWallets(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
[engineKeys.backendWallets(instance)],
async () => {
return useQuery({
queryKey: [engineKeys.backendWallets(instance)],
queryFn: async () => {
const res = await fetch(`${instance}backend-wallet/get-all?limit=50`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -112,8 +112,8 @@ export function useEngineBackendWallets(instance: string) {
return (json.result as BackendWallet[]) || [];
},
{ enabled: !!instance && !!token },
);
enabled: !!instance && !!token,
});
}
export interface EngineSystemHealth {
@@ -126,9 +126,9 @@ export function useEngineSystemHealth(
instanceUrl: string,
pollInterval: number | false = false,
) {
return useQuery(
engineKeys.health(instanceUrl),
async () => {
return useQuery({
queryKey: engineKeys.health(instanceUrl),
queryFn: async () => {
const res = await fetch(`${instanceUrl}system/health`, {
headers: getEngineRequestHeaders(null),
});
@@ -138,23 +138,57 @@ export function useEngineSystemHealth(
const json = (await res.json()) as EngineSystemHealth;
return json;
},
{
enabled: !!instanceUrl,
refetchInterval: pollInterval,
enabled: !!instanceUrl,
refetchInterval: pollInterval,
});
}
export interface EngineSystemQueueMetrics {
result: {
queued: number;
pending: number;
latency?: {
msToSend: { p50: number; p90: number };
msToMine: { p50: number; p90: number };
};
};
}
export function useEngineQueueMetrics(
instanceUrl: string,
pollInterval: number | false = false,
) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery({
queryKey: engineKeys.queueMetrics(instanceUrl),
queryFn: async () => {
const res = await fetch(`${instanceUrl}system/queue`, {
headers: getEngineRequestHeaders(token),
});
if (!res.ok) {
throw new Error(`Unexpected status ${res.status}: ${await res.text()}`);
}
return (await res.json()) as EngineSystemQueueMetrics;
},
);
enabled: !!instanceUrl && !!token,
refetchInterval: pollInterval,
});
}
export function useEngineLatestVersion() {
return useQuery(engineKeys.latestVersion(), async () => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/engine/latest-version`, {
method: "GET",
});
if (!res.ok) {
throw new Error(`Unexpected status ${res.status}: ${await res.text()}`);
}
const json = await res.json();
return json.data.version as string;
return useQuery({
queryKey: engineKeys.latestVersion(),
queryFn: async () => {
const res = await fetch(`${THIRDWEB_API_HOST}/v1/engine/latest-version`, {
method: "GET",
});
if (!res.ok) {
throw new Error(`Unexpected status ${res.status}: ${await res.text()}`);
}
const json = await res.json();
return json.data.version as string;
},
});
}
@@ -299,6 +333,7 @@ export type Transaction = {
gasPrice?: string | null;
maxFeePerGas?: string | null;
maxPriorityFeePerGas?: string | null;
effectiveGasPrice?: string | null;
transactionType?: number | null;
transactionHash?: string | null;
queuedAt?: string | null;
@@ -347,9 +382,9 @@ type TransactionResponse = {
export function useEngineTransactions(instance: string, autoUpdate: boolean) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.transactions(instance),
async () => {
return useQuery({
queryKey: engineKeys.transactions(instance),
queryFn: async () => {
const res = await fetch(`${instance}transaction/get-all`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -359,11 +394,10 @@ export function useEngineTransactions(instance: string, autoUpdate: boolean) {
return (json.result as TransactionResponse) || {};
},
{
enabled: !!instance && !!token,
refetchInterval: autoUpdate ? 4_000 : false,
},
);
enabled: !!instance && !!token,
refetchInterval: autoUpdate ? 4_000 : false,
});
}
type WalletConfig =
@@ -388,9 +422,9 @@ type WalletConfig =
export function useEngineWalletConfig(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.walletConfig(instance),
async () => {
return useQuery({
queryKey: engineKeys.walletConfig(instance),
queryFn: async () => {
const res = await fetch(`${instance}configuration/wallets`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -400,8 +434,8 @@ export function useEngineWalletConfig(instance: string) {
return (json.result as WalletConfig) || {};
},
{ enabled: !!instance && !!token },
);
enabled: !!instance && !!token,
});
}
type CurrencyValue = {
@@ -421,9 +455,9 @@ export function useEngineBackendWalletBalance(
invariant(chainId, "chainId is required");
return useQuery(
engineKeys.backendWalletBalance(address, chainId),
async () => {
return useQuery({
queryKey: engineKeys.backendWalletBalance(address, chainId),
queryFn: async () => {
const res = await fetch(
`${instance}backend-wallet/${chainId}/${address}/get-balance`,
{
@@ -436,8 +470,8 @@ export function useEngineBackendWalletBalance(
return (json.result as CurrencyValue) || {};
},
{ enabled: !!instance && !!address && !!chainId && !!token },
);
enabled: !!instance && !!address && !!chainId && !!token,
});
}
export type EngineAdmin = {
@@ -450,9 +484,9 @@ export function useEnginePermissions(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
const address = useActiveAccount()?.address;
return useQuery(
engineKeys.permissions(instance),
async () => {
return useQuery({
queryKey: engineKeys.permissions(instance),
queryFn: async () => {
const res = await fetch(`${instance}auth/permissions/get-all`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -466,10 +500,9 @@ export function useEnginePermissions(instance: string) {
return (json.result as EngineAdmin[]) || [];
},
{
enabled: !!instance && !!token && !!address,
},
);
enabled: !!instance && !!token && !!address,
});
}
export type AccessToken = {
@@ -484,9 +517,9 @@ export type AccessToken = {
export function useEngineAccessTokens(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.accessTokens(instance),
async () => {
return useQuery({
queryKey: engineKeys.accessTokens(instance),
queryFn: async () => {
const res = await fetch(`${instance}auth/access-tokens/get-all`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -496,8 +529,8 @@ export function useEngineAccessTokens(instance: string) {
return (json.result as AccessToken[]) || [];
},
{ enabled: !!instance && !!token },
);
enabled: !!instance && !!token,
});
}
export type KeypairAlgorithm = "ES256" | "RS256" | "PS256";
@@ -514,9 +547,9 @@ export type Keypair = {
export function useEngineKeypairs(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.keypairs(instance),
async () => {
return useQuery({
queryKey: engineKeys.keypairs(instance),
queryFn: async () => {
const res = await fetch(`${instance}auth/keypair/get-all`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -526,8 +559,8 @@ export function useEngineKeypairs(instance: string) {
return (json.result as Keypair[]) || [];
},
{ enabled: !!instance && !!token },
);
enabled: !!instance && !!token,
});
}
type AddKeypairInput = {
@@ -610,9 +643,9 @@ export type EngineRelayer = {
export function useEngineRelayer(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.relayers(instance),
async () => {
return useQuery({
queryKey: engineKeys.relayers(instance),
queryFn: async () => {
const res = await fetch(`${instance}relayer/get-all`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -622,8 +655,8 @@ export function useEngineRelayer(instance: string) {
return (json.result as EngineRelayer[]) || [];
},
{ enabled: !!instance && !!token },
);
enabled: !!instance && !!token,
});
}
export type CreateRelayerInput = {
@@ -747,9 +780,9 @@ export interface EngineWebhook {
export function useEngineWebhooks(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.webhooks(instance),
async () => {
return useQuery({
queryKey: engineKeys.webhooks(instance),
queryFn: async () => {
const res = await fetch(`${instance}webhooks/get-all`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -759,8 +792,8 @@ export function useEngineWebhooks(instance: string) {
return (json.result as EngineWebhook[]) || [];
},
{ enabled: !!instance && !!token },
);
enabled: !!instance && !!token,
});
}
// POST REQUESTS
@@ -1206,9 +1239,9 @@ export function useEngineSendTokens(instance: string) {
export function useEngineCorsConfiguration(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.corsUrls(instance),
async () => {
return useQuery({
queryKey: engineKeys.corsUrls(instance),
queryFn: async () => {
const res = await fetch(`${instance}configuration/cors`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -1218,8 +1251,8 @@ export function useEngineCorsConfiguration(instance: string) {
return (json.result as string[]) || [];
},
{ enabled: !!instance && !!token },
);
enabled: !!instance && !!token,
});
}
interface SetCorsUrlInput {
@@ -1262,9 +1295,9 @@ export function useEngineIpAllowlistConfiguration(instance: string) {
// if engine instance is not updated to have IP_ALLOWLIST
const { data: health } = useEngineSystemHealth(instance);
return useQuery(
engineKeys.ipAllowlist(instance),
async () => {
return useQuery({
queryKey: engineKeys.ipAllowlist(instance),
queryFn: async () => {
const res = await fetch(`${instance}configuration/ip-allowlist`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -1273,11 +1306,10 @@ export function useEngineIpAllowlistConfiguration(instance: string) {
const json = await res.json();
return (json.result as string[]) || [];
},
{
enabled:
!!instance && !!token && health?.features?.includes("IP_ALLOWLIST"),
},
);
enabled:
!!instance && !!token && health?.features?.includes("IP_ALLOWLIST"),
});
}
interface SetIpAllowlistInput {
@@ -1330,9 +1362,9 @@ export interface EngineContractSubscription {
export function useEngineContractSubscription(instance: string) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.contractSubscriptions(instance),
async () => {
return useQuery({
queryKey: engineKeys.contractSubscriptions(instance),
queryFn: async () => {
const res = await fetch(`${instance}contract-subscriptions/get-all`, {
method: "GET",
headers: getEngineRequestHeaders(token),
@@ -1341,10 +1373,9 @@ export function useEngineContractSubscription(instance: string) {
const json = await res.json();
return json.result as EngineContractSubscription[];
},
{
enabled: !!instance && !!token,
},
);
enabled: !!instance && !!token,
});
}
export interface AddContractSubscriptionInput {
@@ -1430,9 +1461,9 @@ export function useEngineSubscriptionsLastBlock(
) {
const token = useLoggedInUser().user?.jwt ?? null;
return useQuery(
engineKeys.contractSubscriptionsLastBlock(instanceUrl, chainId),
async () => {
return useQuery({
queryKey: engineKeys.contractSubscriptionsLastBlock(instanceUrl, chainId),
queryFn: async () => {
const response = await fetch(
`${instanceUrl}contract-subscriptions/last-block?chain=${chainId}`,
{
@@ -1444,11 +1475,10 @@ export function useEngineSubscriptionsLastBlock(
const json = await response.json();
return json.result.lastBlock as number;
},
{
enabled: !!instanceUrl && !!token,
refetchInterval: autoUpdate ? 5_000 : false,
},
);
enabled: !!instanceUrl && !!token,
refetchInterval: autoUpdate ? 5_000 : false,
});
}
export interface EngineResourceMetrics {
@@ -1462,12 +1492,12 @@ export interface EngineResourceMetrics {
};
}
export function useEngineResourceMetrics(engineId: string) {
export function useEngineSystemMetrics(engineId: string) {
const [enabled, setEnabled] = useState(true);
return useQuery(
engineKeys.metrics(engineId),
async () => {
return useQuery({
queryKey: engineKeys.systemMetrics(engineId),
queryFn: async () => {
const res = await fetch(
`${THIRDWEB_API_HOST}/v1/engine/${engineId}/metrics`,
);
@@ -1478,10 +1508,9 @@ export function useEngineResourceMetrics(engineId: string) {
const json = (await res.json()) as EngineResourceMetrics;
return json;
},
{
// Poll every 5s unless disabled.
enabled,
refetchInterval: 5_000,
},
);
// Poll every 5s unless disabled.
enabled,
refetchInterval: 5_000,
});
}
@@ -1,7 +1,7 @@
import { useSupportedChains } from "@thirdweb-dev/react";
import { useFavouriteChainIds } from "app/(dashboard)/(chain)/components/client/star-button";
import { useSupportedChains } from "hooks/chains/configureChains";
import { useMemo } from "react";
import type { ChainMetadata } from "thirdweb/chains";
import { useFavouriteChainIds } from "../../../app/(dashboard)/(chain)/components/client/star-button";
export function useFavoriteChains() {
const allChains = useSupportedChains();
@@ -1,16 +0,0 @@
import { useQuery } from "@tanstack/react-query";
export type GasEstimate = { gasPrice: number; ethPrice: number };
export function useGas() {
return useQuery(
["gas-price", "ethereum"],
async () => {
const res = await fetch("/api/gas");
return res.json() as Promise<GasEstimate>;
},
{
refetchInterval: 60_000,
},
);
}
@@ -1,12 +1,13 @@
import { LOGGED_IN_ONLY_PATHS } from "@/constants/auth";
import { isLoginRequired } from "@/constants/auth";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { useQuery } from "@tanstack/react-query";
import { usePathname, useRouter } from "next/navigation";
import type { EnsureLoginResponse } from "app/api/auth/ensure-login/route";
import { usePathname } from "next/navigation";
import { useRef } from "react";
import {
useActiveAccount,
useActiveWalletConnectionStatus,
} from "thirdweb/react";
import type { EnsureLoginResponse } from "../../../app/api/auth/ensure-login/route";
// define "TW_AUTH_TOKEN" to exist on the window object
declare global {
@@ -20,7 +21,7 @@ export function useLoggedInUser(): {
isLoggedIn: boolean;
user: { address: string; jwt?: string } | null;
} {
const router = useRouter();
const router = useDashboardRouter();
const pathname = usePathname();
const connectedAddress = useActiveAccount()?.address;
const connectionStatus = useActiveWalletConnectionStatus();
@@ -35,12 +36,12 @@ export function useLoggedInUser(): {
// enabled if:
// - there is a pathname
// - we are not already currently connecting
// - the pathname is one of the LOGGED_IN_ONLY_PATHS
// - the pathname requires login
enabled:
!!pathname &&
connectionStatus !== "connecting" &&
statusWasEverConnecting.current &&
LOGGED_IN_ONLY_PATHS.some((path) => pathname.startsWith(path)),
isLoginRequired(pathname),
// the last "persist", part of the queryKey, is to make sure that we do not cache this query in indexDB
// convention in v4 of the SDK that we are (ab)using here
queryKey: ["logged_in_user", connectedAddress, { persist: false }],
@@ -113,7 +114,7 @@ export function useLoggedInUser(): {
}
// if we are not on a logged in path, we can simply return the connected address
if (!LOGGED_IN_ONLY_PATHS.some((path) => pathname.startsWith(path))) {
if (!isLoginRequired(pathname)) {
return {
isLoading: false,
isLoggedIn: true,
@@ -1,46 +1,35 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useSigner } from "@thirdweb-dev/react";
import { addContractToMultiChainRegistry } from "components/contract-components/utils";
import { MULTICHAIN_REGISTRY_CONTRACT } from "constants/contracts";
import {
addContractToMultiChainRegistry,
getGaslessPolygonSDK,
} from "components/contract-components/utils";
DASHBOARD_ENGINE_RELAYER_URL,
DASHBOARD_FORWARDER_ADDRESS,
} from "constants/misc";
import type { BasicContract } from "contract-ui/types/types";
import { getAllMultichainRegistry } from "dashboard-extensions/common/read/getAllMultichainRegistry";
import { useAllChainsData } from "hooks/chains/allChains";
import { useSupportedChainsRecord } from "hooks/chains/configureChains";
import { thirdwebClient } from "lib/thirdweb-client";
import { defineDashboardChain } from "lib/v5-adapter";
import { useMemo } from "react";
import { getContract } from "thirdweb";
import { polygon } from "thirdweb/chains";
import { sendAndConfirmTransaction } from "thirdweb";
import { remove } from "thirdweb/extensions/thirdweb";
import { useActiveAccount } from "thirdweb/react";
import invariant from "tiny-invariant";
const MULTICHAIN_REGISTRY_ADDRESS =
"0xcdAD8FA86e18538aC207872E8ff3536501431B73";
const registryContract = getContract({
client: thirdwebClient,
address: MULTICHAIN_REGISTRY_ADDRESS,
chain: defineDashboardChain(polygon.id),
});
function useMultiChainRegContractList(walletAddress?: string) {
return useQuery(
["dashboard-registry", walletAddress, "multichain-contract-list"],
async () => {
return useQuery({
queryKey: ["dashboard-registry", walletAddress, "multichain-contract-list"],
queryFn: async () => {
invariant(walletAddress, "walletAddress is required");
const contracts = await getAllMultichainRegistry({
contract: registryContract,
contract: MULTICHAIN_REGISTRY_CONTRACT,
address: walletAddress,
});
return contracts;
},
{
enabled: !!walletAddress,
},
);
enabled: !!walletAddress,
});
}
interface Options {
@@ -96,28 +85,30 @@ type RemoveContractParams = {
};
export function useRemoveContractMutation() {
const walletAddress = useActiveAccount()?.address;
const signer = useSigner();
const { chainIdToChainRecord } = useAllChainsData();
const queryClient = useQueryClient();
const account = useActiveAccount();
return useMutation(
async (data: RemoveContractParams) => {
invariant(
walletAddress,
"cannot add a contract without a wallet address",
);
invariant(chainIdToChainRecord, "chains not initialzed yet");
invariant(signer, "no wallet connected");
invariant(data.chainId, "chainId not provided");
invariant(account, "No wallet connected");
const { contractAddress, chainId } = data;
const gaslessPolygonSDK = getGaslessPolygonSDK(signer);
return await gaslessPolygonSDK.multiChainRegistry?.removeContract({
address: contractAddress,
chainId,
const transaction = remove({
contract: MULTICHAIN_REGISTRY_CONTRACT,
deployer: account.address,
deployment: contractAddress,
chainId: BigInt(chainId),
});
return await sendAndConfirmTransaction({
transaction,
account,
gasless: {
experimentalChainlessSupport: true,
provider: "engine",
relayerUrl: DASHBOARD_ENGINE_RELAYER_URL,
relayerForwarderAddress: DASHBOARD_FORWARDER_ADDRESS,
},
});
},
{
@@ -0,0 +1,21 @@
import { useQuery } from "@tanstack/react-query";
import type { Abi } from "abitype";
import type { ThirdwebContract } from "thirdweb";
import { resolveContractAbi } from "thirdweb/contract";
import invariant from "tiny-invariant";
export function useResolveContractAbi(contract?: ThirdwebContract) {
return useQuery({
queryKey: [
"full-contract-abi",
contract?.chain.id || "",
contract?.address || "",
],
queryFn: async () => {
invariant(contract, "contract is required");
const abi = await resolveContractAbi<Abi>(contract);
return abi;
},
enabled: !!contract,
});
}
@@ -1,29 +1,21 @@
import { useToast } from "@chakra-ui/react";
import { useSDKChainId } from "@thirdweb-dev/react";
import type { Split } from "@thirdweb-dev/sdk";
import type {
BalanceQueryRequest,
BalanceQueryResponse,
} from "pages/api/moralis/balances";
import { toast } from "sonner";
import type { ThirdwebContract } from "thirdweb";
import { distribute, distributeByToken } from "thirdweb/extensions/split";
import { useSendAndConfirmTransaction } from "thirdweb/react";
import invariant from "tiny-invariant";
import { parseErrorToMessage } from "utils/errorParser";
import { splitsKeys } from "..";
import {
useMutationWithInvalidate,
useQueryWithNetwork,
} from "./query/useQueryWithNetwork";
export function useSplitData(contract?: Split) {
return useQueryWithNetwork(
splitsKeys.list(contract?.getAddress()),
async () => contract?.getAllRecipients(),
{
enabled: !!contract,
},
);
}
export function useSplitBalances(contractAddress?: string) {
const chainId = useSDKChainId();
export function useSplitBalances(contract: ThirdwebContract) {
const chainId = contract.chain.id;
const contractAddress = contract.address;
const currencies = useQueryWithNetwork(
splitsKeys.currencies(contractAddress),
async () => {
@@ -48,72 +40,31 @@ export function useSplitBalances(contractAddress?: string) {
return currencies;
}
export function useSplitDistributeFunds(contract?: Split) {
const contractAddress = contract?.getAddress();
const balances = useSplitBalances(contractAddress);
const toast = useToast();
export function useSplitDistributeFunds(contract: ThirdwebContract) {
const contractAddress = contract.address;
const balances = useSplitBalances(contract);
const { mutateAsync } = useSendAndConfirmTransaction();
return useMutationWithInvalidate(
async () => {
invariant(contract, "split contract is not ready");
invariant(balances.data, "No balances to distribute");
const distributions = (balances.data || [])
.filter((token) => token.display_balance !== "0.0")
.map(async (currency) => {
if (currency.name === "Native Token") {
await contract
.distribute()
.then(() => {
toast({
position: "bottom",
variant: "solid",
title: "Success",
description: `Successfully distributed ${currency.name}`,
status: "success",
duration: 5000,
isClosable: true,
const transaction =
currency.name === "Native Token"
? distribute({ contract })
: distributeByToken({
contract,
tokenAddress: currency.token_address,
});
return void 0;
})
.catch((err: unknown) => {
toast({
position: "bottom",
variant: "solid",
title: `Error distributing ${currency.name}`,
description: parseErrorToMessage(err),
status: "error",
duration: 9000,
isClosable: true,
});
});
} else {
await contract
.distributeToken(currency.token_address)
.then(() => {
toast({
position: "bottom",
variant: "solid",
title: "Success",
description: `Successfully distributed ${currency.name}`,
status: "success",
duration: 5000,
isClosable: true,
});
return void 0;
})
.catch((err: unknown) => {
toast({
position: "bottom",
variant: "solid",
title: `Error distributing ${currency.name}`,
description: parseErrorToMessage(err),
status: "error",
duration: 9000,
isClosable: true,
});
});
}
const promise = mutateAsync(transaction);
toast.promise(promise, {
success: `Successfully distributed ${currency.name}`,
error: `Error distributing ${currency.name}`,
loading: "Distributing funds",
});
});
return await Promise.all(distributions);
@@ -1,18 +1,36 @@
import { useContract, useContractMetadata, useSDK } from "@thirdweb-dev/react";
import type { Vote, VoteType } from "@thirdweb-dev/sdk";
import { useActiveAccount } from "thirdweb/react";
import { thirdwebClient } from "@/constants/client";
import { type ThirdwebContract, getContract, toTokens } from "thirdweb";
import {
balanceOf,
decimals,
delegate,
delegates,
} from "thirdweb/extensions/erc20";
import {
type VoteType,
canExecute,
castVoteWithReason,
executeProposal,
getAll,
hasVoted,
propose,
token,
} from "thirdweb/extensions/vote";
import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react";
import invariant from "tiny-invariant";
import type { RequiredParam } from "utils/types";
import { voteKeys } from "../cache-keys";
import {
useMutationWithInvalidate,
useQueryWithNetwork,
} from "./query/useQueryWithNetwork";
export function useVoteProposalList(contract?: Vote) {
export function useVoteProposalList(contract?: ThirdwebContract) {
return useQueryWithNetwork(
voteKeys.proposals(contract?.getAddress()),
async () => await contract?.getAll(),
voteKeys.proposals(contract?.address || ""),
async () => {
invariant(contract, "contract is required");
return await getAll({ contract });
},
{
enabled: !!contract,
},
@@ -20,17 +38,20 @@ export function useVoteProposalList(contract?: Vote) {
}
export function useHasVotedOnProposal(
contract: RequiredParam<Vote>,
proposalId: string,
contract: ThirdwebContract,
proposalId: bigint,
) {
const address = useActiveAccount()?.address;
const userAddress = useActiveAccount()?.address;
return useQueryWithNetwork(
voteKeys.userHasVotedOnProposal(
proposalId,
contract?.getAddress(),
address,
proposalId.toString(),
contract.address,
userAddress,
),
async () => await contract?.hasVoted(proposalId, address),
async () => {
invariant(userAddress, "address is required");
return await hasVoted({ contract, proposalId, account: userAddress });
},
{
enabled: !!contract,
},
@@ -38,65 +59,83 @@ export function useHasVotedOnProposal(
}
export function useCanExecuteProposal(
contract: RequiredParam<Vote>,
proposalId: string,
contract: ThirdwebContract,
proposalId: bigint,
) {
return useQueryWithNetwork(
voteKeys.canExecuteProposal(proposalId, contract?.getAddress()),
async () => await contract?.canExecute(proposalId),
voteKeys.canExecuteProposal(proposalId.toString(), contract.address),
async () => await canExecute({ contract, proposalId }),
{
enabled: !!contract,
},
);
}
export function useTokensDelegated(contract?: Vote) {
const sdk = useSDK();
const address = useActiveAccount()?.address;
export function useTokensDelegated(contract: ThirdwebContract) {
const userAddress = useActiveAccount()?.address;
return useQueryWithNetwork(
voteKeys.delegation(contract?.getAddress(), address),
voteKeys.delegation(contract.address, userAddress),
async () => {
invariant(address, "address is required");
invariant(contract, "vote contract is required");
const metadata = await contract?.metadata.get();
const tokenAddress = metadata?.voting_token_address;
const tokenContract = await sdk?.getToken(tokenAddress);
const delegation = await tokenContract?.getDelegationOf(address);
return delegation?.toLowerCase() === address.toLowerCase();
invariant(userAddress, "wallet address is required");
const tokenAddress = await token({ contract });
if (!tokenAddress) {
throw new Error("Expected a delegated token address");
}
const tokenContract = getContract({
address: tokenAddress,
chain: contract.chain,
client: thirdwebClient,
});
const delegatedAddress = await delegates({
contract: tokenContract,
account: userAddress,
});
return delegatedAddress?.toLowerCase() === userAddress.toLowerCase();
},
{
enabled: !!contract && !!address,
enabled: !!contract && !!userAddress,
},
);
}
export function useVoteTokenBalances(contract?: Vote, addresses?: string[]) {
const { data } = useContractMetadata(contract);
const tokenContract = useContract(
data?.voting_token_address,
"token",
).contract;
export function useVoteTokenBalances(
contract: ThirdwebContract,
addresses: string[],
) {
return useQueryWithNetwork(
voteKeys.balances(contract?.getAddress(), addresses),
async () => {
invariant(data, "contract metadata is required");
invariant(tokenContract, "voting contract is required");
invariant(addresses, "addresses are required");
const balances = addresses.map(async (address) => {
voteKeys.balances(contract.address, addresses),
async (): Promise<
Array<{ address: string; balance: string; decimals: number }>
> => {
invariant(addresses.length, "addresses are required");
const tokenAddress = await token({ contract });
if (!tokenAddress) {
throw new Error("Expected a delegated token address");
}
const tokenContract = getContract({
address: tokenAddress,
chain: contract.chain,
client: thirdwebClient,
});
const _decimals = await decimals({ contract: tokenContract });
const balanceData = await Promise.all(
addresses.map((address) =>
balanceOf({ contract: tokenContract, address }),
),
);
const balances = addresses.map((address, index) => {
const balance = balanceData[index] || 0n;
return {
address,
balance: (await tokenContract.balanceOf(address)).displayValue,
balance: toTokens(balance, _decimals),
decimals: _decimals,
};
});
return await Promise.all(balances);
},
{
enabled: !!data && !!contract && !!addresses?.length,
enabled: addresses.length > 0,
},
);
}
@@ -105,94 +144,143 @@ export interface IProposalInput {
description: string;
}
export function useProposalCreateMutation(contractAddress?: string) {
const voteContract = useContract(contractAddress, "vote").contract;
/**
* This hook is a simplified version meant to use on the Dashboard
* since _currently_ the dashboard only supports creating proposals with descriptions
*
* todo: make an extension in the SDK that is more robust and user-friendly ?
*/
export function useProposalCreateMutation(contract: ThirdwebContract) {
const { mutateAsync } = useSendAndConfirmTransaction();
return useMutationWithInvalidate(
(proposal: IProposalInput) => {
invariant(voteContract, "contract is required");
async (proposal: IProposalInput) => {
const { description } = proposal;
return voteContract.propose(description);
const transaction = propose({
contract,
description,
targets: [contract.address],
values: [0n],
calldatas: ["0x"],
});
return await mutateAsync(transaction);
},
{
onSuccess: (_data, _options, _variables, invalidate) => {
return invalidate([voteKeys.proposals(contractAddress)]);
return invalidate([voteKeys.proposals(contract.address)]);
},
},
);
}
export function useDelegateMutation(contract?: Vote) {
const sdk = useSDK();
const address = useActiveAccount()?.address;
const contractAddress = contract?.getAddress();
export function useDelegateMutation(contract: ThirdwebContract) {
const userAddress = useActiveAccount()?.address;
const { mutateAsync } = useSendAndConfirmTransaction();
return useMutationWithInvalidate(
async () => {
invariant(address, "address is required");
invariant(contractAddress, "contract address is required");
invariant(contract, "vote contract is required");
const metadata = await contract?.metadata.get();
const tokenAddress = metadata?.voting_token_address;
const tokenContract = await sdk?.getToken(tokenAddress);
return tokenContract?.delegateTo(address);
invariant(userAddress, "address is required");
const tokenAddress = await token({ contract });
if (!tokenAddress) {
throw new Error("Expected a delegated token address");
}
const tokenContract = getContract({
address: tokenAddress,
chain: contract.chain,
client: thirdwebClient,
});
const transaction = delegate({
contract: tokenContract,
delegatee: userAddress,
});
return await mutateAsync(transaction);
},
{
onSuccess: (_data, _options, _variables, invalidate) => {
return invalidate([voteKeys.delegation(contractAddress, address)]);
return invalidate([voteKeys.delegation(contract.address, userAddress)]);
},
},
);
}
/**
* Get the decimals of the voting erc20 token
*/
export function useVotingTokenDecimals(contract: ThirdwebContract) {
return useMutationWithInvalidate(async () => {
const tokenAddress = await token({ contract });
if (!tokenAddress) {
throw new Error("Expected a delegated token address");
}
const tokenContract = getContract({
address: tokenAddress,
chain: contract.chain,
client: thirdwebClient,
});
const _decimals = await decimals({ contract: tokenContract });
return _decimals;
});
}
interface IVoteCast {
voteType: VoteType;
reason?: string;
}
export function useCastVoteMutation(
contract: RequiredParam<Vote>,
proposalId: string,
contract: ThirdwebContract,
proposalId: bigint,
) {
const address = useActiveAccount()?.address;
const contractAddress = contract?.getAddress();
const contractAddress = contract.address;
const { mutateAsync } = useSendAndConfirmTransaction();
return useMutationWithInvalidate(
async (vote: IVoteCast) => {
async (voteItem: IVoteCast) => {
invariant(contract, "contract is required");
invariant(address, "address is required");
const { voteType, reason } = vote;
return contract.vote(proposalId, voteType, reason);
const { voteType, reason } = voteItem;
const transaction = castVoteWithReason({
contract,
proposalId,
support: voteType,
reason: reason ?? "",
});
return await mutateAsync(transaction);
},
{
onSuccess: (_data, _options, _variables, invalidate) => {
return invalidate([
voteKeys.proposals(contractAddress),
voteKeys.userHasVotedOnProposal(proposalId, contractAddress, address),
voteKeys.canExecuteProposal(proposalId, contractAddress),
voteKeys.userHasVotedOnProposal(
proposalId.toString(),
contractAddress,
address,
),
voteKeys.canExecuteProposal(proposalId.toString(), contractAddress),
]);
},
},
);
}
/**
* This hook is a simplified version for the Dashboard
* It doesn't pass any extra info to the execute function
*/
export function useExecuteProposalMutation(
contract: RequiredParam<Vote>,
proposalId: string,
contract: ThirdwebContract,
proposalId: bigint,
) {
const contractAddress = contract?.getAddress();
const contractAddress = contract.address;
const mutation = useSendAndConfirmTransaction();
return useMutationWithInvalidate(
async () => {
invariant(contract, "contract is required");
return contract.execute(proposalId);
const transaction = executeProposal({ contract, proposalId });
return await mutation.mutateAsync(transaction);
},
{
onSuccess: (_data, _options, _variables, invalidate) => {
return invalidate([
voteKeys.proposals(contractAddress),
voteKeys.canExecuteProposal(proposalId, contractAddress),
voteKeys.canExecuteProposal(proposalId.toString(), contractAddress),
]);
},
},
@@ -2,13 +2,15 @@
import { Spinner } from "@/components/ui/Spinner/Spinner";
import { Button } from "@/components/ui/button";
import { thirdwebClient } from "@/constants/client";
import { THIRDWEB_ENGINE_FAUCET_WALLET } from "@/constants/env";
import { CustomConnectWallet } from "@3rdweb-sdk/react/components/connect-wallet";
import { useMutation } from "@tanstack/react-query";
import { thirdwebClient } from "lib/thirdweb-client";
import { useRouter } from "next/navigation";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import type { CanClaimResponseType } from "app/api/testnet-faucet/can-claim/CanClaimResponseType";
import { mapV4ChainToV5Chain } from "contexts/map-chains";
import { useTrack } from "hooks/analytics/useTrack";
import { toast } from "sonner";
import { defineChain, toUnits } from "thirdweb";
import { toUnits } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { useActiveAccount, useWalletBalance } from "thirdweb/react";
@@ -29,23 +31,33 @@ function formatTime(seconds: number) {
export function FaucetButton({
chain,
ttlSeconds,
amount,
}: {
chain: ChainMetadata;
ttlSeconds: number;
amount: string;
}) {
const address = useActiveAccount()?.address;
const chainId = chain.chainId;
const definedChain = defineChain(chainId);
// do not include local overrides for chain pages
// eslint-disable-next-line no-restricted-syntax
const definedChain = mapV4ChainToV5Chain(chain);
const faucetWalletBalanceQuery = useWalletBalance({
address: THIRDWEB_ENGINE_FAUCET_WALLET,
chain: definedChain,
client: thirdwebClient,
});
const trackEvent = useTrack();
const queryClient = useQueryClient();
const claimMutation = useMutation({
mutationFn: async () => {
trackEvent({
category: "faucet",
action: "claim",
label: "attempt",
chain_id: chainId,
});
const response = await fetch("/api/testnet-faucet/claim", {
method: "POST",
headers: {
@@ -54,30 +66,62 @@ export function FaucetButton({
body: JSON.stringify({
chainId: chainId,
toAddress: address,
amount,
}),
});
if (!response.ok) {
const data = await response.json();
throw data.error;
throw new Error(data?.error || "Failed to claim funds");
}
},
onSuccess: () => {
router.refresh();
trackEvent({
category: "faucet",
action: "claim",
label: "success",
chain_id: chainId,
});
},
onError: (error) => {
trackEvent({
category: "faucet",
action: "claim",
label: "error",
chain_id: chainId,
errorMsg: error instanceof Error ? error.message : "Unknown error",
});
},
onSettled: () => {
return queryClient.invalidateQueries([
"testnet-faucet-can-claim",
chainId,
]);
},
});
const canClaimFaucetQuery = useQuery({
queryKey: ["testnet-faucet-can-claim", chainId],
queryFn: async () => {
const response = await fetch(
`/api/testnet-faucet/can-claim?chainId=${chainId}`,
);
if (!response.ok) {
throw new Error("Failed to get claim status");
}
const data = (await response.json()) as CanClaimResponseType;
return data;
},
});
const router = useRouter();
const isFaucetEmpty =
faucetWalletBalanceQuery.data !== undefined &&
faucetWalletBalanceQuery.data.value < toUnits("1", 17);
// checking faucet balance
if (faucetWalletBalanceQuery.isLoading) {
// loading state
if (faucetWalletBalanceQuery.isLoading || canClaimFaucetQuery.isLoading) {
return (
<Button variant="secondary" className="w-full gap-2">
Checking Faucet Balance <Spinner className="size-3" />
Checking Faucet <Spinner className="size-3" />
</Button>
);
}
@@ -85,17 +129,25 @@ export function FaucetButton({
// faucet is empty
if (isFaucetEmpty) {
return (
<Button variant="outline" disabled className="w-full">
Faucet is empty right now, come back later
<Button variant="secondary" disabled className="w-full !opacity-100 ">
Faucet is empty right now
</Button>
);
}
// not eligible to claim right now
if (ttlSeconds > 0) {
// Can not claim
if (canClaimFaucetQuery.data && canClaimFaucetQuery.data.canClaim === false) {
return (
<Button variant="outline" className="w-full" disabled>
Your next claim is available {formatTime(ttlSeconds)}
<Button variant="secondary" className="w-full !opacity-100 " disabled>
{canClaimFaucetQuery.data.type === "throttle" && (
<>
Your next claim is available{" "}
{formatTime(canClaimFaucetQuery.data.ttlSeconds)}
</>
)}
{canClaimFaucetQuery.data.type === "unsupported-chain" &&
"Faucet is empty right now"}
</Button>
);
}
@@ -1,34 +0,0 @@
"use client";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import { MenuIcon } from "lucide-react";
import { useState } from "react";
import type { ChainMetadata } from "thirdweb/chains";
import { SidebarContent } from "../server/sidebar-content";
export function MobileMenu(props: {
chain: ChainMetadata;
}) {
const [isOpen, setIsOpen] = useState(false);
return (
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogTrigger asChild>
<Button size="icon" variant="outline" className="lg:hidden">
<MenuIcon strokeWidth={1} />
</Button>
</DialogTrigger>
<DialogContent
className="p-0"
dialogCloseClassName="hidden"
onClick={(e) => {
if (e.target instanceof HTMLAnchorElement) {
setIsOpen(false);
}
}}
>
<SidebarContent chain={props.chain} />
</DialogContent>
</Dialog>
);
}
@@ -2,17 +2,29 @@
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import { thirdwebClient } from "@/constants/client";
import { useTrack } from "hooks/analytics/useTrack";
import { defineDashboardChain } from "lib/defineDashboardChain";
import { useTheme } from "next-themes";
import { defineChain } from "thirdweb";
import { PayEmbed } from "thirdweb/react";
import { getSDKTheme } from "../../../../../../components/sdk-component-theme";
export function PayModalButton(props: { chainId: number; label: string }) {
const { theme } = useTheme();
const trackEvent = useTrack();
return (
<Dialog>
<DialogTrigger asChild>
<Button variant="primary" className="w-full">
<Button
variant="primary"
className="w-full"
onClick={() => {
trackEvent({
category: "pay",
action: "buy",
label: "attempt",
});
}}
>
{props.label}
</Button>
</DialogTrigger>
@@ -26,8 +38,38 @@ export function PayModalButton(props: { chainId: number; label: string }) {
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
className="!w-auto"
payOptions={{
onPurchaseSuccess(info) {
if (
info.type === "crypto" &&
info.status.status !== "NOT_FOUND"
) {
trackEvent({
category: "pay",
action: "buy",
label: "success",
type: info.type,
chainId: info.status.quote.toToken.chainId,
tokenAddress: info.status.quote.toToken.tokenAddress,
amount: info.status.quote.toAmount,
});
}
if (info.type === "fiat" && info.status.status !== "NOT_FOUND") {
trackEvent({
category: "pay",
action: "buy",
label: "success",
type: info.type,
chainId: info.status.quote.toToken.chainId,
tokenAddress: info.status.quote.toToken.tokenAddress,
amount: info.status.quote.estimatedToTokenAmount,
});
}
},
prefillBuy: {
chain: defineChain(props.chainId),
// Do not include local chain overrides for chain pages
// eslint-disable-next-line no-restricted-syntax
chain: defineDashboardChain(props.chainId, undefined),
allowEdits: {
chain: false,
amount: true,
@@ -3,9 +3,9 @@
import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { Skeleton } from "@/components/ui/skeleton";
import { ToolTipLabel } from "@/components/ui/tooltip";
import { thirdwebClient } from "@/constants/client";
import { isProd } from "@/constants/env";
import { useQuery } from "@tanstack/react-query";
import { isProd } from "constants/rpc";
import { thirdwebClient } from "lib/thirdweb-client";
import { CircleCheck, XIcon } from "lucide-react";
import { useState } from "react";
import { hostnameEndsWith } from "utils/url";
@@ -1,7 +1,6 @@
import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { ExternalLinkIcon } from "lucide-react";
import Link from "next/link";
import React from "react";
import type { ChainMetadata } from "thirdweb/chains";
import { ChainLiveStats } from "../client/live-stats";
import { SectionTitle } from "./SectionTitle";
@@ -1,20 +1,15 @@
import { getIpAddress } from "lib/ip";
import { cacheTtl } from "lib/redis";
import type { ChainMetadata } from "thirdweb/chains";
import { ChainIcon } from "../../../../components/server/chain-icon";
import { FaucetButton } from "../client/FaucetButton";
import { GiftIcon } from "../icons/GiftIcon";
import { SectionTitle } from "./SectionTitle";
const amountToGive = "0.1";
const amountToGive = "0.01";
export async function FaucetSection(props: { chain: ChainMetadata }) {
const { chain } = props;
// Check eligibilty.
const ipAddress = getIpAddress();
const cacheKey = `testnet-faucet:${chain.chainId}:${ipAddress}`;
const ttlSeconds = await cacheTtl(cacheKey);
const sanitizedChainName = chain.name.replace("Mainnet", "").trim();
return (
@@ -45,11 +40,7 @@ export async function FaucetSection(props: { chain: ChainMetadata }) {
<div className="h-8" />
<FaucetButton
chain={chain}
ttlSeconds={ttlSeconds}
amount={amountToGive}
/>
<FaucetButton chain={chain} amount={amountToGive} />
</div>
</div>
</section>
@@ -1,10 +1,9 @@
import { AspectRatio } from "@/components/ui/aspect-ratio";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import { defineChain } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { mapV4ChainToV5Chain } from "../../../../../../../contexts/map-chains";
import { ChainIcon } from "../../../../components/server/chain-icon";
import { MobileMenu } from "../client/MobileMenu";
import { AddChainToWallet } from "../client/add-chain-to-wallet";
type ChainHeaderProps = {
@@ -48,16 +47,19 @@ export function ChainHeader(props: ChainHeaderProps) {
<div className="pt-3 lg:pt-6">
{/* Desktop only */}
<div className="hidden lg:flex flex-row gap-2">
<AddChainToWallet chain={defineChain(props.chain)} />
<AddChainToWallet
chain={
// Do not include chain overrides for chain pages
// eslint-disable-next-line no-restricted-syntax
mapV4ChainToV5Chain(props.chain)
}
/>
<Button variant="primary" asChild>
<Link href="https://thirdweb.com/dashboard" target="_blank">
Get started with thirdweb
</Link>
</Button>
</div>
{/* Mobile Menu */}
<MobileMenu chain={props.chain} />
</div>
</div>
</div>
@@ -1,70 +0,0 @@
import { ArrowLeftIcon } from "lucide-react";
import Link from "next/link";
import type React from "react";
import type { ChainMetadata } from "thirdweb/chains";
import { Button } from "../../../../../../../@/components/ui/button";
import { Separator } from "../../../../../../../@/components/ui/separator";
import { NavLink } from "../client/nav-link.client";
export type SidebarContentProps = {
chain: ChainMetadata;
};
export function SidebarContent(props: SidebarContentProps) {
return (
<div className="p-4 md:pt-8 sticky top-0">
{/* Desktop only */}
<div className="lg:flex items-center gap-1.5 mb-5 hidden flex-wrap">
<Link
href="/chainlist"
className="text-secondary-foreground hover:text-foreground text-sm"
>
Chainlist
</Link>
<span className="text-secondary-foreground text-sm"> / </span>
<Link href={`/${props.chain.slug}`} className="text-foreground text-sm">
{props.chain.name.replace("Mainnet", "")}
</Link>
</div>
<div className="flex flex-col gap-2 lg:gap-4 lg:border-l-2 lg:pl-1">
<SidebarNavLink href={`/${props.chain.slug}`} label="Overview" />
<SidebarNavLink
href={`/${props.chain.slug}/popular`}
label="Popular Contracts"
/>
</div>
{/* mobile obly */}
<div className="lg:hidden">
<Separator className="mt-10 mb-4" />
<SidebarNavLink
href="/chainlist"
label={
<>
<ArrowLeftIcon className="size-4" />
<span className="text-secondary-foreground">View all chains</span>
</>
}
/>
</div>
</div>
);
}
function SidebarNavLink(props: {
href: string;
label: React.ReactNode;
}) {
return (
<Button size="sm" variant="ghost" asChild>
<NavLink
href={props.href}
className="!text-left justify-start flex gap-2 h-auto py-3.5 lg:text-secondary-foreground before:absolute before:h-full relative before:w-[2px] before:-left-1.5 lg:py-0 lg:h-auto lg:hover:bg-transparent"
activeClassName="bg-accent lg:text-foreground lg:bg-transparent lg:before:bg-link-foreground "
>
{props.label}
</NavLink>
</Button>
);
}
@@ -1,14 +1,15 @@
import { BurgerMenuButton } from "@/components/blocks/BurgerMenuButton";
import { Sidebar } from "@/components/blocks/Sidebar";
import { Button } from "@/components/ui/button";
import { TicketCheckIcon } from "lucide-react";
import { ArrowLeftIcon, TicketCheckIcon } from "lucide-react";
import type { Metadata } from "next";
import Link from "next/link";
import { redirect } from "next/navigation";
import { defineChain } from "thirdweb";
import { mapV4ChainToV5Chain } from "../../../../../contexts/map-chains";
import { StarButton } from "../../components/client/star-button";
import { getChain, getChainMetadata } from "../../utils";
import { AddChainToWallet } from "./components/client/add-chain-to-wallet";
import { ChainHeader } from "./components/server/chain-header";
import { SidebarContent } from "./components/server/sidebar-content";
// TODO: improve the behavior when clicking "Get started with thirdweb", currently just redirects to the dashboard
@@ -45,11 +46,37 @@ export default async function ChainPageLayout({
const chainMetadata = await getChainMetadata(chain.chainId);
const sidebarLinks = [
{
href: `/${chain.slug}`,
label: "Overview",
},
{
href: `/${chain.slug}/popular`,
label: "Popular Contracts",
},
];
return (
<div className="container flex flex-row h-full">
<aside className="w-[280px] flex-shrink-0 hidden lg:block">
<SidebarContent chain={chain} />
</aside>
<Sidebar
header={
<div className="flex items-center gap-1.5 mb-5 flex-wrap">
<Link
href="/chainlist"
className="text-secondary-foreground hover:text-foreground text-sm"
>
Chainlist
</Link>
<span className="text-secondary-foreground text-sm"> / </span>
<Link href={`/${chain.slug}`} className="text-foreground text-sm">
{chain.name.replace("Mainnet", "")}
</Link>
</div>
}
links={sidebarLinks}
/>
<div className="flex flex-col w-full lg:px-6 lg:border-x pb-10">
{/* Icon + Background */}
<ChainHeader
@@ -58,6 +85,23 @@ export default async function ChainPageLayout({
chain={chain}
/>
<div className="flex lg:hidden justify-end">
<BurgerMenuButton
links={sidebarLinks}
footer={
<div className="mt-5 border-t pt-6 pb-2">
<Link
href="/chainlist"
className="px-2 text-sm flex justify-start gap-2 items-center text-secondary-foreground hover:text-foreground"
>
<ArrowLeftIcon className="size-4" />
View all chains
</Link>
</div>
}
/>
</div>
<div className="h-4 md:h-8" />
<div className="flex flex-col gap-3 md:gap-2">
@@ -99,7 +143,13 @@ export default async function ChainPageLayout({
{/* mobile action row */}
<div className="sm:hidden w-full">
<div className="grid grid-cols-2 gap-2">
<AddChainToWallet chain={defineChain(chain)} />
<AddChainToWallet
chain={
// Do not include chain overrides for chain pages
// eslint-disable-next-line no-restricted-syntax
mapV4ChainToV5Chain(chain)
}
/>
<Button variant="primary">
<Link href="https://thirdweb.com/dashboard" target="_blank">
Get started
@@ -1,10 +1,6 @@
/* eslint-disable @next/next/no-img-element */
import {
DASHBOARD_THIRDWEB_SECRET_KEY,
IPFS_GATEWAY_URL,
} from "@/constants/env";
import { thirdwebClient } from "@/constants/client";
import { ImageResponse } from "next/og";
import { createThirdwebClient } from "thirdweb";
import { download } from "thirdweb/storage";
import { fetchChain } from "utils/fetchChain";
@@ -66,15 +62,6 @@ const TWLogo: React.FC = () => (
export default async function Image({
params,
}: { params: { chain_id: string } }) {
const thirdwebClient = createThirdwebClient({
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
config: {
storage: {
gatewayUrl: IPFS_GATEWAY_URL,
},
},
});
const chain = await fetchChain(params.chain_id);
if (!chain) {
return new Response("Chain not found", { status: 400 });
@@ -1,7 +1,7 @@
import { Button } from "@/components/ui/button";
import { fetchTopContracts } from "lib/search";
import { ArrowRightIcon, CircleAlertIcon } from "lucide-react";
import Link from "next/link";
import { type SortBy, fetchTopContracts } from "../../../../../lib/search";
import { TrendingContractSection } from "../../../trending/components/trending-table";
import { getChain, getChainMetadata } from "../../utils";
import { BuyFundsSection } from "./components/server/BuyFundsSection";
@@ -14,7 +14,6 @@ import { ExplorersSection } from "./components/server/explorer-section";
export default async function Page(props: {
params: { chain_id: string };
searchParams: { page?: number; sortBy?: SortBy };
}) {
const chain = await getChain(props.params.chain_id);
const chainMetadata = await getChainMetadata(chain.chainId);
@@ -22,8 +21,6 @@ export default async function Page(props: {
const topContracts = await fetchTopContracts({
chainId: chain.chainId,
page: props.searchParams.page,
sortBy: props.searchParams.sortBy,
perPage: 3,
timeRange: "month",
});
@@ -48,13 +45,12 @@ export default async function Page(props: {
</section>
)}
{/* Buy Funds */}
{chain.services.find((c) => c.service === "pay" && c.enabled) && (
{/* Faucet / Buy Funds */}
{chain.testnet ? (
<FaucetSection chain={chain} />
) : chain.services.find((c) => c.service === "pay" && c.enabled) ? (
<BuyFundsSection chain={chain} />
)}
{/* Faucet */}
{chain.testnet && <FaucetSection chain={chain} />}
) : null}
{/* Chain Overview */}
<ChainOverviewSection chain={chain} />
@@ -83,8 +79,8 @@ export default async function Page(props: {
<TrendingContractSection
topContracts={topContracts}
chainId={chain.chainId}
searchParams={props.searchParams}
showPagination={false}
searchParams={undefined}
/>
</section>
)}
@@ -1,9 +1,11 @@
import { type SortBy, fetchTopContracts } from "lib/search";
import { CircleAlertIcon } from "lucide-react";
import React from "react";
import { type SortBy, fetchTopContracts } from "../../../../../../lib/search";
import { TrendingContractSection } from "../../../../trending/components/trending-table";
import { getChain } from "../../../utils";
// we're using searchParams here - use dynamic rendering
export const dynamic = "force-dynamic";
export default async function Page(props: {
params: { chain_id: string };
searchParams: { page?: number; sortBy?: SortBy };
@@ -1,14 +1,7 @@
import { Badge } from "@/components/ui/badge";
import { Separator } from "@/components/ui/separator";
import { IPFS_GATEWAY_URL } from "@/constants/env";
import { DASHBOARD_THIRDWEB_SECRET_KEY, PROD_OR_DEV_URL } from "constants/rpc";
import {
ZERO_ADDRESS,
createThirdwebClient,
defineChain,
toTokens,
} from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { thirdwebClient } from "@/constants/client";
import { ZERO_ADDRESS, toTokens } from "thirdweb";
import {
eth_getBlockByHash,
eth_getTransactionByHash,
@@ -16,34 +9,19 @@ import {
getRpcClient,
} from "thirdweb/rpc";
import { hexToNumber, shortenAddress, toEther } from "thirdweb/utils";
import { mapV4ChainToV5Chain } from "../../../../../../contexts/map-chains";
import { getChain } from "../../../utils";
function defineDashboardChain(chainId: number, dashboardChain?: ChainMetadata) {
return defineChain({
id: chainId,
rpc:
dashboardChain?.rpc?.[0] || `https://${chainId}.rpc.${PROD_OR_DEV_URL}`,
slug: dashboardChain?.slug,
nativeCurrency: dashboardChain?.nativeCurrency,
});
}
export default async function Page(props: {
params: { chain_id: string; txHash: `0x${string}` };
}) {
const thirdwebClient = createThirdwebClient({
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
config: {
storage: {
gatewayUrl: IPFS_GATEWAY_URL,
},
},
});
const chain = await getChain(props.params.chain_id);
const rpcRequest = getRpcClient({
client: thirdwebClient,
chain: defineDashboardChain(chain.chainId),
// Do not include chain overrides for chain pages
// eslint-disable-next-line no-restricted-syntax
chain: mapV4ChainToV5Chain(chain),
});
const [transaction, receipt] = await Promise.all([
@@ -10,8 +10,9 @@ import {
} from "@/components/ui/popover";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Separator } from "@/components/ui/separator";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { ChevronDownIcon, Filter, XIcon } from "lucide-react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { usePathname, useSearchParams } from "next/navigation";
import type React from "react";
import { type PropsWithChildren, useCallback, useMemo } from "react";
import { products } from "../../../components/server/products";
@@ -73,7 +74,7 @@ type FilterResetButtonProps = {
const FilterResetButton: React.FC<
PropsWithChildren<FilterResetButtonProps>
> = ({ filters, children }) => {
const router = useRouter();
const router = useDashboardRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const mutableSearchParams = useMemo(() => {
@@ -124,7 +125,7 @@ type ChainTypeFilterProps = { sectionOnly?: boolean };
export const ChainTypeFilter: React.FC<ChainTypeFilterProps> = ({
sectionOnly,
}) => {
const router = useRouter();
const router = useDashboardRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
@@ -228,7 +229,7 @@ type ChainOptionsFilterProps = { sectionOnly?: boolean };
export const ChainOptionsFilter: React.FC<ChainOptionsFilterProps> = ({
sectionOnly,
}) => {
const router = useRouter();
const router = useDashboardRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const mutableSearchParams = useMemo(() => {
@@ -332,7 +333,7 @@ type ChainServiceFilterProps = { sectionOnly?: boolean };
export const ChainServiceFilter: React.FC<ChainServiceFilterProps> = ({
sectionOnly,
}) => {
const router = useRouter();
const router = useDashboardRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const mutableSearchParams = useMemo(() => {
@@ -1,8 +1,9 @@
"use client";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { PaginationButtons } from "@/components/pagination-buttons";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { usePathname, useSearchParams } from "next/navigation";
import { useCallback } from "react";
import { PaginationButtons } from "../../../../../../@/components/pagination-buttons";
type ChainlistPaginationProps = {
totalPages: number;
@@ -15,7 +16,7 @@ export const ChainlistPagination: React.FC<ChainlistPaginationProps> = ({
}) => {
const pathname = usePathname();
const searchParams = useSearchParams();
const router = useRouter();
const router = useDashboardRouter();
const createPageURL = useCallback(
(pageNumber: number) => {
@@ -2,8 +2,9 @@
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { SearchIcon, XCircleIcon } from "lucide-react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { usePathname, useSearchParams } from "next/navigation";
import { useRef } from "react";
import { useDebouncedCallback } from "use-debounce";
@@ -15,7 +16,7 @@ function cleanUrl(url: string) {
}
export const SearchInput: React.FC = () => {
const router = useRouter();
const router = useDashboardRouter();
const pathname = usePathname();
const searchParams = useSearchParams();

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