mirror of
https://github.com/fullstack-cash/bch-api.git
synced 2026-09-23 01:32:03 -07:00
linting
This commit is contained in:
@@ -46,15 +46,15 @@ class Control {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /control/getnetworkinfo Get Network Info
|
||||
* @apiName GetNetworkInfo
|
||||
* @apiGroup Control
|
||||
* @apiDescription RPC call which gets basic full node information.
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/control/getnetworkinfo" -H "accept: application/json"
|
||||
*
|
||||
*/
|
||||
* @api {get} /control/getnetworkinfo Get Network Info
|
||||
* @apiName GetNetworkInfo
|
||||
* @apiGroup Control
|
||||
* @apiDescription RPC call which gets basic full node information.
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/control/getnetworkinfo" -H "accept: application/json"
|
||||
*
|
||||
*/
|
||||
async getNetworkInfo (req, res, next) {
|
||||
// Axios options
|
||||
const options = _this.routeUtils.getAxiosOptions()
|
||||
|
||||
@@ -68,17 +68,17 @@ class Mining {
|
||||
// });
|
||||
|
||||
/**
|
||||
* @api {get} /mining/getMiningInfo Get Mining Info.
|
||||
* @apiName Mining info.
|
||||
* @apiGroup Mining
|
||||
* @apiDescription Returns a json object containing mining-related information.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/mining/getMiningInfo" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {get} /mining/getMiningInfo Get Mining Info.
|
||||
* @apiName Mining info.
|
||||
* @apiGroup Mining
|
||||
* @apiDescription Returns a json object containing mining-related information.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/mining/getMiningInfo" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
async getMiningInfo (req, res, next) {
|
||||
try {
|
||||
const options = _this.routeUtils.getAxiosOptions()
|
||||
@@ -98,17 +98,17 @@ class Mining {
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /mining/getNetworkHashps?nblocks=&height= Get Estimated network hashes per second.
|
||||
* @apiName Estimated network hashes per second.
|
||||
* @apiGroup Mining
|
||||
* @apiDescription Returns the estimated network hashes per second based on the last n blocks. Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change. Pass in [height] to estimate the network speed at the time when a certain block was found.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/mining/getNetworkHashps?nblocks=120&height=-1" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {get} /mining/getNetworkHashps?nblocks=&height= Get Estimated network hashes per second.
|
||||
* @apiName Estimated network hashes per second.
|
||||
* @apiGroup Mining
|
||||
* @apiDescription Returns the estimated network hashes per second based on the last n blocks. Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change. Pass in [height] to estimate the network speed at the time when a certain block was found.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/mining/getNetworkHashps?nblocks=120&height=-1" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
async getNetworkHashPS (req, res, next) {
|
||||
try {
|
||||
|
||||
@@ -22,7 +22,10 @@ class RawTransactions {
|
||||
|
||||
this.router = router
|
||||
this.router.get('/', this.root)
|
||||
this.router.get('/decodeRawTransaction/:hex', this.decodeRawTransactionSingle)
|
||||
this.router.get(
|
||||
'/decodeRawTransaction/:hex',
|
||||
this.decodeRawTransactionSingle
|
||||
)
|
||||
this.router.post('/decodeRawTransaction', this.decodeRawTransactionBulk)
|
||||
this.router.get('/decodeScript/:hex', this.decodeScriptSingle)
|
||||
this.router.post('/decodeScript', this.decodeScriptBulk)
|
||||
@@ -52,17 +55,15 @@ class RawTransactions {
|
||||
// Decode transaction hex into a JSON object.
|
||||
// GET
|
||||
/**
|
||||
* @api {get} /rawtransactions/decodeRawTransaction/{hex} Decode Single Raw Transaction.
|
||||
* @apiName Decode Single Raw Transaction
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Return a JSON object representing the serialized, hex-encoded transaction.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/decodeRawTransaction/02000000010e991f7ccec410f27d333f737f149b5d3be6728687da81072e638aed0063a176010000006b483045022100cd20443b0af090053450bc4ab00d563d4ac5955bb36e0135b00b8a96a19f233302205047f2c70a08c6ef4b76f2d198b33a31d17edfaa7e1e9e865894da0d396009354121024d4e7f522f67105b7bf5f9dbe557e7b2244613fdfcd6fe09304f93877328f6beffffffff02a0860100000000001976a9140ee020c07f39526ac5505c54fa1ab98490979b8388acb5f0f70b000000001976a9143a9b2b0c12fe722fcf653b6ef5dcc38732d6ff5188ac00000000" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {get} /rawtransactions/decodeRawTransaction/{hex} Decode Single Raw Transaction.
|
||||
* @apiName Decode Single Raw Transaction
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Return a JSON object representing the serialized, hex-encoded transaction.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/decodeRawTransaction/02000000010e991f7ccec410f27d333f737f149b5d3be6728687da81072e638aed0063a176010000006b483045022100cd20443b0af090053450bc4ab00d563d4ac5955bb36e0135b00b8a96a19f233302205047f2c70a08c6ef4b76f2d198b33a31d17edfaa7e1e9e865894da0d396009354121024d4e7f522f67105b7bf5f9dbe557e7b2244613fdfcd6fe09304f93877328f6beffffffff02a0860100000000001976a9140ee020c07f39526ac5505c54fa1ab98490979b8388acb5f0f70b000000001976a9143a9b2b0c12fe722fcf653b6ef5dcc38732d6ff5188ac00000000" -H "accept: application/json"
|
||||
*/
|
||||
async decodeRawTransactionSingle (req, res, next) {
|
||||
try {
|
||||
const hex = req.params.hex
|
||||
@@ -90,19 +91,19 @@ class RawTransactions {
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @api {post} /rawtransactions/decodeRawTransaction Decode Bulk Raw Transactions.
|
||||
* @apiName Decode Bulk Raw Transactions
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Return bulk hex encoded transaction.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/decodeRawTransaction" -H "accept: application/json" -H "Content-Type: application/json" -d '{"hexes":["01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000","01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000"]}'
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @api {post} /rawtransactions/decodeRawTransaction Decode Bulk Raw Transactions.
|
||||
* @apiName Decode Bulk Raw Transactions
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Return bulk hex encoded transaction.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/decodeRawTransaction" -H "accept: application/json" -H "Content-Type: application/json" -d '{"hexes":["01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000","01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000"]}'
|
||||
*
|
||||
*
|
||||
*/
|
||||
async decodeRawTransactionBulk (req, res, next) {
|
||||
try {
|
||||
const hexes = req.body.hexes
|
||||
@@ -152,38 +153,6 @@ class RawTransactions {
|
||||
|
||||
res.status(200)
|
||||
return res.json(result)
|
||||
|
||||
/*
|
||||
// Loop through each hex and creates an array of requests to call in parallel
|
||||
hexes = hexes.map(async (hex: any) => {
|
||||
if (!hex || hex === "") {
|
||||
res.status(400)
|
||||
return res.json({ error: "Encountered empty hex" })
|
||||
}
|
||||
const {
|
||||
BitboxHTTP,
|
||||
username,
|
||||
password,
|
||||
requestConfig
|
||||
} = routeUtils.setEnvVars()
|
||||
requestConfig.data.id = "decoderawtransaction"
|
||||
requestConfig.data.method = "decoderawtransaction"
|
||||
requestConfig.data.params = [hex]
|
||||
return await BitboxHTTP(requestConfig)
|
||||
})
|
||||
const result: Array<any> = []
|
||||
return axios.all(hexes).then(
|
||||
axios.spread((...args) => {
|
||||
args.forEach((arg: any) => {
|
||||
if (arg) {
|
||||
result.push(arg.data.result)
|
||||
}
|
||||
})
|
||||
res.status(200)
|
||||
return res.json(result)
|
||||
})
|
||||
)
|
||||
*/
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/getRawTransaction: `, err)
|
||||
@@ -198,17 +167,17 @@ class RawTransactions {
|
||||
// Decode a raw transaction from hex to assembly.
|
||||
// GET single
|
||||
/**
|
||||
* @api {get} /rawtransactions/decodeScript/{hex} Decode Single Script.
|
||||
* @apiName Decode Single Script
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Decode a hex-encoded script.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/decodeScript/4830450221009a51e00ec3524a7389592bc27bea4af5104a59510f5f0cfafa64bbd5c164ca2e02206c2a8bbb47eabdeed52f17d7df668d521600286406930426e3a9415fe10ed592012102e6e1423f7abde8b70bca3e78a7d030e5efabd3eb35c19302542b5fe7879c1a16" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {get} /rawtransactions/decodeScript/{hex} Decode Single Script.
|
||||
* @apiName Decode Single Script
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Decode a hex-encoded script.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/decodeScript/4830450221009a51e00ec3524a7389592bc27bea4af5104a59510f5f0cfafa64bbd5c164ca2e02206c2a8bbb47eabdeed52f17d7df668d521600286406930426e3a9415fe10ed592012102e6e1423f7abde8b70bca3e78a7d030e5efabd3eb35c19302542b5fe7879c1a16" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
async decodeScriptSingle (req, res, next) {
|
||||
try {
|
||||
const hex = req.params.hex
|
||||
@@ -239,17 +208,17 @@ class RawTransactions {
|
||||
// Decode a raw transaction from hex to assembly.
|
||||
// POST bulk
|
||||
/**
|
||||
* @api {post} /rawtransactions/decodeScript Bulk Decode Script.
|
||||
* @apiName Bulk Decode Script
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Decode multiple hex-encoded scripts.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
*curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/decodeScript" -H "accept:" -H "Content-Type: application/json" -d '{"hexes":["01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000","01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000"]}'
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {post} /rawtransactions/decodeScript Bulk Decode Script.
|
||||
* @apiName Bulk Decode Script
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Decode multiple hex-encoded scripts.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
*curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/decodeScript" -H "accept:" -H "Content-Type: application/json" -d '{"hexes":["01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000","01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000"]}'
|
||||
*
|
||||
*
|
||||
*/
|
||||
async decodeScriptBulk (req, res, next) {
|
||||
try {
|
||||
const hexes = req.body.hexes
|
||||
@@ -329,16 +298,16 @@ class RawTransactions {
|
||||
// Get a JSON object breakdown of transaction details.
|
||||
// POST
|
||||
/**
|
||||
* @api {post} /rawtransactions/getRawTransaction Get Bulk Raw Transactions.
|
||||
* @apiName Get Bulk Raw Transactions.
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Return the raw transaction data for multiple transactions. If verbose is 'true', returns an Object with information about 'txid'. If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/getRawTransaction" -H "accept: application/json" -H "Content-Type: application/json" -d '{"txids":["a5f972572ee1753e2fd2457dd61ce5f40fa2f8a30173d417e49feef7542c96a1","5165dc531aad05d1149bb0f0d9b7bda99c73e2f05e314bcfb5b4bb9ca5e1af5e"],"verbose":true}'
|
||||
*
|
||||
*/
|
||||
* @api {post} /rawtransactions/getRawTransaction Get Bulk Raw Transactions.
|
||||
* @apiName Get Bulk Raw Transactions.
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Return the raw transaction data for multiple transactions. If verbose is 'true', returns an Object with information about 'txid'. If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/getRawTransaction" -H "accept: application/json" -H "Content-Type: application/json" -d '{"txids":["a5f972572ee1753e2fd2457dd61ce5f40fa2f8a30173d417e49feef7542c96a1","5165dc531aad05d1149bb0f0d9b7bda99c73e2f05e314bcfb5b4bb9ca5e1af5e"],"verbose":true}'
|
||||
*
|
||||
*/
|
||||
async getRawTransactionBulk (req, res, next) {
|
||||
try {
|
||||
let verbose = 0
|
||||
@@ -404,17 +373,17 @@ class RawTransactions {
|
||||
// Get a JSON object breakdown of transaction details.
|
||||
// GET
|
||||
/**
|
||||
* @api {get} /rawtransactions/getRawTransaction/{txid} Return the raw transaction data.
|
||||
* @apiName Get Raw Transaction
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription return the raw transaction data. If verbose is 'true', returns an Object with information about 'txid'. If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/getRawTransaction/fe28050b93faea61fa88c4c630f0e1f0a1c24d0082dd0e10d369e13212128f33?verbose=true" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {get} /rawtransactions/getRawTransaction/{txid} Return the raw transaction data.
|
||||
* @apiName Get Raw Transaction
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription return the raw transaction data. If verbose is 'true', returns an Object with information about 'txid'. If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/getRawTransaction/fe28050b93faea61fa88c4c630f0e1f0a1c24d0082dd0e10d369e13212128f33?verbose=true" -H "accept: application/json"
|
||||
*
|
||||
*
|
||||
*/
|
||||
async getRawTransactionSingle (req, res, next) {
|
||||
try {
|
||||
let verbose = 0
|
||||
@@ -432,7 +401,10 @@ class RawTransactions {
|
||||
} catch (err) {
|
||||
// Write out error to error log.
|
||||
// logger.error(`Error in rawtransactions/getRawTransaction: `, err)
|
||||
wlogger.error('Error in rawtransactions.ts/getRawTransactionSingle().', err)
|
||||
wlogger.error(
|
||||
'Error in rawtransactions.ts/getRawTransactionSingle().',
|
||||
err
|
||||
)
|
||||
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
@@ -440,20 +412,20 @@ class RawTransactions {
|
||||
|
||||
// Transmit a raw transaction to the BCH network.
|
||||
/**
|
||||
* @api {post} /rawtransactions/sendRawTransaction Send Bulk Raw Transactions.
|
||||
* @apiName Send Bulk Raw Transactions
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Submits multiple raw transaction (serialized, hex-encoded) to local node and network.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/sendRawTransaction" -H "accept:application/json" -H "Content-Type: application/json" -d '{"hexes":["01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000","01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000"]}'
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {post} /rawtransactions/sendRawTransaction Send Bulk Raw Transactions.
|
||||
* @apiName Send Bulk Raw Transactions
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Submits multiple raw transaction (serialized, hex-encoded) to local node and network.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X POST "https://mainnet.bchjs.cash/v3/rawtransactions/sendRawTransaction" -H "accept:application/json" -H "Content-Type: application/json" -d '{"hexes":["01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000","01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000"]}'
|
||||
*
|
||||
*
|
||||
*/
|
||||
async sendRawTransactionBulk (req, res, next) {
|
||||
try {
|
||||
// Validation
|
||||
// Validation
|
||||
const hexes = req.body.hexes
|
||||
|
||||
// Reject if input is not an array
|
||||
@@ -523,24 +495,27 @@ class RawTransactions {
|
||||
res.status(200)
|
||||
return res.json(result)
|
||||
} catch (err) {
|
||||
wlogger.error('Error in rawtransactions.ts/sendRawTransactionBulk().', err)
|
||||
wlogger.error(
|
||||
'Error in rawtransactions.ts/sendRawTransactionBulk().',
|
||||
err
|
||||
)
|
||||
return this.errorHandler(err, res)
|
||||
}
|
||||
}
|
||||
|
||||
// Transmit a raw transaction to the BCH network.
|
||||
/**
|
||||
* @api {get} /rawtransactions/sendRawTransaction/{hex} Send Single Raw Transaction.
|
||||
* @apiName Send Single Raw Transaction
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Submits single raw transaction (serialized, hex-encoded) to local node and network.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/sendRawTransaction/01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000" -H "accept: "
|
||||
*
|
||||
*
|
||||
*/
|
||||
* @api {get} /rawtransactions/sendRawTransaction/{hex} Send Single Raw Transaction.
|
||||
* @apiName Send Single Raw Transaction
|
||||
* @apiGroup Raw Transaction
|
||||
* @apiDescription Submits single raw transaction (serialized, hex-encoded) to local node and network.
|
||||
*
|
||||
*
|
||||
* @apiExample Example usage:
|
||||
* curl -X GET "https://mainnet.bchjs.cash/v3/rawtransactions/sendRawTransaction/01000000013ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000006a4730440220540986d1c58d6e76f8f05501c520c38ce55393d0ed7ed3c3a82c69af04221232022058ea43ed6c05fec0eccce749a63332ed4525460105346f11108b9c26df93cd72012103083dfc5a0254613941ddc91af39ff90cd711cdcde03a87b144b883b524660c39ffffffff01807c814a000000001976a914d7e7c4e0b70eaa67ceff9d2823d1bbb9f6df9a5188ac00000000" -H "accept: "
|
||||
*
|
||||
*
|
||||
*/
|
||||
async sendRawTransactionSingle (req, res, next) {
|
||||
try {
|
||||
const hex = req.params.hex // URL parameter
|
||||
@@ -581,4 +556,5 @@ class RawTransactions {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RawTransactions
|
||||
|
||||
Reference in New Issue
Block a user