Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/chronik.js
Show First 20 Lines • Show All 452 Lines • ▼ Show 20 Lines | export const parseChronikTx = (BCH, tx, wallet, tokenInfoById) => { | ||||
let decryptionSuccess = false; | let decryptionSuccess = false; | ||||
let replyAddress = ''; | let replyAddress = ''; | ||||
// Iterate over inputs to see if this is an incoming tx (incoming === true) | // Iterate over inputs to see if this is an incoming tx (incoming === true) | ||||
for (let i = 0; i < inputs.length; i += 1) { | for (let i = 0; i < inputs.length; i += 1) { | ||||
const thisInput = inputs[i]; | const thisInput = inputs[i]; | ||||
const thisInputSendingHash160 = thisInput.outputScript; | const thisInputSendingHash160 = thisInput.outputScript; | ||||
// If this is an etoken tx, check for token burn | // If this is an etoken tx, check for token burn | ||||
if (isEtokenTx && typeof thisInput.slpBurn !== 'undefined') { | if ( | ||||
isEtokenTx && | |||||
typeof thisInput.slpBurn !== 'undefined' && | |||||
thisInput.slpBurn.token && | |||||
thisInput.slpBurn.token.amount && | |||||
thisInput.slpBurn.token.amount !== '0' | |||||
) { | |||||
console.log(`Token burn at ${tx.txid}`); | console.log(`Token burn at ${tx.txid}`); | ||||
// Assume that any eToken tx with a burn is a burn tx | // Assume that any eToken tx with a burn is a burn tx | ||||
isTokenBurn = true; | isTokenBurn = true; | ||||
try { | try { | ||||
const thisEtokenBurnAmount = new BigNumber( | const thisEtokenBurnAmount = new BigNumber( | ||||
thisInput.slpBurn.token.amount, | thisInput.slpBurn.token.amount, | ||||
); | ); | ||||
// Need to know the total output amount to compare to total input amount and tell if this is a burn transaction | // Need to know the total output amount to compare to total input amount and tell if this is a burn transaction | ||||
▲ Show 20 Lines • Show All 433 Lines • Show Last 20 Lines |