/** * Authenticates all existing & future sockets with the provided credentials. * Does nothing if an apiKey/apiSecret pair are already known. * * @param {object} args - arguments * @param {object} args.apiKey - saved if not already provided * @param {object} args.apiSecret - saved if not already provided * @param {object} [args.calc] - default 0 * @param {object} [args.dms] - dead man switch, active 4 */ auth ({ apiKey, apiSecret, calc, dms } = {}) { if (this._socketArgs.apiKey || this._socketArgs.apiSecret) { debug('error: auth credentials already provided! refusing auth') return } this._socketArgs.apiKey = apiKey this._socketArgs.apiSecret = apiSecret if (_isFinite(calc)) this._authArgs.calc = calc if (_isFinite(dms)) this._authArgs.dms = dms this._sockets.forEach(s => { if (!s.ws.isAuthenticated()) { s.ws.setAPICredentials(apiKey, apiSecret) s.ws.updateAuthArgs(this._authArgs) s.ws.auth() } }) }
: msg[msg.length - 1] if (!_isFinite(authSeq)) { debug('recv public seq # %d', seq) } else {
prepareAmount(available), ...(_isFinite(value) ? [ prepareAmount(value), currency !== valueCCY