mina_requestAccounts
This method is used to request the current connect account. If there is a connected account, the connected account will be returned. If not, a popup window will show to request a connection.
Params
null
Result
interface ProviderError extends Error {
message: string; // error message.
code: number; // error code.
data?: unknown; // error body.
}
// string[] will contain the connected account address.
Promise<string[] | ProviderError>
Error
1002
The request was rejected by the user.
20001
No account found.
Need create or restore account in Auro Wallet first.
23001
Origin dismatch.
Check origin safe.
Example
Request
await window.mina.requestAccounts().catch((err: any) => err);
Result
// user reject.
{
"code": 1002,
"message": "User rejected the request. "
}
// successful result.
[
"B62qpjxUpgdjzwQfd8q2gzxi99wN7SCgmofpvw27MBkfNHfHoY2VH32"
]
Last updated