Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.19 KB

mina_requestaccounts.md

File metadata and controls

52 lines (38 loc) · 1.19 KB
description
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.

mina_requestAccounts

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

1002The request was rejected by the user.
20001No account found.Need create or restore account in Auro Wallet first.
23001Origin 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"
]