sui
sui copied to clipboard
wallet-ext: consider adding an event to indicate to dapps the wallet API was injected
During the dogfooding we saw the following message even when Sui Wallet was installed.
![Screenshot 2022-07-04 at 15 10 53](https://user-images.githubusercontent.com/10210143/177179518-0dba3e49-207d-41a4-a5c9-568498334d7d.png)
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
Dapp part is fixed. Also pushed the changed to s3 -> http://sui-wallet-demo.s3-website-us-east-1.amazonaws.com/
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.
This is no longer relevant with the new wallet standard interface + wallet adapters.