This is a client library for interacting with the Teslacoil APIs for sending and receiving bitcoin payments. See our API docs for more information. We are still in beta, and are not open for users yet.
$ yarn add teslacoil
$ npm install --save teslacoil
To get an API key, you first need to register an account on teslacoil.io/signup. After registering, use the GUI to create an API-key. The website will guide you through the process. When you have your API-key, you can get started.
import * as teslacoil from 'teslacoil'
teslacoil.setCredentials(`YOUR-API-KEY`)
The default network is mainnet, but testnet is also supported. You can use the API on testnet by doing:
import * as teslacoil from 'teslacoil'
teslacoil.setCredentials(`YOUR-API-KEY`, 'TESTNET')
import * as teslacoil from 'teslacoil'
teslacoil.setCredentials(`YOUR-API-KEY`, 'TESTNET')
// decode a lightning request
const decodedInvoice = await teslacoil.DecodeLightning('insert payment request here')
// create a invoice for 5000 sats
const invoice = await teslacoil.CreateLightningInvoice({ amount: 5000, currency: 'SAT' })
To read documentation and try out the requests in an interactive mode, see our API docs. Here you will find complete code samples for making requests, as well as what responses look like, for all API endpoints and request types.
$ yarn publish
Lints, checks formatting, makes new git tag, pushes new git tag, build, pushes build to npm