How to use the opennode.setCredentials function in opennode

To help you get started, we’ve selected a few opennode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tierion / boltwall / src / routes / parseEnv.ts View on Github external
try {
    testEnvVars()
    let { OPEN_NODE_KEY, LND_TLS_CERT, LND_MACAROON, LND_SOCKET } = getEnvVars()
    // if the tests pass above and we don't have a
    // OPEN_NODE_KEY then we need to setup the lnd service
    if (!OPEN_NODE_KEY) {
      const { lnd } = lnService.authenticatedLndGrpc({
        cert: LND_TLS_CERT,
        macaroon: LND_MACAROON,
        socket: LND_SOCKET,
      })
      req.lnd = lnd
    } else {
      const env = process.env.ENVIRONMENT || 'dev'
      const opennode = require('opennode')
      opennode.setCredentials(OPEN_NODE_KEY, env)
      req.opennode = opennode
    }
    next()
  } catch (e) {
    console.error(
      'Problem with configs for connecting to lightning node:',
      e.message
    )
    next("Could not connect to the paywall's lightning node.")
  }
}
github opennodedev / opennode-node / examples / example.js View on Github external
const opennode = require('opennode');

/**
 * Setup your API Key and environment
 */
opennode.setCredentials('MY_API_KEY', 'dev');


/**
 *
 * Fetch charge information
 */

/**
 * Using promises
 */

opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a')
  .then(charge => {
    console.log(charge);
  })
  .catch(error => {

opennode

Node.js library for the OpenNode API.

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis