Created
December 20, 2013 06:33
-
-
Save jtremback/8051174 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
//Dependencies | |
var unirest = require('unirest'); | |
module.exports = function(id, secret, path, version) { | |
if (!path) var path = 'https://cryptos.io/api/'; | |
if (!version) var version = 'v1/'; | |
return { | |
move: function(from_wallet, to_wallet, amount, coin, callback) { | |
var call = 'move'; | |
unirest.post(path + version + call) | |
.query({ | |
from_wallet: from_wallet | |
, to_wallet: to_wallet | |
, amount: amount | |
, coin: coin | |
, id: id | |
, secret: secret | |
}) | |
.end(function (response) { | |
callback(response.body); | |
}); | |
} | |
, | |
withdraw: function(from_wallet, to_address, amount, coin, callback) { | |
var call = 'withdraw'; | |
unirest.post(path + version + call) | |
.query({ | |
from_wallet: from_wallet | |
, to_address: to_address | |
, amount: amount | |
, coin: coin | |
, id: id | |
, secret: secret | |
}) | |
.end(function (response) { | |
callback(response.body); | |
}); | |
} | |
, | |
viewBalance: function(wallet, coin, callback) { | |
var call = 'balance'; | |
unirest.get(path + version + call) | |
.query({ | |
wallet: wallet | |
, coin: coin | |
, id: id | |
, secret: secret | |
}) | |
.end(function (response) { | |
callback(response.body); | |
}); | |
} | |
, | |
getDepositAddress: function(wallet, coin, callback) { | |
var call = 'deposit_address'; | |
unirest.get(path + version + call) | |
.query({ | |
wallet: wallet | |
, coin: coin | |
, id: id | |
, secret: secret | |
}) | |
.end(function (response) { | |
callback(response.body); | |
}); | |
} | |
}; | |
}; | |
// https://cryptos.io/api/v1/move?from_wallet=foo&to_wallet=bar&amount=34&coin=dog&id=ABCJEHAN&secret=shhhh4566 | |
// https://cryptos.io/api/v1/withdraw?from_wallet=foo&to_address=DRQpm63etc&amount=34&coin=dog&id=ABCJEHAN&secret=shhhh4566 | |
// https://cryptos.io/api/v1/balance?wallet=foo&coin=dog&id=ABCJEHAN&secret=shhhh4566 | |
// https://cryptos.io/api/v1/deposit_address?wallet=foo&coin=dog&id=ABCJEHAN&secret=shhhh4566 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment