@@ -8,6 +8,7 @@ import { useStepProcessDialogContext } from "@/components/global/step-process-di
88import { BuyFractionalStrategy } from "./BuyFractionalStrategy" ;
99import { EOABuyFractionalStrategy } from "./EOABuyFractionalStrategy" ;
1010import { SafeBuyFractionalStrategy } from "./SafeBuyFractionalStrategy" ;
11+ import { Address , getAddress , isAddress } from "viem" ;
1112
1213export const useBuyFractionalStrategy = ( ) : ( ( ) => BuyFractionalStrategy ) => {
1314 const { address, chainId } = useAccount ( ) ;
@@ -20,17 +21,20 @@ export const useBuyFractionalStrategy = (): (() => BuyFractionalStrategy) => {
2021 const activeAddress = selectedAccount ?. address || address ;
2122
2223 return ( ) => {
23- if ( ! activeAddress ) throw new Error ( "No address found" ) ;
24+ if ( ! activeAddress || ! isAddress ( activeAddress ) )
25+ throw new Error ( "No address found" ) ;
2426 if ( ! chainId ) throw new Error ( "No chainId found" ) ;
2527 if ( ! exchangeClient ) throw new Error ( "No HypercertExchangeClient found" ) ;
2628 if ( ! walletClient ) throw new Error ( "No walletClient found" ) ;
2729 if ( ! dialogContext ) throw new Error ( "No dialogContext found" ) ;
2830 if ( ! router ) throw new Error ( "No router found" ) ;
2931
32+ const buyerAddress = getAddress ( activeAddress ) ;
33+
3034 if ( selectedAccount ?. type === "safe" ) {
3135 if ( ! selectedAccount ) throw new Error ( "No selected account found" ) ;
3236 return new SafeBuyFractionalStrategy (
33- activeAddress ,
37+ buyerAddress ,
3438 chainId ,
3539 exchangeClient ,
3640 dialogContext ,
@@ -40,7 +44,7 @@ export const useBuyFractionalStrategy = (): (() => BuyFractionalStrategy) => {
4044 }
4145
4246 return new EOABuyFractionalStrategy (
43- activeAddress ,
47+ buyerAddress ,
4448 chainId ,
4549 exchangeClient ,
4650 dialogContext ,
0 commit comments