Connect
The recommended and easiest way to connect to Phantom is by callingwindow.phantom.sui.requestAccount().
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Connect your Sui dapp to Phantom by requesting user permission to share their public key.
window.phantom.sui.requestAccount().
const provider = getProvider(); // see "Detecting the Provider"
try {
const resp = await provider.requestAccount();
console.log(resp.publicKey.toString());
} catch (err) {
// { code: 4001, message: 'User rejected the request.' }
}
Was this page helpful?