import { Env , Handler , InternalHandler , Message } from "@keplr-wallet/router" ; import { PushEventDataMsg , PushInteractionDataMsg } from "./messages" ; import { InteractionForegroundService } from "./service" ; export const getHandler = ( service ) => { return ( env , msg ) => { switch ( msg . constructor ) { case PushInteractionDataMsg : return handlePushInteractionDataMsg ( service ) ( env , msg as PushInteractionDataMsg ) ; case PushEventDataMsg : return handlePushEventDataMsg ( service ) ( env , msg as PushEventDataMsg ) ; default : throw new Error ( "Unknown msg type" ) ; } } ; } ; const handlePushInteractionDataMsg = ( service ) => { return ( _ , msg ) => { return service . pushData ( msg . data ) ; } ; } ; const handlePushEventDataMsg = ( service ) => { return ( _ , msg ) => { return service . pushEvent ( msg . data ) ; } ; } ;