Super hero wallet Connection

Hi, I’m trying to connect superhero wallet to my Daepp, but I’m getting this error below

Uncaught (in promise) MissingCallbackError: Can't find callback for this messageId 1
    at RpcClient._processResponse2

Unhandled Runtime Error
MissingCallbackError: Can't find callback for this messageId 2

Here is the connection code I wrote

import { AeSdkAepp, BrowserWindowMessageConnection, SUBSCRIPTION_TYPES, Node, walletDetector } from '@aeternity/aepp-sdk'

export const scanForWallet = async (aeSdk : AeSdkAepp) => {
     return new Promise((resolve, reject) => {
        if(!aeSdk) reject("Failed!, SDK is not initialized.");
        const scannerConnection = new BrowserWindowMessageConnection()
        const handleNewWallet = async ({ wallets, newWallet} : any) => {
            const wallet = newWallet || Object.values(wallets)[0]
            stopScan();
            await aeSdk.connectToWallet(await wallet.getConnection());

            await aeSdk.subscribeAddress(
                // @ts-ignore
                SUBSCRIPTION_TYPES.subscribe,
                "current"
            );
            resolve(wallet);
        };

        const stopScan = walletDetector(
            scannerConnection,
            handleNewWallet.bind(this)
        );
    })
};

export const iniSDK = async () => {
    try {
    const aeSdk = new AeSdkAepp({
        name: 'Skaker',
            nodes: [ 
                {
                    name: 'ae_uat',
                    instance: new Node("https://testnet.aeternity.io"),
                }
            ],
            compilerUrl: "https://compiler.aepps.com",
            onAddressChange: (p) => console.log("onAddressChange", p),
            onDisconnect: (p) => console.log("onDisconnect", p),
            onNetworkChange: (p) => console.log("onNetworkChange", p)
        });

        await scanForWallet(aeSdk)

        return aeSdk;
    }catch(error){
        console.log(error)
    }
}

I don’t know what I did wrong

Thanks for reaching out to us @paschal533, great to see you developing an æpplication with a Supero wallet connection. Maybe @davidyuk or @marco.chain could help out here?

1 Like

@paschal533 sorry was too busy over the past days. does the problem still exist? did you manage to get it working?

Yes, I’ve got it working.

1 Like

did you remember what was the exact issue? We can publish the resolution to help with similar problems in future

4 Likes

The problem was from my local environment. I deployed the app to netlify, and I stopped seeing the error. And everything works perfect after the deployment.

3 Likes