import { InjectedKeplr } from "@keplr-wallet/provider" ; import { KeplrMode } from "@keplr-wallet/types" ; export class RNInjectedKeplr extends InjectedKeplr { static parseWebviewMessage ( message ) { if ( message && typeof message === "string" ) { try { return JSON . parse ( message ) ; } catch { } } return message ; } constructor ( version , mode ) { super ( version , mode , { addMessageListener : ( fn ) => window . addEventListener ( "message" , fn ) , removeMessageListener : ( fn ) => window . removeEventListener ( "message" , fn ) , postMessage : ( message ) => { window . ReactNativeWebView . postMessage ( JSON . stringify ( message ) ) ; } , } , RNInjectedKeplr . parseWebviewMessage ) ; } }