NearFi Wallet
  • Introduction
  • App
    • Manage Assets
    • Dapp Browser
    • Import Multiple Accounts
    • Access Key Management
    • Address Book
  • Developer Guide
    • Integrate NearFi Dapp browser into your app
      • Detecting NearFi wallet provider ready
      • Sign-in & sign-out with NearFi
      • Getting account information
      • Send transactions
      • Events
      • Wallet selector
  • Terms and Condition
  • Privacy
  • Support
Powered by GitBook
On this page
  1. Developer Guide
  2. Integrate NearFi Dapp browser into your app

Events

Events emitted when there are state changes with the wallet

NearFi currently supports 3 event types

  • signIn: emitted when the current NearFi wallet account is connected to user application

  • signOut: emitted when the user disconnects/sign-outs the wallet from the application

  • accountChanged: emitted when the wallet user switches from the current wallet to another wallet

Code examples

//register
window.nearFiWallet.on("signIn", function() => {
    //write code to proceed after signing in
})
window.nearFiWallet.on("signOut", function() => {
    //write code to proceed after signing out
})
window.nearFiWallet.on("accountChanged", function() => {
    //reload when account changed
    window.location.reload()
})

//remove events
window.nearFiWallet.remove("signIn")

//register event for once used when the application only wants 
// to listen to the first event instance
window.nearFiWallet.once("signIn", function() => {
    //write code to proceed after signing in
})
PreviousSend transactionsNextWallet selector

Last updated 2 years ago