Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set api endpoint #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ To-Do:
CHANGELOG:
0.0.3 - Add /contact_info/ and /contact_info/{contact_id} routes

0.0.4 - Add ability to set api endpoint (it needs for user in russia because localbitcoins.com is blocked). Usage:
```
var lbc = new LBCClient(api_key, api_secret, {
apiUrl: 'https://localbitcoins.net/api'
});
```

Credit:

Initially inspired by:
Expand Down
5 changes: 2 additions & 3 deletions localbitcoins.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ var crypto = require('crypto');
var querystring = require('querystring');


function LBCClient(key, secret, otp) {
function LBCClient(key, secret, opt = {}) {
var nonce = new Date() * 1000;
var self = this;

var config = {
url: 'https://localbitcoins.com/api',
url: opt.apiUrl || 'https://localbitcoins.com/api',
key: key,
secret: secret,
otp: otp,
timeoutMS: 5000
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "localbitcoins-api",
"version": "0.0.3",
"version": "0.0.4",
"description": "LocalBitcoins API wrapper for NodeJS",
"keywords": [
"localbitcoins",
Expand Down