API Node Client
Node client for the Bitwala.
For a detailed explanation of our API routes, please check out the documentation
Quick Start
- Go to https://my.bitwala.io/api-apps
- Create an app and store your token ID and secret
yarn add bitwala
; const token = _id: 'SuBnyc6d564P49Uuls' secret: 'LTdFE6hw725yh0aM4m4azACEZSpNrtl4aowFjCZetSAAPBaGN3Ecq7FgMSR5b3Va'; const client = bitwala; client ; /*[ { "collection": "BitcoinInvoices", "currency": "XBT" }]*/
Environments
The client can be initialised with the sandbox
or production
env.
For a breakdown of the differences, see our docs.
Methods
Endpoint | Method | Client |
---|---|---|
/info |
GET | .info() |
/info/inputs |
GET | .info('inputs') |
/info/outputs |
GET | .info('outputs') |
/auth |
GET | .auth() |
/transactions?page=1 |
GET | .transactions.get({page: 1}) |
/transactions?transactionId=transactionId |
GET | .transactions.get({transactionId: 'YRTvEJxAEm3MB1GI'}) |
/transactions?ref=ref |
GET | .transactions.get({ref: 'YRTvEJxAEm3MB1GI'}) |
/transactions |
POST | .transactions.create(yourTransactionObj}) |
/transactions/refresh |
POST | .transactions.refresh({transactionId: transactionId}}) |
/transactions/refresh |
POST | .transactions.refresh({transactionId: transactionId}}) |
Promises / Callbacks
All api calls can be used with promises or callbacks.
With callbacks
client
With promises
client ;
With await
and async
(if you're using ES7)
{ let data; try await data = client; catch err console; console;};
Examples
ref
Get a transaction by clienttransactions; ;
Create a transfer to Germany
clienttransactions ;
Receive and verify webhooks
;;; const token = _id: 'SuBnyc6d564P49Uuls' secret: 'LTdFE6hw725yh0aM4m4azACEZSpNrtl4aowFjCZetSAAPBaGN3Ecq7FgMSR5b3Va'; const router = express; router; router;...