From f42d60769b69fafa48b4900d3dd272cc1a4168aa Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 13 Aug 2016 03:45:05 -0700 Subject: [PATCH] http: cli and client refactoring. --- bin/cli | 69 +++--- lib/bcoin/http/client.js | 520 ++++++++++++++++++++------------------- lib/bcoin/http/server.js | 6 - lib/bcoin/http/wallet.js | 34 +-- 4 files changed, 314 insertions(+), 315 deletions(-) diff --git a/bin/cli b/bin/cli index 47101da5..9cf64d57 100755 --- a/bin/cli +++ b/bin/cli @@ -27,7 +27,8 @@ CLI.prototype.log = function log(json) { }; CLI.prototype.createWallet = function createWallet(callback) { - var options = { id: this.config.id }; + var self = this; + var options = { id: this.argv[0] }; if (this.config.type) options.type = this.config.type; @@ -60,12 +61,8 @@ CLI.prototype.createWallet = function createWallet(callback) { CLI.prototype.addKey = function addKey(callback) { var self = this; - var keys = this.config.keys || this.config.key; - if (keys) - keys = keys.split(','); - else - keys = this.argv; - this.wallet.addKey(this.config.account, keys, function(err, wallet) { + var key = this.argv[0]; + this.wallet.addKey(this.config.account, key, function(err, wallet) { if (err) return callback(err); self.log('added'); @@ -73,13 +70,13 @@ CLI.prototype.addKey = function addKey(callback) { }); }; -CLI.prototype.createAccount = function createAccount(callback) { +CLI.prototype.removeKey = function removeKey(callback) { var self = this; - var account = this.argv[0] || this.config.account; - this.wallet.createAccount(account, function(err, account) { + var key = this.argv[0]; + this.wallet.removeKey(this.config.account, key, function(err) { if (err) return callback(err); - self.log(account); + self.log('removed'); callback(); }); }; @@ -95,6 +92,17 @@ CLI.prototype.getAccount = function getAccount(callback) { }); }; +CLI.prototype.createAccount = function createAccount(callback) { + var self = this; + var account = this.argv[0]; + this.wallet.createAccount(account, function(err, account) { + if (err) + return callback(err); + self.log(account); + callback(); + }); +}; + CLI.prototype.getAccounts = function getAccounts(callback) { var self = this; this.wallet.getAccounts(function(err, accounts) { @@ -105,25 +113,9 @@ CLI.prototype.getAccounts = function getAccounts(callback) { }); }; -CLI.prototype.removeKey = function removeKey(callback) { - var self = this; - var keys = this.config.keys || this.config.key; - if (keys) - keys = keys.split(','); - else - keys = this.argv; - this.wallet.removeKey(this.config.account, keys, function(err) { - if (err) - return callback(err); - self.log('removed'); - callback(); - }); -}; - CLI.prototype.getWallet = function getWallet(callback) { var self = this; - var passphrase = this.argv[0]; - this.wallet.getInfo(this.config.account, passphrase, function(err, wallet) { + this.wallet.getInfo(function(err, wallet) { if (err) return callback(err); self.log(wallet); @@ -262,6 +254,8 @@ CLI.prototype.getMempool = function getMempool(callback) { CLI.prototype.sendTX = function sendTX(callback) { var self = this; var output = {}; + var options; + if (this.config.script) { output.script = this.config.script; output.value = utils.satoshi(this.config.value || this.argv[0]); @@ -269,11 +263,13 @@ CLI.prototype.sendTX = function sendTX(callback) { output.address = this.config.address || this.argv[0]; output.value = utils.satoshi(this.config.value || this.argv[1]); } - var options = { + + options = { account: this.config.account, passphrase: this.config.passphrase, outputs: [output] }; + this.wallet.send(options, function(err, tx) { if (err) return callback(err); @@ -284,8 +280,9 @@ CLI.prototype.sendTX = function sendTX(callback) { CLI.prototype.createTX = function createTX(callback) { var self = this; - var options = { account: this.config.account, passphrase: this.config.passphrase }; var output = {}; + var options; + if (this.config.script) { output.script = this.config.script; output.value = utils.satoshi(this.config.value || this.argv[0]); @@ -293,7 +290,13 @@ CLI.prototype.createTX = function createTX(callback) { output.address = this.config.address || this.argv[0]; output.value = utils.satoshi(this.config.value || this.argv[1]); } - options.outputs = [output]; + + options = { + account: this.config.account, + passphrase: this.config.passphrase, + outputs: [output] + }; + this.wallet.createTX(options, function(err, tx) { if (err) return callback(err); @@ -387,7 +390,7 @@ CLI.prototype.handleWallet = function handleWallet(callback) { var self = this; var options = { - id: this.config.id, + id: this.config.id || 'primary', token: this.config.token }; @@ -541,7 +544,7 @@ CLI.prototype.open = function open(callback) { CLI.prototype.destroy = function destroy(callback) { if (this.wallet) - this.wallet.destroy(); + this.wallet.client.destroy(); if (this.client) this.client.destroy(); callback(); diff --git a/lib/bcoin/http/client.js b/lib/bcoin/http/client.js index 843bb8de..bdef1aaf 100644 --- a/lib/bcoin/http/client.js +++ b/lib/bcoin/http/client.js @@ -140,46 +140,6 @@ HTTPClient.prototype._close = function close(callback) { return utils.nextTick(callback); }; -/** - * Listen for events on wallet id. - * @param {WalletID} id - */ - -HTTPClient.prototype.joinWallet = function joinWallet(id, token, callback) { - if (!this.socket) - return callback(); - - this.socket.emit('wallet join', id, token, callback); -}; - -/** - * Unlisten for events on wallet id. - * @param {WalletID} id - */ - -HTTPClient.prototype.leaveWallet = function leaveWallet(id, callback) { - if (!this.socket) - return callback(); - - this.socket.emit('wallet leave', id, callback); -}; - -/** - * Listen for events on all wallets. - */ - -HTTPClient.prototype.all = function all(token, callback) { - this.joinWallet('!all', token, callback); -}; - -/** - * Unlisten for events on all wallets. - */ - -HTTPClient.prototype.none = function none(callback) { - this.leaveWallet('!all', callback); -}; - /** * Make an http request to endpoint. * @private @@ -302,198 +262,21 @@ HTTPClient.prototype._del = function _del(endpoint, json, callback) { }; /** - * Request the raw wallet JSON (will create wallet if it does not exist). - * @private - * @param {Object} options - See {@link Wallet}. + * Get a mempool snapshot. + * @param {Function} callback - Returns [Error, {@link TX}[]]. + */ + +HTTPClient.prototype.getMempool = function getMempool(callback) { + return this._get('/mempool', callback); +}; + +/** + * Get some info about the server (network and version). * @param {Function} callback - Returns [Error, Object]. */ -HTTPClient.prototype.createWallet = function createWallet(options, callback) { - return this._post('/wallet', options, callback); -}; - -/** - * Get the raw wallet JSON. - * @private - * @param {WalletID} id - * @param {Function} callback - Returns [Error, Object]. - */ - -HTTPClient.prototype.getWallet = function getWallet(id, callback) { - return this._get('/wallet/' + id, callback); -}; - -/** - * Get wallet transaction history. - * @param {WalletID} id - * @param {Function} callback - Returns [Error, {@link TX}[]]. - */ - -HTTPClient.prototype.getWalletHistory = function getWalletHistory(id, account, callback) { - var options; - - if (typeof account === 'function') { - callback = account; - account = null; - } - - options = { account: account }; - - return this._get('/wallet/' + id + '/tx/history', options, callback); -}; - -/** - * Get wallet coins. - * @param {WalletID} id - * @param {Function} callback - Returns [Error, {@link Coin}[]]. - */ - -HTTPClient.prototype.getWalletCoins = function getWalletCoins(id, account, callback) { - var options; - - if (typeof account === 'function') { - callback = account; - account = null; - } - - options = { account: account }; - - return this._get('/wallet/' + id + '/coin', options, callback); -}; - -/** - * Get all unconfirmed transactions. - * @param {WalletID} id - * @param {Function} callback - Returns [Error, {@link TX}[]]. - */ - -HTTPClient.prototype.getWalletUnconfirmed = function getUnconfirmed(id, account, callback) { - var options; - - if (typeof account === 'function') { - callback = account; - account = null; - } - - options = { account: account }; - - return this._get('/wallet/' + id + '/tx/unconfirmed', options, callback); -}; - -/** - * Calculate wallet balance. - * @param {WalletID} id - * @param {Function} callback - Returns [Error, {@link Balance}]. - */ - -HTTPClient.prototype.getWalletBalance = function getBalance(id, account, callback) { - var options; - - if (typeof account === 'function') { - callback = account; - account = null; - } - - options = { account: account }; - - return this._get('/wallet/' + id + '/balance', options, callback); -}; - -/** - * Get last N wallet transactions. - * @param {WalletID} id - * @param {Number} limit - Max number of transactions. - * @param {Function} callback - Returns [Error, {@link TX}[]]. - */ - -HTTPClient.prototype.getWalletLast = function getWalletLast(id, account, limit, callback) { - var options; - - if (typeof account === 'function') { - callback = account; - account = null; - } - - options = { account: account, limit: limit }; - - return this._get('/wallet/' + id + '/tx/last', options, callback); -}; - -/** - * Get wallet transactions by timestamp range. - * @param {WalletID} id - * @param {Object} options - * @param {Number} options.start - Start time. - * @param {Number} options.end - End time. - * @param {Number?} options.limit - Max number of records. - * @param {Boolean?} options.reverse - Reverse order. - * @param {Function} callback - Returns [Error, {@link TX}[]]. - */ - -HTTPClient.prototype.getWalletRange = function getWalletRange(id, account, options, callback) { - if (typeof options === 'function') { - callback = options; - options = account; - account = null; - } - - options = { - account: account || options.account, - start: options.start, - end: options.end , - limit: options.limit, - reverse: options.reverse - }; - - return this._get('/wallet/' + id + '/tx/range', options, callback); -}; - -/** - * Get transaction (only possible if the transaction - * is available in the wallet history). - * @param {WalletID} id - * @param {Hash} hash - * @param {Function} callback - Returns [Error, {@link TX}[]]. - */ - -HTTPClient.prototype.getWalletTX = function getTX(id, account, hash, callback) { - var options; - - if (typeof hash === 'function') { - callback = hash; - hash = account; - account = null; - } - - options = { account: account }; - - return this._get('/wallet/' + id + '/tx/' + hash, options, callback); -}; - -/** - * Get unspent coin (only possible if the transaction - * is available in the wallet history). - * @param {WalletID} id - * @param {Hash} hash - * @param {Number} index - * @param {Function} callback - Returns [Error, {@link Coin}[]]. - */ - -HTTPClient.prototype.getWalletCoin = function getCoin(id, account, hash, index, callback) { - var options, path; - - if (typeof hash === 'function') { - callback = index; - index = hash; - hash = account; - account = null; - } - - options = { account: account }; - - path = '/wallet/' + id + '/coin/' + hash + '/' + index; - - return this._get(path, options, callback); +HTTPClient.prototype.getInfo = function getInfo(callback) { + return this._get('/', callback); }; /** @@ -566,6 +349,241 @@ HTTPClient.prototype.broadcast = function broadcast(tx, callback) { return this._post('/broadcast', body, callback); }; +/** + * Listen for events on wallet id. + * @param {WalletID} id + */ + +HTTPClient.prototype.join = function join(id, token, callback) { + if (!this.socket) + return callback(); + + this.socket.emit('wallet join', id, token, callback); +}; + +/** + * Unlisten for events on wallet id. + * @param {WalletID} id + */ + +HTTPClient.prototype.leave = function leave(id, callback) { + if (!this.socket) + return callback(); + + this.socket.emit('wallet leave', id, callback); +}; + +/** + * Listen for events on all wallets. + */ + +HTTPClient.prototype.all = function all(token, callback) { + this.join('!all', token, callback); +}; + +/** + * Unlisten for events on all wallets. + */ + +HTTPClient.prototype.none = function none(callback) { + this.leave('!all', callback); +}; + +/** + * Request the raw wallet JSON (will create wallet if it does not exist). + * @private + * @param {Object} options - See {@link Wallet}. + * @param {Function} callback - Returns [Error, Object]. + */ + +HTTPClient.prototype.createWallet = function createWallet(options, callback) { + return this._post('/wallet', options, callback); +}; + +/** + * Get the raw wallet JSON. + * @private + * @param {WalletID} id + * @param {Function} callback - Returns [Error, Object]. + */ + +HTTPClient.prototype.getWallet = function getWallet(id, callback) { + return this._get('/wallet/' + id, callback); +}; + +/** + * Get wallet transaction history. + * @param {WalletID} id + * @param {Function} callback - Returns [Error, {@link TX}[]]. + */ + +HTTPClient.prototype.getHistory = function getHistory(id, account, callback) { + var options; + + if (typeof account === 'function') { + callback = account; + account = null; + } + + options = { account: account }; + + return this._get('/wallet/' + id + '/tx/history', options, callback); +}; + +/** + * Get wallet coins. + * @param {WalletID} id + * @param {Function} callback - Returns [Error, {@link Coin}[]]. + */ + +HTTPClient.prototype.getCoins = function getCoins(id, account, callback) { + var options; + + if (typeof account === 'function') { + callback = account; + account = null; + } + + options = { account: account }; + + return this._get('/wallet/' + id + '/coin', options, callback); +}; + +/** + * Get all unconfirmed transactions. + * @param {WalletID} id + * @param {Function} callback - Returns [Error, {@link TX}[]]. + */ + +HTTPClient.prototype.getUnconfirmed = function getUnconfirmed(id, account, callback) { + var options; + + if (typeof account === 'function') { + callback = account; + account = null; + } + + options = { account: account }; + + return this._get('/wallet/' + id + '/tx/unconfirmed', options, callback); +}; + +/** + * Calculate wallet balance. + * @param {WalletID} id + * @param {Function} callback - Returns [Error, {@link Balance}]. + */ + +HTTPClient.prototype.getBalance = function getBalance(id, account, callback) { + var options; + + if (typeof account === 'function') { + callback = account; + account = null; + } + + options = { account: account }; + + return this._get('/wallet/' + id + '/balance', options, callback); +}; + +/** + * Get last N wallet transactions. + * @param {WalletID} id + * @param {Number} limit - Max number of transactions. + * @param {Function} callback - Returns [Error, {@link TX}[]]. + */ + +HTTPClient.prototype.getLast = function getLast(id, account, limit, callback) { + var options; + + if (typeof account === 'function') { + callback = account; + account = null; + } + + options = { account: account, limit: limit }; + + return this._get('/wallet/' + id + '/tx/last', options, callback); +}; + +/** + * Get wallet transactions by timestamp range. + * @param {WalletID} id + * @param {Object} options + * @param {Number} options.start - Start time. + * @param {Number} options.end - End time. + * @param {Number?} options.limit - Max number of records. + * @param {Boolean?} options.reverse - Reverse order. + * @param {Function} callback - Returns [Error, {@link TX}[]]. + */ + +HTTPClient.prototype.getRange = function getRange(id, account, options, callback) { + if (typeof options === 'function') { + callback = options; + options = account; + account = null; + } + + options = { + account: account, + start: options.start, + end: options.end , + limit: options.limit, + reverse: options.reverse + }; + + return this._get('/wallet/' + id + '/tx/range', options, callback); +}; + +/** + * Get transaction (only possible if the transaction + * is available in the wallet history). + * @param {WalletID} id + * @param {Hash} hash + * @param {Function} callback - Returns [Error, {@link TX}[]]. + */ + +HTTPClient.prototype.getWalletTX = function getWalletTX(id, account, hash, callback) { + var options; + + if (typeof hash === 'function') { + callback = hash; + hash = account; + account = null; + } + + options = { account: account }; + + return this._get('/wallet/' + id + '/tx/' + hash, options, callback); +}; + +/** + * Get unspent coin (only possible if the transaction + * is available in the wallet history). + * @param {WalletID} id + * @param {Hash} hash + * @param {Number} index + * @param {Function} callback - Returns [Error, {@link Coin}[]]. + */ + +HTTPClient.prototype.getWalletCoin = function getWalletCoin(id, account, hash, index, callback) { + var options, path; + + if (typeof hash === 'function') { + callback = index; + index = hash; + hash = account; + account = null; + } + + options = { account: account }; + + path = '/wallet/' + id + '/coin/' + hash + '/' + index; + + return this._get(path, options, callback); +}; + /** * Create a transaction, fill, sign, and broadcast. * @param {WalletID} id @@ -575,7 +593,7 @@ HTTPClient.prototype.broadcast = function broadcast(tx, callback) { * @param {Function} callback - Returns [Error, {@link TX}]. */ -HTTPClient.prototype.walletSend = function walletSend(id, options, callback) { +HTTPClient.prototype.send = function send(id, options, callback) { options = utils.merge({}, options); options.outputs = options.outputs || []; @@ -599,7 +617,7 @@ HTTPClient.prototype.walletSend = function walletSend(id, options, callback) { * @param {Function} callback */ -HTTPClient.prototype.walletRetoken = function walletRetoken(id, passphrase, callback) { +HTTPClient.prototype.retoken = function retoken(id, passphrase, callback) { var options = { passphrase: passphrase }; return this._post('/wallet/' + id + '/retoken', options, function(err, body) { @@ -617,7 +635,7 @@ HTTPClient.prototype.walletRetoken = function walletRetoken(id, passphrase, call * @param {Function} callback */ -HTTPClient.prototype.walletSetPassphrase = function walletSetPassphrase(id, old, new_, callback) { +HTTPClient.prototype.setPassphrase = function setPassphrase(id, old, new_, callback) { var options = { old: old, passphrase: new_ }; return this._post('/wallet/' + id + '/passphrase', options, callback); @@ -630,7 +648,7 @@ HTTPClient.prototype.walletSetPassphrase = function walletSetPassphrase(id, old, * @param {Function} callback - Returns [Error, {@link TX}]. */ -HTTPClient.prototype.walletCreate = function walletCreate(id, options, callback) { +HTTPClient.prototype.createTX = function createTX(id, options, callback) { options = utils.merge({}, options); if (options.rate) @@ -655,14 +673,17 @@ HTTPClient.prototype.walletCreate = function walletCreate(id, options, callback) * @param {Function} callback - Returns [Error, {@link TX}]. */ -HTTPClient.prototype.walletSign = function walletCreate(id, tx, options, callback) { +HTTPClient.prototype.sign = function sign(id, tx, options, callback) { var body; if (typeof options === 'function') { callback = options; - options = {}; + options = null; } + if (!options) + options = {}; + body = utils.merge({}, options); body.tx = toHex(tx); @@ -675,9 +696,9 @@ HTTPClient.prototype.walletSign = function walletCreate(id, tx, options, callbac * @param {Function} callback - Returns [Error, {@link TX}]. */ -HTTPClient.prototype.walletFill = function walletFill(tx, callback) { +HTTPClient.prototype.fillCoins = function fillCoins(id, tx, callback) { var body = { tx: toHex(tx) }; - return this._post('/wallet/_/fill', body, callback); + return this._post('/wallet/' + id + '/fill', body, callback); }; /** @@ -687,7 +708,7 @@ HTTPClient.prototype.walletFill = function walletFill(tx, callback) { * @param {Function} callback */ -HTTPClient.prototype.walletZap = function walletZap(id, account, age, callback) { +HTTPClient.prototype.zap = function zap(id, account, age, callback) { var body; if (typeof age === 'function') { @@ -760,7 +781,7 @@ HTTPClient.prototype.removeKey = function removeKey(id, account, key, callback) * @param {Function} callback - Returns [Error, Array]. */ -HTTPClient.prototype.getWalletAccounts = function getWalletAccounts(id, callback) { +HTTPClient.prototype.getAccounts = function getAccounts(id, callback) { var path = '/wallet/' + id + '/account'; return this._get(path, callback); }; @@ -772,7 +793,7 @@ HTTPClient.prototype.getWalletAccounts = function getWalletAccounts(id, callback * @param {Function} callback - Returns [Error, Array]. */ -HTTPClient.prototype.createWalletAccount = function createWalletAccount(id, options, callback) { +HTTPClient.prototype.createAccount = function createAccount(id, options, callback) { var path; if (typeof options === 'function') { @@ -791,25 +812,6 @@ HTTPClient.prototype.createWalletAccount = function createWalletAccount(id, opti return this._post(path, options, callback); }; - -/** - * Get a mempool snapshot. - * @param {Function} callback - Returns [Error, {@link TX}[]]. - */ - -HTTPClient.prototype.getMempool = function getMempool(callback) { - return this._get('/mempool', callback); -}; - -/** - * Get some info about the server (network and version). - * @param {Function} callback - Returns [Error, Object]. - */ - -HTTPClient.prototype.getInfo = function getInfo(callback) { - return this._get('/', callback); -}; - /* * Helpers */ diff --git a/lib/bcoin/http/server.js b/lib/bcoin/http/server.js index 37319f7d..23116a67 100644 --- a/lib/bcoin/http/server.js +++ b/lib/bcoin/http/server.js @@ -434,9 +434,6 @@ HTTPServer.prototype._init = function _init() { if (err) return next(err); - if (!txs.length) - return send(404); - utils.forEachSerial(txs, function(tx, next) { self.node.fillHistory(tx, next); }, function(err) { @@ -704,9 +701,6 @@ HTTPServer.prototype._init = function _init() { if (err) return next(err); - if (!coins.length) - return send(404); - send(200, coins.map(function(coin) { return coin.toJSON(); })); diff --git a/lib/bcoin/http/wallet.js b/lib/bcoin/http/wallet.js index e5bfc040..d73b8837 100644 --- a/lib/bcoin/http/wallet.js +++ b/lib/bcoin/http/wallet.js @@ -107,7 +107,7 @@ HTTPWallet.prototype.open = function open(options, callback) { self.client.getWallet(self.id, function(err, wallet) { if (err) return callback(err); - self.client.joinWallet(self.id, wallet.token, function(err) { + self.client.join(self.id, wallet.token, function(err) { if (err) return callback(new Error(err.error)); callback(null, wallet); @@ -156,7 +156,7 @@ HTTPWallet.prototype.close = function close(callback) { */ HTTPWallet.prototype.getHistory = function getHistory(account, callback) { - return this.client.getWalletHistory(this.id, account, callback); + return this.client.getHistory(this.id, account, callback); }; /** @@ -164,7 +164,7 @@ HTTPWallet.prototype.getHistory = function getHistory(account, callback) { */ HTTPWallet.prototype.getCoins = function getCoins(account, callback) { - return this.client.getWalletCoins(this.id, account, callback); + return this.client.getCoins(this.id, account, callback); }; /** @@ -172,7 +172,7 @@ HTTPWallet.prototype.getCoins = function getCoins(account, callback) { */ HTTPWallet.prototype.getUnconfirmed = function getUnconfirmed(account, callback) { - return this.client.getWalletUnconfirmed(this.id, account, callback); + return this.client.getUnconfirmed(this.id, account, callback); }; /** @@ -180,7 +180,7 @@ HTTPWallet.prototype.getUnconfirmed = function getUnconfirmed(account, callback) */ HTTPWallet.prototype.getBalance = function getBalance(account, callback) { - return this.client.getWalletBalance(this.id, account, callback); + return this.client.getBalance(this.id, account, callback); }; /** @@ -188,7 +188,7 @@ HTTPWallet.prototype.getBalance = function getBalance(account, callback) { */ HTTPWallet.prototype.getLast = function getLast(account, limit, callback) { - return this.client.getWalletLast(this.id, account, limit, callback); + return this.client.getLast(this.id, account, limit, callback); }; /** @@ -196,7 +196,7 @@ HTTPWallet.prototype.getLast = function getLast(account, limit, callback) { */ HTTPWallet.prototype.getRange = function getRange(account, options, callback) { - return this.client.getWalletRange(this.id, account, options, callback); + return this.client.getRange(this.id, account, options, callback); }; /** @@ -220,7 +220,7 @@ HTTPWallet.prototype.getCoin = function getCoin(account, hash, index, callback) */ HTTPWallet.prototype.zap = function zap(account, age, callback) { - return this.client.walletZap(this.id, account, age, callback); + return this.client.zap(this.id, account, age, callback); }; /** @@ -228,7 +228,7 @@ HTTPWallet.prototype.zap = function zap(account, age, callback) { */ HTTPWallet.prototype.createTX = function createTX(options, outputs, callback) { - return this.client.walletCreate(this.id, options, outputs, callback); + return this.client.createTX(this.id, options, outputs, callback); }; /** @@ -236,7 +236,7 @@ HTTPWallet.prototype.createTX = function createTX(options, outputs, callback) { */ HTTPWallet.prototype.send = function send(options, callback) { - return this.client.walletSend(this.id, options, callback); + return this.client.send(this.id, options, callback); }; /** @@ -244,7 +244,7 @@ HTTPWallet.prototype.send = function send(options, callback) { */ HTTPWallet.prototype.sign = function sign(tx, options, callback) { - return this.client.walletSign(this.id, tx, options, callback); + return this.client.sign(this.id, tx, options, callback); }; /** @@ -252,7 +252,7 @@ HTTPWallet.prototype.sign = function sign(tx, options, callback) { */ HTTPWallet.prototype.fillCoins = function fillCoins(tx, callback) { - return this.client.walletFill(tx, callback); + return this.client.fillCoins(tx, callback); }; /** @@ -268,7 +268,7 @@ HTTPWallet.prototype.getInfo = function getInfo(callback) { */ HTTPWallet.prototype.getAccounts = function getAccounts(callback) { - return this.client.getWalletAccounts(this.id, callback); + return this.client.getAccounts(this.id, callback); }; /** @@ -276,7 +276,7 @@ HTTPWallet.prototype.getAccounts = function getAccounts(callback) { */ HTTPWallet.prototype.getAccount = function getAccount(options, callback) { - return this.client.getWalletAccount(this.id, options, callback); + return this.client.getAccount(this.id, options, callback); }; /** @@ -284,7 +284,7 @@ HTTPWallet.prototype.getAccount = function getAccount(options, callback) { */ HTTPWallet.prototype.createAccount = function createAccount(options, callback) { - return this.client.createWalletAccount(this.id, options, callback); + return this.client.createAccount(this.id, options, callback); }; /** @@ -292,7 +292,7 @@ HTTPWallet.prototype.createAccount = function createAccount(options, callback) { */ HTTPWallet.prototype.setPassphrase = function setPassphrase(old, new_, callback) { - return this.client.walletSetPassphrase(this.id, old, new_, callback); + return this.client.setPassphrase(this.id, old, new_, callback); }; /** @@ -301,7 +301,7 @@ HTTPWallet.prototype.setPassphrase = function setPassphrase(old, new_, callback) HTTPWallet.prototype.retoken = function retoken(passphrase, callback) { var self = this; - return this.client.walletRetoken(this.id, passphrase, function(err, token) { + return this.client.retoken(this.id, passphrase, function(err, token) { if (err) return callback(err);