mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2025-01-06 03:44:04 +01:00
Fix eslint errors
This commit is contained in:
parent
692cbe56d0
commit
a49e935b8f
@ -30,12 +30,8 @@ export default function request(url, config = {}, onlyJsonResponse = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return baseRequest(apiUrl, requestConfig)
|
return baseRequest(apiUrl, requestConfig)
|
||||||
.then((res) => onlyJsonResponse ? res.json() : // eslint-disable-line no-confusing-arrow
|
.then(res => (onlyJsonResponse ? res.json() : { json: res.json(), url: res.url }))
|
||||||
{
|
.catch(err => {
|
||||||
json: res.json(),
|
|
||||||
url: res.url
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error(err)
|
console.error(err)
|
||||||
throw err
|
throw err
|
||||||
})
|
})
|
||||||
|
@ -10,11 +10,11 @@ import coreObjectEntries from 'core-js/library/fn/object/entries'
|
|||||||
function filterFromObject(obj, filter, { isInclusion = true } = {}) {
|
function filterFromObject(obj, filter, { isInclusion = true } = {}) {
|
||||||
if (filter && Array.isArray(filter)) {
|
if (filter && Array.isArray(filter)) {
|
||||||
return applyFilterOnObject(obj, isInclusion ? ((_, key) => coreIncludes(filter, key))
|
return applyFilterOnObject(obj, isInclusion ? ((_, key) => coreIncludes(filter, key))
|
||||||
: ((_, key) => !coreIncludes(filter, key)))
|
: ((_, key) => !coreIncludes(filter, key)))
|
||||||
} else if (filter && typeof filter === 'function') {
|
} else if (filter && typeof filter === 'function') {
|
||||||
// Flip the filter fn's return if it's for inclusion
|
// Flip the filter fn's return if it's for inclusion
|
||||||
return applyFilterOnObject(obj, isInclusion ? filter
|
return applyFilterOnObject(obj, isInclusion ? filter
|
||||||
: (...args) => !filter(...args))
|
: (...args) => !filter(...args))
|
||||||
} else {
|
} else {
|
||||||
throw new Error('The given filter is not an array or function. Exclude aborted')
|
throw new Error('The given filter is not an array or function. Exclude aborted')
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,11 @@ import makeTransaction from './makeTransaction'
|
|||||||
// TODO:
|
// TODO:
|
||||||
// - Make `metadata` optional argument
|
// - Make `metadata` optional argument
|
||||||
export default function makeTransferTransaction(
|
export default function makeTransferTransaction(
|
||||||
unspentTransaction,
|
unspentTransaction,
|
||||||
metadata,
|
metadata,
|
||||||
outputs,
|
outputs,
|
||||||
...outputIndices
|
...outputIndices
|
||||||
) {
|
) {
|
||||||
const inputs = outputIndices.map((outputIndex) => {
|
const inputs = outputIndices.map((outputIndex) => {
|
||||||
const fulfilledOutput = unspentTransaction.outputs[outputIndex]
|
const fulfilledOutput = unspentTransaction.outputs[outputIndex]
|
||||||
const transactionLink = {
|
const transactionLink = {
|
||||||
@ -42,7 +42,7 @@ export default function makeTransferTransaction(
|
|||||||
|
|
||||||
const assetLink = {
|
const assetLink = {
|
||||||
'id': unspentTransaction.operation === 'CREATE' ? unspentTransaction.id
|
'id': unspentTransaction.operation === 'CREATE' ? unspentTransaction.id
|
||||||
: unspentTransaction.asset.id
|
: unspentTransaction.asset.id
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeTransaction('TRANSFER', assetLink, metadata, outputs, inputs)
|
return makeTransaction('TRANSFER', assetLink, metadata, outputs, inputs)
|
||||||
|
@ -20,7 +20,7 @@ test('Threshold condition encoding', t => {
|
|||||||
const publicKey = '4zvwRjXUKGfvwnParsHAS3HuSVzV5cA4McphgmoCtajS'
|
const publicKey = '4zvwRjXUKGfvwnParsHAS3HuSVzV5cA4McphgmoCtajS'
|
||||||
const ed25519 = Transaction.makeEd25519Condition(publicKey, false)
|
const ed25519 = Transaction.makeEd25519Condition(publicKey, false)
|
||||||
const condition = Transaction.makeThresholdCondition(
|
const condition = Transaction.makeThresholdCondition(
|
||||||
1, [ed25519, ed25519])
|
1, [ed25519, ed25519])
|
||||||
const output = Transaction.makeOutput(condition)
|
const output = Transaction.makeOutput(condition)
|
||||||
const target = {
|
const target = {
|
||||||
condition: {
|
condition: {
|
||||||
@ -64,8 +64,8 @@ test('Fulfillment correctly formed', t => {
|
|||||||
const msg = Transaction.serializeTransactionIntoCanonicalString(txTransfer)
|
const msg = Transaction.serializeTransactionIntoCanonicalString(txTransfer)
|
||||||
const txSigned = Transaction.signTransaction(txTransfer, alice.privateKey)
|
const txSigned = Transaction.signTransaction(txTransfer, alice.privateKey)
|
||||||
t.truthy(cc.validateFulfillment(txSigned.inputs[0].fulfillment,
|
t.truthy(cc.validateFulfillment(txSigned.inputs[0].fulfillment,
|
||||||
txCreate.outputs[0].condition.uri,
|
txCreate.outputs[0].condition.uri,
|
||||||
new Buffer(msg)))
|
new Buffer(msg)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user