mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 17:50:09 +01:00
more linting
This commit is contained in:
parent
90cfaf1103
commit
9822967a7f
@ -41,12 +41,12 @@ export default class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
* @param tx_id
|
* @param txId
|
||||||
*/
|
*/
|
||||||
getStatus(tx_id) {
|
getStatus(txId) {
|
||||||
return this._req(this.getApiUrls('statuses'), {
|
return this._req(this.getApiUrls('statuses'), {
|
||||||
query: {
|
query: {
|
||||||
tx_id
|
txId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -65,13 +65,13 @@ export default class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
* @param tx_id
|
* @param txId
|
||||||
* @param status
|
* @param status
|
||||||
*/
|
*/
|
||||||
listBlocks({ tx_id, status }) {
|
listBlocks({ txId, status }) {
|
||||||
return this._req(this.getApiUrls('blocks'), {
|
return this._req(this.getApiUrls('blocks'), {
|
||||||
query: {
|
query: {
|
||||||
tx_id,
|
txId,
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -108,33 +108,33 @@ export default class Connection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
* @param block_id
|
* @param blockId
|
||||||
*/
|
*/
|
||||||
listVotes(block_id) {
|
listVotes(blockId) {
|
||||||
return this._req(this.getApiUrls('votes'), {
|
return this._req(this.getApiUrls('votes'), {
|
||||||
query: {
|
query: {
|
||||||
block_id
|
blockId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
* @param tx_id
|
* @param txId
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
pollStatusAndFetchTransaction(tx_id) {
|
pollStatusAndFetchTransaction(txId) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
this.getStatus(tx_id)
|
this.getStatus(txId)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log('Fetched transaction status:', res)
|
console.log('Fetched transaction status:', res) // eslint-disable-line no-console
|
||||||
if (res.status === 'valid') {
|
if (res.status === 'valid') {
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
this.getTransaction(tx_id)
|
this.getTransaction(txId)
|
||||||
.then((res) => {
|
.then((res_) => {
|
||||||
console.log('Fetched transaction:', res)
|
console.log('Fetched transaction:', res_) // eslint-disable-line no-console
|
||||||
resolve(res)
|
resolve(res_)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -3,7 +3,7 @@ import { sprintf } from 'sprintf-js'
|
|||||||
|
|
||||||
// Regexes taken from or inspired by sprintf-js
|
// Regexes taken from or inspired by sprintf-js
|
||||||
const Regex = {
|
const Regex = {
|
||||||
TEMPLATE_LITERAL: /\${([^\)]+?)}/g,
|
TEMPLATE_LITERAL: /\${([^)]+?)}/g,
|
||||||
KEY: /^([a-z_][a-z_\d]*)/i,
|
KEY: /^([a-z_][a-z_\d]*)/i,
|
||||||
KEY_ACCESS: /^\.([a-z_][a-z_\d]*)/i,
|
KEY_ACCESS: /^\.([a-z_][a-z_\d]*)/i,
|
||||||
INDEX_ACCESS: /^\[(\d+)\]/
|
INDEX_ACCESS: /^\[(\d+)\]/
|
||||||
|
@ -29,7 +29,7 @@ export default function request(url, config = {}, onlyJsonResponse = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return baseRequest(apiUrl, requestConfig)
|
return baseRequest(apiUrl, requestConfig)
|
||||||
.then((res) => onlyJsonResponse ? res.json() :
|
.then(res => onlyJsonResponse ? res.json() :
|
||||||
{
|
{
|
||||||
json: res.json(),
|
json: res.json(),
|
||||||
url: res.url
|
url: res.url
|
||||||
|
@ -22,7 +22,12 @@ import makeTransaction from './makeTransaction'
|
|||||||
* @returns {object} Unsigned transaction -- make sure to call signTransaction() on it before
|
* @returns {object} Unsigned transaction -- make sure to call signTransaction() on it before
|
||||||
* sending it off!
|
* 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 inputs = fulfilledOutputs.map((outputIndex) => {
|
||||||
const fulfilledOutput = unspentTransaction.outputs[outputIndex]
|
const fulfilledOutput = unspentTransaction.outputs[outputIndex]
|
||||||
const transactionLink = {
|
const transactionLink = {
|
||||||
|
@ -3,7 +3,7 @@ import base58 from 'bs58'
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
* Serializes a crypto-condition class (Condition or Fulfillment) into a BigchainDB-compatible JSON
|
* 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)
|
* @returns {object} Ed25519 Condition (that will need to wrapped in an Output)
|
||||||
*/
|
*/
|
||||||
export default function ccJsonify(fulfillment) {
|
export default function ccJsonify(fulfillment) {
|
||||||
|
Loading…
Reference in New Issue
Block a user