Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/chronik.js
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | export const getUtxosChronik = async (chronik, hash160sMappedToAddresses) => { | ||||
const flatUtxos = allUtxos.flat(); | const flatUtxos = allUtxos.flat(); | ||||
return flatUtxos; | return flatUtxos; | ||||
}; | }; | ||||
export const organizeUtxosByType = chronikUtxos => { | export const organizeUtxosByType = chronikUtxos => { | ||||
/* | /* | ||||
Convert chronik utxos (returned by getUtxosChronik function, above) to match | Convert chronik utxos (returned by getUtxosChronik function, above) to match | ||||
shape of existing slpBalancesAndUtxos object | wallet storage pattern | ||||
This means sequestering eToken utxos from non-eToken utxos | This means sequestering eToken utxos from non-eToken utxos | ||||
For legacy reasons, the term "SLP" is still sometimes used to describe an eToken | For legacy reasons, the term "SLP" is still sometimes used to describe an eToken | ||||
So, SLP utxos === eToken utxos, it's just a semantics difference here | So, SLP utxos === eToken utxos, it's just a semantics difference here | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 436 Lines • ▼ Show 20 Lines | for (let i = 0; i < outputs.length; i += 1) { | ||||
continue; // skip to next output hex | continue; // skip to next output hex | ||||
} | } | ||||
// this is an encrypted Cashtab message | // this is an encrypted Cashtab message | ||||
let msgString = parsedOpReturnArray[1]; | let msgString = parsedOpReturnArray[1]; | ||||
let fundingWif, privateKeyObj, privateKeyBuff; | let fundingWif, privateKeyObj, privateKeyBuff; | ||||
if ( | if ( | ||||
wallet && | wallet && | ||||
wallet.state && | wallet.state && | ||||
wallet.state.slpBalancesAndUtxos && | wallet.state.nonSlpUtxos && | ||||
wallet.state.slpBalancesAndUtxos.nonSlpUtxos[0] | wallet.state.nonSlpUtxos[0] | ||||
) { | ) { | ||||
fundingWif = getUtxoWif( | fundingWif = getUtxoWif( | ||||
wallet.state.slpBalancesAndUtxos.nonSlpUtxos[0], | wallet.state.nonSlpUtxos[0], | ||||
wallet, | wallet, | ||||
); | ); | ||||
privateKeyObj = wif.decode(fundingWif); | privateKeyObj = wif.decode(fundingWif); | ||||
privateKeyBuff = privateKeyObj.privateKey; | privateKeyBuff = privateKeyObj.privateKey; | ||||
if (!privateKeyBuff) { | if (!privateKeyBuff) { | ||||
isCashtabMessage = true; | isCashtabMessage = true; | ||||
isEncryptedMessage = true; | isEncryptedMessage = true; | ||||
opReturnMessage = 'Private key extraction error'; | opReturnMessage = 'Private key extraction error'; | ||||
▲ Show 20 Lines • Show All 349 Lines • Show Last 20 Lines |