1
- import { usePrivy } from ' @privy-io/expo' ;
2
- import abi from ' ../contracts/base_abi.json' ;
3
- import { useSmartWallets } from ' @privy-io/expo/smart-wallets' ;
4
- import { encodeFunctionData } from ' viem' ;
1
+ import { usePrivy } from " @privy-io/expo" ;
2
+ import abi from " ../contracts/base_abi.json" ;
3
+ import { useSmartWallets } from " @privy-io/expo/smart-wallets" ;
4
+ import { encodeFunctionData } from " viem" ;
5
5
6
6
export function useBaseContract ( ) {
7
7
const { user } = usePrivy ( ) ;
@@ -11,7 +11,7 @@ export function useBaseContract() {
11
11
if (
12
12
user &&
13
13
user . linked_accounts &&
14
- user . linked_accounts . findIndex ( ( f ) => f . type === ' smart_wallet' ) >= 0
14
+ user . linked_accounts . findIndex ( ( f ) => f . type === " smart_wallet" ) >= 0
15
15
) {
16
16
// smart wallet
17
17
if ( client ) {
@@ -21,29 +21,29 @@ export function useBaseContract() {
21
21
// }); // base-sepolia
22
22
const fndata = encodeFunctionData ( {
23
23
abi : abi . abi ,
24
- functionName : ' claimUSDC' ,
24
+ functionName : " claimUSDC" ,
25
25
args : [ amount ] ,
26
26
} ) ;
27
27
const tx = await client . sendTransaction ( {
28
28
account : client . account ,
29
29
calls : [
30
30
{
31
- to : '0xB8760af2a4F4Df2225894324C106d587951D00CC' as `0x${string } `,
31
+ to : "0xB445f1c6FD6BD19Fe196A5894D12F46b66e5Ad29" as `0x${string } `,
32
32
data : fndata ,
33
33
} ,
34
34
] ,
35
35
} ) ;
36
36
return tx ;
37
37
} catch ( error ) {
38
- console . error ( ' Error getting client or sending transaction:' , error ) ;
38
+ console . error ( " Error getting client or sending transaction:" , error ) ;
39
39
throw error ;
40
40
}
41
41
} else {
42
- console . error ( ' SmartWallets not available' ) ;
43
- throw new Error ( ' SmartWallets not available' ) ;
42
+ console . error ( " SmartWallets not available" ) ;
43
+ throw new Error ( " SmartWallets not available" ) ;
44
44
}
45
45
} else {
46
- alert ( ' Non-smart wallet not supported yet' ) ;
46
+ alert ( " Non-smart wallet not supported yet" ) ;
47
47
return null ;
48
48
}
49
49
} ;
0 commit comments