Bug fixes

This commit is contained in:
sairaj mote 2023-06-22 01:39:16 +05:30
parent 90e7cb2d91
commit 6b6cd86804

View File

@ -743,12 +743,11 @@
`; `;
}, },
transactionPage(obj) { transactionPage(obj) {
console.log(obj)
let { type, name, blockHeight, amount, sender, receiver, floData, hash, confirmations, nftHash } = obj; let { type, name, blockHeight, amount, sender, receiver, floData, hash, confirmations, nftHash } = obj;
// todo : This is a temporary fix. Fix this on the Database and API level
if (type == 'smartContractPays' || type == ' smartContractPays') { if (type == 'smartContractPays' || type == ' smartContractPays') {
name = '' name = ''
} }
if (type.trim() === 'nftIncorporation') if (type.trim() === 'nftIncorporation')
type = 'NFT Incorporation' type = 'NFT Incorporation'
else if (type.trim() === 'nft transfer') else if (type.trim() === 'nft transfer')
@ -798,10 +797,9 @@
<h5 class="label">Block Confirmations</h5> <h5 class="label">Block Confirmations</h5>
<h4>${confirmations}</h4> <h4>${confirmations}</h4>
${nftHash ? html` ${nftHash ? html`
<h5 class="label">NFT hash</h5> <h5 class="label">NFT hash</h5>
<sm-copy value=${nftHash} clip-text></sm-copy> <sm-copy value=${nftHash} clip-text></sm-copy>
`: '' `: ''}
}
</div> </div>
</div> </div>
`; `;
@ -1428,7 +1426,6 @@
} }
async function renderTransactions(container, transactions = []) { async function renderTransactions(container, transactions = []) {
console.log(transactions)
let txFrag = parseTransactions(transactions); let txFrag = parseTransactions(transactions);
const renderedTransactions = txFrag.map(tx => { const renderedTransactions = txFrag.map(tx => {
switch (tx.type) { switch (tx.type) {
@ -1457,7 +1454,6 @@
break; break;
} }
}) })
console.log(renderedTransactions)
renderElem(document.getElementById(container), html`${renderedTransactions.length ? renderedTransactions : html`<div class="no-results">No transactions found</div>`}`) renderElem(document.getElementById(container), html`${renderedTransactions.length ? renderedTransactions : html`<div class="no-results">No transactions found</div>`}`)
} }
@ -1820,32 +1816,38 @@
async function getTxInfo(thisTx) { async function getTxInfo(thisTx) {
try { try {
const transaction = await fetchJson(`${floGlobals.tokenApiUrl}/api/v2/transactionDetails/${thisTx}`) const transaction = await fetchJson(`${floGlobals.tokenApiUrl}/api/v2/transactionDetails/${thisTx}`)
console.log(transaction)
if (transaction.result === 'error') { if (transaction.result === 'error') {
return [false, transaction.description] return [false, transaction.description]
} else { } else {
let { transactionHash, floData, tokenAmount, tokenIdentification, type, nftHash, blockheight, vin, vout, confirmations } = transaction; let {
let sender = vin[0].addr; floData,
let receiver = sender tokenAmount,
for (let i = 0; i < vout.length; i++) { tokenIdentification,
if (vout[i]["scriptPubKey"]["addresses"][0] !== vin[0]["addr"]) { type,
receiver = vout[i]["scriptPubKey"]["addresses"][0]; nftHash,
} blockheight,
} vin,
// todo - temporary fixes below. Fix these on the Database and API level vout,
let transactionType = transferType || '' confirmations,
transferType,
senderAddress,
receiverAddress,
txid
} = transaction;
if (type == 'smartContractPays') { if (type == 'smartContractPays') {
tokenAmount = '-' tokenAmount = '-'
} }
return [ return [
true, { true, {
type: `${transactionType} ${type}`, type: `${transferType || ''} ${type}`,
name: tokenIdentification, name: tokenIdentification,
blockHeight: blockheight, blockHeight: blockheight,
amount: tokenAmount, amount: tokenAmount,
sender, sender: senderAddress,
receiver, receiver: receiverAddress,
floData, floData,
hash: transactionHash, hash: txid,
confirmations, confirmations,
nftHash nftHash
} }