@@ -24,6 +24,8 @@ import {
2424 CardTitle ,
2525} from "@/components/ui/card" ;
2626import { Input } from "@/components/ui/input" ;
27+ import { InputTokenAmount } from "@/components/ui/input-token-amount" ;
28+ import type { TokenInfo } from "@/types/token" ;
2729
2830export const Route = createFileRoute ( "/examples/transfer-sol" ) ( {
2931 component : ( ) => < TransferSolPage /> ,
@@ -59,6 +61,14 @@ const TransferSolPage: React.FC = () => {
5961 address : signer ?. address ?? null ,
6062 } ) ;
6163
64+ // SOL token info
65+ const solToken : TokenInfo = {
66+ address : "11111111111111111111111111111111" ,
67+ symbol : "SOL" ,
68+ decimals : 9 ,
69+ name : "Solana" ,
70+ } ;
71+
6272 const {
6373 register,
6474 handleSubmit,
@@ -182,32 +192,18 @@ const TransferSolPage: React.FC = () => {
182192 </ div >
183193
184194 < div className = "space-y-2" >
185- < div className = "flex items-center justify-between" >
186- < label htmlFor = "amount" className = "text-sm font-medium" >
187- Amount (SOL)
188- </ label >
189- < button
190- type = "button"
191- onClick = { ( ) => {
192- const maxAmount = Math . max (
193- 0 ,
194- availableBalance - estimatedFee ,
195- ) ;
196- setValue ( "amount" , maxAmount . toFixed ( 9 ) ) ;
197- } }
198- className = "text-xs text-primary hover:underline"
199- disabled = { isSubmitting }
200- >
201- MAX: { Math . max ( 0 , availableBalance - estimatedFee ) . toFixed ( 4 ) } { " " }
202- SOL
203- </ button >
204- </ div >
205- < Input
206- id = "amount"
207- type = "text"
208- placeholder = "0.0"
209- { ...register ( "amount" ) }
210- className = { errors . amount ? "border-destructive" : "" }
195+ < label htmlFor = "amount" className = "text-sm font-medium" >
196+ Amount to Send
197+ </ label >
198+ < InputTokenAmount
199+ token = { solToken }
200+ value = { watch ( "amount" ) }
201+ onChange = { ( value ) => {
202+ setValue ( "amount" , value ) ;
203+ } }
204+ maxAmount = { Math . max ( 0 , availableBalance - estimatedFee ) . toFixed (
205+ 9 ,
206+ ) }
211207 disabled = { isSubmitting }
212208 />
213209 { errors . amount && (
0 commit comments