File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
apps/playground-web/src/components/pay
packages/thirdweb/src/react/web/ui/TransactionButton Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 22
33import { useTheme } from "next-themes" ;
44import { getContract } from "thirdweb" ;
5- import { base , polygon } from "thirdweb/chains" ;
5+ import { prepareTransaction } from "thirdweb" ;
6+ import { base , baseSepolia , polygon } from "thirdweb/chains" ;
67import { transfer } from "thirdweb/extensions/erc20" ;
78import { claimTo , getNFT } from "thirdweb/extensions/erc1155" ;
89import {
@@ -12,6 +13,7 @@ import {
1213 useActiveAccount ,
1314 useReadContract ,
1415} from "thirdweb/react" ;
16+ import { toWei } from "thirdweb/utils" ;
1517import { THIRDWEB_CLIENT } from "../../lib/client" ;
1618import { StyledConnectButton } from "../styled-connect-button" ;
1719
@@ -99,6 +101,27 @@ export function PayTransactionButtonPreview() {
99101 >
100102 Buy VIP Pass
101103 </ TransactionButton >
104+ < div className = "h-10" />
105+ < div className = "flex items-center gap-2" > Price: 0.1 ETH</ div >
106+ < TransactionButton
107+ transaction = { ( ) => {
108+ if ( ! account ) throw new Error ( "No active account" ) ;
109+ return prepareTransaction ( {
110+ chain : baseSepolia ,
111+ client : THIRDWEB_CLIENT ,
112+ to : account . address ,
113+ value : toWei ( "0.1" ) ,
114+ } ) ;
115+ } }
116+ onError = { ( e ) => {
117+ console . error ( e ) ;
118+ } }
119+ payModal = { {
120+ theme : theme === "light" ? "light" : "dark" ,
121+ } }
122+ >
123+ Send 0.1 ETH
124+ </ TransactionButton >
102125 </ div >
103126 ) }
104127 </ >
Original file line number Diff line number Diff line change @@ -52,7 +52,10 @@ export function TransactionModal(props: ModalProps) {
5252 toToken : props . tx . erc20Value
5353 ? ( await resolvePromisedValue ( props . tx . erc20Value ) ) ?. tokenAddress
5454 : undefined ,
55- event : "open_pay_transaction_modal" ,
55+ event :
56+ props . modalMode === "buy"
57+ ? "open_pay_transaction_modal"
58+ : "open_pay_deposit_modal" ,
5659 } ) ;
5760
5861 return null ;
You can’t perform that action at this time.
0 commit comments