salt-sdk
    Preparing search index...

    Class NudgeListener

    The Nudge Listener class enables joining Salt account creation processes. Nudges are Websocket events sent from the server, triggered when an admin in the organisation creates a new account. Nudges events will be received by users on the Salt Application, robos, and API clients using this class.

    Index

    Constructors

    • Create an instance of the NudgeListener

      Parameters

      • socketIOConnector: SaltSocket
      • environment: EnvironmentConfig

        The environment configuration

      • authToken: string

        An auth token for Salt

      • signer: Signer

        An ethers signer instance

      Returns NudgeListener

    Methods

    • Stop listening for nudges. This will stop the listener from receiving.

      Returns void

      // to stop reacting to nudges
      nudgeListener.disableNudgeListener()
    • Enables the nudge listener, which will automatically respond to requests to join account creations (i.e. nudges) and sign the required data... This is done automatically when the NudgeListener is constructed.

      Returns void

      // if disabled you can enable the nudge listener again at any point
      nudgeListener.enableNudgeListener()
    • Queue of all the nudges received by the signer.

      Returns { accountId: string; from: string; organisationId: string; to: string }[]

      • accountId: string

        salt account id

        '4838B106FCe9647Bdf1E7877BF73cE8B0BAD5f97'
        
      • from: string

        address of the user nudging

        '0x4838B106FCe9647Bdf1E7877BF73cE8B0BAD5f97'
        
      • organisationId: string

        salt organisation id

        '4838B106FCe9647Bdf1E7877BF73cE8B0BAD5f97'
        
      • to: string

        address of the user being nudged

        '0x4838B106FCe9647Bdf1E7877BF73cE8B0BAD5f97'
        
      // useful if you want to know at any point the queued nudges, i.e. the nudges that will be processed next
      const nudges = nudgeListener.getNudgeQueue()
    • Array of accounts for which a nudge has been processed, i.e. the signer has responsded by joining the account creation process.

      Returns Account[]

      const accounts = nudgeListener.getAccounts();
      // get the signers status on the first account
      const statuses = accounts[0].getSignersStatuses();
      // get one of the signer's registration status
      const registered = statuses['0x1234567890123456789012345678901234567890']?.registered;