Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/useWallet.js
Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | const update = async ({ wallet }) => { | ||||
const finalizedSlpUtxos = finalizeSlpUtxos( | const finalizedSlpUtxos = finalizeSlpUtxos( | ||||
preliminarySlpUtxos, | preliminarySlpUtxos, | ||||
updatedTokenInfoById, | updatedTokenInfoById, | ||||
); | ); | ||||
// Preserve bch-api for tx history for now, as this will take another stacked diff to migrate to chronik | // Preserve bch-api for tx history for now, as this will take another stacked diff to migrate to chronik | ||||
const txHistory = await getTxHistory(BCH, cashAddresses); | const txHistory = await getTxHistory(BCH, cashAddresses); | ||||
const chronikTxHistory = await getTxHistoryChronik( | const chronikTxHistory = await getTxHistoryChronik(chronik, wallet); | ||||
chronik, | |||||
hash160AndAddressObjArray, | |||||
); | |||||
console.log( | console.log( | ||||
`chronikTxHistory as flattened array, sorted by blockheight and time first seen, with parse info`, | `chronikTxHistory as flattened array, sorted by blockheight and time first seen, with parse info, and partial legacy parse info`, | ||||
chronikTxHistory, | chronikTxHistory, | ||||
); | ); | ||||
// public keys are used to determined if a tx is incoming outgoing | // public keys are used to determined if a tx is incoming outgoing | ||||
const parsedTxHistory = await getTxData( | const parsedTxHistory = await getTxData( | ||||
BCH, | BCH, | ||||
txHistory, | txHistory, | ||||
publicKeys, | publicKeys, | ||||
▲ Show 20 Lines • Show All 629 Lines • ▼ Show 20 Lines | const processChronikWsMsg = async (msg, wallet, fiatPrice) => { | ||||
// Update it | // Update it | ||||
setWalletRefreshInterval(10); | setWalletRefreshInterval(10); | ||||
// get txid info | // get txid info | ||||
const txid = msg.txid; | const txid = msg.txid; | ||||
const txDetails = await chronik.tx(txid); | const txDetails = await chronik.tx(txid); | ||||
// parse tx for notification | // parse tx for notification | ||||
const hash160Array = getHashArrayFromWallet(wallet); | const parsedChronikTx = parseChronikTx(txDetails, wallet); | ||||
const parsedChronikTx = parseChronikTx(txDetails, hash160Array); | |||||
if (parsedChronikTx.incoming) { | if (parsedChronikTx.incoming) { | ||||
if (parsedChronikTx.isEtokenTx) { | if (parsedChronikTx.isEtokenTx) { | ||||
try { | try { | ||||
// Get the tokenID | // Get the tokenID | ||||
const incomingTokenId = parsedChronikTx.slpMeta.tokenId; | const incomingTokenId = parsedChronikTx.slpMeta.tokenId; | ||||
// Check cache for token info | // Check cache for token info | ||||
// NB this procedure will change when chronik utxo formatting is implemented | // NB this procedure will change when chronik utxo formatting is implemented | ||||
▲ Show 20 Lines • Show All 569 Lines • Show Last 20 Lines |