I am trying to setup a Tezos wallet connectivity using Beacon sdk dappclient. I am adding custom handler on abort for wallt connectivity but for some reason it is not working for custom logic and still falling back to default behaviour. I am following this from the docs: https://docs.walletbeacon.io/advanced/ui-elements

const handleLogin = async () => {
    try {
      setLoading(true); // Start loading

      const handlePermissionRequestError = (error: any) => {
        console.log("Signing request error:", error);
        setLoading(false); // Reset the loading state

      const handlePairInit = async (eventData: {
        p2pPeerInfo: () => Promise<P2PPairingRequest>;
        postmessagePeerInfo: () => Promise<PostMessagePairingRequest>;
        walletConnectPeerInfo: () => Promise<WalletConnectPairingRequest>;
        networkType: NetworkType;
        abortedHandler?(): void;
        disclaimerText?: string;
        analytics: AnalyticsInterface;
        featuredWallets?: string[];
      }): Promise<void> => {
        // If you want to attach your own "on alert closed" handler
        // eslint-disable-next-line @typescript-eslint/unbound-method
        const oldHandler = eventData.abortedHandler;
        const newHandler = async (): Promise<void> => {
          if (oldHandler) {
            // Make sure to call the internal abortedHandler
          // Add your own logic here
          console.log("Pairing process aborted");
          setLoading(false); // Reset the loading state

          eventData.abortedHandler = newHandler; // Replace the internal abortedHandler with the new one
          // await defaultEventCallbacks.PAIR_INIT(eventData); // Add this if you want to keep the default behaviour.
          console.log("syncInfo", eventData);

      dAppClient?.subscribeToEvent(BeaconEvent.PAIR_INIT, handlePairInit);

Any help would be appreciated.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.