22
33import { getStellarWalletKit } from "@/lib/helpers/stellar/wallet" ;
44import { useStellarWalletStore } from "@/stores/stellarWalletStore" ;
5- import { notify } from "@/lib/toast" ;
6-
7- const FREIGHTER_MOBILE_TOAST_KEY = "neko_freighter_mobile_toast_shown" ;
8-
9- function isFreighterMobileBrowser ( ) : boolean {
10- if ( typeof window === "undefined" ) return false ;
11- const s = (
12- window as Window & { stellar ?: { provider ?: string ; platform ?: string } }
13- ) . stellar ;
14- return s ?. provider === "freighter" && s ?. platform === "mobile" ;
15- }
165
176export function useStellarWallet ( ) {
187 const { address, walletName, setWallet, clearWallet } =
@@ -24,22 +13,6 @@ export function useStellarWallet() {
2413 // v2 authModal returns { address } directly — no callback needed.
2514 const { address : walletAddress } = await Kit . authModal ( ) ;
2615 setWallet ( { address : walletAddress , walletName : "Stellar Wallet" } ) ;
27-
28- // When in Freighter's mobile in-app browser the only available option
29- // is WalletConnect. Freighter will show an "Untrusted Transaction Domain"
30- // warning the first time a transaction comes through — remind the user to
31- // tap Trust so transactions don't get silently rejected.
32- if (
33- isFreighterMobileBrowser ( ) &&
34- ! sessionStorage . getItem ( FREIGHTER_MOBILE_TOAST_KEY )
35- ) {
36- sessionStorage . setItem ( FREIGHTER_MOBILE_TOAST_KEY , "1" ) ;
37- notify ( "Trust this domain in Freighter" , "info" , {
38- description :
39- "When Freighter asks to trust this domain, tap Trust — otherwise transaction signing will be blocked." ,
40- duration : 8000 ,
41- } ) ;
42- }
4316 } ;
4417
4518 const disconnect = async ( ) => {
0 commit comments