self.__next_f.push([1,"import { useState, useEffect, useCallback } from 'react';\n\ninterface CantonWallet {\n  isCantonWallet: boolean;\n  version: string;\n  connect: (options?: { dappName?: string }) =\u003e Promise\u003c{ partyId: string }\u003e;\n  disconnect: () =\u003e Promise\u003cvoid\u003e;\n  isConnected: () =\u003e Promise\u003cboolean\u003e;\n  getPartyId: () =\u003e Promise\u003c{ partyId: string }\u003e;\n  getBalances: () =\u003e Promise\u003cunknown\u003e;\n  signAndSubmit: (tx: Record\u003cstring, unknown\u003e) =\u003e Promise\u003c{ transactionId: string }\u003e;\n  on: (event: string, handler: (data?: unknown) =\u003e void) =\u003e void;\n  off: (event: string, handler: (data?: unknown) =\u003e void) =\u003e void;\n}\n\nexport function useZoff() {\n  const [isConnected, setIsConnected] = useState(false);\n  const [partyId, setPartyId] = useState\u003cstring | null\u003e(null);\n\n  useEffect(() =\u003e {\n    const wallet = (window as any).cantonWallet as CantonWallet | undefined;\n    if (!wallet) return;\n\n    const onAccountChanged = (newPartyId: unknown) =\u003e {\n      setPartyId(newPartyId as string);\n    };\n\n    const onDisconnect = () =\u003e {\n      setIsConnected(false);\n      setPartyId(null);\n    };\n\n    wallet.on('accountChanged', onAccountChanged);\n    wallet.on('disconnect', onDisconnect);\n\n    return () =\u003e {\n      wallet.off('accountChanged', onAccountChanged);\n      wallet.off('disconnect', onDisconnect);\n    };\n  }, []);\n\n  const connect = useCallback(async () =\u003e {\n    const wallet = (window as any).cantonWallet as CantonWallet | undefined;\n    if (!wallet) throw new Error('Zoff Wallet not installed');\n\n    const result = await wallet.connect();\n    setIsConnected(true);\n    setPartyId(result.partyId);\n  }, []);\n\n  const disconnect = useCallback(async () =\u003e {\n    const wallet = (window as any).cantonWallet as CantonWallet | undefined;\n    await wallet?.disconnect();\n    setIsConnected(false);\n    setPartyId(null);\n  }, []);\n\n  const signAndSubmit = useCallback(async (transaction: Record\u003cstring, unknown\u003e) =\u003e {\n    const wallet = (window as any).cantonWallet as CantonWallet | undefined;\n    if (!wallet) throw new Error('Zoff Wallet not installed');\n    return wallet.signAndSubmit(transaction);\n  }, []);\n\n  return { isConnected, partyId, connect, disconnect, signAndSubmit };\n}\n"])