|
|
@ -151,7 +151,12 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
// DEPRECATED
|
|
|
|
router.post('/v1/wallets/', function(req, res) { |
|
|
|
logDeprecated(req); |
|
|
|
var server = getServer(req, res); |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|
} catch (ex) { |
|
|
|
return returnError(ex, res, req); |
|
|
|
} |
|
|
|
req.body.supportBIP44AndP2PKH = false; |
|
|
|
server.createWallet(req.body, function(err, walletId) { |
|
|
|
if (err) return returnError(err, res, req); |
|
|
@ -162,7 +167,12 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
}); |
|
|
|
|
|
|
|
router.post('/v2/wallets/', function(req, res) { |
|
|
|
var server = getServer(req, res); |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|
} catch (ex) { |
|
|
|
return returnError(ex, res, req); |
|
|
|
} |
|
|
|
server.createWallet(req.body, function(err, walletId) { |
|
|
|
if (err) return returnError(err, res, req); |
|
|
|
res.json({ |
|
|
@ -173,7 +183,12 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
|
|
|
|
router.put('/v1/copayers/:id/', function(req, res) { |
|
|
|
req.body.copayerId = req.params['id']; |
|
|
|
var server = getServer(req, res); |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|
} catch (ex) { |
|
|
|
return returnError(ex, res, req); |
|
|
|
} |
|
|
|
server.addAccess(req.body, function(err, result) { |
|
|
|
if (err) return returnError(err, res, req); |
|
|
|
res.json(result); |
|
|
@ -185,7 +200,12 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
logDeprecated(req); |
|
|
|
req.body.walletId = req.params['id']; |
|
|
|
req.body.supportBIP44AndP2PKH = false; |
|
|
|
var server = getServer(req, res); |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|
} catch (ex) { |
|
|
|
return returnError(ex, res, req); |
|
|
|
} |
|
|
|
server.joinWallet(req.body, function(err, result) { |
|
|
|
if (err) return returnError(err, res, req); |
|
|
|
|
|
|
@ -195,7 +215,12 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
|
|
|
|
router.post('/v2/wallets/:id/copayers/', function(req, res) { |
|
|
|
req.body.walletId = req.params['id']; |
|
|
|
var server = getServer(req, res); |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|
} catch (ex) { |
|
|
|
return returnError(ex, res, req); |
|
|
|
} |
|
|
|
server.joinWallet(req.body, function(err, result) { |
|
|
|
if (err) return returnError(err, res, req); |
|
|
|
|
|
|
@ -340,7 +365,12 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
logDeprecated(req); |
|
|
|
var opts = {}; |
|
|
|
if (req.query.network) opts.network = req.query.network; |
|
|
|
var server = getServer(req, res); |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|
} catch (ex) { |
|
|
|
return returnError(ex, res, req); |
|
|
|
} |
|
|
|
server.getFeeLevels(opts, function(err, feeLevels) { |
|
|
|
if (err) return returnError(err, res, req); |
|
|
|
_.each(feeLevels, function(feeLevel) { |
|
|
@ -354,7 +384,12 @@ ExpressApp.prototype.start = function(opts, cb) { |
|
|
|
router.get('/v2/feelevels/', function(req, res) { |
|
|
|
var opts = {}; |
|
|
|
if (req.query.network) opts.network = req.query.network; |
|
|
|
var server = getServer(req, res); |
|
|
|
var server; |
|
|
|
try { |
|
|
|
server = getServer(req, res); |
|
|
|
} catch (ex) { |
|
|
|
return returnError(ex, res, req); |
|
|
|
} |
|
|
|
server.getFeeLevels(opts, function(err, feeLevels) { |
|
|
|
if (err) return returnError(err, res, req); |
|
|
|
res.json(feeLevels); |
|
|
|