_sendXHR(payload, success, error) {
    return new Promise((resolve, reject) => {
      let url = `${this.host}:${this.port}/json_rpc`,
          id  = this.id
      if (this.logging) {
        console.log('************')
        console.log(`Sending HTTP request to walletd JSON-RPC interface at ${url}...`)
        console.log(`Request (id: ${id}):`)
        console.log(payload)
        console.log('************')
      }

      post({
        url,
        body: payload
      })
      .then(res => {
        if (this.logging) {
          console.log('************')
          console.log (`Request (id: ${id}) to walletd HTTP JSON-RPC interface successful!`)
          console.log(res.status)
          console.log(res.headers)
          console.log(res.body)
          console.log('************')
        }

        res.body = JSON.parse(res.body)
        success  ? success(res) : resolve(res)
      })
      .catch(err => {
        if (this.logging) {
          console.log('************')
          console.log(`Error sending request (id: ${id})`)
          console.log(err)
          console.log('************')
        }

        error ? error(err) : resolve(err)
      })

      this.id++

    })
  }
/**
   * Private method. Sends the actual HTTP request to JSON-RPC daemon
   * @private
   */
Private method. Sends the actual HTTP request to JSON-RPC daemon
@private
Private method . Sends the actual HTTP request to JSON - RPC daemon @private
_sendXHR(payload, success, error) {
    return new Promise((resolve, reject) => {
      let url = `${this.host}:${this.port}/json_rpc`,
          id  = this.id
      if (this.logging) {
        console.log('************')
        console.log(`Sending HTTP request to walletd JSON-RPC interface at ${url}...`)
        console.log(`Request (id: ${id}):`)
        console.log(payload)
        console.log('************')
      }
      post({
        url,
        body: payload
      })
      .then(res => {
        if (this.logging) {
          console.log('************')
          console.log (`Request (id: ${id}) to walletd HTTP JSON-RPC interface successful!`)
          console.log(res.status)
          console.log(res.headers)
          console.log(res.body)
          console.log('************')
        }
        res.body = JSON.parse(res.body)
        success  ? success(res) : resolve(res)
      })
      .catch(err => {
        if (this.logging) {
          console.log('************')
          console.log(`Error sending request (id: ${id})`)
          console.log(err)
          console.log('************')
        }
        error ? error(err) : resolve(err)
      })
      this.id++
    })
  }
_sendXHR ( payload , success , error ) { return new Promise ( ( resolve , reject ) => { let url = ` ${ this . host } ${ this . port } ` , id = this . id if ( this . logging ) { console . log ( '************' ) console . log ( ` ${ url } ` ) console . log ( ` ${ id } ` ) console . log ( payload ) console . log ( '************' ) } post ( { url , body : payload } ) . then ( res => { if ( this . logging ) { console . log ( '************' ) console . log ( ` ${ id } ` ) console . log ( res . status ) console . log ( res . headers ) console . log ( res . body ) console . log ( '************' ) } res . body = JSON . parse ( res . body ) success ? success ( res ) : resolve ( res ) } ) . catch ( err => { if ( this . logging ) { console . log ( '************' ) console . log ( ` ${ id } ` ) console . log ( err ) console . log ( '************' ) } error ? error ( err ) : resolve ( err ) } ) this . id ++ } ) }
Private method.
Private method .