Compare commits

...
Author SHA1 Message Date
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
781a626461 Version Packages (#8217)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-09 01:27:39 -07:00
Joaquim VergesandGitHub f630912b9b [SDK] Export missing x402 types (#8218) 2025-10-09 01:14:37 -07:00
163ab8afe1 Project Wallet (Default Server Wallet) (#8212)
Co-authored-by: Joaquim Verges <[email protected]>
2025-10-08 20:57:32 +07:00
MananTank 62cfbb7441 SDK: Show error in BuyWidget and SwapWidget UI if fetching token details fails (#8215)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces error handling in the `BuyWidget` and `SwapWidget` UIs, displaying appropriate error messages when fetching token details fails.

### Detailed summary
- Added `isError` state to handle errors in token fetching.
- Updated `SelectedTokenButton` to check for errors before rendering.
- Enhanced `SwapUI` to show error messages based on different query states.
- Implemented error display in `FundWallet` for unsupported tokens.
- Modified balance display logic to accommodate new error handling.

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

<!-- end pr-codex -->

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

- New Features
  - Inline error banners in Buy and Swap widgets when token details fail to load.
  - Clear, specific messages for quote, buy-token, and sell-token fetch failures.
- Improvements
  - Selected token UI now falls back gracefully on errors instead of showing partial data.
  - Balance display uses richer token info (value, decimals, symbol, name) for accuracy.
  - More consistent handling of unsupported tokens across the flow.
- Bug Fixes
  - Prevents stale token icons/details from appearing during error states.
  - Disables auto-retry on token price fetches to reduce UI flicker.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-07 21:36:48 +00:00
Joaquim VergesandGitHub d7104f69f4 [Dashboard] Add engineCloud to ActiveStatus and reduce revalidation time to 30 seconds (#8216) 2025-10-07 14:22:32 -07:00
Joaquim VergesandGitHub 23545cb999 [Docs] Add ERC-7702 Smart EOA session keys documentation (#8214) 2025-10-07 13:35:46 -07:00
MananTank f9283f389b Portal: Add missing redirects for bridge pages (#8201)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the redirect paths in the `redirects.mjs` file to streamline payment-related navigation by adding new routes that point to a `bridge` structure.

### Detailed summary
- Added redirect for `"/payments/sell"` to `"/bridge/sell"`
- Added redirect for `"/payments/swap"` to `"/bridge/swap"`
- Added redirect for `"/payments/tokens"` to `"/bridge/tokens"`
- Added redirect for `"/payments/routes"` to `"/bridge/routes"`

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

<!-- end pr-codex -->

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

* **New Features**
  * Added redirects so payment URLs now route to corresponding bridge destinations:
    * /payments/sell → /bridge/sell
    * /payments/swap → /bridge/swap
    * /payments/tokens → /bridge/tokens
    * /payments/routes → /bridge/routes
  * Existing bookmarks and shared links to payment pages will continue working and automatically route to the updated locations, with no UI changes required.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-07 11:30:51 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
9fbb29dc25 Version Packages (#8202)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-07 02:05:50 -07:00
Joaquim VergesandGitHub 71a1e58eaf [AI-SDK-provider] Add default in-memory session store with custom store option (#8211) 2025-10-07 02:00:38 -07:00
MananTank 68b48f4faa [MNY-232] SDK: Fix ExecutingTxScreen missing back button in TransactionWidget (#8193)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `onBack` functionality in the `TransactionWidget` and `TransactionModal` components, ensuring that the back navigation behavior is more consistent across these components.

### Detailed summary
- In `TransactionWidget.tsx`, `onBack` now sets the screen to `init-ui`.
- In `TransactionModal.tsx`, `onBack` sets the screen to `deposit`.
- In `ExecutingScreen.tsx`, the `onBack` prop is changed from optional to required.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **New Features**
  * Added back navigation from the executing transaction screen, allowing users to return to the previous step without closing the modal.
  * Unified back-button behavior across transaction flows for a more consistent experience.
  * Provides clearer control during long-running executions with an explicit back option.
  * Navigation enhancement applies to both bridge and transaction modal flows, improving step-to-step control while keeping transaction processing unchanged.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 22:33:31 +00:00
MananTank 1c660d4712 [MNY-202] Dashboard: Update resource links in project > bridge page (#8196)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the `QuickstartSection.client.tsx` and `page.tsx` files in the bridge section of the dashboard. It modifies features, links, and documentation references to align with the new bridge functionality.

### Detailed summary
- Updated `setupTime` to `5` in `QuickstartSection.client.tsx`.
- Changed `features` from `["Swap any token", "Cross-chain swaps"]` to `["Swap any token", "Cross-chain swap"]`.
- Updated link `href` from `https://portal.thirdweb.com/payments/swap` to `https://portal.thirdweb.com/bridge/swap` and changed label to "Setup Swap".
- Added new documentation link to `page.tsx`: `https://portal.thirdweb.com/bridge`.
- Added new playground link to `page.tsx`: `https://playground.thirdweb.com/bridge/swap-widget`.
- Removed old commented-out documentation links related to payments.
- Removed several links under the footer sections for payments and replaced them with new links relevant to the bridge.

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

<!-- end pr-codex -->

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

- New Features
  - Added a direct link to Bridge docs in the header for quicker access.
  - Added a Playground link in the header to enable easy testing of the Bridge swap widget.
- Style
  - Removed footer sections from the Bridge page to streamline the layout and reduce clutter.
- Chores
  - Updated the “Setup Swap” feature card and its link to point to the Bridge setup URL for improved navigation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 21:22:22 +00:00
MananTank 30b5c30ba0 [PRO-27] Dashboard: copy changes in bridge page (#8191)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `description` in the `page.tsx` file for the `bridge` component, enhancing its clarity and accuracy regarding token capabilities. It also modifies the text of a `PillLink` to better reflect its functionality.

### Detailed summary
- Updated the `description` to specify "3,200+ tokens" instead of "9M+ token routes".
- Changed the `PillLink` text from "Integrate Bridge in your apps in minutes, and start generating revenue" to "Accept Payments in Any Token Right Inside Your App".

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

- **Documentation**
  - Updated page metadata to reflect 3,200+ tokens across 85+ chains, with clearer phrasing around finality and pricing for improved SEO and share previews.

- **Style**
  - Refined call-to-action on the Bridge page to “Accept Payments in Any Token Right Inside Your App,” improving clarity and alignment with user goals.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 21:12:26 +00:00
MananTank 86461f9a07 [PRO-25] Dashboard: Update bridge page header to show supported tokens, chains and routes count (#8195)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the content of the `Page` component in the `page.tsx` file by removing a `Link` element and replacing it with a `p` element that provides information about token and chain support.

### Detailed summary
- Removed the `Link` component that directed users to the thirdweb bridge.
- Added a `p` element stating "85+ chains, 3200+ tokens and 9+ million routes supported".

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

- **Style**
  - Updated the Tokens dashboard header to display marketing stats: “85+ chains, 3200+ tokens, and 9+ million routes supported.”
  - Replaced the previous header link with a plain text paragraph for a cleaner presentation.
  - No changes to data, performance, or underlying functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 20:01:56 +00:00
MananTank 2ebba6139a [MNY-235] Dashboard: Fix payment page theme issues (#8199)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on integrating the `ThemeProvider` from `next-themes` into multiple components within the payment module, enhancing theming support across the application.

### Detailed summary
- Removed `ThemeProvider` from `PayLayout` in `layout.tsx`.
- Added `ThemeProvider` wrapping to `PayPage` in `page.tsx`.
- Integrated `ThemeProvider` in `PayPageWidget` to manage theme settings.
- Updated theme handling logic in `PayPageWidget` to use `getSDKTheme`.
- Wrapped the main structure in `ThemeProvider` in `[id]/page.tsx`.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

- New Features
  - Consistent light/dark theme across all Pay pages, with support for forcing a theme per link and reduced visual flicker from system theme changes.
- Style
  - Refined header layout: project image, name, and description grouped; “Secured by thirdweb” badge retained.
  - Improved details on large screens: clearer “Network” label with icon and chain name; seller shown as ENS or shortened address, reordered for readability.
- Refactor
  - Consolidated theming at the page level for consistent behavior across views.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 19:51:09 +00:00
MananTank f3bacc16cb [MNY-203] Dashboard: ERC20 token page title, metadata and OG updates (#8194)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the logic for generating `title` and `description` variables in the `shared-layout.tsx` file, particularly for different types of smart contracts. It enhances the information displayed for ERC20 contracts and adds fallback values for when contract metadata is not available.

### Detailed summary
- Changed `const title` to `let title` to allow reassignment.
- Updated `title` and `description` for `ERC20` contracts using `contractMetadata`.
- Added fallback values for `title` and `description` when an error occurs, including `openGraph` properties.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **New Features**
  * Richer link previews for contract pages via Open Graph metadata, improving social sharing and discoverability.
  * More accurate, branded titles and descriptions: ERC20 pages use token name and symbol; non-ERC20 pages use contract name, with references to Buy, Swap, Bridge & Price.
  * Robust fallbacks ensure meaningful titles, descriptions, and previews even if metadata loading fails.
  * Consistent metadata across success and fallback states for a more reliable sharing experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 19:41:13 +00:00
MananTank 968913d55b [MNY-231] SDK: Fix TransactionWidget not updating on currency prop change after initial render (#8192)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the `TransactionWidget` to ensure it updates correctly when the `currency` prop changes after the initial render. It also refines how the total cost and display values are calculated based on the selected currency.

### Detailed summary
- Updated `PaymentOverview` to remove the `currency` prop from `TransactionOverViewCompact`.
- Enhanced `TransactionPayment` to calculate `totalFiatCost` and `costToDisplay` based on the selected currency.
- Adjusted the display of USD value to use `costToDisplay`.
- Removed the `currency` type from `UseTransactionDetailsOptions`.
- Simplified `useTransactionDetails` by removing currency-related calculations.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **Bug Fixes**
  * Transaction widget now updates correctly when the selected currency changes after initial render.
  * Payment and transaction details display accurate fiat totals, with graceful fallback when pricing data is unavailable.

* **Improvements**
  * Streamlined pricing display to focus on the selected currency, improving clarity and consistency across payment views.

* **Chores**
  * Added a patch-level changeset entry documenting the bug fix.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 19:22:28 +00:00
MananTank bd70db4a5d [MNY-211] Dashboard: Add chainId and is_tesnet properties in reported events (#8198)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the handling of testnet-related functionality across various components in the application. It introduces the `is_testnet` and `isTestnet` props to multiple components and functions, ensuring that the application can properly differentiate between mainnet and testnet environments.

### Detailed summary
- Added `isTestnet` prop to `UniversalBridgeEmbed`.
- Introduced `is_testnet` to the `create-nft-page` and `launch-token` components.
- Updated `ChainPageView` to accept `is_testnet`.
- Included `is_testnet` in the `BuyFundsSection` and various asset page components.
- Modified `reportAssetPageview` and `reportChainPageview` to include `is_testnet`.
- Enhanced `reportContractDeployed` to capture `is_testnet` and chain ID.
- Adjusted functions in `report.ts` to utilize `is_testnet` for analytics tracking.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

- New Features
  - Analytics now capture testnet status across chain and asset pageviews, buy flows, contract deployments, and token/NFT creation.
  - Asset creation reports now include chain ID on success and failure for improved tracking accuracy.
- Chores
  - Standardized analytics event reporting to pass complete property objects, ensuring consistent payloads.
  - Propagated testnet indicators through relevant components to enrich analytics without altering UI or workflows.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 19:12:07 +00:00
MananTank d9a138a90a [MNY-236] Portal: Update BridgeWidget script docs to reflect new typescript type (#8200)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on making the `buy` properties optional in the configuration for the "Buy" tab UI, enhancing flexibility by allowing users to omit certain parameters. It also updates the documentation to reflect these changes.

### Detailed summary
- Changed `buy` properties (`amount`, `chainId`) from required to optional in type definitions.
- Updated documentation to remove "Required" tags for `amount` and `chainId`.
- Clarified descriptions for `amount`, `chainId`, and `tokenAddress` in the documentation.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **New Features**
  * Buy configuration is now optional in the bridge widget; amount and chain selection can be omitted and will use defaults.
  * Removed forced preset buy values, enabling more flexible initialization.

* **Documentation**
  * Updated docs to reflect optional Buy fields and default behaviors.
  * Revised examples and type descriptions to indicate optional amount and chain settings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-06 19:06:30 +00:00
Joaquim VergesandGitHub 777aed1e5f [Docs] Add metadata to x402 documentation pages (#8190) 2025-10-06 04:15:16 -07:00
Joaquim VergesandGitHub fbed4be959 [Docs] Update MCP tool filtering to use comma-separated list (#8189) 2025-10-06 04:07:32 -07:00
Joaquim VergesandGitHub 5a26217a43 [Docs] Add MCP tool filtering, agent examples, and available tools list (#8188) 2025-10-06 03:23:24 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
938c1e2f60 Version Packages (#8185)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-05 01:36:29 +13:00
Joaquim VergesandGitHub af9a73d930 [SDK] Fix waitUntil facilitator parameter not being respected (#8184) 2025-10-04 05:06:10 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
34c5d24043 Version Packages (#8182)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-04 19:33:33 +13:00
MananTank e612f16a85 [MNY-192] SDK: BuyWidget Improvements (#8181)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces several enhancements to the payment features, including optional props for token and chain selection, improvements to UI components, and the addition of a receiver address input for transactions.

### Detailed summary
- Added `receiverAddress` to various components.
- Made `amount` and `chainId` optional in `BuyWidget`.
- Improved UI for `BuyWidget`, allowing token and chain selection.
- Updated `FundWallet` to handle token selection and input.
- Enhanced `DecimalInput` for better user experience.
- Refactored components for better code organization and readability.

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

<!-- end pr-codex -->

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

* **New Features**
  * Receiver address input for Buy/Pay flows.
  * Editable fiat and token amounts, current balance visible, and wallet disconnect option.
  * Copy icon supports configurable size.

* **Improvements**
  * Chain and amount can be optional; token and chain remain changeable.
  * Enhanced token selection, preset amount buttons, compact active-wallet header, improved theming and responsive layouts.
  * Added story variants (light/dark).

* **Documentation**
  * Examples updated to reflect buy prefill changes.

* **Style**
  * Simplified address text styling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-03 23:52:49 +00:00
Jonas DanielsandGitHub 4a30b9c89a Add Google Click ID tracking to Stripe checkout (#8180) 2025-10-03 15:05:20 -07:00
MananTank ef9cf3409b SDK: Delete Bridge Orchestrator, Refactor Bridge widget components (#8169)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring and updating various components related to payment and transaction handling in the `thirdweb` library. It introduces new props, modifies existing interfaces, and cleans up the codebase by removing unused files.

### Detailed summary
- Deleted several unused files related to payment and transaction handling.
- Updated `transaction` and `payment` components to use new props and interfaces.
- Replaced `type` definitions with `interface` in some components for consistency.
- Improved error handling and state management in transaction modals.
- Enhanced `SuccessScreen` and `UnsupportedTokenScreen` with new props for better UI.
- Modified various story files to reflect component updates and new props.
- Adjusted payment selection and fund wallet components to align with new data structures.

> The following files were skipped due to too many changes: `packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx`, `packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx`, `packages/thirdweb/src/stories/Bridge/fixtures.ts`, `packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx`, `packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx`

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

<!-- end pr-codex -->

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

* **New Features**
  * Optional fiat currency display across payment & transaction modals (defaults to USD).
  * Token support detection with a dedicated unsupported-token screen.

* **Refactor**
  * Bridge flows reorganized into modular multi-step UIs (selection, quote, preview, execute, success).
  * Components now use explicit metadata (title/description/image) and explicit currency/mode props; branding handling centralized.

* **Documentation**
  * Storybook reorganized: decorator-based theming, updated/added widget stories, and cleaned-up story exports.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-10-03 15:36:06 +00:00
Joaquim VergesandGitHub fd20a6cabb [SDK] Deprecate payTo parameter and simplify facilitator implementation (#8177) 2025-10-03 02:32:59 -07:00
Jonas DanielsandGitHub 9095041ea7 Fix invoice status logic and refactor billing components (#8175) 2025-10-02 20:44:22 -07:00
Joaquim VergesandGitHub 2dbb9e2de4 [Dashboard] Move server wallet sections to wallets tab (#8174) 2025-10-02 18:00:43 -07:00
Joaquim VergesandGitHub 00b8adf3a2 [Docs] Simplify x402 documentation (#8173) 2025-10-02 15:02:17 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ae3dfa36c3 Version Packages (#8170)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-10-02 16:08:01 +13:00
Joaquim VergesandGitHub eb603f8908 [Multi] Update dependencies, improve wagmi adapter (#8167) 2025-10-02 15:42:13 +13:00
Joaquim VergesandGitHub e11b0da20e [Dashboard] Update transaction status endpoint path (#8166) 2025-09-30 16:10:00 -07:00
Joaquim VergesandGitHub 4c51fe6a8f [Dashboard] Add transaction filtering by Queue ID to engine v2 (#8163) 2025-09-30 15:53:15 -07:00
MananTank 64034c0ddb Dashboard: Fix Token Rewards UI not accounting for token decimals (#8164)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the handling of token rewards by adding `decimals` properties for tokens in various components and improving the retrieval of metadata related to tokens.

### Detailed summary
- Added `decimals` property to `token0` and `token1` in `claim-rewards-page.stories.tsx`.
- Introduced `chainMetadata` in `page.tsx`.
- Updated `ClaimRewardsPageUI` to utilize `decimals` for token amounts.
- Refactored `getUnclaimedFees` to fetch `decimals` and `symbol` for tokens.
- Improved token contract retrieval logic in `getUnclaimedFees`.

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

<!-- end pr-codex -->

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

- New Features
  - Token amounts now display using each token’s specific decimals.
  - Chain metadata is passed to unclaimed-fees retrieval to source native token symbol and decimals.

- Bug Fixes
  - Removed hardcoded 18-decimal assumption so amounts render correctly for tokens with different precisions.

- Tests
  - Story/test stubs updated to include decimals for token objects for more realistic scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-30 22:37:28 +00:00
Jonas DanielsandGitHub 90c1e576ff Add /payments/x402 to framer-rewrites (#8165) 2025-09-30 15:27:56 -07:00
Joaquim VergesandGitHub 27d5a81c49 [Dashboard] Add transaction filtering by Queue ID and wallet address (#8162) 2025-09-30 15:15:10 -07:00
MananTank dbadc23e04 Dashboard: Disable pay modal in ERC1155 set claim conditions if cost estimation is already done in dashboard (#8161)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the logic for handling transaction confirmations in the `create-nft-page.tsx` file, specifically addressing scenarios with multiple batches.

### Detailed summary
- Added a conditional check for `totalBatches > 1`.
- If true, it uses `sendAndConfirmTxNoPayModal.mutateAsync(tx)` for transaction confirmation.
- If false, it defaults to `sendAndConfirmTx.mutateAsync(tx)` for single batch transactions.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **New Features**
  * Streamlined multi-batch transaction confirmation when configuring NFT claim conditions. When multiple batches are required and a wallet is connected, a no-payment confirmation modal is used to reduce prompts and improve reliability. Single-batch flows continue to use the standard confirmation path.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-30 19:01:52 +00:00
Joaquim VergesandGitHub 21d5d0b6af [Nebula] Add permanent redirect to thirdweb.com/ai (#8155) 2025-09-30 11:42:56 -07:00
MananTank b2239c91c9 [MNY-214] Dashboard: ERC1155 set claim conditions step UX improvements (#8146)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces functionality for handling insufficient funds when creating NFTs, enhancing the user experience by allowing users to buy funds directly if their balance is low.

### Detailed summary
- Added `onNotEnoughFunds` callback to handle insufficient funds.
- Implemented logic to calculate total transaction costs.
- Integrated `BuyWidget` to enable users to purchase funds directly.
- Enhanced error handling and user feedback for fund-related issues.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

- New Features
  - Gas-cost–aware NFT minting with total cost estimation and balance pre-checks.
  - Insufficient funds handling with a user-facing prompt showing required vs. available balance.
  - Integrated Buy Funds widget with theme and chain awareness, plus retry and back controls.
  - Optional transaction path that skips the pay modal in eligible scenarios.
  - Enhanced batch processing for ERC1155/721 flows with a callback to surface funding issues.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-30 14:51:10 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
ca701a48c2 Version Packages (#8143)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-29 18:11:08 -07:00
Joaquim VergesandGitHub 94aae902a1 [SDK] Expose waitUntil parameter in settlePayment() (#8153) 2025-09-29 17:32:59 -07:00
MananTank 0c7149eb44 Portal: remove underlines from links in changelog page (#8148)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on updating the styles for links within the `changelog-page` in the `styles.css` file, specifically removing certain text decoration properties.

### Detailed summary
- Removed the text decoration properties (`text-decoration`, `text-decoration-color`, `text-decoration-style`, `text-underline-offset`, `transition`) from the `.changelog-page a` selector.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **Style**
  * Updated link appearance on the changelog page for consistency with global styles. Regular links no longer use custom underlines or color transitions, resulting in a cleaner look and improved readability. Headings remain without underlines, and hover behavior is unchanged. Users should notice a more consistent visual experience across the page without functional changes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-29 23:48:49 +00:00
Joaquim VergesandGitHub ce9220ea00 [Docs] Add comprehensive x402 payment documentation (#8149) 2025-09-30 12:27:40 +13:00
FirekeeperandGitHub 99c2af5e25 Add ecosystem-specific chain config support (#8147) 2025-09-30 04:21:49 +07:00
MananTank 7495f46222 [MNY-213] SDK/SwapWidget: token search improvements (#8145)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the token search functionality in the `SwapWidget` by incorporating a debounce mechanism to optimize search input handling and refining the token filtering logic.

### Detailed summary
- Updated `use-tokens.ts` to use `query` and `tokenAddress` based on search conditions.
- Added `useDebouncedValue` hook in `select-token-ui.tsx` for debouncing the search input.
- Changed token filtering logic to utilize `debouncedSearch` instead of raw `search` value.

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

<!-- end pr-codex -->
2025-09-29 19:25:57 +00:00
MananTank b8afa98de6 [MNY-212] SDK: Set refetch: false on token list queries in SwapWidget (#8144)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving the loading experience in the `SwapWidget` by removing the retry mechanism when fetching the list of tokens, which reduces the time skeletons are displayed in the UI.

### Detailed summary
- Removed the `retry` option from the token fetching query in `use-tokens.ts`.
- The `retry` option is set to `false` for both the tokens query and the token balances query.
- This change aims to decrease loading times and improve UI responsiveness.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **Bug Fixes**
  * Improved SwapWidget responsiveness by removing automatic retries for fetching token lists and balances, reducing how long loading placeholders are shown. Errors surface sooner, enabling quicker user action.

* **Chores**
  * Added a changelog entry documenting the update.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-29 19:00:23 +00:00
Joaquim VergesandGitHub 496615feae [SDK] Improve token info discovery for x402 payments (#8142) 2025-09-29 01:56:53 -07:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
e2931df858 Version Packages (#8137)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-28 15:03:25 -07:00
Joaquim VergesandGitHub 85bde21dc9 [SDK] Handle 7702 accounts in verifyTypedData (#8141) 2025-09-29 10:32:20 +13:00
FirekeeperandGitHub 2c84ac4089 [Portal] .NET v3 & Unity v6 Documentation (#8140) 2025-09-28 00:44:00 +07:00
MananTank 5ee449fc9c Dashboard: Bridge page UI adjustments, add tracking (#8139)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the UI and functionality of the dashboard and bridge components. It includes style updates, component restructuring, and the addition of an event reporting function for link clicks.

### Detailed summary
- Added `bg-background` class to the `canvas` in `DarkVeil.tsx`.
- Wrapped `FaqSection` in a `div` for padding in `page.tsx`.
- Introduced `reportBridgePageLinkClick` function in `report.ts` for event tracking.
- Simplified structure of `faq-section.tsx`.
- Created `PillLink` component in `pill-link.tsx` for better link handling and event tracking.
- Updated `BridgePage` to include new `PillLink` components and adjusted layout with spacing elements.

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

<!-- end pr-codex -->

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

- New Features
  - Added click tracking for Bridge page links.
  - Introduced pill-style external link buttons on the Bridge page.

- Refactor
  - Simplified FAQ markup to a single semantic section.
  - Extracted and reused a PillLink component across the Bridge page.
  - Reorganized Bridge page layout for clearer structure.

- Style
  - Adjusted vertical spacing and rhythm across Bridge, FAQ, and chain pages.
  - Made hero animation snappier.
  - Updated pill text color, background pattern accents, and veil canvas background.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-26 23:58:10 +00:00
MananTank a94e9c2396 [MNY-223] Update Bridge Page (#8138)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces enhancements and new features to the `dashboard` application, including updates to the `Bridge` functionality, improvements in the UI components, and new utility functions for handling themes and FAQs.

### Detailed summary
- Added `ogl` dependency for graphics handling.
- Updated `ChainSeo` type in `chain-seo.ts` for better structure.
- Increased blockchain support from 80+ to 85+ in documentation.
- Enhanced `PageHeader` and `ToggleThemeButton` components for improved styling.
- Refactored `FaqSection` to accept a more flexible props structure.
- Introduced `BridgeVeil` component for visual effects based on themes.
- Added `DataPill` and `PillLink` components for better UI elements.
- Created a `BridgeFaqSection` with FAQs related to bridging.
- Improved `TokenPage` to manage filters and sorting more effectively.

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

<!-- end pr-codex -->
2025-09-26 22:09:35 +00:00
MananTank 64f5e474bb [MNY-216] Update SEO metadata on chain pages, Add FAQ section (#8135)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refactoring and enhancing the codebase for better readability and functionality. It primarily involves renaming functions, updating component styles, and implementing a new SEO fetching mechanism.

### Detailed summary
- Renamed `getChainMetadata` to `getCustomChainMetadata`.
- Updated styles in several components for consistency.
- Added `fetchChainSeo` function for improved SEO handling.
- Replaced `chainMetadata` with `customChainMetadata` in various components.
- Introduced `FaqSection` component for displaying FAQs.
- Adjusted metadata generation to utilize fetched SEO data.

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

<!-- end pr-codex -->

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

- New Features
  - Chain pages now show an interactive FAQ section when SEO data includes FAQs.
  - SEO data is fetched and cached externally to provide richer titles, descriptions, and OpenGraph/Twitter previews.

- Bug Fixes / Behavior
  - Metadata generation now depends on external SEO (may be unavailable), affecting preview availability and link consistency.
  - Chain header images and gas-sponsored indicators now use the updated metadata source.

- Style
  - More compact Supported Products cards, adjusted overview spacing/corner radius, lighter explorer/info-item typography, and refined link styling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-26 22:09:34 +00:00
MananTank aa0d23e966 SDK: Fix Embed widget container size, Dashboard: Fix Bridge embed UI width (#8136)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on fixing the embed container size across various components in the `thirdweb` and `dashboard` applications, ensuring better layout and responsiveness.

### Detailed summary
- Updated `maxWidth` in `ConnectEmbed` to `100%` and adjusted `width` based on `modalSize`.
- Removed redundant `layout: "centered"` parameter in `ConnectEmbed` story.
- Simplified `UniversalBridgeEmbed` structure by removing unnecessary wrapping `div`.
- Added `min-w-0` class to `BuyAndSwapEmbed` and `GridPatternEmbedContainer` for better responsiveness.
- Adjusted layout classes in `GridPatternEmbedContainer` for improved alignment.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

- Bug Fixes
  - Fixed embed container sizing in the Connect Wallet modal to respect modal width and prevent viewport overflow.
  - Resolved overflow and min-width issues in embed containers for smoother responsive behavior.

- Style
  - Updated Bridge page layout to display components side-by-side on larger screens.
  - Improved responsive rounding and overflow handling around embed containers for cleaner visuals.

- Chores
  - Updated thirdweb dependency to the latest patch release.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-26 20:10:28 +00:00
MananTank b888413ca6 Dashboard: Fix BuyAndSwapWidget width (#8134)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on making minor adjustments to the layout and styling of components in the dashboard, specifically in `grid-pattern-embed-container.tsx` and `BuyAndSwapEmbed.tsx`.

### Detailed summary
- In `grid-pattern-embed-container.tsx`, the width class `sm:w-[420px]` was removed from the `div`, allowing it to take its natural width.
- In `BuyAndSwapEmbed.tsx`, the width class `!w-full` was removed from two instances of `SwapWidget`, maintaining the rounded border style but removing the full width constraint.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* Style
  * Buy and Swap widgets no longer force full-width, adapting to their container while preserving rounded, borderless styling.
  * Embed container relaxes small-screen width limits, allowing content to use available space more naturally.
  * Improves responsiveness, spacing, and alignment across devices, reducing unnecessary whitespace and preventing overstretched layouts.
  * Visual update only; no changes to widget behavior or controls.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-26 16:56:25 +00:00
MananTank 108a79ab3e Playground: Use Geist fonts (#8133)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on integrating the `geist` font into the `playground-web` application, updating the `tailwind` configuration, and replacing existing font imports with `GeistSans` and `GeistMono`.

### Detailed summary
- Added `geist` dependency in `package.json`.
- Updated `tailwind.config.ts` to extend the theme with `geist` font families.
- Replaced `Fira_Code` and `Inter` font imports in `layout.tsx` with `GeistMono` and `GeistSans`.
- Updated the body class to use `GeistSans` and `GeistMono` variables.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

- Style
  - Updated global typography to Geist Sans and Geist Mono for a cleaner, consistent look.
  - Replaced previous Inter and Fira Code fonts with new Geist font variables in the app layout.
  - Configured Tailwind to use Geist-based sans and mono font families across the app.

- Chores
  - Added Geist font package as a new dependency.

- Notes
  - No functional changes; visual update limited to typography.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-26 11:47:00 +00:00
MananTank 51390f3af0 Playground: Fix ConnectEmbed width (#8132)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on refining the styling of components in the `playground-web` application by removing unnecessary CSS classes that limit width.

### Detailed summary
- In `styled-connect-embed.tsx`, removed the class `!max-w-full`.
- In `RightSection.tsx`, changed the class from `!max-w-full` to `shadow-xl`, removing the width constraint.

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

<!-- end pr-codex -->

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

## Summary by CodeRabbit

* **Style**
  * Updated Connect modal styling for sign-in: removed restrictive max-width constraint to improve responsiveness and layout in the RightSection.
  * Simplified styling by removing custom class overrides from the styled Connect component, relying on default styles for more consistent appearance.
  * Result: more reliable modal sizing, better visual consistency, and cleaner presentation across themes and wallet variants.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-26 10:37:31 +00:00
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fb8c95a325 Version Packages (#8130)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-25 19:24:09 -07:00
Joaquim VergesandGitHub cf02cbf3af [wagmi-adapter] Add onConnect callback (#8131) 2025-09-25 19:00:35 -07:00
Joaquim VergesandGitHub f152139d73 [SDK] Support ERC-2612 permit for x402 payments (#8128) 2025-09-25 18:21:58 -07:00
MananTank 16307019be Portal: Add BridgeWidget script docs (#8129)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on enhancing the `BridgeWidget` functionality, updating UI components, and improving documentation for better user experience and clarity.

### Detailed summary
- Added `BridgeWidget Script` route in sidebar.
- Updated `Paragraph` and `Heading` components' margin classes.
- Revised `Details` component structure.
- Changed text references from `BuyWidget` to `SwapWidget`.
- Enhanced documentation for `BridgeWidget Script` with detailed integration instructions.
- Introduced new options for customizing the widget's appearance and behavior.

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

<!-- end pr-codex -->
2025-09-25 22:50:37 +00:00
MananTank 10fb338877 Portal: UI tweaks 2 (#8127)
<!--

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

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

## Notes for the reviewer

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

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces several enhancements and styling updates across various components in the application, including adjustments to CSS, layout changes, and the addition of a new package, `geist`. It aims to improve the overall appearance and functionality of the portal.

### Detailed summary
- Added `font-feature-settings` to `globals.css`.
- Updated `text-rendering`, `-webkit-font-smoothing`, and `text-size-adjust` in `global.css`.
- Included `geist` package in `package.json`.
- Modified layout and spacing in `vault/page.mdx`.
- Adjusted classes for `ApiEndpoint.tsx`, `Paragraph.tsx`, and `InlineCode.tsx`.
- Changed text color in `Subscribe.tsx`.
- Revised spacing and border styles in various components.
- Updated icons in `Anchor.tsx` and `ChatButton.tsx`.
- Enhanced styling of buttons and links across multiple components.
- Improved overall layout structure in `Header.tsx` and sidebar components.
- Refined search modal styles and item presentation in `DocSearch.tsx`.

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

<!-- end pr-codex -->

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

- Style
  - Switched site typography to Geist, enabled ligatures and improved text rendering.
  - Redesigned header with central branding, consolidated controls, mobile menu and subtle backdrop.
  - Refreshed visuals across search, footer, sidebar, platform selector, steps, cards, code/inline code, and mobile sidebar.
  - Updated icons (chat, next-page, anchors), spacing/typography tweaks; vault features now stack vertically.

- Refactor
  - Localized an article card component and reorganized footer/next-page flows; Edit link now wrapped in a button.

- Chores
  - Added Geist dependency and extended Tailwind font settings; global font/rendering tweaks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-25 22:50:36 +00:00
313 changed files with 17247 additions and 8258 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ name: Auto Author Assign
on:
pull_request:
types: [opened, reopened, ready_for_review, draft]
types: [opened, reopened, ready_for_review]
permissions:
pull-requests: write
+1
View File
@@ -10,6 +10,7 @@ module.exports = [
"/wallets",
"/account-abstraction",
"/payments",
"/payments/x402",
"/auth",
"/in-app-wallets",
"/transactions",
+1
View File
@@ -47,6 +47,7 @@
"next-themes": "^0.4.6",
"nextjs-toploader": "^1.6.12",
"nuqs": "^2.4.3",
"ogl": "^1.0.11",
"papaparse": "^5.5.3",
"pluralize": "^8.0.0",
"posthog-js": "1.256.1",
@@ -0,0 +1,70 @@
"use server";
import { createVaultClient, listEoas } from "@thirdweb-dev/vault-sdk";
import { NEXT_PUBLIC_THIRDWEB_VAULT_URL } from "@/constants/public-envs";
import type { ProjectWalletSummary } from "@/lib/server/project-wallet";
interface VaultWalletListItem {
id: string;
address: string;
metadata?: {
label?: string;
projectId?: string;
teamId?: string;
type?: string;
} | null;
}
export async function listProjectServerWallets(params: {
managementAccessToken: string;
projectId: string;
pageSize?: number;
}): Promise<ProjectWalletSummary[]> {
const { managementAccessToken, projectId, pageSize = 100 } = params;
if (!managementAccessToken || !NEXT_PUBLIC_THIRDWEB_VAULT_URL) {
return [];
}
try {
const vaultClient = await createVaultClient({
baseUrl: NEXT_PUBLIC_THIRDWEB_VAULT_URL,
});
const response = await listEoas({
client: vaultClient,
request: {
auth: {
accessToken: managementAccessToken,
},
options: {
page: 0,
// @ts-expect-error - Vault SDK expects snake_case pagination fields
page_size: pageSize,
},
},
});
if (!response.success || !response.data?.items) {
return [];
}
const items = response.data.items as VaultWalletListItem[];
return items
.filter((item) => {
return (
item.metadata?.projectId === projectId &&
(!item.metadata?.type || item.metadata.type === "server-wallet")
);
})
.map<ProjectWalletSummary>((item) => ({
id: item.id,
address: item.address,
label: item.metadata?.label ?? undefined,
}));
} catch (error) {
console.error("Failed to list project server wallets", error);
return [];
}
}
@@ -0,0 +1,74 @@
"use server";
import { configure, sendTokens } from "@thirdweb-dev/api";
import { THIRDWEB_API_HOST } from "@/constants/urls";
configure({
override: {
baseUrl: THIRDWEB_API_HOST,
},
});
export async function sendProjectWalletTokens(options: {
walletAddress: string;
recipientAddress: string;
chainId: number;
quantityWei: string;
publishableKey: string;
teamId: string;
tokenAddress?: string;
secretKey: string;
vaultAccessToken?: string;
}) {
const {
walletAddress,
recipientAddress,
chainId,
quantityWei,
publishableKey,
teamId,
tokenAddress,
secretKey,
vaultAccessToken,
} = options;
if (!secretKey) {
return {
error: "A project secret key is required to send funds.",
ok: false,
} as const;
}
const response = await sendTokens({
body: {
chainId,
from: walletAddress,
recipients: [
{
address: recipientAddress,
quantity: quantityWei,
},
],
...(tokenAddress ? { tokenAddress } : {}),
},
headers: {
"Content-Type": "application/json",
"x-client-id": publishableKey,
"x-secret-key": secretKey,
"x-team-id": teamId,
...(vaultAccessToken ? { "x-vault-access-token": vaultAccessToken } : {}),
},
});
if (response.error || !response.data) {
return {
error: response.error || "Failed to submit transfer request.",
ok: false,
} as const;
}
return {
ok: true,
transactionIds: response.data.result?.transactionIds ?? [],
} as const;
}
@@ -1,6 +1,6 @@
import "server-only";
import { headers } from "next/headers";
import { cookies, headers } from "next/headers";
import Stripe from "stripe";
import type { Team } from "@/api/team/get-team";
import {
@@ -88,6 +88,9 @@ export async function fetchClientSecret(team: Team) {
throw new Error("No customer ID found");
}
// try to get the gclid cookie
const gclid = (await cookies()).get("gclid")?.value;
// Create Checkout Sessions from body params.
const session = await stripe.checkout.sessions.create({
ui_mode: "embedded",
@@ -117,6 +120,8 @@ export async function fetchClientSecret(team: Team) {
missing_payment_method: "cancel",
},
},
// if gclid exists, set it as a metadata field so we can attribute the conversion later
metadata: gclid ? { gclid } : undefined,
},
});
+41 -45
View File
@@ -24,6 +24,7 @@ export function reportContractDeployed(properties: {
publisher: string | undefined;
contractName: string | undefined;
deploymentType?: "asset";
is_testnet: boolean | undefined;
}) {
posthog.capture("contract deployed", properties);
}
@@ -40,6 +41,7 @@ export function reportContractDeployed(properties: {
export function reportContractDeployFailed(properties: {
errorMessage: string;
chainId: number;
is_testnet: boolean | undefined;
publisher: string | undefined;
contractName: string | undefined;
}) {
@@ -171,9 +173,7 @@ export function reportOnboardingCompleted() {
*
*/
export function reportFaucetUsed(properties: { chainId: number }) {
posthog.capture("faucet used", {
chainId: properties.chainId,
});
posthog.capture("faucet used", properties);
}
// ----------------------------
@@ -197,12 +197,7 @@ export function reportChainConfigurationAdded(properties: {
decimals: number;
};
}) {
posthog.capture("chain configuration added", {
chainId: properties.chainId,
chainName: properties.chainName,
nativeCurrency: properties.nativeCurrency,
rpcURLs: properties.rpcURLs,
});
posthog.capture("chain configuration added", properties);
}
// ----------------------------
@@ -227,12 +222,9 @@ export function reportAssetBuySuccessful(properties: {
chainId: number;
contractType: AssetContractType | undefined;
assetType: "nft" | "coin";
is_testnet: boolean | undefined;
}) {
posthog.capture("asset buy successful", {
assetType: properties.assetType,
chainId: properties.chainId,
contractType: properties.contractType,
});
posthog.capture("asset buy successful", properties);
}
type TokenSwapParams = {
@@ -349,16 +341,12 @@ export function reportTokenSwapCancelled(properties: TokenSwapParams) {
*/
export function reportAssetBuyFailed(properties: {
chainId: number;
is_testnet: boolean | undefined;
contractType: AssetContractType | undefined;
assetType: "nft" | "coin";
error: string;
}) {
posthog.capture("asset buy failed", {
assetType: properties.assetType,
chainId: properties.chainId,
contractType: properties.contractType,
error: properties.error,
});
posthog.capture("asset buy failed", properties);
}
/**
@@ -371,14 +359,11 @@ export function reportAssetBuyFailed(properties: {
*/
export function reportAssetBuyCancelled(properties: {
chainId: number;
is_testnet: boolean | undefined;
contractType: AssetContractType | undefined;
assetType: "nft" | "coin";
}) {
posthog.capture("asset buy cancelled", {
assetType: properties.assetType,
chainId: properties.chainId,
contractType: properties.contractType,
});
posthog.capture("asset buy cancelled", properties);
}
// Assets Landing Page ----------------------------
@@ -423,10 +408,7 @@ export function reportAssetCreationStepConfigured(
step: "coin-info" | "token-distribution" | "launch-coin";
},
) {
posthog.capture("asset creation step configured", {
assetType: properties.assetType,
step: properties.step,
});
posthog.capture("asset creation step configured", properties);
}
/**
@@ -440,11 +422,10 @@ export function reportAssetCreationStepConfigured(
export function reportAssetCreationSuccessful(properties: {
assetType: "nft" | "coin";
contractType: AssetContractType;
chainId: number;
is_testnet: boolean | undefined;
}) {
posthog.capture("asset creation successful", {
assetType: properties.assetType,
contractType: properties.contractType,
});
posthog.capture("asset creation successful", properties);
}
type CoinCreationStep =
@@ -466,7 +447,12 @@ type CoinCreationStep =
* @MananTank
*/
export function reportAssetCreationFailed(
properties: { contractType: AssetContractType; error: string } & (
properties: {
contractType: AssetContractType;
error: string;
is_testnet: boolean | undefined;
chainId: number;
} & (
| {
assetType: "nft";
step:
@@ -481,12 +467,7 @@ export function reportAssetCreationFailed(
}
),
) {
posthog.capture("asset creation failed", {
assetType: properties.assetType,
contractType: properties.contractType,
error: properties.error,
step: properties.step,
});
posthog.capture("asset creation failed", properties);
}
type UpsellParams = {
@@ -582,6 +563,7 @@ export function reportPaymentLinkBuyFailed(properties: {
export function reportAssetPageview(properties: {
assetType: "nft" | "coin";
chainId: number;
is_testnet: boolean | undefined;
}) {
posthog.capture("asset pageview", properties);
}
@@ -593,7 +575,10 @@ export function reportAssetPageview(properties: {
* ### Who is responsible for this event?
* @MananTank
*/
export function reportChainPageview(properties: { chainId: number }) {
export function reportChainPageview(properties: {
chainId: number;
is_testnet: boolean | undefined;
}) {
posthog.capture("chain pageview", properties);
}
@@ -686,8 +671,19 @@ export function reportProductFeedback(properties: {
feedback: string;
source: "desktop" | "mobile";
}) {
posthog.capture("product feedback submitted", {
feedback: properties.feedback,
source: properties.source,
});
posthog.capture("product feedback submitted", properties);
}
/**
* ### Why do we need to report this event?
* - To track conversions for the bridge page links
*
* ### Who is responsible for this event?
* @MananTank
*
*/
export function reportBridgePageLinkClick(params: {
linkType: "integrate-bridge" | "trending-tokens";
}) {
posthog.capture("bridge page link clicked", params);
}
+3 -1
View File
@@ -448,6 +448,7 @@ type ActiveStatus = {
pay: boolean;
inAppWallet: boolean;
ecosystemWallet: boolean;
engineCloud: boolean;
};
export const isProjectActive = unstable_cache(
@@ -479,6 +480,7 @@ export const isProjectActive = unstable_cache(
pay: false,
rpc: false,
sdk: false,
engineCloud: false,
storage: false,
} as ActiveStatus;
}
@@ -488,7 +490,7 @@ export const isProjectActive = unstable_cache(
},
["isProjectActive"],
{
revalidate: 60 * 60, // 1 hour
revalidate: 30, // 30 seconds
},
);
@@ -0,0 +1,192 @@
"use client";
/* eslint-disable no-restricted-syntax */
import { Mesh, Program, Renderer, Triangle, Vec2 } from "ogl";
import { useEffect, useRef } from "react";
const vertex = `
attribute vec2 position;
void main(){gl_Position=vec4(position,0.0,1.0);}
`;
const fragment = `
#ifdef GL_ES
precision lowp float;
#endif
uniform vec2 uResolution;
uniform float uTime;
uniform float uHueShift;
uniform float uNoise;
uniform float uScan;
uniform float uScanFreq;
uniform float uWarp;
uniform vec3 uBackgroundColor;
uniform float uBackgroundOpacity;
uniform float uPatternLightness;
#define iTime uTime
#define iResolution uResolution
vec4 buf[8];
float rand(vec2 c){return fract(sin(dot(c,vec2(12.9898,78.233)))*43758.5453);}
mat3 rgb2yiq=mat3(0.299,0.587,0.114,0.596,-0.274,-0.322,0.211,-0.523,0.312);
mat3 yiq2rgb=mat3(1.0,0.956,0.621,1.0,-0.272,-0.647,1.0,-1.106,1.703);
vec3 hueShiftRGB(vec3 col,float deg){
vec3 yiq=rgb2yiq*col;
float rad=radians(deg);
float cosh=cos(rad),sinh=sin(rad);
vec3 yiqShift=vec3(yiq.x,yiq.y*cosh-yiq.z*sinh,yiq.y*sinh+yiq.z*cosh);
return clamp(yiq2rgb*yiqShift,0.0,1.0);
}
vec4 sigmoid(vec4 x){return 1./(1.+exp(-x));}
vec4 cppn_fn(vec2 coordinate,float in0,float in1,float in2){
buf[6]=vec4(coordinate.x,coordinate.y,0.3948333106474662+in0,0.36+in1);
buf[7]=vec4(0.14+in2,sqrt(coordinate.x*coordinate.x+coordinate.y*coordinate.y),0.,0.);
buf[0]=mat4(vec4(6.5404263,-3.6126034,0.7590882,-1.13613),vec4(2.4582713,3.1660357,1.2219609,0.06276096),vec4(-5.478085,-6.159632,1.8701609,-4.7742867),vec4(6.039214,-5.542865,-0.90925294,3.251348))*buf[6]+mat4(vec4(0.8473259,-5.722911,3.975766,1.6522468),vec4(-0.24321538,0.5839259,-1.7661959,-5.350116),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(0.21808943,1.1243913,-1.7969975,5.0294676);
buf[1]=mat4(vec4(-3.3522482,-6.0612736,0.55641043,-4.4719114),vec4(0.8631464,1.7432913,5.643898,1.6106541),vec4(2.4941394,-3.5012043,1.7184316,6.357333),vec4(3.310376,8.209261,1.1355612,-1.165539))*buf[6]+mat4(vec4(5.24046,-13.034365,0.009859298,15.870829),vec4(2.987511,3.129433,-0.89023495,-1.6822904),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-5.9457836,-6.573602,-0.8812491,1.5436668);
buf[0]=sigmoid(buf[0]);buf[1]=sigmoid(buf[1]);
buf[2]=mat4(vec4(-15.219568,8.095543,-2.429353,-1.9381982),vec4(-5.951362,4.3115187,2.6393783,1.274315),vec4(-7.3145227,6.7297835,5.2473326,5.9411426),vec4(5.0796127,8.979051,-1.7278991,-1.158976))*buf[6]+mat4(vec4(-11.967154,-11.608155,6.1486754,11.237008),vec4(2.124141,-6.263192,-1.7050359,-0.7021966),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-4.17164,-3.2281182,-4.576417,-3.6401186);
buf[3]=mat4(vec4(3.1832156,-13.738922,1.879223,3.233465),vec4(0.64300746,12.768129,1.9141049,0.50990224),vec4(-0.049295485,4.4807224,1.4733979,1.801449),vec4(5.0039253,13.000481,3.3991797,-4.5561905))*buf[6]+mat4(vec4(-0.1285731,7.720628,-3.1425676,4.742367),vec4(0.6393625,3.714393,-0.8108378,-0.39174938),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-1.1811101,-21.621881,0.7851888,1.2329718);
buf[2]=sigmoid(buf[2]);buf[3]=sigmoid(buf[3]);
buf[4]=mat4(vec4(5.214916,-7.183024,2.7228765,2.6592617),vec4(-5.601878,-25.3591,4.067988,0.4602802),vec4(-10.57759,24.286327,21.102104,37.546658),vec4(4.3024497,-1.9625226,2.3458803,-1.372816))*buf[0]+mat4(vec4(-17.6526,-10.507558,2.2587414,12.462782),vec4(6.265566,-502.75443,-12.642513,0.9112289),vec4(-10.983244,20.741234,-9.701768,-0.7635988),vec4(5.383626,1.4819539,-4.1911616,-4.8444734))*buf[1]+mat4(vec4(12.785233,-16.345072,-0.39901125,1.7955981),vec4(-30.48365,-1.8345358,1.4542528,-1.1118771),vec4(19.872723,-7.337935,-42.941723,-98.52709),vec4(8.337645,-2.7312303,-2.2927687,-36.142323))*buf[2]+mat4(vec4(-16.298317,3.5471997,-0.44300047,-9.444417),vec4(57.5077,-35.609753,16.163465,-4.1534753),vec4(-0.07470326,-3.8656476,-7.0901804,3.1523974),vec4(-12.559385,-7.077619,1.490437,-0.8211543))*buf[3]+vec4(-7.67914,15.927437,1.3207729,-1.6686112);
buf[5]=mat4(vec4(-1.4109162,-0.372762,-3.770383,-21.367174),vec4(-6.2103205,-9.35908,0.92529047,8.82561),vec4(11.460242,-22.348068,13.625772,-18.693201),vec4(-0.3429052,-3.9905605,-2.4626114,-0.45033523))*buf[0]+mat4(vec4(7.3481627,-4.3661838,-6.3037653,-3.868115),vec4(1.5462853,6.5488915,1.9701879,-0.58291394),vec4(6.5858274,-2.2180402,3.7127688,-1.3730392),vec4(-5.7973905,10.134961,-2.3395722,-5.965605))*buf[1]+mat4(vec4(-2.5132585,-6.6685553,-1.4029363,-0.16285264),vec4(-0.37908727,0.53738135,4.389061,-1.3024765),vec4(-0.70647055,2.0111287,-5.1659346,-3.728635),vec4(-13.562562,10.487719,-0.9173751,-2.6487076))*buf[2]+mat4(vec4(-8.645013,6.5546675,-6.3944063,-5.5933375),vec4(-0.57783127,-1.077275,36.91025,5.736769),vec4(14.283112,3.7146652,7.1452246,-4.5958776),vec4(2.7192075,3.6021907,-4.366337,-2.3653464))*buf[3]+vec4(-5.9000807,-4.329569,1.2427121,8.59503);
buf[4]=sigmoid(buf[4]);buf[5]=sigmoid(buf[5]);
buf[6]=mat4(vec4(-1.61102,0.7970257,1.4675229,0.20917463),vec4(-28.793737,-7.1390953,1.5025433,4.656581),vec4(-10.94861,39.66238,0.74318546,-10.095605),vec4(-0.7229728,-1.5483948,0.7301322,2.1687684))*buf[0]+mat4(vec4(3.2547753,21.489103,-1.0194173,-3.3100595),vec4(-3.7316632,-3.3792162,-7.223193,-0.23685838),vec4(13.1804495,0.7916005,5.338587,5.687114),vec4(-4.167605,-17.798311,-6.815736,-1.6451967))*buf[1]+mat4(vec4(0.604885,-7.800309,-7.213122,-2.741014),vec4(-3.522382,-0.12359311,-0.5258442,0.43852118),vec4(9.6752825,-22.853785,2.062431,0.099892326),vec4(-4.3196306,-17.730087,2.5184598,5.30267))*buf[2]+mat4(vec4(-6.545563,-15.790176,-6.0438633,-5.415399),vec4(-43.591583,28.551912,-16.00161,18.84728),vec4(4.212382,8.394307,3.0958717,8.657522),vec4(-5.0237565,-4.450633,-4.4768,-5.5010443))*buf[3]+mat4(vec4(1.6985557,-67.05806,6.897715,1.9004834),vec4(1.8680354,2.3915145,2.5231109,4.081538),vec4(11.158006,1.7294737,2.0738268,7.386411),vec4(-4.256034,-306.24686,8.258898,-17.132736))*buf[4]+mat4(vec4(1.6889864,-4.5852966,3.8534803,-6.3482175),vec4(1.3543309,-1.2640043,9.932754,2.9079645),vec4(-5.2770967,0.07150358,-0.13962056,3.3269649),vec4(28.34703,-4.918278,6.1044083,4.085355))*buf[5]+vec4(6.6818056,12.522166,-3.7075126,-4.104386);
buf[7]=mat4(vec4(-8.265602,-4.7027016,5.098234,0.7509808),vec4(8.6507845,-17.15949,16.51939,-8.884479),vec4(-4.036479,-2.3946867,-2.6055532,-1.9866527),vec4(-2.2167742,-1.8135649,-5.9759874,4.8846445))*buf[0]+mat4(vec4(6.7790847,3.5076547,-2.8191125,-2.7028968),vec4(-5.743024,-0.27844876,1.4958696,-5.0517144),vec4(13.122226,15.735168,-2.9397483,-4.101023),vec4(-14.375265,-5.030483,-6.2599335,2.9848232))*buf[1]+mat4(vec4(4.0950394,-0.94011575,-5.674733,4.755022),vec4(4.3809423,4.8310084,1.7425908,-3.437416),vec4(2.117492,0.16342592,-104.56341,16.949184),vec4(-5.22543,-2.994248,3.8350096,-1.9364246))*buf[2]+mat4(vec4(-5.900337,1.7946124,-13.604192,-3.8060522),vec4(6.6583457,31.911177,25.164474,91.81147),vec4(11.840538,4.1503043,-0.7314397,6.768467),vec4(-6.3967767,4.034772,6.1714606,-0.32874924))*buf[3]+mat4(vec4(3.4992442,-196.91893,-8.923708,2.8142626),vec4(3.4806502,-3.1846354,5.1725626,5.1804223),vec4(-2.4009497,15.585794,1.2863957,2.0252278),vec4(-71.25271,-62.441242,-8.138444,0.50670296))*buf[4]+mat4(vec4(-12.291733,-11.176166,-7.3474145,4.390294),vec4(10.805477,5.6337385,-0.9385842,-4.7348723),vec4(-12.869276,-7.039391,5.3029537,7.5436664),vec4(1.4593618,8.91898,3.5101583,5.840625))*buf[5]+vec4(2.2415268,-6.705987,-0.98861027,-2.117676);
buf[6]=sigmoid(buf[6]);buf[7]=sigmoid(buf[7]);
buf[0]=mat4(vec4(1.6794263,1.3817469,2.9625452,0.),vec4(-1.8834411,-1.4806935,-3.5924516,0.),vec4(-1.3279216,-1.0918057,-2.3124623,0.),vec4(0.2662234,0.23235129,0.44178495,0.))*buf[0]+mat4(vec4(-0.6299101,-0.5945583,-0.9125601,0.),vec4(0.17828953,0.18300213,0.18182953,0.),vec4(-2.96544,-2.5819945,-4.9001055,0.),vec4(1.4195864,1.1868085,2.5176322,0.))*buf[1]+mat4(vec4(-1.2584374,-1.0552157,-2.1688404,0.),vec4(-0.7200217,-0.52666044,-1.438251,0.),vec4(0.15345335,0.15196142,0.272854,0.),vec4(0.945728,0.8861938,1.2766753,0.))*buf[2]+mat4(vec4(-2.4218085,-1.968602,-4.35166,0.),vec4(-22.683098,-18.0544,-41.954372,0.),vec4(0.63792,0.5470648,1.1078634,0.),vec4(-1.5489894,-1.3075932,-2.6444845,0.))*buf[3]+mat4(vec4(-0.49252132,-0.39877754,-0.91366625,0.),vec4(0.95609266,0.7923952,1.640221,0.),vec4(0.30616966,0.15693925,0.8639857,0.),vec4(1.1825981,0.94504964,2.176963,0.))*buf[4]+mat4(vec4(0.35446745,0.3293795,0.59547555,0.),vec4(-0.58784515,-0.48177817,-1.0614829,0.),vec4(2.5271258,1.9991658,4.6846647,0.),vec4(0.13042648,0.08864098,0.30187556,0.))*buf[5]+mat4(vec4(-1.7718065,-1.4033192,-3.3355875,0.),vec4(3.1664357,2.638297,5.378702,0.),vec4(-3.1724713,-2.6107926,-5.549295,0.),vec4(-2.851368,-2.249092,-5.3013067,0.))*buf[6]+mat4(vec4(1.5203838,1.2212278,2.8404984,0.),vec4(1.5210563,1.2651345,2.683903,0.),vec4(2.9789467,2.4364579,5.2347264,0.),vec4(2.2270417,1.8825914,3.8028636,0.))*buf[7]+vec4(-1.5468478,-3.6171484,0.24762098,0.);
buf[0]=sigmoid(buf[0]);
return vec4(buf[0].x,buf[0].y,buf[0].z,1.);
}
void mainImage(out vec4 fragColor,in vec2 fragCoord){
vec2 uv=fragCoord/uResolution.xy*2.-1.;
uv.y*=-1.;
uv+=uWarp*vec2(sin(uv.y*6.283+uTime*0.5),cos(uv.x*6.283+uTime*0.5))*0.05;
fragColor=cppn_fn(uv,0.1*sin(0.3*uTime),0.1*sin(0.69*uTime),0.1*sin(0.44*uTime));
}
void main(){
vec4 col;mainImage(col,gl_FragCoord.xy);
col.rgb=hueShiftRGB(col.rgb,uHueShift);
float scanline_val=sin(gl_FragCoord.y*uScanFreq)*0.5+0.5;
col.rgb*=1.-(scanline_val*scanline_val)*uScan;
col.rgb+=(rand(gl_FragCoord.xy+uTime)-0.5)*uNoise;
// Apply lightness control to pattern
col.rgb = col.rgb * uPatternLightness;
// Use background color as base, then add pattern on top
vec3 finalColor = uBackgroundColor + col.rgb * uBackgroundOpacity;
gl_FragColor=vec4(clamp(finalColor,0.0,1.0),1.0);
}
`;
type Props = {
hueShift?: number;
noiseIntensity?: number;
scanlineIntensity?: number;
speed?: number;
scanlineFrequency?: number;
warpAmount?: number;
resolutionScale?: number;
backgroundColor?: [number, number, number];
backgroundOpacity?: number;
patternLightness?: number;
};
export function DarkVeil({
hueShift = 0,
noiseIntensity = 0,
scanlineIntensity = 0,
speed = 0.5,
scanlineFrequency = 0,
warpAmount = 0,
resolutionScale = 1,
backgroundColor = [0, 0, 0],
backgroundOpacity = 1,
patternLightness = 1.0,
}: Props) {
const ref = useRef<HTMLCanvasElement>(null);
useEffect(() => {
const canvas = ref.current as HTMLCanvasElement;
const parent = canvas.parentElement as HTMLElement;
const renderer = new Renderer({
dpr: Math.min(window.devicePixelRatio, 2),
canvas,
});
const gl = renderer.gl;
const geometry = new Triangle(gl);
const program = new Program(gl, {
vertex,
fragment,
uniforms: {
uTime: { value: 0 },
uResolution: { value: new Vec2() },
uHueShift: { value: hueShift },
uNoise: { value: noiseIntensity },
uScan: { value: scanlineIntensity },
uScanFreq: { value: scanlineFrequency },
uWarp: { value: warpAmount },
uBackgroundColor: { value: backgroundColor },
uBackgroundOpacity: { value: backgroundOpacity },
uPatternLightness: { value: patternLightness },
},
});
const mesh = new Mesh(gl, { geometry, program });
const resize = () => {
const w = parent.clientWidth,
h = parent.clientHeight;
renderer.setSize(w * resolutionScale, h * resolutionScale);
program.uniforms.uResolution.value.set(w, h);
};
window.addEventListener("resize", resize);
resize();
const start = performance.now();
let frame = 0;
const loop = () => {
program.uniforms.uTime.value =
((performance.now() - start) / 1000) * speed;
program.uniforms.uHueShift.value = hueShift;
program.uniforms.uNoise.value = noiseIntensity;
program.uniforms.uScan.value = scanlineIntensity;
program.uniforms.uScanFreq.value = scanlineFrequency;
program.uniforms.uWarp.value = warpAmount;
program.uniforms.uBackgroundColor.value = backgroundColor;
program.uniforms.uBackgroundOpacity.value = backgroundOpacity;
program.uniforms.uPatternLightness.value = patternLightness;
renderer.render({ scene: mesh });
frame = requestAnimationFrame(loop);
};
loop();
return () => {
cancelAnimationFrame(frame);
window.removeEventListener("resize", resize);
};
}, [
hueShift,
noiseIntensity,
scanlineIntensity,
speed,
scanlineFrequency,
warpAmount,
resolutionScale,
backgroundColor,
backgroundOpacity,
patternLightness,
]);
return <canvas ref={ref} className="w-full h-full block bg-background" />;
}
@@ -34,6 +34,7 @@ export function BuyAndSwapEmbed(props: {
tokenAddress: string | undefined;
buyAmount: string | undefined;
pageType: PageType;
isTestnet: boolean | undefined;
}) {
const { theme } = useTheme();
const [tab, setTab] = useState<"buy" | "swap">("swap");
@@ -67,7 +68,7 @@ export function BuyAndSwapEmbed(props: {
}, [props.pageType]);
return (
<div className="bg-card rounded-2xl border overflow-hidden flex flex-col relative z-10 shadow-xl">
<div className="bg-card rounded-2xl border overflow-hidden flex flex-col relative z-10 shadow-xl min-w-0">
<div className="flex gap-2.5 p-4 border-b border-dashed">
<TabButton
label="Swap"
@@ -85,7 +86,7 @@ export function BuyAndSwapEmbed(props: {
<BuyWidget
amount={props.buyAmount || "1"}
chain={props.chain}
className="!rounded-2xl !w-full !border-none"
className="!rounded-2xl !border-none"
title=""
client={client}
connectOptions={{
@@ -116,6 +117,7 @@ export function BuyAndSwapEmbed(props: {
chainId: props.chain.id,
error: errorMessage,
contractType: undefined,
is_testnet: props.isTestnet,
});
}
}}
@@ -141,6 +143,7 @@ export function BuyAndSwapEmbed(props: {
assetType: "coin",
chainId: props.chain.id,
contractType: undefined,
is_testnet: props.isTestnet,
});
}
}}
@@ -166,6 +169,7 @@ export function BuyAndSwapEmbed(props: {
assetType: "coin",
chainId: props.chain.id,
contractType: undefined,
is_testnet: props.isTestnet,
});
}
}}
@@ -179,7 +183,7 @@ export function BuyAndSwapEmbed(props: {
<SwapWidget
client={client}
theme={themeObj}
className="!rounded-2xl !border-none !w-full"
className="!rounded-2xl !border-none"
prefill={{
// buy this token by default
buyToken: {
@@ -4,9 +4,10 @@ import { MoonIcon, SunIcon } from "lucide-react";
import { useTheme } from "next-themes";
import { ClientOnly } from "@/components/blocks/client-only";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { Skeleton } from "../ui/skeleton";
export function ToggleThemeButton() {
export function ToggleThemeButton(props: { className?: string }) {
const { setTheme, theme } = useTheme();
return (
@@ -15,7 +16,10 @@ export function ToggleThemeButton() {
>
<Button
aria-label="Toggle theme"
className="h-auto w-auto rounded-full border border-border bg-background p-2"
className={cn(
"h-auto w-auto rounded-full border border-border bg-background p-2",
props.className,
)}
onClick={() => {
setTheme(theme === "dark" ? "light" : "dark");
}}
@@ -0,0 +1,73 @@
"use client";
import { ChevronDownIcon } from "lucide-react";
import { useId, useState } from "react";
import { Button } from "@/components/ui/button";
import { DynamicHeight } from "@/components/ui/DynamicHeight";
import { cn } from "@/lib/utils";
export function FaqSection(props: {
faqs: Array<{ title: string; description: string }>;
}) {
return (
<section>
<h2 className="text-2xl md:text-3xl font-semibold mb-4 tracking-tight">
Frequently asked questions
</h2>
<div className="flex flex-col">
{props.faqs.map((faq, faqIndex) => (
<FaqItem
key={faq.title}
title={faq.title}
description={faq.description}
className={cn(faqIndex === props.faqs.length - 1 && "border-b-0")}
/>
))}
</div>
</section>
);
}
function FaqItem(props: {
title: string;
description: string;
className?: string;
}) {
const [isOpen, setIsOpenn] = useState(false);
const contentId = useId();
return (
<DynamicHeight>
<div className={cn("border-b border-dashed", props.className)}>
<h3>
<Button
variant="ghost"
onClick={() => setIsOpenn(!isOpen)}
aria-controls={contentId}
aria-expanded={isOpen}
className={cn(
"w-full justify-between h-auto py-5 text-base text-muted-foreground hover:bg-transparent pl-0 text-wrap text-left gap-6",
isOpen && "text-foreground",
)}
>
{props.title}
<ChevronDownIcon
className={cn(
"size-4 shrink-0 transition-transform duration-200",
isOpen && "rotate-180",
)}
/>
</Button>
</h3>
<p
className={cn(
"text-muted-foreground text-base leading-7 pb-6 max-w-4xl",
!isOpen && "hidden",
)}
id={contentId}
>
{props.description}
</p>
</div>
</DynamicHeight>
);
}
@@ -4,7 +4,7 @@ export function GridPatternEmbedContainer(props: {
children: React.ReactNode;
}) {
return (
<div className="sm:flex sm:justify-center w-full sm:border sm:border-dashed sm:bg-accent/20 sm:py-12 rounded-xl overflow-hidden relative">
<div className="flex justify-center w-full sm:border sm:border-dashed sm:bg-accent/20 sm:py-12 sm:rounded-xl sm:overflow-hidden relative">
<GridPattern
width={30}
height={30}
@@ -17,7 +17,7 @@ export function GridPatternEmbedContainer(props: {
"linear-gradient(to bottom right,white,transparent,transparent)",
}}
/>
<div className="sm:w-[420px] z-10">{props.children}</div>
<div className="z-10 min-w-0">{props.children}</div>
</div>
);
}
@@ -46,7 +46,7 @@ export function AdvancedSearchInput(props: {
value={searchType}
onValueChange={(value) => setSearchType(value as SearchType)}
>
<SelectTrigger className="w-[140px] bg-card">
<SelectTrigger className="w-[140px] bg-background rounded-full">
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -61,7 +61,7 @@ export function AdvancedSearchInput(props: {
<div className="flex flex-1">
<div className="relative flex-1">
<Input
className="bg-card pl-9 border-r-0 rounded-r-none"
className="bg-background pl-9 border-r-0 rounded-r-none rounded-l-full"
placeholder={`Search by ${searchType}...`}
value={query}
onChange={(e) => setQuery(e.target.value)}
@@ -86,7 +86,7 @@ export function AdvancedSearchInput(props: {
onClick={handleSearch}
variant="outline"
disabled={!query.trim() || props.isLoading}
className="rounded-l-none gap-2 bg-card disabled:opacity-100"
className="rounded-l-none rounded-r-full gap-2 bg-background disabled:opacity-100"
>
{props.isLoading && <Spinner className="size-4" />}
Search
@@ -2,7 +2,7 @@
import { createColumnHelper } from "@tanstack/react-table";
import { format } from "date-fns";
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
import { ArrowLeftIcon, ArrowRightIcon, UserIcon } from "lucide-react";
import Papa from "papaparse";
import { useCallback, useMemo, useState } from "react";
import type { ThirdwebClient } from "thirdweb";
@@ -264,11 +264,24 @@ export function InAppWalletUsersPageContent(
return (
<div>
<div className="flex flex-col gap-4">
{/* Top section */}
<div className="flex flex-col gap-4">
<div className="flex flex-col md:flex-row lg:items-center justify-end gap-3">
<div className="w-full max-w-lg">
<div className="overflow-hidden rounded-xl border border-border bg-card">
<div className="flex flex-col lg:flex-row lg:justify-between p-4 lg:px-6 py-5 lg:items-center gap-5">
<div>
<div className="flex mb-3">
<div className="p-2 rounded-full bg-background border border-border">
<UserIcon className="size-5 text-muted-foreground" />
</div>
</div>
<h2 className="font-semibold text-2xl tracking-tight">
User Wallets
</h2>
<p className="text-muted-foreground text-sm">
View and manage your project's users
</p>
</div>
<div className="flex flex-col items-start lg:items-end gap-2.5 border-t lg:border-t-0 pt-5 lg:pt-0 border-dashed">
<div className="w-full lg:w-auto lg:min-w-[320px]">
<AdvancedSearchInput
onSearch={handleSearch}
onClear={handleClearSearch}
@@ -277,7 +290,7 @@ export function InAppWalletUsersPageContent(
/>
</div>
<Button
className="gap-2 bg-card"
className="gap-2 bg-background rounded-full"
disabled={wallets.length === 0 || isPending}
onClick={downloadCSV}
variant="outline"
@@ -298,11 +311,11 @@ export function InAppWalletUsersPageContent(
data={wallets}
isFetched={walletsQuery.isFetched}
isPending={walletsQuery.isPending}
tableContainerClassName="rounded-b-none"
tableContainerClassName="rounded-none border-x-0 border-b-0"
title="in-app wallets"
/>
<div className="flex justify-center gap-3 rounded-b-lg border border-t-0 bg-card p-6">
<div className="flex justify-center gap-3 border-t bg-card p-6">
<Button
className="gap-2 bg-background"
disabled={activePage === 1 || walletsQuery.isPending}
@@ -5,6 +5,7 @@ import Link from "next/link";
import { Button } from "@/components/ui/button";
import { useLocalStorage } from "@/hooks/useLocalStorage";
// biome-ignore lint/correctness/noUnusedVariables: banner is toggled on-demand via API content changes
function AnnouncementBannerUI(props: {
href: string;
label: string;
@@ -64,7 +64,7 @@ const CreateProjectDialog = (props: CreateProjectDialogProps) => {
<CreateProjectDialogUI
createProject={async (params) => {
const res = await createProjectClient(props.teamId, params);
await createVaultAccountAndAccessToken({
const vaultTokens = await createVaultAccountAndAccessToken({
project: res.project,
projectSecretKey: res.secret,
}).catch((error) => {
@@ -74,6 +74,13 @@ const CreateProjectDialog = (props: CreateProjectDialogProps) => {
);
throw error;
});
const managementAccessToken = vaultTokens.managementToken?.accessToken;
if (!managementAccessToken) {
throw new Error("Missing management access token for project wallet");
}
return {
project: res.project,
secret: res.secret,
+16 -2
View File
@@ -379,12 +379,27 @@ export function useEngineTransactions(params: {
page?: number;
status?: EngineStatus;
};
id?: string;
}) {
const { instanceUrl, autoUpdate, authToken } = params;
const { instanceUrl, autoUpdate, authToken, id } = params;
return useQuery({
placeholderData: keepPreviousData,
queryFn: async () => {
if (id) {
const res = await fetch(`${instanceUrl}transaction/status/${id}`, {
headers: getEngineRequestHeaders(authToken),
method: "GET",
});
const json = await res.json();
const transaction = (json.result as Transaction) || {};
return {
transactions: [transaction],
totalCount: 1,
};
}
const url = new URL(`${instanceUrl}transaction/get-all`);
if (params.queryParams) {
for (const key in params.queryParams) {
@@ -402,7 +417,6 @@ export function useEngineTransactions(params: {
});
const json = await res.json();
return (json.result as TransactionResponse) || {};
},
queryKey: engineKeys.transactions(instanceUrl, params),
@@ -0,0 +1,21 @@
const PROJECT_WALLET_LABEL_SUFFIX = " Wallet";
const PROJECT_WALLET_LABEL_MAX_LENGTH = 32;
/**
* Builds the default label for a project's primary server wallet.
* Ensures a stable naming convention so the wallet can be identified across flows.
*/
export function getProjectWalletLabel(projectName: string | undefined) {
const baseName = projectName?.trim() || "Project";
const maxBaseLength = Math.max(
1,
PROJECT_WALLET_LABEL_MAX_LENGTH - PROJECT_WALLET_LABEL_SUFFIX.length,
);
const normalizedBase =
baseName.length > maxBaseLength
? baseName.slice(0, maxBaseLength).trimEnd()
: baseName;
return `${normalizedBase}${PROJECT_WALLET_LABEL_SUFFIX}`;
}
@@ -0,0 +1,99 @@
import "server-only";
import { createVaultClient, listEoas } from "@thirdweb-dev/vault-sdk";
import type { Project } from "@/api/project/projects";
import { NEXT_PUBLIC_THIRDWEB_VAULT_URL } from "@/constants/public-envs";
import { getProjectWalletLabel } from "@/lib/project-wallet";
export type ProjectWalletSummary = {
id: string;
address: string;
label?: string;
};
type VaultWalletListItem = {
id: string;
address: string;
metadata?: {
label?: string;
projectId?: string;
teamId?: string;
type?: string;
};
};
export async function getProjectWallet(
project: Project,
): Promise<ProjectWalletSummary | undefined> {
const engineCloudService = project.services.find(
(service) => service.name === "engineCloud",
);
const managementAccessToken =
engineCloudService?.managementAccessToken || undefined;
const projectWalletAddress = (
engineCloudService as { projectWalletAddress?: string } | undefined
)?.projectWalletAddress;
if (
!managementAccessToken ||
!NEXT_PUBLIC_THIRDWEB_VAULT_URL ||
!projectWalletAddress
) {
return undefined;
}
try {
const vaultClient = await createVaultClient({
baseUrl: NEXT_PUBLIC_THIRDWEB_VAULT_URL,
});
const response = await listEoas({
client: vaultClient,
request: {
auth: {
accessToken: managementAccessToken,
},
options: {
page: 0,
// @ts-expect-error - SDK expects snake_case for pagination arguments
page_size: 100,
},
},
});
if (!response.success || !response.data) {
return undefined;
}
const items = response.data.items as VaultWalletListItem[] | undefined;
if (!items?.length) {
return undefined;
}
const defaultLabel = getProjectWalletLabel(project.name);
const serverWallets = items.filter(
(item) => item.metadata?.projectId === project.id,
);
const defaultWallet = serverWallets.find(
(item) =>
item.address.toLowerCase() === projectWalletAddress.toLowerCase(),
);
if (!defaultWallet) {
return undefined;
}
return {
id: defaultWallet.id,
address: defaultWallet.address,
label: defaultWallet.metadata?.label ?? defaultLabel,
};
} catch (error) {
console.error("Failed to load project wallet", error);
return undefined;
}
}
@@ -0,0 +1,50 @@
import "server-only";
import { unstable_cache } from "next/cache";
type ChainSeo = {
title: string;
description: string;
og: {
title: string;
description: string;
site_name: string;
url: string;
};
faqs: Array<{
title: string;
description: string;
}>;
chain: {
chainId: number;
name: string;
slug: string;
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
testnet: boolean;
is_deprecated: boolean;
};
};
export const fetchChainSeo = unstable_cache(
async (chainId: number) => {
const url = new URL(
`https://seo-pages-generator-5814.zeet-nftlabs.zeet.app/chain/${chainId}`,
);
const res = await fetch(url, {
headers: {
"Content-Type": "application/json",
},
});
if (!res.ok) {
return undefined;
}
return res.json() as Promise<ChainSeo>;
},
["chain-seo"],
{ revalidate: 60 * 60 * 24 }, // 24 hours
);
@@ -8,6 +8,7 @@ export function BuyFundsSection(props: { chain: ChainMetadata }) {
return (
<GridPatternEmbedContainer>
<BuyAndSwapEmbed
isTestnet={props.chain.testnet}
// eslint-disable-next-line no-restricted-syntax
chain={defineDashboardChain(props.chain.chainId, props.chain)}
buyAmount={undefined}
@@ -2,10 +2,11 @@
import { reportChainPageview } from "@/analytics/report";
import { useEffectOnce } from "@/hooks/useEffectOnce";
export function ChainPageView(props: { chainId: number }) {
export function ChainPageView(props: { chainId: number; is_testnet: boolean }) {
useEffectOnce(() => {
reportChainPageview({
chainId: props.chainId,
is_testnet: props.is_testnet,
});
});
@@ -11,7 +11,7 @@ export function ChainOverviewSection(props: { chain: ChainMetadata }) {
return (
<section>
<SectionTitle title="Chain Overview" />
<div className="grid grid-cols-1 gap-6 rounded-lg border bg-card p-4 md:grid-cols-2 md:p-6 lg:grid-cols-3 lg:gap-8">
<div className="grid grid-cols-1 gap-6 rounded-xl border bg-card p-4 md:grid-cols-2 md:p-6 lg:grid-cols-3 lg:gap-6">
{/* Info */}
{chain.infoURL && (
<PrimaryInfoItem title="Info">
@@ -1,4 +1,3 @@
import { CircleCheckIcon } from "lucide-react";
import Link from "next/link";
import type { ChainMetadataWithServices } from "@/types/chain";
import { products } from "../../../../components/server/products";
@@ -24,15 +23,18 @@ export function SupportedProductsSection(props: {
{enabledProducts.map((product) => {
return (
<div
className="relative flex gap-3 rounded-lg border bg-card p-4 pr-8 transition-colors hover:border-active-border"
className="relative rounded-xl border bg-card p-4 hover:border-active-border"
key={product.id}
>
<CircleCheckIcon className="absolute top-4 right-4 size-5 text-success-text" />
<product.icon className="mt-0.5 size-5 shrink-0" />
<div className="flex mb-4">
<div className="p-2 rounded-full border bg-background">
<product.icon className="size-4 text-muted-foreground" />
</div>
</div>
<div>
<h3 className="mb-1.5 font-medium">
<h3 className="mb-1">
<Link
className="before:absolute before:inset-0"
className="before:absolute before:inset-0 text-base font-medium"
href={product.link}
rel="noopener noreferrer"
target="_blank"
@@ -17,7 +17,7 @@ export function ExplorersSection(props: {
key={explorer.url}
>
<ExternalLinkIcon className="absolute top-4 right-4 size-4 text-muted-foreground" />
<h3 className="mb-1 font-semibold text-base capitalize">
<h3 className="mb-1 font-medium text-base capitalize">
{explorer.name}
</h3>
<Link
@@ -6,9 +6,7 @@ export function PrimaryInfoItem(props: {
return (
<div>
<div className="flex items-center gap-2">
<h3 className="font-medium text-base text-muted-foreground">
{props.title}
</h3>
<h3 className="text-base text-muted-foreground">{props.title}</h3>
{props.titleIcon}
</div>
{props.children}
@@ -22,39 +22,51 @@ import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { mapV4ChainToV5Chain } from "@/utils/map-chains";
import { TeamHeader } from "../../../../team/components/TeamHeader/team-header";
import { StarButton } from "../../components/client/star-button";
import { getChain, getChainMetadata } from "../../utils";
import { getChain, getCustomChainMetadata } from "../../utils";
import { fetchChainSeo } from "./apis/chain-seo";
import { AddChainToWallet } from "./components/client/add-chain-to-wallet";
import { ChainPageView } from "./components/client/chain-pageview";
import { ChainHeader } from "./components/server/chain-header";
// TODO: improve the behavior when clicking "Get started with thirdweb", currently just redirects to the dashboard
type Params = Promise<{ chain_id: string }>;
export async function generateMetadata(props: {
params: Promise<{ chain_id: string }>;
}): Promise<Metadata> {
params: Params;
}): Promise<Metadata | undefined> {
const params = await props.params;
const chain = await getChain(params.chain_id);
const sanitizedChainName = chain.name.replace("Mainnet", "").trim();
const title = `${sanitizedChainName}: RPC and Chain Settings`;
const chainSeo = await fetchChainSeo(Number(chain.chainId)).catch(
() => undefined,
);
const description = `Use the best ${sanitizedChainName} RPC and add to your wallet. Discover the chain ID, native token, explorers, and ${
chain.testnet && chain.faucets?.length ? "faucet options" : "more"
}.`;
if (!chainSeo) {
return undefined;
}
return {
description,
title: chainSeo.title,
description: chainSeo.description,
metadataBase: new URL("https://thirdweb.com"),
openGraph: {
description,
title,
title: chainSeo.og.title,
description: chainSeo.og.description,
siteName: "thirdweb",
type: "website",
url: "https://thirdweb.com",
},
twitter: {
title: chainSeo.og.title,
description: chainSeo.og.description,
card: "summary_large_image",
creator: "@thirdweb",
site: "@thirdweb",
},
title,
};
}
// this is the dashboard layout file
export default async function ChainPageLayout(props: {
children: React.ReactNode;
params: Promise<{ chain_id: string }>;
params: Params;
}) {
const params = await props.params;
const { children } = props;
@@ -67,12 +79,14 @@ export default async function ChainPageLayout(props: {
redirect(chain.slug);
}
const chainMetadata = await getChainMetadata(chain.chainId);
const customChainMetadata = getCustomChainMetadata(chain.chainId);
const chainSeo = await fetchChainSeo(chain.chainId);
const client = getClientThirdwebClient(undefined);
const description = customChainMetadata?.about || chainSeo?.description;
return (
<div className="flex grow flex-col">
<ChainPageView chainId={chain.chainId} />
<ChainPageView chainId={chain.chainId} is_testnet={chain.testnet} />
<div className="border-border border-b bg-card">
<TeamHeader />
</div>
@@ -123,7 +137,7 @@ export default async function ChainPageLayout(props: {
<ChainHeader
chain={chain}
client={client}
headerImageUrl={chainMetadata?.headerImgUrl}
headerImageUrl={customChainMetadata?.headerImgUrl}
logoUrl={chain.icon?.url}
/>
@@ -131,7 +145,7 @@ export default async function ChainPageLayout(props: {
<div className="flex flex-col gap-3 md:gap-2">
{/* Gas Sponsored badge - Mobile */}
{chainMetadata?.gasSponsored && (
{customChainMetadata?.gasSponsored && (
<div className="flex md:hidden">
<GasSponsoredBadge />
</div>
@@ -153,7 +167,7 @@ export default async function ChainPageLayout(props: {
)}
{/* Gas Sponsored badge - Desktop */}
{chainMetadata?.gasSponsored && (
{customChainMetadata?.gasSponsored && (
<div className="hidden md:block">
<GasSponsoredBadge />
</div>
@@ -161,9 +175,9 @@ export default async function ChainPageLayout(props: {
</div>
{/* description */}
{chainMetadata?.about && (
<p className="mb-2 whitespace-pre-line text-muted-foreground text-sm lg:text-base">
{chainMetadata.about}
{description && (
<p className="mb-2 whitespace-pre-line text-muted-foreground text-sm lg:text-base text-pretty max-w-3xl">
{description}
</p>
)}
@@ -1,7 +1,9 @@
import { CircleAlertIcon } from "lucide-react";
import { getRawAccount } from "@/api/account/get-account";
import { FaqSection } from "@/components/blocks/faq-section";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { getChain, getChainMetadata } from "../../utils";
import { getChain, getCustomChainMetadata } from "../../utils";
import { fetchChainSeo } from "./apis/chain-seo";
import { BuyFundsSection } from "./components/client/BuyFundsSection";
import { ChainOverviewSection } from "./components/server/ChainOverviewSection";
import { ChainCTA } from "./components/server/cta-card";
@@ -9,22 +11,27 @@ import { ExplorersSection } from "./components/server/explorer-section";
import { FaucetSection } from "./components/server/FaucetSection";
import { SupportedProductsSection } from "./components/server/SupportedProductsSection";
export default async function Page(props: {
type Props = {
params: Promise<{ chain_id: string }>;
}) {
};
export default async function Page(props: Props) {
const params = await props.params;
const chain = await getChain(params.chain_id);
const chainMetadata = await getChainMetadata(chain.chainId);
const customChainMetadata = getCustomChainMetadata(Number(params.chain_id));
const chainSeo = await fetchChainSeo(Number(chain.chainId)).catch(
() => undefined,
);
const client = getClientThirdwebClient();
const isDeprecated = chain.status === "deprecated";
const account = await getRawAccount();
return (
<div className="flex flex-col gap-10">
{/* Custom CTA */}
{(chainMetadata?.cta?.title || chainMetadata?.cta?.description) && (
<ChainCTA {...chainMetadata.cta} />
{(customChainMetadata?.cta?.title ||
customChainMetadata?.cta?.description) && (
<ChainCTA {...customChainMetadata.cta} />
)}
{/* Deprecated Alert */}
@@ -58,6 +65,12 @@ export default async function Page(props: {
{chain.services.filter((s) => s.enabled).length > 0 && (
<SupportedProductsSection services={chain.services} />
)}
{chainSeo?.faqs && chainSeo.faqs.length > 0 && (
<div className="py-10">
<FaqSection faqs={chainSeo.faqs} />
</div>
)}
</div>
);
}
@@ -5,11 +5,13 @@ import { useEffectOnce } from "@/hooks/useEffectOnce";
export function AssetPageView(props: {
assetType: "nft" | "coin";
chainId: number;
is_testnet: boolean;
}) {
useEffectOnce(() => {
reportAssetPageview({
assetType: props.assetType,
chainId: props.chainId,
is_testnet: props.is_testnet,
});
});
@@ -122,6 +122,7 @@ export function TokenDropClaim(props: {
chainId: props.contract.chain.id,
contractType: "DropERC20",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
toast.error("Failed to approve spending", {
@@ -160,6 +161,7 @@ export function TokenDropClaim(props: {
chainId: props.contract.chain.id,
contractType: "DropERC20",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
toast.error("Failed to buy tokens", {
@@ -172,6 +174,7 @@ export function TokenDropClaim(props: {
assetType: "coin",
chainId: props.contract.chain.id,
contractType: "DropERC20",
is_testnet: props.chainMetadata.testnet,
});
setStepsUI({
@@ -76,7 +76,11 @@ export async function ERC20PublicPage(props: {
return (
<div className="flex grow flex-col">
<AssetPageView assetType="coin" chainId={props.chainMetadata.chainId} />
<AssetPageView
assetType="coin"
chainId={props.chainMetadata.chainId}
is_testnet={props.chainMetadata.testnet}
/>
<PageHeader containerClassName="max-w-7xl" />
<div className="border-b border-dashed">
@@ -199,6 +203,7 @@ function BuyEmbed(props: {
tokenAddress={props.clientContract.address}
buyAmount={undefined}
pageType="asset"
isTestnet={props.chainMetadata.testnet}
/>
);
}
@@ -18,7 +18,11 @@ export function NFTPublicPageLayout(props: {
}) {
return (
<div className="flex grow flex-col">
<AssetPageView assetType="nft" chainId={props.chainMetadata.chainId} />
<AssetPageView
assetType="nft"
chainId={props.chainMetadata.chainId}
is_testnet={props.chainMetadata.testnet}
/>
<PageHeader containerClassName="max-w-8xl" />
<div className="border-b">
<div className="container max-w-8xl">
@@ -120,6 +120,7 @@ export function BuyEditionDrop(props: BuyEditionDropProps) {
chainId: props.contract.chain.id,
contractType: "DropERC1155",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
console.error(errorMessage);
@@ -147,6 +148,7 @@ export function BuyEditionDrop(props: BuyEditionDropProps) {
assetType: "nft",
chainId: props.contract.chain.id,
contractType: "DropERC1155",
is_testnet: props.chainMetadata.testnet,
});
props.onSuccess?.();
@@ -163,6 +165,7 @@ export function BuyEditionDrop(props: BuyEditionDropProps) {
chainId: props.contract.chain.id,
contractType: "DropERC1155",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
return;
@@ -180,6 +183,7 @@ export function BuyEditionDrop(props: BuyEditionDropProps) {
chainId: props.contract.chain.id,
contractType: "DropERC1155",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
}
});
@@ -77,6 +77,7 @@ export function BuyNFTDrop(props: BuyNFTDropProps) {
chainId: props.contract.chain.id,
contractType: "DropERC721",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
return;
@@ -103,6 +104,7 @@ export function BuyNFTDrop(props: BuyNFTDropProps) {
assetType: "nft",
chainId: props.contract.chain.id,
contractType: "DropERC721",
is_testnet: props.chainMetadata.testnet,
});
props.onSuccess?.();
@@ -115,6 +117,7 @@ export function BuyNFTDrop(props: BuyNFTDropProps) {
chainId: props.contract.chain.id,
contractType: "DropERC721",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
return;
@@ -131,6 +134,7 @@ export function BuyNFTDrop(props: BuyNFTDropProps) {
chainId: props.contract.chain.id,
contractType: "DropERC721",
error: errorMessage,
is_testnet: props.chainMetadata.testnet,
});
}
};
@@ -190,25 +190,37 @@ export async function generateContractLayoutMetadata(params: {
.replace("Testnet", "")
.trim();
const title = `${contractDisplayName} | ${cleanedChainName} Smart Contract`;
let title = `${contractDisplayName} | ${cleanedChainName} Smart Contract`;
let description = "";
if (isERC721 || isERC1155) {
description = `View tokens, source code, transactions, balances, and analytics for the ${contractDisplayName} smart contract on ${cleanedChainName}.`;
} else if (isERC20) {
description = `View ERC20 tokens, transactions, balances, source code, and analytics for the ${contractDisplayName} smart contract on ${cleanedChainName}`;
title = `${contractMetadata.name} (${contractMetadata.symbol}) on ${cleanedChainName} | Buy, Swap, Bridge & Price`;
description = `Buy, swap & bridge ${contractMetadata.name} (${contractMetadata.symbol}) on ${cleanedChainName} with thirdweb Bridge. View contract address, holders, analytics, transactions and live price.`;
} else {
description = `View tokens, transactions, balances, source code, and analytics for the ${contractDisplayName} smart contract on ${cleanedChainName}`;
description = `View tokens, transactions, balances, source code, and analytics for the ${contractMetadata.name} smart contract on ${cleanedChainName}`;
}
return {
description: description,
title: title,
openGraph: {
description: description,
title: title,
},
};
} catch {
const fallbackTitle = `${shortenIfAddress(params.contractAddress)} | ${params.chainIdOrSlug}`;
const fallbackDescription = `View tokens, transactions, balances, source code, and analytics for the smart contract on Chain ID ${params.chainIdOrSlug}`;
return {
description: `View tokens, transactions, balances, source code, and analytics for the smart contract on Chain ID ${params.chainIdOrSlug}`,
title: `${shortenIfAddress(params.contractAddress)} | ${params.chainIdOrSlug}`,
description: fallbackDescription,
title: fallbackTitle,
openGraph: {
description: fallbackDescription,
title: fallbackTitle,
},
};
}
}
@@ -5,7 +5,7 @@ import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import type { ChainSupportedService } from "@/types/chain";
import { ChainIcon } from "../../../components/server/chain-icon";
import { getChainMetadata } from "../../../utils";
import { getCustomChainMetadata } from "../../../utils";
type ChainListCardProps = {
favoriteButton: JSX.Element | undefined;
@@ -18,7 +18,7 @@ type ChainListCardProps = {
iconUrl?: string;
};
export async function ChainListCard({
export function ChainListCard({
isDeprecated,
chainId,
chainName,
@@ -28,7 +28,7 @@ export async function ChainListCard({
favoriteButton,
iconUrl,
}: ChainListCardProps) {
const chainMetadata = await getChainMetadata(chainId);
const customChainMetadata = getCustomChainMetadata(chainId);
return (
<div className="relative h-full">
@@ -90,9 +90,9 @@ export async function ChainListCard({
</tbody>
</table>
{(isDeprecated || chainMetadata?.gasSponsored) && (
{(isDeprecated || customChainMetadata?.gasSponsored) && (
<div className="mt-5 flex gap-5 border-t pt-4">
{!isDeprecated && chainMetadata?.gasSponsored && (
{!isDeprecated && customChainMetadata?.gasSponsored && (
<div className="flex items-center gap-1.5">
<TicketCheckIcon className="size-5 text-foreground" />
<p className="text-sm">Gas Sponsored</p>
@@ -13,7 +13,7 @@ import { cn } from "@/lib/utils";
import type { ChainSupportedService } from "@/types/chain";
import { ChainIcon } from "../../../components/server/chain-icon";
import { products } from "../../../components/server/products";
import { getChainMetadata } from "../../../utils";
import { getCustomChainMetadata } from "../../../utils";
type ChainListRowProps = {
favoriteButton: JSX.Element | undefined;
@@ -26,7 +26,7 @@ type ChainListRowProps = {
iconUrl?: string;
};
export async function ChainListRow({
export function ChainListRow({
isDeprecated,
chainId,
chainName,
@@ -36,7 +36,7 @@ export async function ChainListRow({
favoriteButton,
iconUrl,
}: ChainListRowProps) {
const chainMetadata = await getChainMetadata(chainId);
const chainMetadata = getCustomChainMetadata(chainId);
return (
<TableRow className="hover:bg-accent/50" linkBox>
{/* Name */}
@@ -914,9 +914,9 @@ const chainMetaRecord = {
} satisfies Record<number, ExtraChainMetadata>;
// END TEMPORARY
export async function getChainMetadata(
export function getCustomChainMetadata(
chainId: number,
): Promise<(ExtraChainMetadata & { gasSponsored?: true }) | null> {
): (ExtraChainMetadata & { gasSponsored?: true }) | null {
// TODO: fetch this from the API
if (chainId in chainMetaRecord) {
return {
@@ -50,6 +50,7 @@ import {
} from "@/constants/addresses";
import { LAST_USED_PROJECT_ID, LAST_USED_TEAM_ID } from "@/constants/cookie";
import { ZERO_FEE_CHAINS } from "@/constants/fee-config";
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";
import {
useCustomFactoryAbi,
useFunctionParamsFromABI,
@@ -206,6 +207,8 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
const activeAccount = useActiveAccount();
const walletChain = useActiveWalletChain();
const walletChainMetadata = useV5DashboardChain(walletChain?.id);
const { onError } = useTxNotifications(
"Successfully deployed contract",
"Failed to deploy contract",
@@ -656,6 +659,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
chainId: walletChain.id,
contractName: metadata.name,
publisher: rewriteTwPublisher(metadata.publisher),
is_testnet: walletChainMetadata?.testnet,
});
deployStatusModal.nextStep();
@@ -694,6 +698,7 @@ export const CustomContractForm: React.FC<CustomContractFormProps> = ({
contractName: metadata.name,
errorMessage: parsedError,
publisher: rewriteTwPublisher(metadata.publisher),
is_testnet: walletChain.testnet,
});
deployStatusModal.close();
@@ -4,7 +4,7 @@ import { useQuery } from "@tanstack/react-query";
import { Input } from "@workspace/ui/components/input";
import { cn } from "@workspace/ui/lib/utils";
import { ActivityIcon, SearchIcon, TrendingUpIcon } from "lucide-react";
import { useState } from "react";
import { useCallback, useState } from "react";
import { Bridge } from "thirdweb";
import { BridgeNetworkSelector } from "@/components/blocks/NetworkSelectors";
import { Button } from "@/components/ui/button";
@@ -15,11 +15,22 @@ const client = getClientThirdwebClient();
const pageSize = 20;
type Filter =
| { type: "filter"; value: "volume" | "market_cap" }
| { type: "search"; value: string };
export function TokenPage(props: { chains: Bridge.chains.Result }) {
const [page, setPage] = useState(1);
const [chainId, setChainId] = useState(1);
const [search, setSearch] = useState("");
const [sortBy, setSortBy] = useState<"volume" | "market_cap">("volume");
const [filter, _setFilter] = useState<Filter>({
type: "filter",
value: "volume",
});
const setFilter = useCallback((filter: Filter) => {
_setFilter(filter);
setPage(1);
}, []);
const tokensQuery = useQuery({
queryKey: [
@@ -27,8 +38,7 @@ export function TokenPage(props: { chains: Bridge.chains.Result }) {
{
page,
chainId,
sortBy,
search,
filter,
},
],
queryFn: () => {
@@ -37,8 +47,8 @@ export function TokenPage(props: { chains: Bridge.chains.Result }) {
chainId: chainId,
limit: pageSize,
offset: (page - 1) * pageSize,
sortBy: search ? undefined : sortBy,
query: search ? search : undefined,
sortBy: filter.type === "filter" ? filter.value : undefined,
query: filter.type === "search" ? filter.value : undefined,
});
},
refetchOnMount: false,
@@ -62,19 +72,19 @@ export function TokenPage(props: { chains: Bridge.chains.Result }) {
<SortButton
label="Popular"
onClick={() => {
setSortBy("market_cap");
setSearch("");
setFilter({ type: "filter", value: "market_cap" });
}}
isSelected={sortBy === "market_cap" && !search}
isSelected={
filter.type === "filter" && filter.value === "market_cap"
}
icon={ActivityIcon}
/>
<SortButton
label="Trending"
onClick={() => {
setSortBy("volume");
setSearch("");
setFilter({ type: "filter", value: "volume" });
}}
isSelected={sortBy === "volume" && !search}
isSelected={filter.type === "filter" && filter.value === "volume"}
icon={TrendingUpIcon}
/>
</div>
@@ -83,9 +93,11 @@ export function TokenPage(props: { chains: Bridge.chains.Result }) {
<SearchIcon className="size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" />
<Input
placeholder="Search Tokens"
value={search}
value={filter.type === "search" ? filter.value : ""}
className="rounded-xl bg-card flex-1 pl-9"
onChange={(e) => setSearch(e.target.value)}
onChange={(e) =>
setFilter({ type: "search", value: e.target.value })
}
/>
</div>
</div>
@@ -1,7 +1,6 @@
import { BringToFrontIcon } from "lucide-react";
import type { Metadata } from "next";
import { unstable_cache } from "next/cache";
import Link from "next/link";
import { Bridge } from "thirdweb";
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
import { PageHeader } from "./components/header";
@@ -35,13 +34,10 @@ export default async function Page() {
<h1 className="text-4xl font-bold tracking-tighter mb-1">
Discover and swap any tokens on any chain, instantly
</h1>
<Link
className="text-muted-foreground hover:text-foreground"
href="https://thirdweb.com/monetize/bridge"
target="_blank"
>
Powered by thirdweb bridge
</Link>
<p className="text-muted-foreground">
85+ chains, 3200+ tokens and 9+ million routes supported
</p>
</div>
</div>
<TokenPage chains={chains} />
@@ -55,7 +55,7 @@ export function CreateProjectFormOnboarding(props: {
<CreateProjectForm
createProject={async (params) => {
const res = await createProjectClient(props.teamId, params);
await createVaultAccountAndAccessToken({
const vaultTokens = await createVaultAccountAndAccessToken({
project: res.project,
projectSecretKey: res.secret,
}).catch((error) => {
@@ -65,6 +65,16 @@ export function CreateProjectFormOnboarding(props: {
);
throw error;
});
const managementAccessToken =
vaultTokens.managementToken?.accessToken;
if (!managementAccessToken) {
throw new Error(
"Missing management access token for project wallet",
);
}
return {
project: res.project,
secret: res.secret,
@@ -25,6 +25,34 @@ import { ToolTipLabel } from "@/components/ui/tooltip";
import { ThirdwebMiniLogo } from "../../../../../../../components/ThirdwebMiniLogo";
import { searchParams } from "../search-params";
function getStatusBadge(invoice: Stripe.Invoice) {
switch (invoice.status) {
case "paid":
return <Badge variant="success">Paid</Badge>;
case "open":
// we treat "uncollectible" as unpaid
case "uncollectible": {
// if the invoice has a due date, use that, otherwise use the effective at date (which is the date the invoice was created)
const effectiveDueDate = invoice.due_date || invoice.effective_at;
// if the invoice due date is in the past, we want to display it as past due
if (effectiveDueDate && effectiveDueDate * 1000 < Date.now()) {
return <Badge variant="destructive">Past Due</Badge>;
}
return <Badge variant="outline">Open</Badge>;
}
case "void":
return <Badge variant="secondary">Void</Badge>;
default:
return <Badge variant="outline">Unknown</Badge>;
}
}
function isInvoicePayable(invoice: Stripe.Invoice) {
return invoice.status === "open" || invoice.status === "uncollectible";
}
export function BillingHistory(props: {
teamSlug: string;
invoices: Stripe.Invoice[];
@@ -57,27 +85,6 @@ export function BillingHistory(props: {
});
};
const getStatusBadge = (invoice: Stripe.Invoice) => {
switch (invoice.status) {
case "paid":
return <Badge variant="success">Paid</Badge>;
case "open":
// we treate "uncollectible" as unpaid
case "uncollectible": {
// if the invoice due date is in the past, we want to display it as past due
if (invoice.due_date && invoice.due_date * 1000 < Date.now()) {
return <Badge variant="destructive">Past Due</Badge>;
}
return <Badge variant="outline">Open</Badge>;
}
case "void":
return <Badge variant="secondary">Void</Badge>;
default:
return <Badge variant="outline">Unknown</Badge>;
}
};
if (props.invoices.length === 0) {
if (props.status === "open") {
return (
@@ -126,7 +133,7 @@ export function BillingHistory(props: {
<TableCell>{getStatusBadge(invoice)}</TableCell>
<TableCell className="text-right">
<div className="flex justify-end space-x-2">
{invoice.status === "open" && (
{isInvoicePayable(invoice) && (
<>
{/* always show the crypto payment button */}
<ToolTipLabel
@@ -552,7 +552,7 @@ export function AccountAbstractionSettingsPage(
you build your own rules.{" "}
<UnderlineLink
className="text-primary-500"
href="https://portal.thirdweb.com/wallets/smart-wallet/sponsorship-rules#setting-up-a-server-verifier"
href="https://portal.thirdweb.com/transactions/policies#server-verifier"
rel="noopener noreferrer"
target="_blank"
>
@@ -28,11 +28,11 @@ export function QuickStartSection(props: {
icon={ArrowRightLeftIcon}
setupTime={5}
id="swap_tokens"
features={["Swap any token", "Cross-chain swaps"]}
features={["Swap any token", "Cross-chain swap"]}
description="Swap tokens cross-chain with dedicated swapping endpoints."
link={{
href: `https://portal.thirdweb.com/payments/swap`,
label: "Setup Swaps",
href: `https://portal.thirdweb.com/bridge/swap`,
label: "Setup Swap",
}}
/>
@@ -69,70 +69,20 @@ export default async function Page(props: {
},
},
links: [
// TODO - add docs when bridge docs are added in portal
// {
// type: "docs",
// href: "https://portal.thirdweb.com/payments",
// },
{
type: "docs",
href: "https://portal.thirdweb.com/bridge",
},
{
type: "playground",
href: "https://playground.thirdweb.com/bridge/swap-widget",
},
{
type: "api",
href: "https://api.thirdweb.com/reference#tag/bridge",
},
],
}}
footer={{
center: {
links: [
{
href: "https://playground.thirdweb.com/payments/ui-components",
label: "UI Component",
},
{
href: "https://playground.thirdweb.com/connect/payments/fund-wallet",
label: "Buy Crypto",
},
{
href: "https://playground.thirdweb.com/connect/payments/commerce",
label: "Checkout",
},
{
href: "https://playground.thirdweb.com/connect/payments/transactions",
label: "Transactions",
},
],
title: "Demos",
},
left: {
links: [
{
href: "https://portal.thirdweb.com/payments",
label: "Overview",
},
{
href: "https://portal.thirdweb.com/typescript/v5/convertCryptoToFiat",
label: "TypeScript",
},
{
href: "https://portal.thirdweb.com/react/v5/pay/fund-wallets",
label: "React",
},
{
href: "https://portal.thirdweb.com/dotnet/universal-bridge/quickstart",
label: ".NET",
},
],
title: "Documentation",
},
right: {
links: [
{
href: "https://www.youtube.com/watch?v=aBu175-VsNY",
label: "Implement cross-chain payments in any app",
},
],
title: "Tutorials",
},
}}
>
<div className="flex flex-col gap-12">
<ResponsiveSearchParamsProvider value={searchParams}>
@@ -31,5 +31,6 @@ export const Default: Story = {
],
},
teamSlug: "bar",
managementAccessToken: undefined,
},
};
@@ -7,6 +7,7 @@ import {
import Link from "next/link";
import type { Project } from "@/api/project/projects";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { AlertDialogFooter } from "@/components/ui/alert-dialog";
import { CodeServer } from "@/components/ui/code/code.server";
import { UnderlineLink } from "@/components/ui/UnderlineLink";
import { DotNetIcon } from "@/icons/brand-icons/DotNetIcon";
@@ -18,13 +19,34 @@ import { UnrealIcon } from "@/icons/brand-icons/UnrealIcon";
import { ContractIcon } from "@/icons/ContractIcon";
import { InsightIcon } from "@/icons/InsightIcon";
import { PayIcon } from "@/icons/PayIcon";
import { WalletProductIcon } from "@/icons/WalletProductIcon";
import { getProjectWalletLabel } from "@/lib/project-wallet";
import {
getProjectWallet,
type ProjectWalletSummary,
} from "@/lib/server/project-wallet";
import CreateServerWallet from "../../transactions/server-wallets/components/create-server-wallet.client";
import { ClientIDSection } from "./ClientIDSection";
import { IntegrateAPIKeyCodeTabs } from "./IntegrateAPIKeyCodeTabs";
import { ProjectWalletControls } from "./ProjectWalletControls.client";
import { SecretKeySection } from "./SecretKeySection";
export function ProjectFTUX(props: { project: Project; teamSlug: string }) {
export async function ProjectFTUX(props: {
project: Project;
teamSlug: string;
wallet?: ProjectWalletSummary | undefined;
managementAccessToken: string | undefined;
}) {
const projectWallet = props.wallet ?? (await getProjectWallet(props.project));
return (
<div className="flex flex-col gap-10">
<ProjectWalletSection
project={props.project}
teamSlug={props.teamSlug}
wallet={projectWallet}
managementAccessToken={props.managementAccessToken}
/>
<IntegrateAPIKeySection
project={props.project}
teamSlug={props.teamSlug}
@@ -39,6 +61,76 @@ export function ProjectFTUX(props: { project: Project; teamSlug: string }) {
);
}
export function ProjectWalletSection(props: {
project: Project;
teamSlug: string;
wallet: ProjectWalletSummary | undefined;
managementAccessToken: string | undefined;
}) {
const defaultLabel = getProjectWalletLabel(props.project.name);
const walletAddress = props.wallet?.address;
const label = props.wallet?.label ?? defaultLabel;
return (
<section>
<div className="rounded-lg border border-border bg-card p-4">
<div className="flex flex-col gap-4">
<div className="flex items-center gap-3">
<div className="rounded-full border border-border bg-background p-2">
<WalletProductIcon className="size-5 text-muted-foreground" />
</div>
<div>
<p className="font-semibold text-lg tracking-tight">
Project Wallet
</p>
<p className="text-muted-foreground text-sm">
Default managed server wallet for this project. Use it for
deployments, payments, and API integrations.
</p>
</div>
</div>
{walletAddress ? (
<>
<ProjectWalletControls
label={label}
project={props.project}
walletAddress={walletAddress}
/>
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end">
<Link
className="inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline"
href={`/team/${props.teamSlug}/${props.project.slug}/transactions`}
>
View Transactions
<ChevronRightIcon className="size-4" />
</Link>
</div>
</>
) : (
<Alert variant="info">
<CircleAlertIcon className="size-5" />
<AlertTitle>No default project wallet set</AlertTitle>
<AlertDescription>
Set a default project wallet to use for dashboard and API
integrations.
</AlertDescription>
<AlertDialogFooter className="flex justify-start sm:justify-start pt-4">
<CreateServerWallet
managementAccessToken={props.managementAccessToken}
project={props.project}
teamSlug={props.teamSlug}
setAsProjectWallet={true}
/>
</AlertDialogFooter>
</Alert>
)}
</div>
</div>
</section>
);
}
// Integrate API key section ------------------------------------------------------------
function IntegrateAPIKeySection({
@@ -0,0 +1,725 @@
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
EllipsisVerticalIcon,
RefreshCcwIcon,
SendIcon,
ShuffleIcon,
WalletIcon,
} from "lucide-react";
import { useEffect, useMemo, useState } from "react";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { toWei } from "thirdweb";
import { useWalletBalance } from "thirdweb/react";
import { isAddress } from "thirdweb/utils";
import { z } from "zod";
import { listProjectServerWallets } from "@/actions/project-wallet/list-server-wallets";
import { sendProjectWalletTokens } from "@/actions/project-wallet/send-tokens";
import type { Project } from "@/api/project/projects";
import { FundWalletModal } from "@/components/blocks/fund-wallets-modal";
import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors";
import { WalletAddress } from "@/components/blocks/wallet-address";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Spinner } from "@/components/ui/Spinner";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import type { ProjectWalletSummary } from "@/lib/server/project-wallet";
import { cn } from "@/lib/utils";
import { updateDefaultProjectWallet } from "../../transactions/lib/vault.client";
type ProjectWalletControlsProps = {
walletAddress: string;
label: string;
project: Pick<
Project,
"id" | "publishableKey" | "teamId" | "services" | "name"
>;
defaultChainId?: number;
};
export function ProjectWalletControls(props: ProjectWalletControlsProps) {
const { walletAddress, label, project, defaultChainId } = props;
const [isSendOpen, setIsSendOpen] = useState(false);
const [isReceiveOpen, setIsReceiveOpen] = useState(false);
const [selectedChainId, setSelectedChainId] = useState(defaultChainId ?? 1);
const [isChangeWalletOpen, setIsChangeWalletOpen] = useState(false);
const [selectedWalletId, setSelectedWalletId] = useState<string | undefined>(
undefined,
);
const client = useMemo(() => getClientThirdwebClient(), []);
const chain = useV5DashboardChain(selectedChainId);
const queryClient = useQueryClient();
const router = useDashboardRouter();
const engineCloudService = useMemo(
() => project.services?.find((service) => service.name === "engineCloud"),
[project.services],
);
const managementAccessToken =
engineCloudService?.managementAccessToken ?? undefined;
const isManagedVault = !!engineCloudService?.encryptedAdminKey;
const serverWalletsQuery = useQuery({
enabled: !!managementAccessToken,
queryFn: async () => {
if (!managementAccessToken) {
return [] as ProjectWalletSummary[];
}
return listProjectServerWallets({
managementAccessToken,
projectId: project.id,
});
},
queryKey: ["project", project.id, "server-wallets", managementAccessToken],
staleTime: 60_000,
});
const serverWallets = serverWalletsQuery.data ?? [];
const currentWalletAddressLower = walletAddress.toLowerCase();
const otherWallets = useMemo(() => {
return serverWallets.filter((wallet) => {
return wallet.address.toLowerCase() !== currentWalletAddressLower;
});
}, [serverWallets, currentWalletAddressLower]);
const canChangeWallet = otherWallets.length > 0;
const handleOpenChangeWallet = () => {
const currentWallet = serverWallets.find(
(wallet) => wallet.address.toLowerCase() === currentWalletAddressLower,
);
const nextWalletId =
otherWallets[0]?.id ?? currentWallet?.id ?? serverWallets[0]?.id;
setSelectedWalletId(nextWalletId);
setIsChangeWalletOpen(true);
};
const handleCloseChangeWallet = () => {
setIsChangeWalletOpen(false);
setSelectedWalletId(undefined);
};
const selectedWallet = useMemo(() => {
if (!selectedWalletId) {
return undefined;
}
return serverWallets.find((wallet) => wallet.id === selectedWalletId);
}, [selectedWalletId, serverWallets]);
const isSelectionDifferent = Boolean(
selectedWallet &&
selectedWallet.address.toLowerCase() !== currentWalletAddressLower,
);
const changeWalletMutation = useMutation({
mutationFn: async (wallet: ProjectWalletSummary) => {
await updateDefaultProjectWallet({
project: project as Project,
projectWalletAddress: wallet.address,
});
},
onError: (error) => {
const message =
error instanceof Error
? error.message
: "Failed to update project wallet";
toast.error(message);
},
onSuccess: async (_, wallet) => {
const descriptionLabel = wallet.label ?? wallet.address;
toast.success("Default project wallet updated", {
description: `Now pointing to ${descriptionLabel}`,
});
await queryClient.invalidateQueries({
queryKey: [
"project",
project.id,
"server-wallets",
managementAccessToken,
],
});
handleCloseChangeWallet();
router.refresh();
},
});
const balanceQuery = useWalletBalance({
address: walletAddress,
chain,
client,
});
const balanceDisplay = balanceQuery.data
? `${balanceQuery.data.displayValue} ${balanceQuery.data.symbol}`
: undefined;
return (
<div className="space-y-5">
<div className="rounded-lg border border-border bg-background p-3">
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-3 lg:flex-row">
<div className="flex-1">
<p className="text-muted-foreground text-xs">Address</p>
<WalletAddress address={walletAddress} client={client} />
</div>
<div className="flex-1">
<p className="text-muted-foreground text-xs">Label</p>
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">
<p className="font-mono text-sm break-all py-2 sm:py-0">
{label}
</p>
{canChangeWallet && (
<Button
className="h-8 gap-1 sm:ml-4"
onClick={handleOpenChangeWallet}
size="sm"
disabled={serverWalletsQuery.isLoading}
variant="outline"
>
<ShuffleIcon className="size-3.5" />
Change default
</Button>
)}
</div>
</div>
</div>
<div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
<div className="flex-1 flex-col">
<p className="text-xs text-muted-foreground pb-2">Balance</p>
<div className="flex items-center gap-2">
<WalletIcon className="size-4 text-muted-foreground" />
{balanceQuery.isLoading ? (
<Spinner className="size-4" />
) : balanceDisplay ? (
<span className="text-md tracking-tight">
{balanceDisplay}
</span>
) : (
<span className="text-muted-foreground text-sm">N/A</span>
)}
<Button
aria-label="Refresh balance"
className="h-8 w-8 p-0"
disabled={balanceQuery.isFetching}
onClick={() => balanceQuery.refetch()}
size="icon"
variant="outline"
>
<RefreshCcwIcon
className={cn(
"size-4",
balanceQuery.isFetching && "animate-spin",
)}
/>
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
aria-label="Open wallet actions"
className="h-9 w-9"
size="icon"
variant="outline"
>
<EllipsisVerticalIcon className="size-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-48 rounded-xl">
<DropdownMenuItem
className="flex items-center gap-2"
onSelect={() => setIsSendOpen(true)}
>
<SendIcon className="size-4 text-muted-foreground" />
Send funds
</DropdownMenuItem>
<DropdownMenuItem
className="flex items-center gap-2"
onSelect={() => setIsReceiveOpen(true)}
>
<WalletIcon className="size-4 text-muted-foreground" />
Receive funds
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</div>
<div className="flex-col flex-1">
<p className="text-xs text-muted-foreground pb-2">Network</p>
<SingleNetworkSelector
chainId={selectedChainId}
className="max-w-xs rounded-lg"
client={client}
disableDeprecated
disableChainId
onChange={setSelectedChainId}
placeholder="Select network"
/>
</div>
</div>
</div>
</div>
<SendProjectWalletModal
chainId={selectedChainId}
client={client}
isManagedVault={isManagedVault}
label={label}
onClose={() => setIsSendOpen(false)}
onSuccess={() => balanceQuery.refetch()}
open={isSendOpen}
publishableKey={project.publishableKey}
teamId={project.teamId}
walletAddress={walletAddress}
/>
<FundWalletModal
checkoutWidgetTitle={`Fund ${label}`}
client={client}
defaultChainId={selectedChainId}
description="Use your card or crypto to deposit into this server wallet"
onOpenChange={setIsReceiveOpen}
open={isReceiveOpen}
recipientAddress={walletAddress}
title="Fund project wallet"
/>
<Dialog
onOpenChange={(nextOpen) => {
if (!nextOpen) {
handleCloseChangeWallet();
}
}}
open={isChangeWalletOpen}
>
<DialogContent className="gap-0 p-0">
<DialogHeader className="p-4 lg:p-6">
<DialogTitle>Change default wallet</DialogTitle>
<DialogDescription>
Choose another server wallet to use as the default for this
project.
</DialogDescription>
</DialogHeader>
<div className="px-4 pb-8 lg:px-6">
{serverWalletsQuery.isLoading ? (
<div className="flex justify-center py-6">
<Spinner className="size-5" />
</div>
) : serverWallets.length <= 1 ? (
<p className="text-sm text-muted-foreground">
You need at least two server wallets to pick a different
default.
</p>
) : (
<RadioGroup
className="space-y-3"
onValueChange={(value) => setSelectedWalletId(value)}
value={selectedWalletId}
>
{serverWallets.map((wallet) => {
const isCurrent =
wallet.address.toLowerCase() === currentWalletAddressLower;
const isSelected = wallet.id === selectedWalletId;
return (
<Label
key={wallet.id}
htmlFor={`project-wallet-${wallet.id}`}
className={cn(
"flex cursor-pointer items-center gap-3 rounded-lg border border-border bg-card px-4 py-3 transition",
isSelected && "border-primary ring-2 ring-primary/20",
)}
>
<RadioGroupItem
id={`project-wallet-${wallet.id}`}
value={wallet.id}
className="mt-0.5"
/>
<div className="flex flex-1 flex-col overflow-hidden">
<div className="flex items-center gap-2">
<span className="text-sm font-medium text-foreground">
{wallet.label ?? "Unnamed server wallet"}
</span>
{isCurrent && (
<Badge variant="success" className="text-xs">
current
</Badge>
)}
</div>
<span className="text-xs text-muted-foreground break-all">
{wallet.address}
</span>
</div>
</Label>
);
})}
</RadioGroup>
)}
</div>
<DialogFooter className="flex justify-end gap-3 border-t bg-card p-4 lg:p-6">
<Button
onClick={handleCloseChangeWallet}
type="button"
variant="outline"
disabled={changeWalletMutation.isPending}
>
Cancel
</Button>
<Button
disabled={
!selectedWallet ||
!isSelectionDifferent ||
changeWalletMutation.isPending
}
onClick={() => {
if (selectedWallet) {
changeWalletMutation.mutate(selectedWallet);
}
}}
type="button"
>
{changeWalletMutation.isPending && (
<Spinner className="mr-2 size-4" />
)}
Save default
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</div>
);
}
const createSendFormSchema = (secretKeyLabel: string) =>
z.object({
chainId: z.number({
required_error: "Select a network",
}),
toAddress: z
.string()
.trim()
.min(1, "Destination address is required")
.refine((value) => Boolean(isAddress(value)), {
message: "Enter a valid wallet address",
}),
amount: z.string().trim().min(1, "Amount is required"),
secretKey: z.string().trim().min(1, `${secretKeyLabel} is required`),
vaultAccessToken: z.string().trim(),
});
const SECRET_KEY_LABEL = "Project secret key";
type SendFormValues = z.infer<ReturnType<typeof createSendFormSchema>>;
function SendProjectWalletModal(props: {
open: boolean;
onClose: () => void;
onSuccess: () => void;
walletAddress: string;
publishableKey: string;
teamId: string;
chainId: number;
label: string;
client: ReturnType<typeof getClientThirdwebClient>;
isManagedVault: boolean;
}) {
const {
open,
onClose,
onSuccess,
walletAddress,
publishableKey,
teamId,
chainId,
label,
client,
isManagedVault,
} = props;
const secretKeyLabel = SECRET_KEY_LABEL;
const secretKeyPlaceholder = "Enter your project secret key";
const secretKeyHelper =
"Your project secret key was generated when you created your project. If you lost it, regenerate one from Project settings.";
const vaultAccessTokenHelper =
"Vault access tokens are optional credentials with server wallet permissions. Manage them in Vault settings.";
const formSchema = useMemo(() => createSendFormSchema(SECRET_KEY_LABEL), []);
const form = useForm<SendFormValues>({
defaultValues: {
amount: "0",
chainId,
secretKey: "",
vaultAccessToken: "",
toAddress: "",
},
mode: "onChange",
resolver: zodResolver(formSchema),
});
const selectedChain = useV5DashboardChain(form.watch("chainId"));
// eslint-disable-next-line no-restricted-syntax -- form submission chainId must track selector state
useEffect(() => {
form.setValue("chainId", chainId);
}, [chainId, form]);
// eslint-disable-next-line no-restricted-syntax -- reset cached inputs when modal closes to avoid leaking state
useEffect(() => {
if (!open) {
const currentValues = form.getValues();
form.reset({
amount: "0",
chainId,
secretKey: currentValues.secretKey ?? "",
vaultAccessToken: currentValues.vaultAccessToken ?? "",
toAddress: "",
});
}
}, [open, chainId, form]);
const sendMutation = useMutation({
mutationFn: async (values: SendFormValues) => {
const quantityWei = toWei(values.amount).toString();
const secretKeyValue = values.secretKey.trim();
const vaultAccessTokenValue = values.vaultAccessToken.trim();
const result = await sendProjectWalletTokens({
chainId: values.chainId,
publishableKey,
quantityWei,
recipientAddress: values.toAddress,
teamId,
walletAddress,
secretKey: secretKeyValue,
...(vaultAccessTokenValue
? { vaultAccessToken: vaultAccessTokenValue }
: {}),
});
if (!result.ok) {
const errorMessage =
typeof result.error === "string"
? result.error
: "Failed to send funds";
throw new Error(errorMessage);
}
return result.transactionIds;
},
onError: (error) => {
toast.error(error.message);
},
onSuccess: (transactionIds) => {
toast.success("Transfer submitted", {
description:
transactionIds && transactionIds.length > 0
? `Transaction ID: ${transactionIds[0]}`
: undefined,
});
onSuccess();
onClose();
},
});
return (
<Dialog
onOpenChange={(nextOpen) => {
if (!nextOpen) {
onClose();
}
}}
open={open}
>
<DialogContent className="gap-0 p-0">
<DialogHeader className="p-4 lg:p-6">
<DialogTitle>Send from {label}</DialogTitle>
<DialogDescription>
Execute a one-off transfer using your server wallet.
</DialogDescription>
</DialogHeader>
<Form {...form}>
<form
onSubmit={form.handleSubmit((values) => {
void sendMutation.mutateAsync(values);
})}
>
<div className="space-y-4 px-4 pb-8 lg:px-6">
<FormField
control={form.control}
name="chainId"
render={({ field }) => (
<FormItem>
<FormLabel>Network</FormLabel>
<FormControl>
<SingleNetworkSelector
chainId={field.value}
className="bg-card"
client={client}
disableDeprecated
onChange={(nextChainId) => {
field.onChange(nextChainId);
}}
placeholder="Select network"
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="toAddress"
render={({ field }) => (
<FormItem>
<FormLabel>Send to</FormLabel>
<FormControl>
<Input
autoComplete="off"
placeholder="0x..."
{...field}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="amount"
render={({ field }) => (
<FormItem>
<FormLabel>Amount</FormLabel>
<FormControl>
<Input
inputMode="decimal"
min="0"
step="any"
{...field}
/>
</FormControl>
<FormDescription>
Sending native token
{selectedChain?.nativeCurrency?.symbol
? ` (${selectedChain.nativeCurrency.symbol})`
: ""}
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="secretKey"
render={({ field }) => (
<FormItem>
<FormLabel>{secretKeyLabel}</FormLabel>
<FormControl>
<Input
autoComplete="off"
autoCorrect="off"
placeholder={secretKeyPlaceholder}
spellCheck={false}
type="password"
{...field}
/>
</FormControl>
<FormDescription>{secretKeyHelper}</FormDescription>
<FormMessage />
</FormItem>
)}
/>
{!isManagedVault && (
<FormField
control={form.control}
name="vaultAccessToken"
render={({ field }) => (
<FormItem>
<FormLabel>
Vault access token
<span className="text-muted-foreground">
{" "}
(optional)
</span>
</FormLabel>
<FormControl>
<Input
autoComplete="off"
autoCorrect="off"
placeholder="Enter a vault access token (optional)"
spellCheck={false}
type="password"
{...field}
/>
</FormControl>
<FormDescription>
{vaultAccessTokenHelper}
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
)}
</div>
<div className="flex justify-end gap-3 border-t bg-card p-4 lg:p-6">
<Button onClick={onClose} type="button" variant="outline">
Cancel
</Button>
<Button
className="gap-2"
disabled={!form.formState.isValid || sendMutation.isPending}
type="submit"
>
{sendMutation.isPending && <Spinner className="size-4" />}
Submit transfer
</Button>
</div>
</form>
</Form>
</DialogContent>
</Dialog>
);
}
@@ -1,3 +1,4 @@
import { Input } from "@workspace/ui/components/input";
import { format, formatDistanceToNowStrict } from "date-fns";
import {
ArrowLeftIcon,
@@ -110,6 +111,7 @@ export function TransactionsTable(props: {
const [autoUpdate, setAutoUpdate] = useState(true);
const [page, setPage] = useState(1);
const [status, setStatus] = useState<EngineStatus | undefined>(undefined);
const [filterId, setFilterId] = useState<string | undefined>(undefined);
const autoUpdateId = useId();
const pageSize = 10;
const transactionsQuery = useEngineTransactions({
@@ -121,6 +123,7 @@ export function TransactionsTable(props: {
page: page,
status,
},
id: filterId,
});
const transactions = transactionsQuery.data?.transactions ?? [];
@@ -160,6 +163,16 @@ export function TransactionsTable(props: {
onCheckedChange={(v) => setAutoUpdate(!!v)}
/>
</div>
<Input
className="max-w-[250px]"
onChange={(e) => {
const value = e.target.value.trim();
setFilterId(value || undefined);
setPage(1);
}}
placeholder="Filter by Queue ID"
value={filterId || ""}
/>
<StatusSelector
setStatus={(v) => {
setStatus(v);
@@ -29,6 +29,7 @@ import { ResponsiveTimeFilters } from "@/components/analytics/responsive-time-fi
import { ProjectAvatar } from "@/components/blocks/avatar/project-avatar";
import { ProjectPage } from "@/components/blocks/project-page/project-page";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { getProjectWallet } from "@/lib/server/project-wallet";
import { getFiltersFromSearchParams } from "@/lib/time";
import type {
InAppWalletStats,
@@ -38,7 +39,10 @@ import type {
import { loginRedirect } from "@/utils/redirects";
import { PieChartCard } from "../../../components/Analytics/PieChartCard";
import { EngineCloudChartCardAsync } from "./components/EngineCloudChartCard";
import { ProjectFTUX } from "./components/ProjectFTUX/ProjectFTUX";
import {
ProjectFTUX,
ProjectWalletSection,
} from "./components/ProjectFTUX/ProjectFTUX";
import { RpcMethodBarChartCardAsync } from "./components/RpcMethodBarChartCard";
import { TransactionsChartCardAsync } from "./components/Transactions";
import { ProjectHighlightsCard } from "./overview/highlights-card";
@@ -64,6 +68,9 @@ type PageProps = {
searchParams: Promise<PageSearchParams>;
};
// Revalidate this page data every 30 seconds
export const revalidate = 30;
export default async function ProjectOverviewPage(props: PageProps) {
const [params, searchParams] = await Promise.all([
props.params,
@@ -104,6 +111,11 @@ export default async function ProjectOverviewPage(props: PageProps) {
teamId: project.teamId,
});
const projectWallet = await getProjectWallet(project);
const managementAccessToken =
project.services?.find((service) => service.name === "engineCloud")
?.managementAccessToken ?? undefined;
return (
<ResponsiveSearchParamsProvider value={searchParams}>
<ProjectPage
@@ -125,6 +137,12 @@ export default async function ProjectOverviewPage(props: PageProps) {
>
{isActive ? (
<div className="flex flex-col gap-4 md:gap-6">
<ProjectWalletSection
project={project}
teamSlug={params.team_slug}
wallet={projectWallet}
managementAccessToken={managementAccessToken}
/>
<ResponsiveTimeFilters defaultRange={defaultRange} />
<ProjectAnalytics
authToken={authToken}
@@ -137,7 +155,12 @@ export default async function ProjectOverviewPage(props: PageProps) {
/>
</div>
) : (
<ProjectFTUX project={project} teamSlug={params.team_slug} />
<ProjectFTUX
project={project}
teamSlug={params.team_slug}
wallet={projectWallet}
managementAccessToken={managementAccessToken}
/>
)}
</ProjectPage>
</ResponsiveSearchParamsProvider>
@@ -15,6 +15,7 @@ export function QuickStartSection(props: {
projectSlug: string;
clientId: string;
teamId: string;
projectWalletAddress?: string;
}) {
return (
<section>
@@ -43,6 +44,7 @@ export function QuickStartSection(props: {
action={
<CreatePaymentLinkButton
clientId={props.clientId}
projectWalletAddress={props.projectWalletAddress}
teamId={props.teamId}
>
<Button
@@ -45,7 +45,11 @@ const formSchema = z.object({
});
export function CreatePaymentLinkButton(
props: PropsWithChildren<{ clientId: string; teamId: string }>,
props: PropsWithChildren<{
clientId: string;
teamId: string;
projectWalletAddress?: string;
}>,
) {
const [open, setOpen] = useState(false);
@@ -55,6 +59,7 @@ export function CreatePaymentLinkButton(
<DialogContent className="p-0 !max-w-lg">
<CreatePaymentLinkDialogContent
clientId={props.clientId}
projectWalletAddress={props.projectWalletAddress}
setOpen={setOpen}
teamId={props.teamId}
/>
@@ -67,6 +72,7 @@ function CreatePaymentLinkDialogContent(props: {
clientId: string;
teamId: string;
setOpen: (open: boolean) => void;
projectWalletAddress?: string;
}) {
const client = getClientThirdwebClient();
@@ -182,14 +188,41 @@ function CreatePaymentLinkDialogContent(props: {
render={({ field }) => (
<FormItem>
<FormLabel>Recipient Address</FormLabel>
<Input
className="w-full bg-card"
{...field}
onChange={field.onChange}
value={field.value}
placeholder="Address or ENS"
required
/>
<div className="flex flex-col gap-2 sm:flex-row">
<Input
className="w-full bg-card sm:flex-1"
{...field}
onChange={field.onChange}
value={field.value}
placeholder="Address or ENS"
required
/>
{props.projectWalletAddress && (
<Button
className="sm:w-auto"
onClick={() => {
if (!props.projectWalletAddress) {
return;
}
form.setValue(
"recipient",
props.projectWalletAddress,
{
shouldDirty: true,
shouldTouch: true,
shouldValidate: true,
},
);
}}
size="sm"
type="button"
variant="outline"
>
Use Project Wallet
</Button>
)}
</div>
<FormMessage />
</FormItem>
)}
@@ -40,7 +40,11 @@ import { ErrorState } from "../../components/ErrorState";
import { formatTokenAmount } from "../../components/format";
import { CreatePaymentLinkButton } from "./CreatePaymentLinkButton.client";
export function PaymentLinksTable(props: { clientId: string; teamId: string }) {
export function PaymentLinksTable(props: {
clientId: string;
teamId: string;
projectWalletAddress?: string;
}) {
return (
<section>
<div className="mb-4">
@@ -49,12 +53,20 @@ export function PaymentLinksTable(props: { clientId: string; teamId: string }) {
The payments you have created in this project
</p>
</div>
<PaymentLinksTableInner clientId={props.clientId} teamId={props.teamId} />
<PaymentLinksTableInner
clientId={props.clientId}
projectWalletAddress={props.projectWalletAddress}
teamId={props.teamId}
/>
</section>
);
}
function PaymentLinksTableInner(props: { clientId: string; teamId: string }) {
function PaymentLinksTableInner(props: {
clientId: string;
teamId: string;
projectWalletAddress?: string;
}) {
const paymentLinksQuery = useQuery({
queryFn: async () => {
return getPaymentLinks({
@@ -120,6 +132,7 @@ function PaymentLinksTableInner(props: { clientId: string; teamId: string }) {
<CreatePaymentLinkButton
key="create-payment-link"
clientId={props.clientId}
projectWalletAddress={props.projectWalletAddress}
teamId={props.teamId}
>
<Button className="gap-2 rounded-full" variant="default" size="sm">
@@ -6,6 +6,7 @@ import { getProject } from "@/api/project/projects";
import { ProjectPage } from "@/components/blocks/project-page/project-page";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { PayIcon } from "@/icons/PayIcon";
import { getProjectWallet } from "@/lib/server/project-wallet";
import { loginRedirect } from "@/utils/redirects";
import { AdvancedSection } from "./components/AdvancedSection.client";
import { QuickStartSection } from "./components/QuickstartSection.client";
@@ -29,6 +30,8 @@ export default async function Page(props: {
redirect(`/team/${params.team_slug}`);
}
const projectWallet = await getProjectWallet(project);
const client = getClientThirdwebClient({
jwt: authToken,
teamId: project.teamId,
@@ -51,6 +54,7 @@ export default async function Page(props: {
component: (
<CreatePaymentLinkButton
clientId={project.publishableKey}
projectWalletAddress={projectWallet?.address}
teamId={project.teamId}
>
<Button className="gap-1.5 rounded-full" size="sm">
@@ -141,12 +145,14 @@ export default async function Page(props: {
<div className="flex flex-col gap-12">
<PaymentLinksTable
clientId={project.publishableKey}
projectWalletAddress={projectWallet?.address}
teamId={project.teamId}
/>
<QuickStartSection
projectSlug={params.project_slug}
teamSlug={params.team_slug}
clientId={project.publishableKey}
projectWalletAddress={projectWallet?.address}
teamId={project.teamId}
/>
@@ -7,6 +7,7 @@ import { toast } from "sonner";
import type { Project } from "@/api/project/projects";
import { type Fee, updateFee } from "@/api/universal-bridge/developer";
import { SettingsCard } from "@/components/blocks/SettingsCard";
import { Button } from "@/components/ui/button";
import {
Form,
FormControl,
@@ -25,6 +26,7 @@ interface PayConfigProps {
teamId: string;
teamSlug: string;
fees: Fee;
projectWalletAddress?: string;
}
export const PayConfig: React.FC<PayConfigProps> = (props) => {
@@ -103,7 +105,37 @@ export const PayConfig: React.FC<PayConfigProps> = (props) => {
<FormItem>
<FormLabel>Recipient address</FormLabel>
<FormControl>
<Input {...field} placeholder="0x..." />
<div className="flex flex-col gap-2 sm:flex-row">
<Input
{...field}
className="sm:flex-1"
placeholder="0x..."
/>
{props.projectWalletAddress && (
<Button
onClick={() => {
if (!props.projectWalletAddress) {
return;
}
form.setValue(
"payoutAddress",
props.projectWalletAddress,
{
shouldDirty: true,
shouldTouch: true,
shouldValidate: true,
},
);
}}
size="sm"
type="button"
variant="outline"
>
Use Project Wallet
</Button>
)}
</div>
</FormControl>
</FormItem>
)}
@@ -3,6 +3,7 @@ import { getAuthToken } from "@/api/auth-token";
import { getProject } from "@/api/project/projects";
import { getTeamBySlug } from "@/api/team/get-team";
import { getFees } from "@/api/universal-bridge/developer";
import { getProjectWallet } from "@/lib/server/project-wallet";
import { loginRedirect } from "@/utils/redirects";
import { ProjectSettingsBreadcrumb } from "../_components/project-settings-breadcrumb";
import { PayConfig } from "./PayConfig";
@@ -31,6 +32,8 @@ export default async function Page(props: {
redirect(`/team/${team_slug}`);
}
const projectWallet = await getProjectWallet(project);
let fees = await getFees({
clientId: project.publishableKey,
teamId: team.id,
@@ -64,6 +67,7 @@ export default async function Page(props: {
fees={fees}
project={project}
teamId={team.id}
projectWalletAddress={projectWallet?.address}
teamSlug={team_slug}
/>
</div>
@@ -74,6 +74,10 @@ export type CreateNFTCollectionFunctions = {
count: number;
};
gasless: boolean;
onNotEnoughFunds: (data: {
requiredAmount: string;
balance: string;
}) => void;
}) => Promise<void>;
lazyMintNFTs: (params: {
values: CreateNFTCollectionAllValues;
@@ -1,6 +1,14 @@
"use client";
import { useRef } from "react";
import { encode, getContract, type ThirdwebClient } from "thirdweb";
import {
encode,
estimateGasCost,
getContract,
getGasPrice,
type PreparedTransaction,
type ThirdwebClient,
toEther,
} from "thirdweb";
import { deployERC721Contract, deployERC1155Contract } from "thirdweb/deploys";
import { multicall } from "thirdweb/extensions/common";
import {
@@ -14,7 +22,8 @@ import {
} from "thirdweb/extensions/erc1155";
import { grantRole } from "thirdweb/extensions/permissions";
import { useActiveAccount } from "thirdweb/react";
import { maxUint256 } from "thirdweb/utils";
import { maxUint256, resolvePromisedValue } from "thirdweb/utils";
import { getWalletBalance } from "thirdweb/wallets";
import { create7702MinimalAccount } from "thirdweb/wallets/smart";
import { revalidatePathAction } from "@/actions/revalidate";
import { reportContractDeployed } from "@/analytics/report";
@@ -39,6 +48,10 @@ export function CreateNFTPage(props: {
const contractAddressRef = useRef<string | undefined>(undefined);
const getChain = useGetV5DashboardChain();
const sendAndConfirmTx = useSendAndConfirmTx();
const sendAndConfirmTxNoPayModal = useSendAndConfirmTx({
payModal: false,
});
function getAccount(params: { gasless: boolean }) {
if (!activeAccount) {
throw new Error("Wallet is not connected");
@@ -130,6 +143,7 @@ export function CreateNFTPage(props: {
contractName: contractType,
deploymentType: "asset",
publisher: "deployer.thirdweb.eth",
is_testnet: chain.testnet,
});
contractAddressRef.current = contractAddress;
@@ -218,6 +232,10 @@ export function CreateNFTPage(props: {
count: number;
};
gasless: boolean;
onNotEnoughFunds: (data: {
requiredAmount: string;
balance: string;
}) => void;
}) {
const { values, batch } = params;
const contract = getDeployedContract({
@@ -277,7 +295,46 @@ export function CreateNFTPage(props: {
data: encodedTransactions,
});
await sendAndConfirmTx.mutateAsync(tx);
// if there are more than one batches, on the first batch, we check if the user has enough funds to cover the cost of all the batches ->
// calculate the cost of one batch, multiply by the number of batches to get the total cost
// if the user does not have enough funds, call the onNotEnoughFunds callback
const totalBatches = Math.ceil(values.nfts.length / batch.count);
if (batch.startIndex === 0 && totalBatches > 1 && !params.gasless) {
if (!activeAccount) {
throw new Error("Wallet is not connected");
}
const costPerBatch = await getTotalTransactionCost({
tx: tx,
from: activeAccount.address,
});
const totalCost = costPerBatch * BigInt(totalBatches);
const walletBalance = await getWalletBalance({
address: activeAccount.address,
chain: contract.chain,
client: contract.client,
});
if (walletBalance.value < totalCost) {
params.onNotEnoughFunds({
balance: toEther(walletBalance.value),
requiredAmount: toEther(totalCost),
});
throw new Error(
`Not enough funds: Required ${toEther(totalCost)}, Balance ${toEther(walletBalance.value)}`,
);
}
await sendAndConfirmTxNoPayModal.mutateAsync(tx);
} else if (totalBatches > 1) {
await sendAndConfirmTxNoPayModal.mutateAsync(tx);
} else {
await sendAndConfirmTx.mutateAsync(tx);
}
}
async function handleSetAdmins(params: {
@@ -390,3 +447,41 @@ function transformSocialUrls(
{} as Record<string, string>,
);
}
async function getTransactionGasCost(tx: PreparedTransaction, from?: string) {
try {
const gasCost = await estimateGasCost({
from,
transaction: tx,
});
const bufferCost = gasCost.wei / 10n;
// Note: get tx.value AFTER estimateGasCost
// add 10% extra gas cost to the estimate to ensure user buys enough to cover the tx cost
return gasCost.wei + bufferCost;
} catch {
if (from) {
// try again without passing from
return await getTransactionGasCost(tx);
}
// fallback if both fail, use the tx value + 1M * gas price
const gasPrice = await getGasPrice({
chain: tx.chain,
client: tx.client,
});
return 1_000_000n * gasPrice;
}
}
async function getTotalTransactionCost(params: {
tx: PreparedTransaction;
from?: string;
}) {
const [txValue, txGasCost] = await Promise.all([
resolvePromisedValue(params.tx.value),
getTransactionGasCost(params.tx, params.from),
]);
return (txValue || 0n) + txGasCost;
}
@@ -1,14 +1,19 @@
"use client";
import {
ArrowLeftIcon,
ArrowRightIcon,
ArrowUpFromLineIcon,
ImageOffIcon,
RefreshCcwIcon,
ShoppingBagIcon,
} from "lucide-react";
import Link from "next/link";
import { useTheme } from "next-themes";
import { useMemo, useRef, useState } from "react";
import type { ThirdwebClient } from "thirdweb";
import {
BuyWidget,
TokenProvider,
TokenSymbol,
useActiveAccount,
@@ -37,6 +42,7 @@ import {
import { Skeleton } from "@/components/ui/skeleton";
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";
import { parseError } from "@/utils/errorParser";
import { getSDKTheme } from "@/utils/sdk-component-theme";
import { ChainOverview } from "../../_common/chain-overview";
import { StepCard } from "../../_common/step-card";
import { StorageErrorPlanUpsell } from "../../_common/storage-error-upsell";
@@ -71,6 +77,10 @@ export function LaunchNFT(props: {
const walletRequiresApproval = activeWallet?.id !== "inApp";
const account = useActiveAccount();
const contractAddressRef = useRef<string | null>(null);
const { theme } = useTheme();
const chainMeta = useV5DashboardChain(
Number(formValues.collectionInfo.chain),
);
function updateStatus(
index: number,
@@ -161,6 +171,18 @@ export function LaunchNFT(props: {
const [isGasless, setIsGasless] = useState(canEnableGasless);
const showGaslessSection = false; // activeWallet?.id === "inApp";
const [notEnoughFunds, setNotEnoughFunds] = useState<
| false
| {
values: {
requiredAmount: string;
balance: string;
};
isBuySuccess: boolean;
showBuyWidget: boolean;
}
>(false);
const contractLink = contractAddressRef.current
? `/team/${props.teamSlug}/${props.projectSlug}/contract/${formValues.collectionInfo.chain}/${contractAddressRef.current}`
: null;
@@ -204,6 +226,16 @@ export function LaunchNFT(props: {
},
gasless: isGasless,
values: formValues,
onNotEnoughFunds: (data) => {
setNotEnoughFunds({
values: {
balance: data.balance,
requiredAmount: data.requiredAmount,
},
isBuySuccess: false,
showBuyWidget: false,
});
},
});
batchesProcessedRef.current += 1;
@@ -216,6 +248,16 @@ export function LaunchNFT(props: {
},
gasless: isGasless,
values: formValues,
onNotEnoughFunds: (data) => {
setNotEnoughFunds({
values: {
balance: data.balance,
requiredAmount: data.requiredAmount,
},
isBuySuccess: false,
showBuyWidget: false,
});
},
});
}
}
@@ -274,6 +316,8 @@ export function LaunchNFT(props: {
contractType: ercType === "erc721" ? "DropERC721" : "DropERC1155",
error: errorMessage,
step: currentStep.id,
is_testnet: chainMeta.testnet,
chainId: Number(formValues.collectionInfo.chain),
});
throw error;
@@ -283,6 +327,8 @@ export function LaunchNFT(props: {
reportAssetCreationSuccessful({
assetType: "nft",
contractType: ercType === "erc721" ? "DropERC721" : "DropERC1155",
chainId: Number(formValues.collectionInfo.chain),
is_testnet: chainMeta?.testnet ?? false,
});
props.onLaunchSuccess();
@@ -357,41 +403,143 @@ export function LaunchNFT(props: {
className="gap-0 overflow-hidden p-0 md:max-w-[480px]"
dialogCloseClassName="hidden"
>
<div className="flex flex-col gap-6 p-6">
<DialogHeader className="space-y-0.5">
<DialogTitle className="font-semibold text-xl tracking-tight">
Status
</DialogTitle>
{walletRequiresApproval && (
<DialogDescription>
Each step will prompt a signature request in your wallet
</DialogDescription>
)}
</DialogHeader>
{/** biome-ignore lint/complexity/useOptionalChain: can't change it to optional chain */}
{notEnoughFunds && notEnoughFunds.showBuyWidget ? (
<div className="bg-card">
<div className="border-b py-2 px-2">
<Button
variant="ghost"
size="sm"
onClick={() =>
setNotEnoughFunds({
...notEnoughFunds,
showBuyWidget: false,
})
}
className="gap-2 px-2 text-muted-foreground hover:text-foreground"
>
<ArrowLeftIcon className="size-4" />
Back
</Button>
</div>
<BuyWidget
client={props.client}
chain={chain}
amount={String(
Number(notEnoughFunds.values.requiredAmount) -
Number(notEnoughFunds.values.balance),
)}
buttonLabel={`Buy ${chainMeta?.nativeCurrency?.symbol || "ETH"}`}
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
className="!border-none !w-full !rounded-none"
onSuccess={() => {
setNotEnoughFunds({
...notEnoughFunds,
isBuySuccess: true,
showBuyWidget: false,
});
}}
/>
</div>
) : (
<div className="flex flex-col gap-6 p-6 mb-2">
<DialogHeader className="space-y-0.5">
<DialogTitle className="font-semibold text-xl tracking-tight">
Status
</DialogTitle>
{walletRequiresApproval && (
<DialogDescription>
Each step will prompt a signature request in your wallet
</DialogDescription>
)}
</DialogHeader>
<MultiStepStatus
onRetry={handleRetry}
renderError={(step, errorMessage) => {
if (
props.teamPlan === "free" &&
errorMessage.toLowerCase().includes("storage limit")
) {
return (
<StorageErrorPlanUpsell
onRetry={() => handleRetry(step)}
teamSlug={props.teamSlug}
trackingCampaign="create-nft"
/>
);
}
<MultiStepStatus
onRetry={handleRetry}
renderError={(step, errorMessage) => {
if (
props.teamPlan === "free" &&
errorMessage.toLowerCase().includes("storage limit")
) {
return (
<StorageErrorPlanUpsell
onRetry={() => handleRetry(step)}
teamSlug={props.teamSlug}
trackingCampaign="create-nft"
/>
);
}
return null;
}}
steps={steps}
/>
</div>
if (notEnoughFunds) {
return (
<div>
{notEnoughFunds.isBuySuccess ? (
<p className="text-success-text text-sm mt-1.5 mb-2">
Funds bought successfully
</p>
) : (
<div className="mt-2 mb-2 space-y-1">
<p className="text-destructive-text text-sm">
Not enough funds
</p>
<p className="text-muted-foreground text-sm">
Required Funds:{" "}
{notEnoughFunds.values.requiredAmount}{" "}
{chainMeta?.nativeCurrency?.symbol || "ETH"}
</p>
<p className="text-muted-foreground text-sm">
Balance: {notEnoughFunds.values.balance}{" "}
{chainMeta?.nativeCurrency?.symbol || "ETH"}
</p>
</div>
)}
<div className="mt-2 flex justify-end gap-4 border-border border-t bg-card p-6">
<div className="flex gap-2">
<Button
onClick={() => {
handleRetry(step);
setNotEnoughFunds(false);
}}
size="sm"
variant={
notEnoughFunds.isBuySuccess
? "default"
: "outline"
}
className="gap-2"
>
<RefreshCcwIcon className="size-3.5" />
Retry
</Button>
{!notEnoughFunds.isBuySuccess && (
<Button
onClick={() => {
setNotEnoughFunds({
...notEnoughFunds,
showBuyWidget: true,
});
}}
size="sm"
className="gap-2"
>
<ShoppingBagIcon className="size-3.5" />
Buy Funds
</Button>
)}
</div>
</div>
);
}
return null;
}}
steps={steps}
/>
</div>
)}
<div className="flex justify-end gap-4 border-border border-t bg-card p-6">
{!isComplete ? (
<Button
onClick={() => {
@@ -178,12 +178,14 @@ export function CreateTokenAssetPage(props: {
teamId: props.teamId,
});
const chainMetadata = getChain(Number(params.values.chain));
reportContractDeployed({
address: contractAddress,
chainId: Number(params.values.chain),
contractName: "DropERC20",
contractName: "ERC20Asset",
deploymentType: "asset",
publisher: account.address,
is_testnet: chainMetadata.testnet,
});
contractAddressRef.current = contractAddress;
@@ -299,12 +301,15 @@ export function CreateTokenAssetPage(props: {
teamId: props.teamId,
});
const chainMetadata = getChain(Number(values.chain));
reportContractDeployed({
address: contractAddress,
chainId: Number(values.chain),
contractName: "DropERC20",
deploymentType: "asset",
publisher: "deployer.thirdweb.eth",
is_testnet: chainMetadata.testnet,
});
return {
@@ -230,6 +230,8 @@ export function LaunchTokenStatus(props: {
: "ERC20Asset",
error: errorMessage,
step: currentStep.id,
is_testnet: chainMetadata?.testnet,
chainId: Number(formValues.chain),
});
updateStatus(i, {
@@ -247,6 +249,8 @@ export function LaunchTokenStatus(props: {
formValues.saleMode === "drop-erc20:token-drop"
? "DropERC20"
: "ERC20Asset",
chainId: Number(formValues.chain),
is_testnet: chainMetadata?.testnet,
});
if (contractAddressRef.current) {
@@ -13,6 +13,7 @@ import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { CopyAddressButton } from "@/components/ui/CopyAddressButton";
import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import {
Select,
@@ -49,6 +50,8 @@ export function TransactionsTableUI(props: {
getData: (params: {
page: number;
status: TransactionStatus | undefined;
id: string | undefined;
from: string | undefined;
}) => Promise<TransactionsResponse>;
project: Project;
teamSlug: string;
@@ -60,13 +63,15 @@ export function TransactionsTableUI(props: {
const [status, setStatus] = useState<TransactionStatus | undefined>(
undefined,
);
const [id, setId] = useState<string | undefined>(undefined);
const [from, setFrom] = useState<string | undefined>(undefined);
const [page, setPage] = useState(1);
const pageSize = 10;
const transactionsQuery = useQuery({
placeholderData: keepPreviousData,
queryFn: () => props.getData({ page, status }),
queryKey: ["transactions", props.project.id, page, status],
queryFn: () => props.getData({ page, status, id, from }),
queryKey: ["transactions", props.project.id, page, status, id, from],
refetchInterval: autoUpdate ? 4_000 : false,
});
@@ -84,18 +89,18 @@ export function TransactionsTableUI(props: {
return (
<div className="overflow-hidden rounded-lg border border-border bg-card">
<div className="flex flex-col gap-4 rounded-lg rounded-b-none px-6 py-6 lg:flex-row lg:justify-between">
<div>
<h2 className="font-semibold text-2xl tracking-tight">
Transaction History
</h2>
<p className="text-muted-foreground text-sm">
Transactions sent from server wallets
</p>
</div>
<div className="flex flex-col gap-4 rounded-lg rounded-b-none px-6 py-6">
<div className="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div>
<h2 className="font-semibold text-2xl tracking-tight">
Transaction History
</h2>
<p className="text-muted-foreground text-sm">
Transactions sent from server wallets
</p>
</div>
<div className="flex items-center justify-end gap-5 border-border border-t pt-4 lg:border-none lg:pt-0">
<div className="flex shrink-0 items-center gap-2">
<div className="flex shrink-0 items-center gap-2 border-border border-t pt-4 lg:border-none lg:pt-0">
<Label htmlFor={autoUpdateId}>Auto Update</Label>
<Switch
checked={autoUpdate}
@@ -103,14 +108,39 @@ export function TransactionsTableUI(props: {
onCheckedChange={(v) => setAutoUpdate(!!v)}
/>
</div>
<StatusSelector
setStatus={(v) => {
setStatus(v);
// reset page
</div>
<div className="flex flex-wrap items-center justify-end gap-3">
<Input
className="max-w-[250px]"
onChange={(e) => {
const value = e.target.value.trim();
setId(value || undefined);
setPage(1);
}}
status={status}
placeholder="Filter by Queue ID"
value={id || ""}
/>
<Input
className="max-w-[250px]"
onChange={(e) => {
const value = e.target.value.trim();
setFrom(value || undefined);
setPage(1);
}}
placeholder="Filter by wallet address"
value={from || ""}
/>
<div>
<StatusSelector
setStatus={(v) => {
setStatus(v);
// reset page
setPage(1);
}}
status={status}
/>
</div>
</div>
</div>
@@ -16,11 +16,13 @@ export function TransactionsTable(props: {
return (
<TransactionsTableUI
client={props.client}
getData={async ({ page, status }) => {
getData={async ({ page, status, id, from }) => {
return await getTransactions({
page,
project: props.project,
status,
id,
from,
});
}}
project={props.project}
@@ -34,10 +36,14 @@ async function getTransactions({
project,
page,
status,
id,
from,
}: {
project: Project;
page: number;
status: TransactionStatus | undefined;
id: string | undefined;
from: string | undefined;
}) {
const transactions = await engineCloudProxy<{ result: TransactionsResponse }>(
{
@@ -52,6 +58,8 @@ async function getTransactions({
limit: "20",
page: page.toString(),
status: status ?? undefined,
id: id ?? undefined,
from: from ?? undefined,
},
},
);
@@ -3,14 +3,17 @@
import { encrypt } from "@thirdweb-dev/service-utils";
import {
createAccessToken,
createEoa,
createServiceAccount,
createVaultClient,
rotateServiceAccount,
type VaultClient,
} from "@thirdweb-dev/vault-sdk";
import { engineCloudProxy } from "@/actions/proxies";
import type { Project } from "@/api/project/projects";
import { NEXT_PUBLIC_THIRDWEB_VAULT_URL } from "@/constants/public-envs";
import { updateProjectClient } from "@/hooks/useApi";
import { getProjectWalletLabel } from "@/lib/project-wallet";
const SERVER_WALLET_ACCESS_TOKEN_PURPOSE =
"Access Token for All Server Wallets";
@@ -126,6 +129,92 @@ export async function createVaultAccountAndAccessToken(props: {
}
}
export async function createProjectServerWallet(props: {
project: Project;
managementAccessToken: string;
label?: string;
setAsProjectWallet?: boolean;
}) {
const vaultClient = await initVaultClient();
const walletLabel = props.label?.trim()
? props.label.trim()
: getProjectWalletLabel(props.project.name);
const eoa = await createEoa({
client: vaultClient,
request: {
auth: {
accessToken: props.managementAccessToken,
},
options: {
metadata: {
label: walletLabel,
projectId: props.project.id,
teamId: props.project.teamId,
type: "server-wallet",
},
},
},
});
if (!eoa.success) {
throw new Error(eoa.error?.message || "Failed to create server wallet");
}
engineCloudProxy({
body: JSON.stringify({
signerAddress: eoa.data.address,
}),
headers: {
"Content-Type": "application/json",
"x-client-id": props.project.publishableKey,
"x-team-id": props.project.teamId,
},
method: "POST",
pathname: "/cache/smart-account",
}).catch((err) => {
console.warn("failed to cache server wallet", err);
});
if (props.setAsProjectWallet) {
await updateDefaultProjectWallet({
project: props.project,
projectWalletAddress: eoa.data.address,
});
}
return eoa.data;
}
export async function updateDefaultProjectWallet(props: {
project: Project;
projectWalletAddress: string;
}) {
const services = props.project.services.filter(
(service) => service.name !== "engineCloud",
);
const engineCloudService = props.project.services.find(
(service) => service.name === "engineCloud",
);
if (engineCloudService) {
const engineCloudServiceWithProjectWallet = {
...engineCloudService,
projectWalletAddress: props.projectWalletAddress,
};
await updateProjectClient(
{
projectId: props.project.id,
teamId: props.project.teamId,
},
{
services: [...services, engineCloudServiceWithProjectWallet],
},
);
}
}
async function createAndEncryptVaultAccessTokens(props: {
project: Project;
vaultClient: VaultClient;
@@ -157,6 +246,13 @@ async function createAndEncryptVaultAccessTokens(props: {
const managementToken = managementTokenResult.data;
const walletToken = walletTokenResult.data;
// create a default project server wallet
const defaultProjectServerWallet = await createProjectServerWallet({
project,
managementAccessToken: managementToken.accessToken,
label: getProjectWalletLabel(project.name),
});
if (projectSecretKey) {
// verify that the project secret key is valid
const projectSecretKeyHash = await hashSecretKey(projectSecretKey);
@@ -182,7 +278,9 @@ async function createAndEncryptVaultAccessTokens(props: {
},
{
services: [
...props.project.services,
...props.project.services.filter(
(service) => service.name !== "engineCloud",
),
{
name: "engineCloud",
actions: [],
@@ -191,6 +289,7 @@ async function createAndEncryptVaultAccessTokens(props: {
encryptedAdminKey,
encryptedWalletAccessToken,
rotationCode: rotationCode,
projectWalletAddress: defaultProjectServerWallet.address,
},
],
},
@@ -204,7 +303,9 @@ async function createAndEncryptVaultAccessTokens(props: {
},
{
services: [
...props.project.services,
...props.project.services.filter(
(service) => service.name !== "engineCloud",
),
{
name: "engineCloud",
actions: [],
@@ -213,6 +314,7 @@ async function createAndEncryptVaultAccessTokens(props: {
encryptedAdminKey: null,
encryptedWalletAccessToken: null,
rotationCode: rotationCode,
projectWalletAddress: defaultProjectServerWallet.address,
},
],
},
@@ -1,10 +1,8 @@
"use client";
import { useMutation } from "@tanstack/react-query";
import { createEoa } from "@thirdweb-dev/vault-sdk";
import { PlusIcon } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import { engineCloudProxy } from "@/actions/proxies";
import type { Project } from "@/api/project/projects";
import { Button } from "@/components/ui/button";
import {
@@ -17,12 +15,13 @@ import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Spinner } from "@/components/ui/Spinner";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { initVaultClient } from "../../lib/vault.client";
import { createProjectServerWallet } from "../../lib/vault.client";
export default function CreateServerWallet(props: {
project: Project;
teamSlug: string;
managementAccessToken: string | undefined;
setAsProjectWallet?: boolean;
}) {
const router = useDashboardRouter();
const [label, setLabel] = useState("");
@@ -36,49 +35,17 @@ export default function CreateServerWallet(props: {
managementAccessToken: string;
label: string;
}) => {
const vaultClient = await initVaultClient();
const eoa = await createEoa({
client: vaultClient,
request: {
auth: {
accessToken: managementAccessToken,
},
options: {
metadata: {
label,
projectId: props.project.id,
teamId: props.project.teamId,
type: "server-wallet",
},
},
},
});
if (!eoa.success) {
throw new Error("Failed to create eoa");
}
// no need to await this, it's not blocking
engineCloudProxy({
body: JSON.stringify({
signerAddress: eoa.data.address,
}),
headers: {
"Content-Type": "application/json",
"x-client-id": props.project.publishableKey,
"x-team-id": props.project.teamId,
},
method: "POST",
pathname: "/cache/smart-account",
}).catch((err) => {
console.warn("failed to cache server wallet", err);
const wallet = await createProjectServerWallet({
label,
managementAccessToken,
project: props.project,
setAsProjectWallet: props.setAsProjectWallet,
});
router.refresh();
setModalOpen(false);
return eoa;
setLabel("");
return wallet;
},
onError: (error) => {
toast.error(error.message);
@@ -1,8 +1,9 @@
"use client";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { format, formatDistanceToNowStrict } from "date-fns";
import {
CheckIcon,
MoreVerticalIcon,
RefreshCcwIcon,
SendIcon,
@@ -10,6 +11,7 @@ import {
} from "lucide-react";
import Link from "next/link";
import { useState } from "react";
import { toast } from "sonner";
import type { ThirdwebClient } from "thirdweb";
import { useWalletBalance } from "thirdweb/react";
import {
@@ -20,6 +22,7 @@ import type { Project } from "@/api/project/projects";
import { FundWalletModal } from "@/components/blocks/fund-wallets-modal";
import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors";
import { WalletAddress } from "@/components/blocks/wallet-address";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
@@ -50,7 +53,9 @@ import {
import { ToolTipLabel } from "@/components/ui/tooltip";
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";
import { WalletProductIcon } from "@/icons/WalletProductIcon";
import { useDashboardRouter } from "@/lib/DashboardRouter";
import { cn } from "@/lib/utils";
import { updateDefaultProjectWallet } from "../../lib/vault.client";
import CreateServerWallet from "../components/create-server-wallet.client";
import type { Wallet } from "./types";
@@ -96,15 +101,22 @@ export function ServerWalletsTableUI({
</div>
<div className="flex flex-col items-start lg:items-end gap-5 border-t lg:border-t-0 pt-5 lg:pt-0 border-dashed">
<SingleNetworkSelector
chainId={selectedChainId}
onChange={setSelectedChainId}
client={client}
disableChainId
className="w-fit min-w-[180px] rounded-full bg-background hover:bg-accent/50"
placeholder="Select network"
popoverContentClassName="!w-[320px] rounded-xl overflow-hidden"
/>
<div className="flex flex-row gap-2.5">
<CreateServerWallet
managementAccessToken={managementAccessToken}
project={project}
teamSlug={teamSlug}
/>
<SingleNetworkSelector
chainId={selectedChainId}
onChange={setSelectedChainId}
client={client}
disableChainId
className="w-fit min-w-[180px] rounded-full bg-background hover:bg-accent/50"
placeholder="Select network"
popoverContentClassName="!w-[320px] rounded-xl overflow-hidden"
/>
</div>
<div className="flex items-center gap-2.5">
<Label
@@ -187,25 +199,10 @@ export function ServerWalletsTableUI({
<XIcon className="size-5 text-muted-foreground" />
</div>
<p className="text-muted-foreground">No server wallets found</p>
<CreateServerWallet
managementAccessToken={managementAccessToken}
project={project}
teamSlug={teamSlug}
/>
</div>
)}
</TableContainer>
{wallets.length > 0 && (
<div className="flex justify-end items-center p-4 py-5 lg:px-6 border-t">
<CreateServerWallet
managementAccessToken={managementAccessToken}
project={project}
teamSlug={teamSlug}
/>
</div>
)}
{totalPages > 1 && (
<div className="flex flex-col items-center border-t p-6">
<div className="mb-4 text-muted-foreground text-sm">
@@ -215,7 +212,7 @@ export function ServerWalletsTableUI({
<PaginationContent>
<PaginationItem>
<Link
href={`/team/${teamSlug}/${project.slug}/transactions/server-wallets?page=${
href={`/team/${teamSlug}/${project.slug}/transactions?page=${
currentPage > 1 ? currentPage - 1 : 1
}`}
legacyBehavior
@@ -232,7 +229,7 @@ export function ServerWalletsTableUI({
(pageNumber) => (
<PaginationItem key={`page-${pageNumber}`}>
<Link
href={`/team/${teamSlug}/${project.slug}/transactions/server-wallets?page=${pageNumber}`}
href={`/team/${teamSlug}/${project.slug}/transactions?page=${pageNumber}`}
passHref
>
<PaginationLink isActive={currentPage === pageNumber}>
@@ -244,7 +241,7 @@ export function ServerWalletsTableUI({
)}
<PaginationItem>
<Link
href={`/team/${teamSlug}/${project.slug}/transactions/server-wallets?page=${
href={`/team/${teamSlug}/${project.slug}/transactions?page=${
currentPage < totalPages ? currentPage + 1 : totalPages
}`}
passHref
@@ -295,18 +292,34 @@ function ServerWalletTableRow(props: {
queryKey: ["smart-account-address", wallet.address, chainId],
});
// Get the default project wallet address
const engineCloudService = project.services.find(
(service) => service.name === "engineCloud",
);
const defaultWalletAddress = engineCloudService?.projectWalletAddress;
const isDefaultWallet =
defaultWalletAddress &&
wallet.address.toLowerCase() === defaultWalletAddress.toLowerCase();
return (
<TableRow key={wallet.id}>
{/* Label */}
<TableCell>
<span
className={cn(
"text-sm text-foreground",
!wallet.metadata.label && "text-muted-foreground",
<div className="flex items-center gap-2">
<span
className={cn(
"text-sm text-foreground",
!wallet.metadata.label && "text-muted-foreground",
)}
>
{wallet.metadata.label || "N/A"}
</span>
{isDefaultWallet && (
<Badge variant="success" className="text-xs">
default
</Badge>
)}
>
{wallet.metadata.label || "N/A"}
</span>
</div>
</TableCell>
{/* Address */}
@@ -399,6 +412,25 @@ function WalletActionsDropdown(props: {
chainId: number;
}) {
const [showFundModal, setShowFundModal] = useState(false);
const router = useDashboardRouter();
const setAsDefaultMutation = useMutation({
mutationFn: async () => {
await updateDefaultProjectWallet({
project: props.project,
projectWalletAddress: props.wallet.address,
});
},
onSuccess: () => {
toast.success("Wallet set as default project wallet");
router.refresh();
},
onError: (error) => {
toast.error(
error instanceof Error ? error.message : "Failed to set default wallet",
);
},
});
return (
<>
@@ -428,6 +460,14 @@ function WalletActionsDropdown(props: {
Fund wallet
</DropdownMenuItem>
)}
<DropdownMenuItem
onClick={() => setAsDefaultMutation.mutate()}
disabled={setAsDefaultMutation.isPending}
className="flex items-center gap-2 h-9 rounded-lg"
>
<CheckIcon className="size-4 text-muted-foreground" />
Set as default
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
@@ -1,3 +1,4 @@
import { createVaultClient, listEoas } from "@thirdweb-dev/vault-sdk";
import { redirect } from "next/navigation";
import { ResponsiveSearchParamsProvider } from "responsive-rsc";
import { getAuthToken } from "@/api/auth-token";
@@ -6,10 +7,13 @@ import type { DurationId } from "@/components/analytics/date-range-selector";
import { ResponsiveTimeFilters } from "@/components/analytics/responsive-time-filters";
import { ProjectPage } from "@/components/blocks/project-page/project-page";
import { InAppWalletUsersPageContent } from "@/components/in-app-wallet-users-content/in-app-wallet-users-content";
import { NEXT_PUBLIC_THIRDWEB_VAULT_URL } from "@/constants/public-envs";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { WalletProductIcon } from "@/icons/WalletProductIcon";
import { getFiltersFromSearchParams } from "@/lib/time";
import { loginRedirect } from "@/utils/redirects";
import type { Wallet } from "../transactions/server-wallets/wallet-table/types";
import { ServerWalletsTable } from "../transactions/server-wallets/wallet-table/wallet-table";
import { InAppWalletAnalytics } from "./analytics/chart";
import { InAppWalletsSummary } from "./analytics/chart/Summary";
@@ -20,6 +24,7 @@ export default async function Page(props: {
to?: string;
type?: string;
interval?: string;
page?: string;
}>;
}) {
const [searchParams, params] = await Promise.all([
@@ -40,12 +45,47 @@ export default async function Page(props: {
to: searchParams.to,
});
const project = await getProject(params.team_slug, params.project_slug);
const [vaultClient, project] = await Promise.all([
createVaultClient({
baseUrl: NEXT_PUBLIC_THIRDWEB_VAULT_URL,
}).catch(() => undefined),
getProject(params.team_slug, params.project_slug),
]);
if (!project) {
redirect(`/team/${params.team_slug}`);
}
const projectEngineCloudService = project.services.find(
(service) => service.name === "engineCloud",
);
const managementAccessToken =
projectEngineCloudService?.managementAccessToken;
// Fetch server wallets with pagination (5 per page)
const pageSize = 5;
const currentPage = Number.parseInt(searchParams.page ?? "1");
const eoas =
vaultClient && managementAccessToken
? await listEoas({
client: vaultClient,
request: {
auth: {
accessToken: managementAccessToken,
},
options: {
page: currentPage - 1,
// @ts-expect-error - TODO: fix this
page_size: pageSize,
},
},
})
: { data: { items: [], totalRecords: 0 }, error: null, success: true };
const serverWallets = eoas.data?.items as Wallet[] | undefined;
const client = getClientThirdwebClient({
jwt: authToken,
teamId: project.teamId,
@@ -103,12 +143,34 @@ export default async function Page(props: {
authToken={authToken}
/>
<InAppWalletUsersPageContent
authToken={authToken}
client={client}
projectClientId={project.publishableKey}
teamId={project.teamId}
/>
{/* Server Wallets Section */}
<div className="flex flex-col gap-4">
{eoas.error ? null : (
<ServerWalletsTable
client={client}
currentPage={currentPage}
managementAccessToken={managementAccessToken ?? undefined}
project={project}
teamSlug={params.team_slug}
totalPages={Math.ceil(eoas.data.totalRecords / pageSize)}
totalRecords={eoas.data.totalRecords}
wallets={serverWallets ?? []}
/>
)}
</div>
{/* User Wallets Section */}
<div className="flex flex-col gap-4">
<h2 className="font-semibold text-2xl tracking-tight">
User wallets
</h2>
<InAppWalletUsersPageContent
authToken={authToken}
client={client}
projectClientId={project.publishableKey}
teamId={project.teamId}
/>
</div>
</div>
</ProjectPage>
</ResponsiveSearchParamsProvider>
@@ -30,11 +30,13 @@ function unclaimedFeesStub(token0Amount: bigint, token1Amount: bigint) {
address: "0x1234567890123456789012345678901234567890",
amount: token0Amount,
symbol: "FOO",
decimals: 18,
},
token1: {
address: "0x0987654321098765432109876543210987654321",
amount: token1Amount,
symbol: "BAR",
decimals: 18,
},
};
}
@@ -29,11 +29,13 @@ export function ClaimRewardsPage(props: {
address: string;
amount: bigint;
symbol: string;
decimals: number;
};
token1: {
address: string;
amount: bigint;
symbol: string;
decimals: number;
};
};
chainSlug: string;
@@ -98,11 +100,13 @@ export function ClaimRewardsPageUI(props: {
address: string;
amount: bigint;
symbol: string;
decimals: number;
};
token1: {
address: string;
amount: bigint;
symbol: string;
decimals: number;
};
};
recipient: string;
@@ -275,6 +279,7 @@ function TokenReward(props: {
address: string;
amount: bigint;
symbol: string;
decimals: number;
};
client: ThirdwebClient;
chain: Chain;
@@ -303,7 +308,8 @@ function TokenReward(props: {
</div>
<div className="space-y-0.5">
<p className="font-bold text-sm">
{toTokens(props.token.amount, 18)} {props.token.symbol}
{toTokens(props.token.amount, props.token.decimals)}{" "}
{props.token.symbol}
</p>
<Link
target="_blank"
@@ -31,6 +31,7 @@ export default async function Page(props: {
const chain = info.clientContract.chain;
const assetContractServer = info.serverContract;
const serverClient = assetContractServer.client;
const chainMetadata = info.chainMetadata;
const { address: entrypointContractAddress } =
await getDeployedEntrypointERC20({
@@ -56,6 +57,7 @@ export default async function Page(props: {
// Note: must use server contract/client here
const unclaimedFees = await getUnclaimedFees({
chainMetadata,
positionManager: getContract({
address: reward.positionManager,
chain,
@@ -1,11 +1,14 @@
import type { ThirdwebContract } from "thirdweb";
import { getContract, readContract } from "thirdweb";
import { getAddress, getContract, readContract, ZERO_ADDRESS } from "thirdweb";
import type { ChainMetadata } from "thirdweb/chains";
import { symbol } from "thirdweb/extensions/common";
import { decimals } from "thirdweb/extensions/erc20";
const maxUint128 = 2n ** 128n - 1n;
export async function getUnclaimedFees(params: {
positionManager: ThirdwebContract;
chainMetadata: ChainMetadata;
reward: {
tokenId: bigint;
recipient: string;
@@ -56,33 +59,60 @@ export async function getUnclaimedFees(params: {
const token0Address = positionsResult[2];
const token1Address = positionsResult[3];
const [token0Symbol, token1Symbol] = await Promise.all([
symbol({
contract: getContract({
address: token0Address,
chain,
client,
}),
}),
symbol({
contract: getContract({
address: token1Address,
chain,
client,
}),
}),
]);
const token0Contract = getContract({
address: token0Address,
chain,
client,
});
const token1Contract = getContract({
address: token1Address,
chain,
client,
});
const isToken0Native = getAddress(token0Address) === getAddress(ZERO_ADDRESS);
const isToken1Native = getAddress(token1Address) === getAddress(ZERO_ADDRESS);
const nativeSymbol = params.chainMetadata.nativeCurrency.symbol;
const nativeDecimals = params.chainMetadata.nativeCurrency.decimals;
const [token0Symbol, token1Symbol, token0Decimals, token1Decimals] =
await Promise.all([
isToken0Native
? nativeSymbol
: symbol({
contract: token0Contract,
}),
isToken1Native
? nativeSymbol
: symbol({
contract: token1Contract,
}),
isToken0Native
? nativeDecimals
: decimals({
contract: token0Contract,
}),
isToken1Native
? nativeDecimals
: decimals({
contract: token1Contract,
}),
]);
return {
token0: {
address: token0Address,
amount: collectResult[0],
symbol: token0Symbol,
decimals: token0Decimals,
},
token1: {
address: token1Address,
amount: collectResult[1],
symbol: token1Symbol,
decimals: token1Decimals,
},
};
}
@@ -0,0 +1,36 @@
"use client";
import { useTheme } from "next-themes";
import { DarkVeil } from "@/components/DarkVeil";
const bgBackground: Record<string, [number, number, number]> = {
dark: [0, 0, 0],
light: [250 / 255, 250 / 255, 250 / 255],
};
const hues = {
light: 65,
dark: -85,
};
const patternLightnesss = {
light: -1,
dark: 0.8,
};
export function BridgeVeil() {
const theme = useTheme();
const isLight = theme.theme === "light";
const patternLightness = isLight
? patternLightnesss.light
: patternLightnesss.dark;
const hueShift = isLight ? hues.light : hues.dark;
return (
<DarkVeil
backgroundColor={bgBackground[isLight ? "light" : "dark"]}
patternLightness={patternLightness}
hueShift={hueShift}
warpAmount={0.5}
/>
);
}
@@ -16,13 +16,12 @@ export function UniversalBridgeEmbed({
const chain = useV5DashboardChain(chainId || 1);
return (
<div className="w-full lg:w-[400px]">
<BuyAndSwapEmbed
chain={chain}
buyAmount={amount}
tokenAddress={token?.address}
pageType="bridge"
/>
</div>
<BuyAndSwapEmbed
chain={chain}
buyAmount={amount}
tokenAddress={token?.address}
pageType="bridge"
isTestnet={chain.testnet}
/>
);
}
@@ -0,0 +1,33 @@
"use client";
import { ChevronRightIcon, DollarSignIcon, TrendingUpIcon } from "lucide-react";
import Link from "next/link";
import { reportBridgePageLinkClick } from "@/analytics/report";
import { cn } from "@/lib/utils";
export function PillLink(props: {
children: React.ReactNode;
href: string;
linkType: "integrate-bridge" | "trending-tokens";
}) {
const Icon =
props.linkType === "integrate-bridge" ? DollarSignIcon : TrendingUpIcon;
return (
<Link
href={props.href}
target="_blank"
onClick={() => reportBridgePageLinkClick({ linkType: props.linkType })}
className={cn(
"shadow-sm text-center justify-center inline-flex items-center gap-4 text-foreground group",
"text-sm bg-card/50 backdrop-blur-lg border border-border/70",
"rounded-full px-4 py-2.5 transition-colors duration-300 text-pretty leading-5",
"hover:bg-pink-300/20 dark:hover:bg-pink-950/30 hover:text-foreground hover:border-pink-400 dark:hover:border-pink-800",
)}
>
<div className="flex items-center gap-2.5">
<Icon className="size-4 shrink-0 text-pink-600" />
{props.children}
</div>
<ChevronRightIcon className="size-4 shrink-0 text-muted-foreground/50 group-hover:translate-x-1 transition-all duration-300 group-hover:text-foreground" />
</Link>
);
}
@@ -6,10 +6,10 @@ import { ThirdwebMiniLogo } from "../../(app)/components/ThirdwebMiniLogo";
export function PageHeader(props: { containerClassName?: string }) {
return (
<div className="border-b border-dashed">
<div className="border-b border-border/50 border-dashed">
<header
className={cn(
"container flex max-w-7xl justify-between py-3",
"container flex max-w-7xl justify-between py-4",
props.containerClassName,
)}
>
@@ -30,7 +30,7 @@ export function PageHeader(props: { containerClassName?: string }) {
>
Docs
</Link>
<ToggleThemeButton />
<ToggleThemeButton className="bg-transparent" />
<PublicPageConnectButton connectButtonClassName="!rounded-full" />
</div>
</header>
Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

+116 -22
View File
@@ -4,14 +4,17 @@ import type { Address } from "thirdweb";
import { defineChain } from "thirdweb/chains";
import { getContract } from "thirdweb/contract";
import { getCurrencyMetadata } from "thirdweb/extensions/erc20";
import { FaqSection } from "@/components/blocks/faq-section";
import { AppFooter } from "@/components/footers/app-footer";
import { BridgeVeil } from "./components/BridgeVeil";
import { PillLink } from "./components/client/pill-link";
import { UniversalBridgeEmbed } from "./components/client/UniversalBridgeEmbed";
import { PageHeader } from "./components/header";
import { bridgeAppThirdwebClient } from "./constants";
const title = "thirdweb Payments: Swap, Bridge, and Onramp";
const title = "thirdweb Bridge: Buy, Bridge & Swap Crypto on 85+ Chains";
const description =
"Swap, bridge, and on-ramp to any EVM chain with thirdweb's Payments.";
"Bridge and swap 3,200+ tokens across 85+ chains (Ethereum, Base, Optimism, Arbitrum, BNB & more). Best-price routing with near-instant finality";
export const metadata: Metadata = {
description,
@@ -52,37 +55,96 @@ export default async function BridgePage({
return (
<div className="grow flex flex-col relative overflow-hidden">
<PageHeader />
<div className="flex grow flex-col items-center justify-center py-36 px-4 min-h-dvh relative overflow-hidden">
<DotsBackgroundPattern />
<UniversalBridgeEmbed
amount={amount as string}
chainId={chainId ? Number(chainId) : undefined}
token={
symbol && decimals && tokenName
? {
address: tokenAddress as Address,
name: tokenName,
symbol,
}
: undefined
}
/>
<div className="absolute top-0 left-0 right-0 h-dvh md:h-[1200px] fade-in-0 animate-in duration-700">
<BridgeVeil />
</div>
<div className="bg-background relative z-10">
<AppFooter />
<div className="relative z-10">
<PageHeader />
<div className="h-20" />
<div className="relative z-10">
<div className="container">
<h1 className="text-5xl md:text-6xl font-bold mb-6 tracking-tighter text-center leading-none text-pretty">
Bridge and Swap tokens <br className="max-sm:hidden" /> across any
chain, instantly
</h1>
<div className="flex-wrap flex gap-3 items-center justify-center">
<DataPill>85+ Chains Supported</DataPill>
<DataPill>3200+ Tokens Supported</DataPill>
<DataPill>9+ Million Routes Available</DataPill>
</div>
</div>
<div className="h-16" />
<div className="flex grow items-center justify-center px-4 relative">
<DotsBackgroundPattern />
<UniversalBridgeEmbed
amount={amount as string}
chainId={chainId ? Number(chainId) : undefined}
token={
symbol && decimals && tokenName
? {
address: tokenAddress as Address,
name: tokenName,
symbol,
}
: undefined
}
/>
</div>
</div>
<div className="h-32" />
<div className="flex flex-col gap-4 items-center container">
<PillLink
href="https://portal.thirdweb.com/bridge"
linkType="integrate-bridge"
>
Accept Payments in Any Token Right Inside Your App
</PillLink>
<PillLink
href="https://thirdweb.com/tokens"
linkType="trending-tokens"
>
Discover Trending Tokens
</PillLink>
</div>
<div className="h-32" />
<div className="container max-w-2xl">
<BridgeFaqSection />
</div>
<div className="h-32" />
<div className="relative">
<AppFooter />
</div>
</div>
</div>
);
}
function DataPill(props: { children: React.ReactNode }) {
return (
<p className="flex items-center gap-1.5 text-foreground/50 text-xs bg-accent/30 backdrop-blur-lg border border-border/70 rounded-full px-3 py-1.5 hover:text-foreground transition-colors duration-300">
{props.children}
</p>
);
}
function DotsBackgroundPattern(props: { className?: string }) {
return (
<div
className={cn(
"pointer-events-none absolute inset-0 text-foreground/30 dark:text-foreground/10",
"pointer-events-none absolute -inset-x-36 -inset-y-24 text-pink-700/30 dark:text-pink-500/20",
props.className,
)}
style={{
@@ -94,3 +156,35 @@ function DotsBackgroundPattern(props: { className?: string }) {
/>
);
}
const bridgeFaqs: Array<{ title: string; description: string }> = [
{
title: "What is bridging in crypto?",
description:
"Crypto bridging (cross-chain bridging) moves tokens between blockchains so you can use assets across networks. In thirdweb Bridge, connect your wallet, choose the source token/network and destination token/network, review the route and price, then confirm. Assets arrive after finality, often under ~10 seconds on fast routes, though timing depends on networks and congestion.",
},
{
title: "How does crypto bridging work?",
description:
"Bridge smart contracts lock or burn tokens on the source chain and mint or release equivalents on the destination via verified cross-chain providers. thirdweb Bridge automatically finds the fastest, lowest-cost route and may use different mechanisms based on networks and liquidity. Arrival can range from seconds to minutes depending on finality; many routes complete in ~10 seconds",
},
{
title: "What is a crypto asset swap?",
description:
"A crypto swap exchanges one token for another via a DEX or aggregator. thirdweb Bridge lets you bridge + swap in one step. For example, ETH on Ethereum to USDC on Base, by selecting your start and end tokens/networks and confirming.",
},
{
title: "How can I get stablecoins like USDC or USDT?",
description:
"Use thirdweb Bridge to convert assets you hold into USDC or USDT on your chosen network: select your current token/network, pick the stablecoin (USDC, USDT, etc) on the destination, and confirm. You can also buy stablecoins with fiat in the Buy flow and bridge if needed. Always verify official token contract addresses.",
},
{
title: "What is the cost of bridging and swapping?",
description:
"Costs include gas on each chain, bridge/liquidity provider fees, and any DEX swap fees or price impact. thirdweb Bridge compares routes and selects the best price route. Save by using lower-gas times or combining bridge + swap in one flow.",
},
];
function BridgeFaqSection() {
return <FaqSection faqs={bridgeFaqs} />;
}
+124 -117
View File
@@ -1,5 +1,6 @@
import { ShieldCheckIcon } from "lucide-react";
import type { Metadata } from "next";
import { ThemeProvider } from "next-themes";
import { Bridge, defineChain, toTokens } from "thirdweb";
import { getChainMetadata } from "thirdweb/chains";
import { shortenAddress } from "thirdweb/utils";
@@ -80,131 +81,137 @@ export default async function PayPage({
}
return (
<div className="flex z-10 flex-col lg:flex-row h-full w-full">
<header className="min-w-full lg:min-w-[500px] border-b lg:border-r lg:h-full bg-card flex flex-col gap-4 items-start p-4 lg:p-8">
<div>
<div className="flex flex-row items-center justify-start gap-4">
{projectMetadata.image && (
<img
src={
resolveSchemeWithErrorHandler({
uri: projectMetadata.image,
client: payAppThirdwebClient,
}) || ""
}
alt={projectMetadata.name}
width={25}
height={25}
className="rounded-full overflow-hidden"
/>
<ThemeProvider
forcedTheme={theme === "light" ? "light" : "dark"}
attribute="class"
disableTransitionOnChange
enableSystem={false}
>
<div className="flex z-10 flex-col lg:flex-row h-full w-full">
<header className="min-w-full lg:min-w-[500px] border-b lg:border-r lg:h-full bg-card flex flex-col gap-4 items-start p-4 lg:p-8">
<div>
<div className="flex flex-row items-center justify-start gap-4">
{projectMetadata.image && (
<img
src={
resolveSchemeWithErrorHandler({
uri: projectMetadata.image,
client: payAppThirdwebClient,
}) || ""
}
alt={projectMetadata.name}
width={25}
height={25}
className="rounded-full overflow-hidden"
/>
)}
<h2 className="text-xl font-bold">{projectMetadata.name}</h2>
</div>
{projectMetadata.description && (
<p className="mt-2 text-sm text-muted-foreground">
{projectMetadata.description}
</p>
)}
<h2 className="text-xl font-bold">{projectMetadata.name}</h2>
</div>
{projectMetadata.description && (
<p className="mt-2 text-sm text-muted-foreground">
{projectMetadata.description}
</p>
)}
</div>
<div className="hidden lg:block my-4 w-full">
{paymentLink.amount && (
<div className="flex flex-col gap-1 w-full my-4">
<span className="text-muted-foreground text-xs">Details</span>
<div className="font-medium flex-row flex justify-between items-center w-full">
<div className="flex flex-row items-center gap-2">
{token.iconUri && (
<img
src={resolveSchemeWithErrorHandler({
uri: token.iconUri,
client: getConfiguredThirdwebClient({
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
teamId: undefined,
}),
})}
alt={token.name}
width={25}
height={25}
className="size-5 rounded-full overflow-hidden"
/>
)}
{toTokens(BigInt(paymentLink.amount), token.decimals)}{" "}
{token.symbol}
</div>
{token.prices.USD && (
<span>
$
{(
Number(token.prices.USD) *
Number(
toTokens(BigInt(paymentLink.amount), token.decimals),
)
).toFixed(2)}
</span>
)}
</div>
</div>
)}
{chain && (
<div className="flex flex-col gap-1 w-full my-4">
<span className="text-muted-foreground text-xs">Network</span>
<div className="font-medium flex-row flex justify-between items-center w-full">
<div className="flex flex-row items-center gap-2">
{chain.icon?.url && (
<img
src={resolveSchemeWithErrorHandler({
uri: chain.icon.url,
client: getConfiguredThirdwebClient({
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
teamId: undefined,
}),
})}
alt={chain.name}
width={chain.icon.width}
height={chain.icon.height}
className="size-5 rounded-full overflow-hidden"
/>
)}
{chain.name}
</div>
</div>
</div>
)}
{recipientEnsOrAddress.ensName ||
(recipientEnsOrAddress.address && (
<div className="hidden lg:block my-4 w-full">
{paymentLink.amount && (
<div className="flex flex-col gap-1 w-full my-4">
<span className="text-muted-foreground text-xs">Seller</span>
<span className="text-muted-foreground text-xs">Details</span>
<div className="font-medium flex-row flex justify-between items-center w-full">
{recipientEnsOrAddress.ensName ??
shortenAddress(recipientEnsOrAddress.address)}
<div className="flex flex-row items-center gap-2">
{token.iconUri && (
<img
src={resolveSchemeWithErrorHandler({
uri: token.iconUri,
client: getConfiguredThirdwebClient({
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
teamId: undefined,
}),
})}
alt={token.name}
width={25}
height={25}
className="size-5 rounded-full overflow-hidden"
/>
)}
{toTokens(BigInt(paymentLink.amount), token.decimals)}{" "}
{token.symbol}
</div>
{token.prices.USD && (
<span>
$
{(
Number(token.prices.USD) *
Number(
toTokens(BigInt(paymentLink.amount), token.decimals),
)
).toFixed(2)}
</span>
)}
</div>
</div>
))}
</div>
)}
{chain && (
<div className="flex flex-col gap-1 w-full my-4">
<span className="text-muted-foreground text-xs">Network</span>
<div className="font-medium flex-row flex justify-between items-center w-full">
<div className="flex flex-row items-center gap-2">
{chain.icon?.url && (
<img
src={resolveSchemeWithErrorHandler({
uri: chain.icon.url,
client: getConfiguredThirdwebClient({
secretKey: DASHBOARD_THIRDWEB_SECRET_KEY,
teamId: undefined,
}),
})}
alt={chain.name}
width={chain.icon.width}
height={chain.icon.height}
className="size-5 rounded-full overflow-hidden"
/>
)}
{chain.name}
</div>
</div>
</div>
)}
{recipientEnsOrAddress.ensName ||
(recipientEnsOrAddress.address && (
<div className="flex flex-col gap-1 w-full my-4">
<span className="text-muted-foreground text-xs">Seller</span>
<div className="font-medium flex-row flex justify-between items-center w-full">
{recipientEnsOrAddress.ensName ??
shortenAddress(recipientEnsOrAddress.address)}
</div>
</div>
))}
</div>
<div className="mt-auto hidden lg:block">
<Badge className="flex items-center gap-1.5 bg-purple-100 text-purple-800 border-purple-200 dark:bg-purple-950 dark:text-purple-300 dark:border-purple-800">
<ShieldCheckIcon className="size-3" />
Secured by thirdweb
</Badge>
</div>
</header>
<main className="flex justify-center p-12 w-full items-center">
<PayPageWidget
amount={paymentLink.amount ? BigInt(paymentLink.amount) : undefined}
chainId={Number(paymentLink.destinationToken.chainId)}
clientId={undefined} // Payment links don't need to use the same client ID to be executed
image={paymentLink.imageUrl}
name={paymentLink.title}
paymentLinkId={id}
purchaseData={paymentLink.purchaseData}
recipientAddress={paymentLink.receiver}
redirectUri={redirectUri}
theme={theme}
token={token}
/>
</main>
</div>
<div className="mt-auto hidden lg:block">
<Badge className="flex items-center gap-1.5 bg-purple-100 text-purple-800 border-purple-200 dark:bg-purple-950 dark:text-purple-300 dark:border-purple-800">
<ShieldCheckIcon className="size-3" />
Secured by thirdweb
</Badge>
</div>
</header>
<main className="flex justify-center p-12 w-full items-center">
<PayPageWidget
amount={paymentLink.amount ? BigInt(paymentLink.amount) : undefined}
chainId={Number(paymentLink.destinationToken.chainId)}
clientId={undefined} // Payment links don't need to use the same client ID to be executed
image={paymentLink.imageUrl}
name={paymentLink.title}
paymentLinkId={id}
purchaseData={paymentLink.purchaseData}
recipientAddress={paymentLink.receiver}
redirectUri={redirectUri}
token={token}
/>
</main>
</div>
</ThemeProvider>
);
}
@@ -1,7 +1,6 @@
"use client";
import { payAppThirdwebClient } from "app/pay/constants";
import { useTheme } from "next-themes";
import { useEffect } from "react";
import { createThirdwebClient, NATIVE_TOKEN_ADDRESS, toTokens } from "thirdweb";
import { AutoConnect, CheckoutWidget } from "thirdweb/react";
import { checksumAddress } from "thirdweb/utils";
@@ -11,6 +10,7 @@ import {
reportPaymentLinkBuySuccessful,
} from "@/analytics/report";
import { useV5DashboardChain } from "@/hooks/chains/v5-adapter";
import { getSDKTheme } from "@/utils/sdk-component-theme";
export function PayPageWidget({
chainId,
@@ -21,7 +21,6 @@ export function PayPageWidget({
name,
image,
redirectUri,
theme,
purchaseData,
clientId,
}: {
@@ -34,17 +33,10 @@ export function PayPageWidget({
image?: string;
redirectUri?: string;
clientId: string | undefined;
theme?: "light" | "dark";
purchaseData: Record<string, unknown> | undefined;
}) {
const { theme: browserTheme, setTheme } = useTheme();
const { theme } = useTheme();
// eslint-disable-next-line no-restricted-syntax
useEffect(() => {
if (theme) {
setTheme(theme);
}
}, [theme, setTheme]);
const chain = useV5DashboardChain(chainId);
return (
@@ -55,6 +47,7 @@ export function PayPageWidget({
}
/>
<CheckoutWidget
theme={getSDKTheme(theme === "light" ? "light" : "dark")}
connectOptions={{
wallets: [
createWallet("io.metamask"),
@@ -87,7 +80,6 @@ export function PayPageWidget({
paymentLinkId={paymentLinkId}
purchaseData={purchaseData}
seller={checksumAddress(recipientAddress)}
theme={theme ?? (browserTheme === "light" ? "light" : "dark")}
tokenAddress={
token.address === NATIVE_TOKEN_ADDRESS
? undefined
+3 -11
View File
@@ -1,6 +1,5 @@
import "@workspace/ui/global.css";
import { Inter } from "next/font/google";
import { ThemeProvider } from "next-themes";
import { cn } from "@/lib/utils";
import { PayProviders } from "./components/client/Providers.client";
@@ -24,16 +23,9 @@ export default async function PayLayout({
)}
>
<PayProviders>
<ThemeProvider
attribute="class"
defaultTheme="dark"
disableTransitionOnChange
enableSystem={false}
>
<div className="relative mx-auto flex h-full w-full items-center justify-center overflow-x-hidden overflow-y-scroll">
{children}
</div>
</ThemeProvider>
<div className="relative mx-auto flex h-full w-full items-center justify-center overflow-x-hidden overflow-y-scroll">
{children}
</div>
</PayProviders>
</body>
</html>
+29 -13
View File
@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import { ThemeProvider } from "next-themes";
import { createThirdwebClient, defineChain, getContract } from "thirdweb";
import { getCurrencyMetadata } from "thirdweb/extensions/erc20";
import { checksumAddress } from "thirdweb/utils";
@@ -33,7 +34,16 @@ export default async function PayPage({
!params.tokenAddress &&
!params.amount
) {
return <PaymentLinkForm />;
return (
<ThemeProvider
forcedTheme={params.theme === "light" ? "light" : "dark"}
attribute="class"
disableTransitionOnChange
enableSystem={false}
>
<PaymentLinkForm />
</ThemeProvider>
);
}
// Validate query parameters
@@ -84,17 +94,23 @@ export default async function PayPage({
};
return (
<PayPageWidget
amount={BigInt(params.amount)}
chainId={Number(params.chainId)}
clientId={client.clientId}
image={params.image}
name={params.name}
purchaseData={undefined}
recipientAddress={params.recipientAddress}
redirectUri={params.redirectUri}
theme={params.theme}
token={token}
/>
<ThemeProvider
forcedTheme={params.theme === "light" ? "light" : "dark"}
attribute="class"
disableTransitionOnChange
enableSystem={false}
>
<PayPageWidget
amount={BigInt(params.amount)}
chainId={Number(params.chainId)}
clientId={client.clientId}
image={params.image}
name={params.name}
purchaseData={undefined}
recipientAddress={params.recipientAddress}
redirectUri={params.redirectUri}
token={token}
/>
</ThemeProvider>
);
}
+37 -8
View File
@@ -7,6 +7,20 @@ import { defineDashboardChain } from "@/lib/defineDashboardChain";
import { isLoginRequired } from "@/utils/auth";
import { LAST_VISITED_TEAM_PAGE_PATH } from "./app/(app)/team/components/last-visited-page/consts";
type CookiesToSet = Record<
string,
| [string]
| [
string,
{
httpOnly: boolean;
sameSite?: "lax" | "strict" | "none";
secure: boolean;
maxAge: number;
},
]
>;
// ignore assets, api - only intercept page routes
export const config = {
matcher: [
@@ -24,12 +38,12 @@ export const config = {
};
export async function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
const { pathname, searchParams } = request.nextUrl;
// nebula subdomain handling
const paths = pathname.slice(1).split("/");
let cookiesToSet: Record<string, string> | undefined;
let cookiesToSet: CookiesToSet = {};
const activeAccount = request.cookies.get(COOKIE_ACTIVE_ACCOUNT)?.value;
const authCookie = activeAccount
@@ -56,12 +70,27 @@ export async function middleware(request: NextRequest) {
cookiesToSet = {};
}
cookiesToSet[key] = value;
cookiesToSet[key] = [value];
}
}
}
}
// handle gclid (if it exists in search params)
const gclid = searchParams.get("gclid");
if (gclid) {
cookiesToSet.gclid = [
gclid,
{
// TODO: define conversion window, for now 7d should do fine
maxAge: 7 * 24 * 60 * 60,
httpOnly: false,
sameSite: "lax",
secure: true,
},
];
}
// logged in paths
if (isLoginRequired(pathname)) {
// check if the user is logged in (has a valid auth cookie)
@@ -146,7 +175,7 @@ export async function middleware(request: NextRequest) {
if (cookiesToSet) {
const defaultResponse = NextResponse.next();
for (const entry of Object.entries(cookiesToSet)) {
defaultResponse.cookies.set(entry[0], entry[1]);
defaultResponse.cookies.set(entry[0], entry[1][0], entry[1][1]);
}
return defaultResponse;
@@ -162,7 +191,7 @@ function isPossibleAddressOrENSName(address: string) {
function rewrite(
request: NextRequest,
relativePath: string,
cookiesToSet: Record<string, string> | undefined,
cookiesToSet: CookiesToSet,
) {
const url = request.nextUrl.clone();
url.pathname = relativePath;
@@ -170,7 +199,7 @@ function rewrite(
if (cookiesToSet) {
for (const entry of Object.entries(cookiesToSet)) {
res.cookies.set(entry[0], entry[1]);
res.cookies.set(entry[0], entry[1][0], entry[1][1]);
}
}
@@ -184,7 +213,7 @@ function redirect(
| {
searchParams?: string;
permanent?: boolean;
cookiesToSet?: Record<string, string> | undefined;
cookiesToSet?: CookiesToSet;
}
| undefined,
) {
@@ -196,7 +225,7 @@ function redirect(
if (options?.cookiesToSet) {
for (const entry of Object.entries(options.cookiesToSet)) {
res.cookies.set(entry[0], entry[1]);
res.cookies.set(entry[0], entry[1][0], entry[1][1]);
}
}
+9
View File
@@ -64,6 +64,15 @@ const baseNextConfig: NextConfig = {
},
productionBrowserSourceMaps: false,
reactStrictMode: true,
async redirects() {
return [
{
source: "/:path*",
destination: "https://thirdweb.com/ai",
permanent: true,
},
];
},
async rewrites() {
return [
{
+1
View File
@@ -26,6 +26,7 @@
"clsx": "^2.1.1",
"date-fns": "4.1.0",
"fetch-event-stream": "0.1.5",
"geist": "^1.5.1",
"lucide-react": "0.525.0",
"next": "15.3.5",
"next-themes": "^0.4.6",
@@ -76,7 +76,7 @@ export function ChatContainer() {
return (
<Reasoning
key={`${message.id}-reasoning-${i}`}
className="w-full"
className="w-full max-w-md"
isStreaming={status === "streaming"}
>
<ReasoningTrigger />
@@ -1,10 +1,90 @@
import { NextResponse } from "next/server";
import { type NextRequest, NextResponse } from "next/server";
import { createThirdwebClient, defineChain } from "thirdweb";
import { toUnits } from "thirdweb/utils";
import { facilitator, settlePayment } from "thirdweb/x402";
import { token } from "../../payments/x402/components/constants";
// Allow streaming responses up to 5 minutes
export const maxDuration = 300;
export async function GET(_req: Request) {
return NextResponse.json({
success: true,
message: "Congratulations! You have accessed the protected route.",
export async function GET(request: NextRequest) {
const client = createThirdwebClient({
secretKey: process.env.THIRDWEB_SECRET_KEY as string,
});
const BACKEND_WALLET_ADDRESS = process.env.ENGINE_BACKEND_WALLET as string;
// const BACKEND_WALLET_ADDRESS = process.env.ENGINE_BACKEND_SMART_WALLET as string;
const ENGINE_VAULT_ACCESS_TOKEN = process.env
.ENGINE_VAULT_ACCESS_TOKEN as string;
const API_URL = `https://${process.env.NEXT_PUBLIC_API_URL || "api.thirdweb.com"}`;
const twFacilitator = facilitator({
baseUrl: `${API_URL}/v1/payments/x402`,
client,
serverWalletAddress: BACKEND_WALLET_ADDRESS,
vaultAccessToken: ENGINE_VAULT_ACCESS_TOKEN,
});
const paymentData = request.headers.get("X-PAYMENT");
const queryParams = request.nextUrl.searchParams;
const chainId = queryParams.get("chainId");
if (!chainId) {
return NextResponse.json(
{ error: "Missing required parameters" },
{ status: 400 },
);
}
const amount = queryParams.get("amount") || "0.01";
const tokenAddress = queryParams.get("tokenAddress") || token.address;
const decimals = queryParams.get("decimals") || token.decimals.toString();
const waitUntil =
(queryParams.get("waitUntil") as "simulated" | "submitted" | "confirmed") ||
"simulated";
const result = await settlePayment({
resourceUrl: "https://playground-web.thirdweb.com/api/paywall",
method: "GET",
paymentData,
network: defineChain(Number(chainId)),
price: {
amount: toUnits(amount, parseInt(decimals)).toString(),
asset: {
address: tokenAddress as `0x${string}`,
decimals: decimals ? parseInt(decimals) : token.decimals,
},
},
routeConfig: {
description: "Access to paid content",
},
waitUntil,
facilitator: twFacilitator,
});
if (result.status === 200) {
// payment successful, execute the request
return NextResponse.json(
{
success: true,
message: "Payment successful. You have accessed the protected route.",
payment: {
amount,
tokenAddress,
},
receipt: result.paymentReceipt,
},
{
status: 200,
headers: result.responseHeaders,
},
);
}
// otherwise, request payment
return NextResponse.json(result.responseBody, {
status: result.status,
headers: result.responseHeaders,
});
}
+4 -15
View File
@@ -1,26 +1,15 @@
import type { Metadata } from "next";
import { Fira_Code, Inter } from "next/font/google";
import { metadataBase } from "@/lib/constants";
import { cn } from "@/lib/utils";
import { AppSidebarLayout } from "./AppSidebar";
import { Providers } from "./providers";
import "@workspace/ui/global.css";
import { GeistMono } from "geist/font/mono";
import { GeistSans } from "geist/font/sans";
import { ThemeProvider } from "next-themes";
import NextTopLoader from "nextjs-toploader";
import { Toaster } from "sonner";
const sansFont = Inter({
subsets: ["latin"],
variable: "--font-sans",
weight: "variable",
});
const monoFont = Fira_Code({
subsets: ["latin"],
variable: "--font-mono",
weight: "variable",
});
export const metadata: Metadata = {
description: "thirdweb playground",
metadataBase,
@@ -37,8 +26,8 @@ export default async function RootLayout({
<body
className={cn(
"bg-background font-sans antialiased ",
sansFont.variable,
monoFont.variable,
GeistSans.variable,
GeistMono.variable,
)}
>
<ThemeProvider
@@ -18,6 +18,7 @@ const defaultOptions: BridgeComponentsPlaygroundOptions = {
sellerAddress: "0x0000000000000000000000000000000000000000",
title: "",
transactionData: "",
receiverAddress: undefined,
currency: "USD",
showThirdwebBranding: true,
},
@@ -118,8 +118,12 @@ tokenId: 2n,
tokenAddress: options.payOptions.buyTokenAddress
? quotes(options.payOptions.buyTokenAddress)
: undefined,
seller: options.payOptions.sellerAddress
? quotes(options.payOptions.sellerAddress)
seller:
widget === "checkout"
? quotes(options.payOptions.sellerAddress)
: undefined,
receiverAddress: options.payOptions.receiverAddress
? quotes(options.payOptions.receiverAddress)
: undefined,
buttonLabel: options.payOptions.buttonLabel
? quotes(options.payOptions.buttonLabel)
@@ -140,6 +140,7 @@ export function LeftSection(props: {
<div className="flex flex-col gap-2">
<Label>Token</Label>
<TokenSelector
disableAddress
chainId={selectedChain}
client={THIRDWEB_CLIENT}
enabled={true}
@@ -154,10 +155,10 @@ export function LeftSection(props: {
)}
{/* Mode-specific form fields */}
<div className="my-2">
<div className="">
{/* Buy Mode - Amount and Payment Methods */}
{props.widget === "buy" && (
<div className="space-y-4">
<div className="space-y-6">
<div className="flex flex-col gap-2">
<Label htmlFor={buyTokenAmountId}>Amount</Label>
<Input
@@ -177,6 +178,30 @@ export function LeftSection(props: {
/>
</div>
{props.widget === "buy" && (
<div className="flex flex-col gap-2">
<Label htmlFor="receiver-address">Receiver Address</Label>
<p className="text-muted-foreground text-sm">
Receive the tokens in a different wallet address
</p>
<Input
className="bg-card"
id="receiver-address"
onChange={(e) => {
setOptions((v) => ({
...v,
payOptions: {
...v.payOptions,
receiverAddress: e.target.value as Address,
},
}));
}}
placeholder="0x..."
value={payOptions.receiverAddress || ""}
/>
</div>
)}
{/* Payment Methods */}
<div className="flex flex-col gap-3">
<Label>Payment Methods</Label>
@@ -206,6 +231,7 @@ export function LeftSection(props: {
/>
<Label htmlFor={cryptoPaymentId}>Crypto</Label>
</div>
<div className="flex items-center space-x-2">
<Checkbox
checked={payOptions.paymentMethods.includes("card")}
@@ -257,7 +283,6 @@ export function LeftSection(props: {
value={payOptions.sellerAddress || ""}
/>
</div>
<div className="flex flex-col gap-2">
<Label htmlFor={paymentAmountId}>Price</Label>
<Input
@@ -67,6 +67,12 @@ export function RightSection(props: {
tokenAddress={props.options.payOptions.buyTokenAddress}
currency={props.options.payOptions.currency}
showThirdwebBranding={props.options.payOptions.showThirdwebBranding}
receiverAddress={props.options.payOptions.receiverAddress}
key={JSON.stringify({
amount: props.options.payOptions.buyTokenAmount,
chain: props.options.payOptions.buyTokenChain,
tokenAddress: props.options.payOptions.buyTokenAddress,
})}
{...(props.options.payOptions.buttonLabel && {
buttonLabel: props.options.payOptions.buttonLabel,
})}
@@ -89,7 +95,6 @@ export function RightSection(props: {
}
name={props.options.payOptions.title || "Your Product Name"}
paymentMethods={props.options.payOptions.paymentMethods}
presetOptions={[1, 2, 3]}
seller={props.options.payOptions.sellerAddress}
theme={themeObj}
tokenAddress={props.options.payOptions.buyTokenAddress}
@@ -48,6 +48,7 @@ export type BridgeComponentsPlaygroundOptions = {
// direct_payment mode options
sellerAddress: Address;
receiverAddress: Address | undefined;
// transaction mode options
transactionData?: string; // Simplified for demo; could be more complex in real implementation
@@ -17,6 +17,7 @@ const defaultOptions: BridgeComponentsPlaygroundOptions = {
paymentMethods: ["crypto", "card"],
sellerAddress: "0x0000000000000000000000000000000000000000",
title: "",
receiverAddress: undefined,
transactionData: "",
currency: "USD",
showThirdwebBranding: true,
@@ -20,6 +20,7 @@ const defaultOptions: BridgeComponentsPlaygroundOptions = {
transactionData: "",
currency: "USD",
showThirdwebBranding: true,
receiverAddress: undefined,
},
theme: {
darkColorOverrides: {},
@@ -0,0 +1,168 @@
"use client";
import type React from "react";
import { useId, useState } from "react";
import { defineChain } from "thirdweb/chains";
import { BridgeNetworkSelector } from "@/components/blocks/NetworkSelectors";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { TokenSelector } from "@/components/ui/TokenSelector";
import { THIRDWEB_CLIENT } from "@/lib/client";
import type { TokenMetadata } from "@/lib/types";
import type { X402PlaygroundOptions } from "./types";
export function X402LeftSection(props: {
options: X402PlaygroundOptions;
setOptions: React.Dispatch<React.SetStateAction<X402PlaygroundOptions>>;
}) {
const { options, setOptions } = props;
// Local state for chain and token selection
const [selectedChain, setSelectedChain] = useState<number | undefined>(() => {
return options.chain?.id;
});
const [selectedToken, setSelectedToken] = useState<
{ chainId: number; address: string } | undefined
>(() => {
if (options.tokenAddress && options.chain?.id) {
return {
address: options.tokenAddress,
chainId: options.chain.id,
};
}
return undefined;
});
const chainId = useId();
const tokenId = useId();
const amountId = useId();
const waitUntilId = useId();
const handleChainChange = (chainId: number) => {
setSelectedChain(chainId);
// Clear token selection when chain changes
setSelectedToken(undefined);
setOptions((v) => ({
...v,
chain: defineChain(chainId),
tokenAddress: "0x0000000000000000000000000000000000000000" as const,
tokenSymbol: "",
tokenDecimals: 18,
}));
};
const handleTokenChange = (token: TokenMetadata) => {
setSelectedToken({
address: token.address,
chainId: selectedChain!,
});
setOptions((v) => ({
...v,
tokenAddress: token.address as `0x${string}`,
tokenSymbol: token.symbol ?? "",
tokenDecimals: token.decimals ?? 18,
}));
};
const handleAmountChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setOptions((v) => ({
...v,
amount: e.target.value,
}));
};
const handleWaitUntilChange = (
value: "simulated" | "submitted" | "confirmed",
) => {
setOptions((v) => ({
...v,
waitUntil: value,
}));
};
return (
<div className="space-y-6">
<div>
<h2 className="mb-4 text-xl font-semibold">Configuration</h2>
<div className="space-y-4">
{/* Chain selection */}
<div className="flex flex-col gap-2">
<Label htmlFor={chainId}>Chain</Label>
<BridgeNetworkSelector
chainId={selectedChain}
onChange={handleChainChange}
placeholder="Select a chain"
className="bg-card"
/>
</div>
{/* Token selection - only show if chain is selected */}
{selectedChain && (
<div className="flex flex-col gap-2">
<Label htmlFor={tokenId}>Token</Label>
<TokenSelector
chainId={selectedChain}
client={THIRDWEB_CLIENT}
enabled={true}
onChange={handleTokenChange}
placeholder="Select a token"
selectedToken={selectedToken}
className="bg-card"
/>
</div>
)}
{/* Amount input */}
<div className="flex flex-col gap-2">
<Label htmlFor={amountId}>Amount</Label>
<Input
id={amountId}
type="text"
placeholder="0.01"
value={options.amount}
onChange={handleAmountChange}
className="bg-card"
/>
{options.tokenSymbol && (
<p className="text-sm text-muted-foreground">
Amount in {options.tokenSymbol}
</p>
)}
</div>
{/* Wait Until selection */}
<div className="flex flex-col gap-2">
<Label htmlFor={waitUntilId}>Wait Until</Label>
<Select
value={options.waitUntil}
onValueChange={handleWaitUntilChange}
>
<SelectTrigger className="bg-card">
<SelectValue placeholder="Select wait condition" />
</SelectTrigger>
<SelectContent>
<SelectItem value="simulated">Simulated</SelectItem>
<SelectItem value="submitted">Submitted</SelectItem>
<SelectItem value="confirmed">Confirmed</SelectItem>
</SelectContent>
</Select>
<p className="text-sm text-muted-foreground">
When to consider the payment settled: simulated (fastest),
submitted (medium), or confirmed (most secure)
</p>
</div>
</div>
</div>
</div>
);
}
@@ -0,0 +1,45 @@
"use client";
import React, { useState } from "react";
import { useActiveAccount } from "thirdweb/react";
import { chain, token } from "./constants";
import type { X402PlaygroundOptions } from "./types";
import { X402LeftSection } from "./X402LeftSection";
import { X402RightSection } from "./X402RightSection";
const defaultOptions: X402PlaygroundOptions = {
chain: chain,
tokenAddress: token.address as `0x${string}`,
tokenSymbol: token.symbol,
tokenDecimals: token.decimals,
amount: "0.01",
payTo: "0x0000000000000000000000000000000000000000",
waitUntil: "simulated",
};
export function X402Playground() {
const [options, setOptions] = useState<X402PlaygroundOptions>(defaultOptions);
const activeAccount = useActiveAccount();
// Update payTo address when wallet connects, but only if it's still the default
React.useEffect(() => {
if (
activeAccount?.address &&
options.payTo === "0x0000000000000000000000000000000000000000"
) {
setOptions((prev) => ({
...prev,
payTo: activeAccount.address as `0x${string}`,
}));
}
}, [activeAccount?.address, options.payTo]);
return (
<div className="relative flex flex-col-reverse gap-6 xl:min-h-[900px] xl:flex-row xl:gap-6">
<div className="grow border-b pb-10 xl:mb-0 xl:border-r xl:border-b-0 xl:pr-6">
<X402LeftSection options={options} setOptions={setOptions} />
</div>
<X402RightSection options={options} />
</div>
);
}
@@ -0,0 +1,307 @@
"use client";
import { useMutation } from "@tanstack/react-query";
import { Badge } from "@workspace/ui/components/badge";
import { CodeClient } from "@workspace/ui/components/code/code.client";
import { CodeIcon, LockIcon } from "lucide-react";
import { usePathname } from "next/navigation";
import { useState } from "react";
import {
ConnectButton,
useActiveAccount,
useActiveWallet,
} from "thirdweb/react";
import { wrapFetchWithPayment } from "thirdweb/x402";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { THIRDWEB_CLIENT } from "@/lib/client";
import { cn } from "@/lib/utils";
import type { X402PlaygroundOptions } from "./types";
type Tab = "ui" | "client-code" | "server-code";
export function X402RightSection(props: { options: X402PlaygroundOptions }) {
const pathname = usePathname();
const [previewTab, _setPreviewTab] = useState<Tab>(() => {
return "ui";
});
function setPreviewTab(tab: "ui" | "client-code" | "server-code") {
_setPreviewTab(tab);
window.history.replaceState({}, "", `${pathname}?tab=${tab}`);
}
const activeWallet = useActiveWallet();
const activeAccount = useActiveAccount();
const paidApiCall = useMutation({
mutationFn: async () => {
if (!activeWallet) {
throw new Error("No active wallet");
}
const fetchWithPay = wrapFetchWithPayment(
fetch,
THIRDWEB_CLIENT,
activeWallet,
BigInt(1 * 10 ** 18),
);
const searchParams = new URLSearchParams();
searchParams.set("chainId", props.options.chain.id.toString());
searchParams.set("payTo", props.options.payTo);
searchParams.set("amount", props.options.amount);
searchParams.set("tokenAddress", props.options.tokenAddress);
searchParams.set("decimals", props.options.tokenDecimals.toString());
searchParams.set("waitUntil", props.options.waitUntil);
const url =
"/api/paywall" +
(searchParams.size > 0 ? "?" + searchParams.toString() : "");
const response = await fetchWithPay(url.toString());
return response.json();
},
});
const handlePayClick = async () => {
paidApiCall.mutate();
};
const clientCode = `import { createThirdwebClient } from "thirdweb";
import { wrapFetchWithPayment } from "thirdweb/x402";
import { useActiveWallet } from "thirdweb/react";
const client = createThirdwebClient({ clientId: "your-client-id" });
export default function Page() {
const wallet = useActiveWallet();
const onClick = async () => {
const fetchWithPay = wrapFetchWithPayment(fetch, client, wallet);
const response = await fetchWithPay('/api/paid-endpoint');
}
return (
<Button onClick={onClick}>Pay Now</Button>
);
}`;
const serverCode = `// Usage in a Next.js API route
import { settlePayment, facilitator } from "thirdweb/x402";
import { createThirdwebClient } from "thirdweb";
import { defineChain } from "thirdweb/chains";
const client = createThirdwebClient({
secretKey: process.env.THIRDWEB_SECRET_KEY,
});
const thirdwebFacilitator = facilitator({
client,
serverWalletAddress: "0xYourServerWalletAddress",
waitUtil: "${props.options.waitUntil}",
});
export async function POST(request: Request) {
const paymentData = request.headers.get("x-payment");
// verify and process the payment
const result = await settlePayment({
resourceUrl: "https://api.example.com/premium-content",
method: "POST",
paymentData,
payTo: "${props.options.payTo}",
network: defineChain(${props.options.chain.id}),
price: {
amount: "${Number(props.options.amount) * 10 ** props.options.tokenDecimals}",
asset: {
address: "${props.options.tokenAddress}",
},
},
facilitator: thirdwebFacilitator,
});
if (result.status === 200) {
// Payment verified and settled successfully
return Response.json({ data: "premium content" });
} else {
// Payment required
return Response.json(result.responseBody, {
status: result.status,
headers: result.responseHeaders,
});
}
}`;
return (
<div className="flex shrink-0 flex-col gap-4 xl:sticky xl:top-0 xl:w-[764px]">
<TabButtons
tabs={[
{
isActive: previewTab === "ui",
name: "UI",
onClick: () => setPreviewTab("ui"),
},
{
isActive: previewTab === "client-code",
name: "Client Code",
onClick: () => setPreviewTab("client-code"),
},
{
isActive: previewTab === "server-code",
name: "Server Code",
onClick: () => setPreviewTab("server-code"),
},
]}
/>
<div
className={cn(
"relative flex min-h-[200px] grow justify-center rounded-lg",
previewTab === "ui" && "items-center",
)}
>
<BackgroundPattern />
{previewTab === "ui" && (
<div className="flex flex-col gap-4 w-full p-4 md:p-12 max-w-lg mx-auto">
<ConnectButton
client={THIRDWEB_CLIENT}
chain={props.options.chain}
detailsButton={{
displayBalanceToken:
props.options.tokenAddress !==
"0x0000000000000000000000000000000000000000"
? {
[props.options.chain.id]: props.options.tokenAddress,
}
: undefined,
}}
supportedTokens={
props.options.tokenAddress !==
"0x0000000000000000000000000000000000000000"
? {
[props.options.chain.id]: [
{
address: props.options.tokenAddress,
symbol: props.options.tokenSymbol,
name: props.options.tokenSymbol,
},
],
}
: undefined
}
/>
<Card className="p-6">
<div className="flex items-center gap-3 mb-4">
<LockIcon className="w-5 h-5 text-muted-foreground" />
<span className="text-lg font-medium">Paid API Call</span>
<Badge variant="success">
<span className="text-xl font-bold">
{props.options.amount}{" "}
{props.options.tokenSymbol || "tokens"}
</span>
</Badge>
</div>
<Button
onClick={handlePayClick}
className="w-full mb-4"
size="lg"
disabled={paidApiCall.isPending || !activeAccount}
>
Access Premium Content
</Button>
<p className="text-sm text-muted-foreground">
Pay for access with {props.options.tokenSymbol || "tokens"} on{" "}
{props.options.chain.name || `chain ${props.options.chain.id}`}
</p>
</Card>
<Card className="p-6">
<div className="flex items-center gap-3 mb-2">
<CodeIcon className="w-5 h-5 text-muted-foreground" />
<span className="text-lg font-medium">API Call Response</span>
</div>
{paidApiCall.isPending && (
<div className="text-center">Loading...</div>
)}
{paidApiCall.isError && (
<div className="text-center">
Error: {paidApiCall.error.message}
</div>
)}
{paidApiCall.data && (
<CodeClient
code={JSON.stringify(paidApiCall.data, null, 2)}
lang="json"
/>
)}
</Card>
</div>
)}
{previewTab === "client-code" && (
<div className="w-full">
<CodeClient
className="h-full rounded-none border-none"
code={clientCode}
lang="tsx"
/>
</div>
)}
{previewTab === "server-code" && (
<div className="w-full">
<CodeClient
className="h-full rounded-none border-none"
code={serverCode}
lang="typescript"
/>
</div>
)}
</div>
</div>
);
}
function BackgroundPattern() {
const color = "hsl(var(--foreground)/15%)";
return (
<div
className="absolute inset-0 z-[-1]"
style={{
backgroundImage: `radial-gradient(${color} 1px, transparent 1px)`,
backgroundSize: "24px 24px",
maskImage:
"radial-gradient(ellipse 100% 100% at 50% 50%, black 30%, transparent 60%)",
}}
/>
);
}
function TabButtons(props: {
tabs: Array<{
name: string;
isActive: boolean;
onClick: () => void;
}>;
}) {
return (
<div>
<div className="flex justify-start gap-1 rounded-lg border bg-card p-2 shadow-md md:inline-flex">
{props.tabs.map((tab) => (
<Button
className={cn(
"gap-2 px-4 text-base",
tab.isActive
? "bg-accent text-foreground"
: "bg-transparent text-muted-foreground",
)}
key={tab.name}
onClick={tab.onClick}
variant="ghost"
>
{tab.name}
</Button>
))}
</div>
</div>
);
}
@@ -0,0 +1,33 @@
import { base } from "thirdweb/chains";
export const chain = base;
export const token = {
address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
name: "USD Coin",
symbol: "USDC",
decimals: 6,
};
// export const chain = base;
// export const token = {
// address: "0x0578d8A44db98B23BF096A382e016e29a5Ce0ffe",
// decimals: 18,
// name: "Higher",
// symbol: "HIGHER",
// version: "1",
// };
// export const token = {
// address: "0xfdcC3dd6671eaB0709A4C0f3F53De9a333d80798",
// decimals: 18,
// name: "Stable Coin",
// symbol: "SBC",
// version: "1",
// // primaryType: "Permit",
// }
// export const chain = defineChain(3338);
// export const token = {
// address: "0xbbA60da06c2c5424f03f7434542280FCAd453d10",
// decimals: 6,
// name: "USDC",
// symbol: "USDC",
// version: "2",
// }

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