You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

840 lines
23 KiB

10 years ago
'use strict';
var _ = require('lodash');
var $ = require('preconditions').singleton();
var async = require('async');
var log = require('npmlog');
log.debug = log.verbose;
var inherits = require('inherits');
var events = require('events');
var nodeutil = require('util');
10 years ago
var Bitcore = require('bitcore');
var PublicKey = Bitcore.PublicKey;
var HDPublicKey = Bitcore.HDPublicKey;
var Address = Bitcore.Address;
10 years ago
var Explorers = require('bitcore-explorers');
10 years ago
var ClientError = require('./clienterror');
var Utils = require('./utils');
10 years ago
var Storage = require('./storage');
var WalletUtils = require('./walletutils');
10 years ago
10 years ago
var Wallet = require('./model/wallet');
var Copayer = require('./model/copayer');
10 years ago
var Address = require('./model/address');
var TxProposal = require('./model/txproposal');
var Notification = require('./model/Notification');
10 years ago
var initialized = false;
var storage;
10 years ago
/**
* Creates an instance of the Copay server.
* @constructor
*/
function CopayServer() {
if (!initialized) throw new Error('Server not initialized');
this.storage = storage;
this.notifyTicker = 0;
};
nodeutil.inherits(CopayServer, events.EventEmitter);
10 years ago
/**
* Initializes global settings for all instances.
10 years ago
* @param {Object} opts
* @param {Storage} [opts.storage] - The storage provider.
10 years ago
*/
10 years ago
CopayServer.initialize = function(opts) {
opts = opts || {};
storage = opts.storage ||  new Storage();
initialized = true;
10 years ago
};
10 years ago
CopayServer.getInstance = function() {
return new CopayServer();
};
/**
* Gets an instance of the server after authenticating the copayer.
* @param {Object} opts
* @param {string} opts.copayerId - The copayer id making the request.
* @param {string} opts.message - The contents of the request to be signed.
* @param {string} opts.signature - Signature of message to be verified using the copayer's signingPubKey.
*/
10 years ago
CopayServer.getInstanceWithAuth = function(opts, cb) {
if (!Utils.checkRequired(opts, ['copayerId', 'message', 'signature']))
return cb(new ClientError('Required argument missing'));
var server = new CopayServer();
10 years ago
server.storage.fetchCopayerLookup(opts.copayerId, function(err, copayer) {
if (err) return cb(err);
10 years ago
if (!copayer) return cb(new ClientError('NOTAUTHORIZED', 'Copayer not found'));
var isValid = server._verifySignature(opts.message, opts.signature, copayer.signingPubKey);
10 years ago
if (!isValid) return cb(new ClientError('NOTAUTHORIZED', 'Invalid signature'));
server.copayerId = opts.copayerId;
server.walletId = copayer.walletId;
return cb(null, server);
});
};
10 years ago
10 years ago
/**
* Creates a new wallet.
10 years ago
* @param {Object} opts
10 years ago
* @param {string} opts.id - The wallet id.
* @param {string} opts.name - The wallet name.
* @param {number} opts.m - Required copayers.
* @param {number} opts.n - Total copayers.
* @param {string} opts.pubKey - Public key to verify copayers joining have access to the wallet secret.
* @param {string} [opts.network = 'livenet'] - The Bitcoin network for this wallet.
*/
10 years ago
CopayServer.prototype.createWallet = function(opts, cb) {
var self = this,
pubKey;
10 years ago
10 years ago
if (!Utils.checkRequired(opts, ['name', 'm', 'n', 'pubKey']))
return cb(new ClientError('Required argument missing'));
10 years ago
10 years ago
if (_.isEmpty(opts.name)) return cb(new ClientError('Invalid wallet name'));
10 years ago
if (!Wallet.verifyCopayerLimits(opts.m, opts.n))
return cb(new ClientError('Invalid combination of required copayers / total copayers'));
var network = opts.network || 'livenet';
10 years ago
if (network != 'livenet' && network != 'testnet')
return cb(new ClientError('Invalid network'));
try {
pubKey = new PublicKey.fromString(opts.pubKey);
} catch (e) {
return cb(e.toString());
};
10 years ago
10 years ago
var wallet = new Wallet({
name: opts.name,
m: opts.m,
n: opts.n,
network: network,
10 years ago
pubKey: pubKey,
});
self.storage.storeWallet(wallet, function(err) {
log.debug('Wallet created', wallet.id, network);
return cb(err, wallet.id);
});
10 years ago
};
10 years ago
/**
* Retrieves a wallet from storage.
10 years ago
* @param {Object} opts
* @returns {Object} wallet
10 years ago
*/
10 years ago
CopayServer.prototype.getWallet = function(opts, cb) {
var self = this;
10 years ago
self.storage.fetchWallet(self.walletId, function(err, wallet) {
if (err) return cb(err);
if (!wallet) return cb(new ClientError('Wallet not found'));
return cb(null, wallet);
});
10 years ago
};
10 years ago
10 years ago
/**
* Verifies a signature
* @param text
* @param signature
* @param pubKey
*/
CopayServer.prototype._verifySignature = function(text, signature, pubKey) {
return WalletUtils.verifyMessage(text, signature, pubKey);
10 years ago
};
10 years ago
/**
* _notify
*
* @param type
* @param data
*/
CopayServer.prototype._notify = function(type, data) {
10 years ago
var self = this;
log.debug('Notification', type, data);
var walletId = self.walletId || data.walletId;
$.checkState(walletId);
10 years ago
var n = new Notification({
type: type,
data: data,
ticker: this.notifyTicker++,
10 years ago
});
this.storage.storeNotification(walletId, n, function() {
10 years ago
self.emit(n);
});
};
10 years ago
/**
* Joins a wallet in creation.
10 years ago
* @param {Object} opts
10 years ago
* @param {string} opts.walletId - The wallet id.
* @param {string} opts.name - The copayer name.
* @param {number} opts.xPubKey - Extended Public Key for this copayer.
* @param {number} opts.xPubKeySignature - Signature of xPubKey using the wallet pubKey.
*/
10 years ago
CopayServer.prototype.joinWallet = function(opts, cb) {
var self = this;
10 years ago
10 years ago
if (!Utils.checkRequired(opts, ['walletId', 'name', 'xPubKey', 'xPubKeySignature']))
return cb(new ClientError('Required argument missing'));
if (_.isEmpty(opts.name))
return cb(new ClientError('Invalid copayer name'));
10 years ago
Utils.runLocked(opts.walletId, cb, function(cb) {
self.storage.fetchWallet(opts.walletId, function(err, wallet) {
if (err) return cb(err);
if (!wallet) return cb(new ClientError('Wallet not found'));
10 years ago
if (!self._verifySignature(opts.xPubKey, opts.xPubKeySignature, wallet.pubKey)) {
return cb(new ClientError());
10 years ago
}
if (_.find(wallet.copayers, {
xPubKey: opts.xPubKey
})) return cb(new ClientError('CINWALLET', 'Copayer already in wallet'));
if (wallet.copayers.length == wallet.n)
return cb(new ClientError('WFULL', 'Wallet full'));
var copayer = Copayer.create({
name: opts.name,
xPubKey: opts.xPubKey,
xPubKeySignature: opts.xPubKeySignature,
copayerIndex: wallet.copayers.length,
});
10 years ago
self.storage.fetchCopayerLookup(copayer.id, function(err, res) {
10 years ago
if (err) return cb(err);
if (res)
return cb(new ClientError('CREGISTED', 'Copayer ID already registered on server'));
wallet.addCopayer(copayer);
self.storage.storeWalletAndUpdateCopayersLookup(wallet, function(err) {
if (err) return cb(err);
self._notify('NewCopayer', {
walletId: opts.walletId,
copayerId: copayer.id,
copayerName: copayer.name,
});
return cb(null, {
copayerId: copayer.id,
wallet: wallet
});
10 years ago
});
});
});
});
10 years ago
};
10 years ago
/**
* Creates a new address.
* @param {Object} opts
* @returns {Address} address
10 years ago
*/
10 years ago
CopayServer.prototype.createAddress = function(opts, cb) {
var self = this;
Utils.runLocked(self.walletId, cb, function(cb) {
self.getWallet({}, function(err, wallet) {
if (err) return cb(err);
if (!wallet.isComplete())
return cb(new ClientError('Wallet is not complete'));
10 years ago
var address = wallet.createAddress(false);
self.storage.storeAddressAndWallet(wallet, address, function(err) {
if (err) return cb(err);
10 years ago
self._notify('NewAddress');
return cb(null, address);
});
});
});
10 years ago
};
/**
* Get all addresses.
* @param {Object} opts
* @returns {Address[]}
*/
10 years ago
CopayServer.prototype.getAddresses = function(opts, cb) {
var self = this;
self.storage.fetchAddresses(self.walletId, function(err, addresses) {
if (err) return cb(err);
return cb(null, addresses);
});
};
10 years ago
/**
* Verifies that a given message was actually sent by an authorized copayer.
* @param {Object} opts
* @param {string} opts.message - The message to verify.
* @param {string} opts.signature - The signature of message to verify.
* @returns {truthy} The result of the verification.
*/
10 years ago
CopayServer.prototype.verifyMessageSignature = function(opts, cb) {
var self = this;
10 years ago
10 years ago
if (!Utils.checkRequired(opts, ['message', 'signature']))
return cb(new ClientError('Required argument missing'));
self.getWallet({}, function(err, wallet) {
if (err) return cb(err);
10 years ago
var copayer = wallet.getCopayer(self.copayerId);
10 years ago
var isValid = self._verifySignature(opts.message, opts.signature, copayer.signingPubKey);
return cb(null, isValid);
});
10 years ago
};
10 years ago
10 years ago
CopayServer.prototype._getBlockExplorer = function(provider, network) {
var url;
switch (provider) {
default:
case 'insight':
switch (network) {
default:
case 'livenet':
url = 'https://insight.bitpay.com:443';
break;
case 'testnet':
url = 'https://test-insight.bitpay.com:443'
break;
}
console.log('[server.js.320:url:]', url); //TODO
return new Explorers.Insight(url, network);
break;
}
10 years ago
};
10 years ago
/**
* _getUtxos
*
*/
CopayServer.prototype._getUtxos = function(cb) {
var self = this;
// Get addresses for this wallet
self.storage.fetchAddresses(self.walletId, function(err, addresses) {
if (err) return cb(err);
if (addresses.length == 0)
return cb(null, []);
10 years ago
var addressStrs = _.pluck(addresses, 'address');
var addressToPath = _.indexBy(addresses, 'address'); // TODO : check performance
var networkName = Bitcore.Address(addressStrs[0]).toObject().network;
var bc = self._getBlockExplorer('insight', networkName);
10 years ago
bc.getUnspentUtxos(addressStrs, function(err, inutxos) {
if (err) return cb(err);
10 years ago
var utxos = _.map(inutxos, function(i) {
return i.toObject();
});
self.getPendingTxs({}, function(err, txps) {
if (err) return cb(err);
var inputs = _.chain(txps)
.pluck('inputs')
.flatten()
10 years ago
.map(function(utxo) {
return utxo.txid + '|' + utxo.vout
})
.value();
10 years ago
var dictionary = _.reduce(utxos, function(memo, utxo) {
memo[utxo.txid + '|' + utxo.vout] = utxo;
return memo;
}, {});
10 years ago
_.each(inputs, function(input) {
if (dictionary[input]) {
dictionary[input].locked = true;
}
});
10 years ago
10 years ago
// Needed for the clients to sign UTXOs
_.each(utxos, function(utxo) {
utxo.path = addressToPath[utxo.address].path;
utxo.publicKeys = addressToPath[utxo.address].publicKeys;
});
10 years ago
return cb(null, utxos);
});
});
});
10 years ago
};
10 years ago
/**
* Creates a new transaction proposal.
* @param {Object} opts
* @returns {Object} balance - Total amount & locked amount.
10 years ago
*/
10 years ago
CopayServer.prototype.getBalance = function(opts, cb) {
var self = this;
10 years ago
self._getUtxos(function(err, utxos) {
if (err) return cb(err);
10 years ago
var balance = {};
10 years ago
balance.totalAmount = Utils.strip(_.reduce(utxos, function(sum, utxo) {
10 years ago
return sum + self._inputSatoshis(utxo);
10 years ago
}, 0));
balance.lockedAmount = Utils.strip(_.reduce(_.filter(utxos, {
10 years ago
locked: true
}), function(sum, utxo) {
10 years ago
return sum + self._inputSatoshis(utxo);
10 years ago
}, 0));
10 years ago
return cb(null, balance);
});
10 years ago
};
// TODO: should be in Utils
10 years ago
CopayServer.prototype._inputSatoshis = function(i) {
return i.amount ? Utils.strip(i.amount * 1e8) : i.satoshis;
};
CopayServer.prototype._selectUtxos = function(txp, utxos) {
var i = 0;
var total = 0;
var selected = [];
var inputs = _.sortBy(utxos, 'amount');
while (i < inputs.length) {
selected.push(inputs[i]);
10 years ago
total += this._inputSatoshis(inputs[i]);
if (total >= txp.amount + Bitcore.Transaction.FEE_PER_KB) {
10 years ago
try {
// Check if there are enough fees
txp.inputs = selected;
var raw = txp.getRawTx();
return;
} catch (ex) {
if (ex.name != 'bitcore.ErrorTransactionFeeError') {
throw ex.message;
}
10 years ago
}
}
i++;
};
10 years ago
txp.inputs = null;
return;
10 years ago
};
10 years ago
10 years ago
/**
* Creates a new transaction proposal.
10 years ago
* @param {Object} opts
10 years ago
* @param {string} opts.toAddress - Destination address.
* @param {number} opts.amount - Amount to transfer in satoshi.
* @param {string} opts.message - A message to attach to this transaction.
* @param {string} opts.proposalSignature - S(toAddress + '|' + amount + '|' + message). Used by other copayers to verify the proposal. Optional in 1-of-1 wallets.
* @returns {TxProposal} Transaction proposal.
10 years ago
*/
10 years ago
CopayServer.prototype.createTx = function(opts, cb) {
var self = this;
10 years ago
if (!Utils.checkRequired(opts, ['toAddress', 'amount', 'proposalSignature']))
10 years ago
return cb(new ClientError('Required argument missing'));
Utils.runLocked(self.walletId, cb, function(cb) {
self.getWallet({}, function(err, wallet) {
if (err) return cb(err);
if (!wallet.isComplete()) return cb(new ClientError('Wallet is not complete'));
var copayer = wallet.getCopayer(self.copayerId);
var hash = WalletUtils.getProposalHash(opts.toAddress, opts.amount, opts.message);
if (!self._verifySignature(hash, opts.proposalSignature, copayer.signingPubKey))
return cb(new ClientError('Invalid proposal signature'));
10 years ago
var toAddress;
try {
toAddress = new Bitcore.Address(opts.toAddress);
} catch (ex) {
return cb(new ClientError('INVALIDADDRESS', 'Invalid address'));
}
if (toAddress.network != wallet.getNetworkName())
return cb(new ClientError('INVALIDADDRESS', 'Incorrect address network'));
if (opts.amount < Bitcore.Transaction.DUST_AMOUNT)
return cb(new ClientError('DUSTAMOUNT', 'Amount below dust threshold'));
self._getUtxos(function(err, utxos) {
if (err) return cb(err);
10 years ago
var changeAddress = wallet.createAddress(true);
10 years ago
utxos = _.reject(utxos, {
locked: true
});
10 years ago
var txp = new TxProposal({
creatorId: self.copayerId,
toAddress: opts.toAddress,
amount: opts.amount,
message: opts.message,
changeAddress: changeAddress.address,
requiredSignatures: wallet.m,
requiredRejections: Math.min(wallet.m, wallet.n - wallet.m + 1),
});
10 years ago
try {
self._selectUtxos(txp, utxos);
} catch (ex) {
return cb(new ClientError(ex));
}
10 years ago
if (!txp.inputs)
return cb(new ClientError('INSUFFICIENTFUNDS', 'Insufficient funds'));
txp.inputPaths = _.pluck(txp.inputs, 'path');
self.storage.storeAddressAndWallet(wallet, changeAddress, function(err) {
if (err) return cb(err);
10 years ago
self.storage.storeTx(wallet.id, txp, function(err) {
if (err) return cb(err);
self._notify('NewTxProposal', {
amount: opts.amount
});
return cb(null, txp);
});
});
});
});
});
10 years ago
};
10 years ago
10 years ago
/**
* Retrieves a tx from storage.
* @param {Object} opts
* @param {string} opts.id - The tx id.
* @returns {Object} txProposal
*/
CopayServer.prototype.getTx = function(opts, cb) {
var self = this;
self.storage.fetchTx(self.walletId, opts.id, function(err, txp) {
10 years ago
if (err) return cb(err);
if (!txp) return cb(new ClientError('Transaction proposal not found'));
return cb(null, txp);
});
};
/**
* removeWallet
*
* @param opts
* @param cb
* @return {undefined}
*/
CopayServer.prototype.removeWallet = function(opts, cb) {
var self = this;
Utils.runLocked(self.walletId, cb, function(cb) {
self.storage.removeWallet(self.walletId, cb);
});
};
10 years ago
/**
* removePendingTx
*
* @param opts
10 years ago
* @param {string} opts.txProposalId - The tx id.
10 years ago
* @return {undefined}
*/
CopayServer.prototype.removePendingTx = function(opts, cb) {
var self = this;
10 years ago
if (!Utils.checkRequired(opts, ['txProposalId']))
10 years ago
return cb(new ClientError('Required argument missing'));
10 years ago
Utils.runLocked(self.walletId, cb, function(cb) {
10 years ago
self.getTx({
10 years ago
id: opts.txProposalId,
}, function(err, txp) {
10 years ago
if (err) return cb(err);
if (!txp.isPending())
return cb(new ClientError('Transaction proposal not pending'));
10 years ago
if (txp.creatorId !== self.copayerId)
return cb(new ClientError('Only creators can remove pending proposals'));
10 years ago
10 years ago
var actors = txp.getActors();
if (actors.length > 1 || (actors.length == 1 && actors[0] !== self.copayerId))
return cb(new ClientError('Cannot remove a proposal signed/rejected by other copayers'));
10 years ago
self._notify('transactionProposalRemoved');
10 years ago
self.storage.removeTx(self.walletId, txp.id, cb);
10 years ago
});
});
};
CopayServer.prototype._broadcastTx = function(txp, cb) {
10 years ago
var raw;
try {
raw = txp.getRawTx();
} catch (ex) {
return cb(ex);
}
var bc = this._getBlockExplorer('insight', txp.getNetworkName());
10 years ago
bc.broadcast(raw, function(err, txid) {
return cb(err, txid);
})
10 years ago
};
10 years ago
/**
* Sign a transaction proposal.
* @param {Object} opts
10 years ago
* @param {string} opts.txProposalId - The identifier of the transaction.
10 years ago
* @param {string} opts.signatures - The signatures of the inputs of this tx for this copayer (in apperance order)
10 years ago
*/
10 years ago
CopayServer.prototype.signTx = function(opts, cb) {
var self = this;
10 years ago
10 years ago
if (!Utils.checkRequired(opts, ['txProposalId', 'signatures']))
return cb(new ClientError('Required argument missing'));
self.getWallet({}, function(err, wallet) {
if (err) return cb(err);
10 years ago
self.getTx({
id: opts.txProposalId
}, function(err, txp) {
if (err) return cb(err);
10 years ago
var action = _.find(txp.actions, {
10 years ago
copayerId: self.copayerId
});
10 years ago
if (action)
return cb(new ClientError('CVOTED', 'Copayer already voted on this transaction proposal'));
10 years ago
if (txp.status != 'pending')
return cb(new ClientError('TXNOTPENDING', 'The transaction proposal is not pending'));
10 years ago
var copayer = wallet.getCopayer(self.copayerId);
10 years ago
if (!txp.sign(self.copayerId, opts.signatures, copayer.xPubKey))
return cb(new ClientError('BADSIGNATURES', 'Bad signatures'));
self.storage.storeTx(self.walletId, txp, function(err) {
if (err) return cb(err);
self._notify('TxProposalAcceptedBy', {
txProposalId: opts.txProposalId,
copayerId: self.copayerId,
});
if (txp.status == 'accepted') {
self._notify('TxProposalFinallyAccepted', {
txProposalId: opts.txProposalId,
});
self._broadcastTx(txp, function(err, txid) {
if (err) return cb(err);
10 years ago
txp.setBroadcasted(txid);
self.storage.storeTx(self.walletId, txp, function(err) {
if (err) return cb(err);
self._notify('NewOutgoingTx', {
txProposalId: opts.txProposalId,
txid: txid
});
return cb(null, txp);
});
10 years ago
});
} else {
return cb(null, txp);
}
});
});
});
};
10 years ago
10 years ago
/**
* Broadcast a transaction proposal.
* @param {Object} opts
* @param {string} opts.txProposalId - The identifier of the transaction.
*/
CopayServer.prototype.broadcastTx = function(opts, cb) {
var self = this;
if (!Utils.checkRequired(opts, ['txProposalId']))
return cb(new ClientError('Required argument missing'));
self.getWallet({}, function(err, wallet) {
if (err) return cb(err);
self.getTx({
id: opts.txProposalId
}, function(err, txp) {
if (err) return cb(err);
if (txp.status == 'broadcasted')
return cb(new ClientError('TXALREADYBROADCASTED', 'The transaction proposal is already broadcasted'));
if (txp.status != 'accepted')
return cb(new ClientError('TXNOTACCEPTED', 'The transaction proposal is not accepted'));
self._broadcastTx(txp, function(err, txid) {
if (err) return cb(err);
txp.setBroadcasted(txid);
self.storage.storeTx(self.walletId, txp, function(err) {
if (err) return cb(err);
self._notify('NewOutgoingTx', {
txProposalId: opts.txProposalId,
txid: txid
});
return cb(null, txid);
10 years ago
});
});
});
});
};
10 years ago
/**
* Reject a transaction proposal.
* @param {Object} opts
* @param {string} opts.txProposalId - The identifier of the transaction.
* @param {string} [opts.reason] - A message to other copayers explaining the rejection.
10 years ago
*/
10 years ago
CopayServer.prototype.rejectTx = function(opts, cb) {
var self = this;
10 years ago
10 years ago
if (!Utils.checkRequired(opts, ['txProposalId']))
return cb(new ClientError('Required argument missing'));
self.getTx({
id: opts.txProposalId
}, function(err, txp) {
if (err) return cb(err);
10 years ago
var action = _.find(txp.actions, {
copayerId: self.copayerId
10 years ago
});
if (action)
return cb(new ClientError('CVOTED', 'Copayer already voted on this transaction proposal'));
if (txp.status != 'pending')
return cb(new ClientError('TXNOTPENDING', 'The transaction proposal is not pending'));
10 years ago
txp.reject(self.copayerId, opts.reason);
10 years ago
self.storage.storeTx(self.walletId, txp, function(err) {
if (err) return cb(err);
10 years ago
self._notify('TxProposalRejectedBy', {
txProposalId: opts.txProposalId,
copayerId: self.copayerId,
});
if (txp.status == 'rejected') {
self._notify('TxProposalFinallyRejected', {
txProposalId: opts.txProposalId,
});
};
return cb();
});
});
10 years ago
};
10 years ago
/**
* Retrieves all pending transaction proposals.
* @param {Object} opts
* @returns {TxProposal[]} Transaction proposal.
10 years ago
*/
10 years ago
CopayServer.prototype.getPendingTxs = function(opts, cb) {
var self = this;
10 years ago
self.storage.fetchPendingTxs(self.walletId, function(err, txps) {
if (err) return cb(err);
10 years ago
return cb(null, txps);
});
10 years ago
};
/**
* Retrieves pending transaction proposals in the range (maxTs-minTs)
* Times are in UNIX EPOCH
*
* @param {Object} opts.minTs (defaults to 0)
* @param {Object} opts.maxTs (defaults to now)
* @param {Object} opts.limit
* @returns {TxProposal[]} Transaction proposals, first newer
*/
CopayServer.prototype.getTxs = function(opts, cb) {
var self = this;
self.storage.fetchTxs(self.walletId, opts, function(err, txps) {
if (err) return cb(err);
return cb(null, txps);
});
};
/**
* Retrieves notifications in the range (maxTs-minTs).
* Times are in UNIX EPOCH. Order is assured even for events with the same time
*
* @param {Object} opts.minTs (defaults to 0)
* @param {Object} opts.maxTs (defaults to now)
* @param {Object} opts.limit
* @param {Object} opts.reverse (default false)
* @returns {Notification[]} Notifications
*/
CopayServer.prototype.getNotifications = function(opts, cb) {
var self = this;
self.storage.fetchNotifications(self.walletId, opts, function(err, notifications) {
if (err) return cb(err);
return cb(null, notifications);
});
};
10 years ago
module.exports = CopayServer;
10 years ago
module.exports.ClientError = ClientError;