Skip to content

Commit

Permalink
fix whitespace (lint errors) (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott authored and intelliot committed Nov 27, 2017
1 parent f90617e commit 7ece43e
Show file tree
Hide file tree
Showing 23 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/common/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Connection extends EventEmitter {
}
return [data.type, data]
} else if (data.type === undefined && data.error) {
return ['error', data.error, data.error_message, data] // e.g. slowDown
return ['error', data.error, data.error_message, data] // e.g. slowDown
}
throw new ResponseFormatError('unrecognized message type: ' + data.type)
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const accountRootFlags = {
RequireDestTag: 0x00020000, // require a DestinationTag for payments
RequireAuth: 0x00040000, // require a authorization to hold IOUs
DisallowXRP: 0x00080000, // disallow sending XRP
DisableMaster: 0x00100000, // force regular key
DisableMaster: 0x00100000, // force regular key
NoFreeze: 0x00200000, // permanently disallowed freezing trustlines
GlobalFreeze: 0x00400000, // trustlines globally frozen
DefaultRipple: 0x00800000
Expand Down Expand Up @@ -36,7 +36,7 @@ const AccountFlagIndices = {

const AccountFields = {
EmailHash: {name: 'emailHash', encoding: 'hex',
length: 32, defaults: '0'},
length: 32, defaults: '0'},
MessageKey: {name: 'messageKey'},
Domain: {name: 'domain', encoding: 'hex'},
TransferRate: {name: 'transferRate', defaults: 0, shift: 9}
Expand Down
2 changes: 1 addition & 1 deletion src/common/serverinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function getServerInfo(connection: Connection): Promise<GetServerInfoResponse> {
}

function computeFeeFromServerInfo(cushion: number,
serverInfo: GetServerInfoResponse
serverInfo: GetServerInfoResponse
): number {
return (Number(serverInfo.validatedLedger.baseFeeXRP)
* Number(serverInfo.loadFactor) * cushion).toString()
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/balance-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function formatBalanceSheet(balanceSheet): GetBalanceSheet {
}
if (!_.isUndefined(balanceSheet.obligations)) {
result.obligations = _.map(balanceSheet.obligations, (value, currency) =>
({currency, value}))
({currency, value}))
}

return result
Expand Down
6 changes: 3 additions & 3 deletions src/ledger/orderbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ type GetOrderbook = {
// account is to specify a "perspective", which affects which unfunded offers
// are returned
function getBookOffers(connection: Connection, account: string,
ledgerVersion?: number, limit?: number, takerGets: Issue,
takerPays: Issue
ledgerVersion?: number, limit?: number, takerGets: Issue,
takerPays: Issue
): Promise<Object[]> {
return connection.request(utils.renameCounterpartyToIssuerInOrder({
command: 'book_offers',
Expand Down Expand Up @@ -92,7 +92,7 @@ function formatBidsAndAsks(orderbook: Orderbook, offers) {
}

function getOrderbook(address: string, orderbook: Orderbook,
options: OrdersOptions = {}
options: OrdersOptions = {}
): Promise<GetOrderbook> {
validate.getOrderbook({address, orderbook, options})

Expand Down
2 changes: 1 addition & 1 deletion src/ledger/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function getOrders(address: string, options: OrdersOptions = {}

return utils.ensureLedgerVersion.call(this, options).then(_options => {
const getter = _.partial(requestAccountOffers, this.connection, address,
_options.ledgerVersion)
_options.ledgerVersion)
return utils.getRecursive(getter, _options.limit).then(orders =>
_.sortBy(orders, order => order.properties.sequence))
})
Expand Down
6 changes: 3 additions & 3 deletions src/ledger/parse/account-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function parseAccountOrder(address: string, order: Object): Object {
})

const makerExchangeRate = order.quality ?
utils.adjustQualityForXRP(order.quality.toString(),
takerGetsAmount.currency, takerPaysAmount.currency) :
computeQuality(takerGetsAmount, takerPaysAmount)
utils.adjustQualityForXRP(order.quality.toString(),
takerGetsAmount.currency, takerPaysAmount.currency) :
computeQuality(takerGetsAmount, takerPaysAmount)
const properties = {
maker: address,
sequence: order.seq,
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/parse/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const BigNumber = require('bignumber.js')
const AccountFields = require('./utils').constants.AccountFields

function parseField(info, value) {
if (info.encoding === 'hex' && !info.length) { // e.g. "domain"
if (info.encoding === 'hex' && !info.length) { // e.g. "domain"
return new Buffer(value, 'hex').toString('ascii')
}
if (info.shift) {
Expand Down
2 changes: 1 addition & 1 deletion src/ledger/parse/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const orderFlags = {
Passive: 0x00010000,
Sell: 0x00020000 // offer was placed as a sell
Sell: 0x00020000 // offer was placed as a sell
}

const trustlineFlags = {
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/parse/orderbook-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ function parseOrderbookOrder(order: Object): Object {
}

const takerGetsFunded = order.taker_gets_funded ?
parseAmount(order.taker_gets_funded) : undefined
parseAmount(order.taker_gets_funded) : undefined
const takerPaysFunded = order.taker_pays_funded ?
parseAmount(order.taker_pays_funded) : undefined
parseAmount(order.taker_pays_funded) : undefined
const available = utils.removeUndefined({
fundedAmount: takerGetsFunded,
priceOfFundedAmount: takerPaysFunded
Expand Down
6 changes: 3 additions & 3 deletions src/ledger/parse/pathfind.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function createAdjustment(address: string, adjustmentWithoutAddress: Object) {
const amountKey = _.keys(adjustmentWithoutAddress)[0]
const amount = adjustmentWithoutAddress[amountKey]
return _.set({address: address}, amountKey,
removeAnyCounterpartyEncoding(address, amount))
removeAnyCounterpartyEncoding(address, amount))
}

function parseAlternative(sourceAddress: string, destinationAddress: string,
Expand All @@ -29,9 +29,9 @@ function parseAlternative(sourceAddress: string, destinationAddress: string,
// directly to preparePayment
const amounts = (alternative.destination_amount !== undefined) ?
{source: {amount: parseAmount(alternative.source_amount)},
destination: {minAmount: parseAmount(alternative.destination_amount)}} :
destination: {minAmount: parseAmount(alternative.destination_amount)}} :
{source: {maxAmount: parseAmount(alternative.source_amount)},
destination: {amount: parseAmount(destinationAmount)}}
destination: {amount: parseAmount(destinationAmount)}}

return {
source: createAdjustment(sourceAddress, amounts.source),
Expand Down
4 changes: 2 additions & 2 deletions src/ledger/parse/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function parseTransactionType(type) {
PaymentChannelFund: 'paymentChannelFund',
PaymentChannelClaim: 'paymentChannelClaim',
SignerListSet: 'settings',
SetFee: 'feeUpdate', // pseudo-transaction
EnableAmendment: 'amendment' // pseudo-transaction
SetFee: 'feeUpdate', // pseudo-transaction
EnableAmendment: 'amendment' // pseudo-transaction
}
return mapping[type] || null
}
Expand Down
8 changes: 4 additions & 4 deletions src/ledger/pathfind.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function conditionallyAddDirectXRPPath(connection: Connection, address: string,
}

function filterSourceFundsLowPaths(pathfind: PathFind,
paths: RippledPathsResponse
paths: RippledPathsResponse
): RippledPathsResponse {
if (pathfind.source.amount &&
pathfind.destination.amount.value === undefined && paths.alternatives) {
Expand All @@ -107,7 +107,7 @@ function formatResponse(pathfind: PathFind, paths: RippledPathsResponse) {
}
if (paths.destination_currencies !== undefined &&
!_.includes(paths.destination_currencies,
pathfind.destination.amount.currency)) {
pathfind.destination.amount.currency)) {
throw new NotFoundError('No paths found. ' +
'The destination_account does not accept ' +
pathfind.destination.amount.currency + ', they only accept: ' +
Expand All @@ -133,8 +133,8 @@ function getPaths(pathfind: PathFind): Promise<GetPaths> {
return requestPathFind(this.connection, pathfind).then(paths =>
conditionallyAddDirectXRPPath(this.connection, address, paths)
)
.then(paths => filterSourceFundsLowPaths(pathfind, paths))
.then(paths => formatResponse(pathfind, paths))
.then(paths => filterSourceFundsLowPaths(pathfind, paths))
.then(paths => formatResponse(pathfind, paths))
}

module.exports = getPaths
30 changes: 15 additions & 15 deletions src/ledger/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ function convertError(connection: Connection, options: TransactionOptions,
if (_error instanceof errors.NotFoundError) {
return utils.hasCompleteLedgerRange(connection, options.minLedgerVersion,
options.maxLedgerVersion).then(hasCompleteLedgerRange => {
if (!hasCompleteLedgerRange) {
return utils.isPendingLedgerVersion(
connection, options.maxLedgerVersion)
.then(isPendingLedgerVersion => {
return isPendingLedgerVersion ?
new errors.PendingLedgerVersionError() :
new errors.MissingLedgerHistoryError()
})
}
return _error
})
if (!hasCompleteLedgerRange) {
return utils.isPendingLedgerVersion(
connection, options.maxLedgerVersion)
.then(isPendingLedgerVersion => {
return isPendingLedgerVersion ?
new errors.PendingLedgerVersionError() :
new errors.MissingLedgerHistoryError()
})
}
return _error
})
}
return Promise.resolve(_error)
}
Expand All @@ -92,11 +92,11 @@ function getTransaction(id: string, options: TransactionOptions = {}
return this.connection.request(request).then(tx =>
attachTransactionDate(this.connection, tx)
).then(_.partial(formatResponse, _options))
.catch(error => {
return convertError(this.connection, _options, error).then(_error => {
throw _error
.catch(error => {
return convertError(this.connection, _options, error).then(_error => {
throw _error
})
})
})
})
}

Expand Down
14 changes: 7 additions & 7 deletions src/ledger/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function counterpartyFilter(filters, tx: TransactionType) {
}

function transactionFilter(address: string, filters: TransactionsOptions,
tx: TransactionType
tx: TransactionType
) {
if (filters.excludeFailures && tx.outcome.result !== 'tesSUCCESS') {
return false
Expand Down Expand Up @@ -136,14 +136,14 @@ function checkForLedgerGaps(connection: Connection,

return utils.hasCompleteLedgerRange(connection, minLedgerVersion,
maxLedgerVersion).then(hasCompleteLedgerRange => {
if (!hasCompleteLedgerRange) {
throw new utils.common.errors.MissingLedgerHistoryError()
}
})
if (!hasCompleteLedgerRange) {
throw new utils.common.errors.MissingLedgerHistoryError()
}
})
}

function formatResponse(connection: Connection, options: TransactionsOptions,
transactions: GetTransactionsResponse
transactions: GetTransactionsResponse
) {
const compare = options.earliestFirst ? utils.compareTransactions :
_.rearg(utils.compareTransactions, 1, 0)
Expand All @@ -153,7 +153,7 @@ function formatResponse(connection: Connection, options: TransactionsOptions,
}

function getTransactionsInternal(connection: Connection, address: string,
options: TransactionsOptions
options: TransactionsOptions
): Promise<GetTransactionsResponse> {
const getter = _.partial(getAccountTx, connection, address, options)
const format = _.partial(formatResponse, connection, options)
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/escrow-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type EscrowCreation = {
}

function createEscrowCreationTransaction(account: string,
payment: EscrowCreation
payment: EscrowCreation
): Object {
const txJSON: Object = {
TransactionType: 'EscrowCreate',
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/escrow-execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type EscrowExecution = {
}

function createEscrowExecutionTransaction(account: string,
payment: EscrowExecution
payment: EscrowExecution
): Object {
const txJSON: Object = {
TransactionType: 'EscrowFinish',
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function createOrderTransaction(account: string, order: Order): Object {
}

function prepareOrder(address: string, order: Order,
instructions: Instructions = {}
instructions: Instructions = {}
): Promise<Prepare> {
validate.prepareOrder({address, order, instructions})
const txJSON = createOrderTransaction(address, order)
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/ordercancellation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const validate = utils.common.validate
import type {Instructions, Prepare} from './types.js'

function createOrderCancellationTransaction(account: string,
orderCancellation: Object
orderCancellation: Object
): Object {
const txJSON: Object = {
TransactionType: 'OfferCancel',
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function createPaymentTransaction(address: string, paymentArgument: Payment
}

function preparePayment(address: string, payment: Payment,
instructions: Instructions = {}
instructions: Instructions = {}
): Promise<Prepare> {
validate.preparePayment({address, payment, instructions})
const txJSON = createPaymentTransaction(address, payment)
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function createSettingsTransaction(account: string, settings: Settings
}

function prepareSettings(address: string, settings: Settings,
instructions: Instructions = {}
instructions: Instructions = {}
): Promise<Prepare> {
validate.prepareSettings({address, settings, instructions})
const txJSON = createSettingsTransaction(address, settings)
Expand Down
4 changes: 2 additions & 2 deletions src/transaction/trustline.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function convertQuality(quality) {
}

function createTrustlineTransaction(account: string,
trustline: TrustLineSpecification
trustline: TrustLineSpecification
): Object {
const limit = {
currency: trustline.currency,
Expand Down Expand Up @@ -51,7 +51,7 @@ function createTrustlineTransaction(account: string,
}

function prepareTrustline(address: string,
trustline: TrustLineSpecification, instructions: Instructions = {}
trustline: TrustLineSpecification, instructions: Instructions = {}
): Promise<Prepare> {
validate.prepareTrustline({address, trustline, instructions})
const txJSON = createTrustlineTransaction(address, trustline)
Expand Down
6 changes: 3 additions & 3 deletions src/transaction/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function scaleValue(value, multiplier, extra = 0) {
}

function prepareTransaction(txJSON: Object, api: Object,
instructions: Instructions
instructions: Instructions
): Promise<Prepare> {
common.validate.instructions(instructions)

Expand Down Expand Up @@ -67,8 +67,8 @@ function prepareTransaction(txJSON: Object, api: Object,
const extraFee =
(txJSON.TransactionType !== 'EscrowFinish' ||
txJSON.Fulfillment === undefined) ? 0 :
(cushion * feeRef * (32 + Math.floor(
new Buffer(txJSON.Fulfillment, 'hex').length / 16)))
(cushion * feeRef * (32 + Math.floor(
new Buffer(txJSON.Fulfillment, 'hex').length / 16)))
const feeDrops = common.xrpToDrops(fee)
if (instructions.maxFee !== undefined) {
const maxFeeDrops = common.xrpToDrops(instructions.maxFee)
Expand Down

0 comments on commit 7ece43e

Please sign in to comment.