Docs
manager

Description

One of the most important aspects of a wallet is the session management.

For instance, once a user is logged in, will you be able to determine if they "sign out" or "change networks"?

In combination with our event emitters, we have made a convinent session manager so that you do not have to listen for certain events.

Usage

 sdk.session

Structure

{
  user?: BasicUser;
  network?: BasicNetwork;
  address?: string;
  isOpen: boolean
  lastPing?: number; //unix
}

Example

Get the current address

    let address = sdk.session.address
 
    console.log(address)
    // 'rUmoi1vt8apeKsqFYKMRSiMvWixFDMC8Jz'
 

Get the current network

    let network = sdk.session.network
 
    console.log(network)
    //  protocol: "xrpl" //Protocol;
    //  type: "main" // NetworkTypes;
    //  wss: "wss://xrplcluster.com/";
    //  rpc: "https://xrplcluster.com/";

Get the current user

    let user = sdk.session.user
 
    console.log(user)
    //  username: VIOLET UNICORN;
    //  type: 'local';
    //  slug: '/unicorn;
    //  developer: true;