Skip to main content

Find Provider

To detect whether the user has UKey Wallet installed, the web application should check whether the window.$ukey.solana object exists.

The UKey Wallet browser extension, UKey Wallet mobile app, and UKey Wallet desktop built-in browser all inject the $ukey.solana object into window in any web application the user visits.

If the window.$ukey.solana object exists, Solana applications can interact with UKey Wallet through the API at window.$ukey.solana. To support legacy integration, this solana object is also accessible at window.solana.

To detect whether UKey Wallet is installed, applications should check for the additional isUKey flag.

const isUKeyInstalled = window.$ukey?.solana?.isUKey;

If UKey Wallet is not detected, the application can prompt the user to install UKey Wallet. One possible handling path:

const getProvider = () => {
if ("$ukey" in window) {
const provider = window.$ukey?.solana;

if (provider?.isUKey) {
return provider;
}
}

window.open("https://ukey.com/zh-CN/download", "_blank");
};