1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 01:36:56 +01:00

more linting

This commit is contained in:
Matthias Kretschmann 2017-06-12 17:19:09 +02:00
parent 90cfaf1103
commit 9822967a7f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 26 additions and 21 deletions

View File

@ -41,12 +41,12 @@ export default class Connection {
/**
* @public
* @param tx_id
* @param txId
*/
getStatus(tx_id) {
getStatus(txId) {
return this._req(this.getApiUrls('statuses'), {
query: {
tx_id
txId
}
})
}
@ -65,13 +65,13 @@ export default class Connection {
/**
* @public
* @param tx_id
* @param txId
* @param status
*/
listBlocks({ tx_id, status }) {
listBlocks({ txId, status }) {
return this._req(this.getApiUrls('blocks'), {
query: {
tx_id,
txId,
status
}
})
@ -108,33 +108,33 @@ export default class Connection {
/**
* @public
* @param block_id
* @param blockId
*/
listVotes(block_id) {
listVotes(blockId) {
return this._req(this.getApiUrls('votes'), {
query: {
block_id
blockId
}
})
}
/**
* @public
* @param tx_id
* @param txId
* @return {Promise}
*/
pollStatusAndFetchTransaction(tx_id) {
pollStatusAndFetchTransaction(txId) {
return new Promise((resolve, reject) => {
const timer = setInterval(() => {
this.getStatus(tx_id)
this.getStatus(txId)
.then((res) => {
console.log('Fetched transaction status:', res)
console.log('Fetched transaction status:', res) // eslint-disable-line no-console
if (res.status === 'valid') {
clearInterval(timer)
this.getTransaction(tx_id)
.then((res) => {
console.log('Fetched transaction:', res)
resolve(res)
this.getTransaction(txId)
.then((res_) => {
console.log('Fetched transaction:', res_) // eslint-disable-line no-console
resolve(res_)
})
}
})

View File

@ -3,7 +3,7 @@ import { sprintf } from 'sprintf-js'
// Regexes taken from or inspired by sprintf-js
const Regex = {
TEMPLATE_LITERAL: /\${([^\)]+?)}/g,
TEMPLATE_LITERAL: /\${([^)]+?)}/g,
KEY: /^([a-z_][a-z_\d]*)/i,
KEY_ACCESS: /^\.([a-z_][a-z_\d]*)/i,
INDEX_ACCESS: /^\[(\d+)\]/

View File

@ -29,7 +29,7 @@ export default function request(url, config = {}, onlyJsonResponse = true) {
}
return baseRequest(apiUrl, requestConfig)
.then((res) => onlyJsonResponse ? res.json() :
.then(res => onlyJsonResponse ? res.json() :
{
json: res.json(),
url: res.url

View File

@ -22,7 +22,12 @@ import makeTransaction from './makeTransaction'
* @returns {object} Unsigned transaction -- make sure to call signTransaction() on it before
* sending it off!
*/
export default function makeTransferTransaction(unspentTransaction, metadata, outputs, ...fulfilledOutputs) {
export default function makeTransferTransaction(
unspentTransaction,
metadata,
outputs,
...fulfilledOutputs
) {
const inputs = fulfilledOutputs.map((outputIndex) => {
const fulfilledOutput = unspentTransaction.outputs[outputIndex]
const transactionLink = {

View File

@ -3,7 +3,7 @@ import base58 from 'bs58'
/**
* @public
* Serializes a crypto-condition class (Condition or Fulfillment) into a BigchainDB-compatible JSON
* @param {cc.Fulfillment} fulfillment base58 encoded Ed25519 public key for the recipient of the Transaction
* @param {cc.Fulfillment} fulfillment base58 encoded Ed25519 public key for recipient of the Transaction
* @returns {object} Ed25519 Condition (that will need to wrapped in an Output)
*/
export default function ccJsonify(fulfillment) {