mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
fix(electrumx): Adding usrObj to Electrumx.Transactions()
This commit is contained in:
+3
-2
@@ -284,7 +284,7 @@ class ElectrumX {
|
|||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
async transactions (address) {
|
async transactions (address, usrObj = null) {
|
||||||
try {
|
try {
|
||||||
// Handle single address.
|
// Handle single address.
|
||||||
if (typeof address === 'string') {
|
if (typeof address === 'string') {
|
||||||
@@ -299,7 +299,8 @@ class ElectrumX {
|
|||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
`${this.restURL}electrumx/transactions`,
|
`${this.restURL}electrumx/transactions`,
|
||||||
{
|
{
|
||||||
addresses: address
|
addresses: address,
|
||||||
|
usrObj // pass user data when making an internal call.
|
||||||
},
|
},
|
||||||
_this.axiosOptions
|
_this.axiosOptions
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ class RawTransactions {
|
|||||||
* // time: 1547752564,
|
* // time: 1547752564,
|
||||||
* // blocktime: 1547752564 } ]
|
* // blocktime: 1547752564 } ]
|
||||||
*/
|
*/
|
||||||
async getRawTransaction (txid, verbose = false) {
|
async getRawTransaction (txid, verbose = false, usrObj = null) {
|
||||||
try {
|
try {
|
||||||
if (typeof txid === 'string') {
|
if (typeof txid === 'string') {
|
||||||
const response = await axios.get(
|
const response = await axios.get(
|
||||||
@@ -278,7 +278,8 @@ class RawTransactions {
|
|||||||
url: `${this.restURL}rawtransactions/getRawTransaction`,
|
url: `${this.restURL}rawtransactions/getRawTransaction`,
|
||||||
data: {
|
data: {
|
||||||
txids: txid,
|
txids: txid,
|
||||||
verbose: verbose
|
verbose: verbose,
|
||||||
|
usrObj // pass user data when making an internal call.
|
||||||
},
|
},
|
||||||
headers: _this.axiosOptions.headers
|
headers: _this.axiosOptions.headers
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -440,7 +440,7 @@ class Utils {
|
|||||||
const path = `${this.restURL}slp/validateTxid`
|
const path = `${this.restURL}slp/validateTxid`
|
||||||
|
|
||||||
// console.log(`txid: ${JSON.stringify(txid, null, 2)}`)
|
// console.log(`txid: ${JSON.stringify(txid, null, 2)}`)
|
||||||
console.log(`validateTxid usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
// console.log(`validateTxid usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
||||||
|
|
||||||
// Handle a single TXID or an array of TXIDs.
|
// Handle a single TXID or an array of TXIDs.
|
||||||
let txids
|
let txids
|
||||||
@@ -452,7 +452,7 @@ class Utils {
|
|||||||
path,
|
path,
|
||||||
{
|
{
|
||||||
txids: txids,
|
txids: txids,
|
||||||
usrObj
|
usrObj // pass user data when making an internal call.
|
||||||
},
|
},
|
||||||
_this.axiosOptions
|
_this.axiosOptions
|
||||||
)
|
)
|
||||||
@@ -656,7 +656,7 @@ class Utils {
|
|||||||
|
|
||||||
// console.log(`txid: ${JSON.stringify(txid, null, 2)}`)
|
// console.log(`txid: ${JSON.stringify(txid, null, 2)}`)
|
||||||
// console.log(`path: ${JSON.stringify(path, null, 2)}`)
|
// console.log(`path: ${JSON.stringify(path, null, 2)}`)
|
||||||
console.log('validateTxid3 usrObj: ', usrObj)
|
// console.log('validateTxid3 usrObj: ', usrObj)
|
||||||
|
|
||||||
// Handle a single TXID or an array of TXIDs.
|
// Handle a single TXID or an array of TXIDs.
|
||||||
let txids
|
let txids
|
||||||
@@ -668,7 +668,7 @@ class Utils {
|
|||||||
path,
|
path,
|
||||||
{
|
{
|
||||||
txids: txids,
|
txids: txids,
|
||||||
usrObj
|
usrObj // pass user data when making an internal call.
|
||||||
},
|
},
|
||||||
_this.axiosOptions
|
_this.axiosOptions
|
||||||
)
|
)
|
||||||
@@ -943,7 +943,7 @@ class Utils {
|
|||||||
if (cachedVal) return cachedVal
|
if (cachedVal) return cachedVal
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`decodeOpReturn usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
// console.log(`decodeOpReturn usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Validate the txid input.
|
// Validate the txid input.
|
||||||
@@ -963,7 +963,7 @@ class Utils {
|
|||||||
{
|
{
|
||||||
verbose: true,
|
verbose: true,
|
||||||
txids: [txid],
|
txids: [txid],
|
||||||
usrObj
|
usrObj // pass user data when making an internal call.
|
||||||
},
|
},
|
||||||
_this.axiosOptions
|
_this.axiosOptions
|
||||||
)
|
)
|
||||||
@@ -1086,7 +1086,7 @@ class Utils {
|
|||||||
// Throw error if input is not an array.
|
// Throw error if input is not an array.
|
||||||
if (!Array.isArray(utxos)) throw new Error('Input must be an array.')
|
if (!Array.isArray(utxos)) throw new Error('Input must be an array.')
|
||||||
|
|
||||||
console.log(`tokenUtxoDetails usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
// console.log(`tokenUtxoDetails usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
||||||
|
|
||||||
// Loop through each element in the array and validate the input before
|
// Loop through each element in the array and validate the input before
|
||||||
// further processing.
|
// further processing.
|
||||||
@@ -1243,7 +1243,7 @@ class Utils {
|
|||||||
try {
|
try {
|
||||||
const decodeOpReturnCache = {}
|
const decodeOpReturnCache = {}
|
||||||
|
|
||||||
console.log(`_hydrateUtxo usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
// console.log(`_hydrateUtxo usrObj: ${JSON.stringify(usrObj, null, 2)}`)
|
||||||
|
|
||||||
// Output Array
|
// Output Array
|
||||||
const outAry = []
|
const outAry = []
|
||||||
@@ -1260,7 +1260,7 @@ class Utils {
|
|||||||
slpData = await this.decodeOpReturn(
|
slpData = await this.decodeOpReturn(
|
||||||
utxo.txid,
|
utxo.txid,
|
||||||
decodeOpReturnCache,
|
decodeOpReturnCache,
|
||||||
usrObj
|
usrObj // pass user data when making an internal call.
|
||||||
)
|
)
|
||||||
// console.log(`slpData: ${JSON.stringify(slpData, null, 2)}`)
|
// console.log(`slpData: ${JSON.stringify(slpData, null, 2)}`)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1352,7 +1352,7 @@ class Utils {
|
|||||||
const genesisData = await this.decodeOpReturn(
|
const genesisData = await this.decodeOpReturn(
|
||||||
slpData.tokenId,
|
slpData.tokenId,
|
||||||
decodeOpReturnCache,
|
decodeOpReturnCache,
|
||||||
usrObj
|
usrObj // pass user data when making an internal call.
|
||||||
)
|
)
|
||||||
// console.log(`genesisData: ${JSON.stringify(genesisData, null, 2)}`)
|
// console.log(`genesisData: ${JSON.stringify(genesisData, null, 2)}`)
|
||||||
|
|
||||||
@@ -1405,7 +1405,7 @@ class Utils {
|
|||||||
const genesisData = await this.decodeOpReturn(
|
const genesisData = await this.decodeOpReturn(
|
||||||
slpData.tokenId,
|
slpData.tokenId,
|
||||||
decodeOpReturnCache,
|
decodeOpReturnCache,
|
||||||
usrObj
|
usrObj // pass user data when making an internal call.
|
||||||
)
|
)
|
||||||
// console.log(`genesisData: ${JSON.stringify(genesisData, null, 2)}`)
|
// console.log(`genesisData: ${JSON.stringify(genesisData, null, 2)}`)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user