1+ "use client" ;
12import { useMutation , useQuery } from "@tanstack/react-query" ;
23import { useTurnkey } from "@turnkey/sdk-react" ;
34import { queryClient } from "../react-query" ;
4- import { useEnvironment } from "../environment/environment" ;
5- import { usePersistedBTCWallet } from "../onebalance-account/use-btc-account" ;
65
76type TurnkeyBrowserSDK = NonNullable < ReturnType < typeof useTurnkey > [ "turnkey" ] > ;
87export type TurnkeyPasskeyClient = NonNullable <
@@ -20,7 +19,6 @@ export const useTurnkeyAuth = () => {
2019 refetch ( ) ;
2120 } ,
2221 } ) ;
23- const [ , setBTCWallet ] = usePersistedBTCWallet ( ) ;
2422
2523 const {
2624 data : user ,
@@ -45,35 +43,6 @@ export const useTurnkeyAuth = () => {
4543 } ,
4644 } ) ;
4745
48- const { mutate : btcLogin } = useMutation ( {
49- mutationFn : async ( { rootOrgId } : { rootOrgId : string } ) => {
50- return turnkey
51- ?. passkeyClient ( )
52- . getWhoami ( {
53- organizationId : rootOrgId ,
54- } )
55- . then ( ( result ) => {
56- return turnkey
57- ?. passkeyClient ( )
58- . getWallets ( {
59- organizationId : result . organizationId ,
60- } )
61- . then ( ( wallets ) => {
62- return [ wallets , result ] as const ;
63- } ) ;
64- } )
65- . then ( ( [ { wallets } , { organizationId } ] ) => {
66- if ( ! wallets [ 0 ] . walletName . toLowerCase ( ) . includes ( "btc wallet" ) )
67- return ;
68-
69- setBTCWallet ( {
70- walletId : wallets [ 0 ] . walletId ,
71- organizationId,
72- } ) ;
73- } ) ;
74- } ,
75- } ) ;
76-
7746 const { data : wallets } = useQuery ( {
7847 queryKey : [ "wallets" ] ,
7948 queryFn : async ( ) => {
@@ -102,6 +71,5 @@ export const useTurnkeyAuth = () => {
10271 isLoginPending,
10372 isUserLoading,
10473 refreshAuthStatus : refetch ,
105- btcLogin,
10674 } ;
10775} ;
0 commit comments