sui icon indicating copy to clipboard operation
sui copied to clipboard

wallet-ext: consider adding an event to indicate to dapps the wallet API was injected

Open pchrysochoidis opened this issue 2 years ago • 2 comments

During the dogfooding we saw the following message even when Sui Wallet was installed.

Screenshot 2022-07-04 at 15 10 53

This happened because the dapp was initialised before the DappInterface.

~~We can change the demo dapp to use something like this:~~ Done in #3009

const useSuiWallet = () => {
    const [wallet, setWallet] = useState(null);

    useEffect(() => {
        const cb = () => setWallet(window.suiWallet || null);
        window.addEventListener('load', cb);
        return () => {
            window.removeEventListener('load', cb);
        };
    });
    return wallet;
};

Maybe also trigger a custom event eg suiApiInjected when the interface is injected, from the injection script

pchrysochoidis avatar Jul 04 '22 15:07 pchrysochoidis

Dapp part is fixed. Also pushed the changed to s3 -> http://sui-wallet-demo.s3-website-us-east-1.amazonaws.com/

pchrysochoidis avatar Jul 06 '22 19:07 pchrysochoidis

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 05 '22 02:09 github-actions[bot]

This is no longer relevant with the new wallet standard interface + wallet adapters.

Jordan-Mysten avatar Oct 12 '22 20:10 Jordan-Mysten