Auro Wallet Docs
  • Getting Started
  • How to integrate
    • Connect Wallet
    • Add or Switch Chain
    • Create Nullifier
    • Send Transaction
    • Send zk Transaction
    • Sign Message
    • VerifyMessage in server-side
    • Anonymous Credentials
    • Building zkApp on Android
  • Wallet Basics
    • Submit token info
    • ​Pull Up Auro Wallet with DeepLink
    • Mina Providers
  • Reference
    • API Reference
      • Methods
        • mina_accounts
        • mina_requestAccounts
        • mina_requestNetwork
        • mina_sendPayment
        • mina_sendStakeDelegation
        • mina_sendTransaction
        • mina_addChain
        • mina_switchChain
        • mina_createNullifier
        • mina_signMessage
        • mina_sign_JsonMessage
        • mina_verifyMessage
        • mina_signFields
        • mina_verifyFields
        • mina_storePrivateCredential
        • mina_requestPresentation
      • Events
      • Error
      • Source
Powered by GitBook
On this page
  • Request Account
  • Account Event
Edit on GitHub
  1. How to integrate

Connect Wallet

Scenarios for connect wallets and request accounts.

PreviousHow to integrateNextAdd or Switch Chain

Last updated 7 months ago

When using the API, you need to ensure that the browser has successfully obtained the window.mina object.

The presence of the mina provider object window.mina, in a user's browser indicates an Mina Protocol user.

To demonstrate this, verify whether your browser is running Auro Wallet by copying and pasting the following code snippet into your browser's developer console.

if (typeof window.mina !== 'undefined') {
  console.log('Auro Wallet is installed!');
}

Request Account

Interactive with Auro Wallet require connect account. This method returns an array when user confirm authorizes, which contains address that authenticated. The current array returns one address at a time. Returns a ProviderError when user reject authorization.

const account:string[]|ProviderError = await window.mina.requestAccounts()
    .catch((err: any) => err);

console.log(account)

requestAccounts will show a popup window when Auro Wallet lock or have no connected account, if you want to request account without popup window. You can use .

let account = await window.mina?.getAccounts();

console.log(account);

Account Event

This method is used to monitor account changes. When the account changes, the monitoring will be trigger.

window.mina?.on("accountsChanged", (accounts: string[]) => {
    console.log(accounts);
});
getAccounts