@ -26,11 +26,11 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
"use strict"
"use strict" ;
//
//
const JSBigInt = require ( '../cryptonote_utils/biginteger' ) . BigInteger
const JSBigInt = require ( "../cryptonote_utils/biginteger" ) . BigInteger ;
const monero _utils = require ( '../monero_utils/monero_cryptonote_utils_instance' )
const monero _utils = require ( "../monero_utils/monero_cryptonote_utils_instance" ) ;
const monero _keyImage _cache _utils = require ( '../monero_utils/monero_keyImage_cache_utils' )
const monero _keyImage _cache _utils = require ( "../monero_utils/monero_keyImage_cache_utils" ) ;
//
//
function Parsed _AddressInfo _ _sync (
function Parsed _AddressInfo _ _sync (
keyImage _cache ,
keyImage _cache ,
@ -38,18 +38,19 @@ function Parsed_AddressInfo__sync(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
) { // -> returnValuesByKey
) {
// -> returnValuesByKey
const total _received = new JSBigInt ( data . total _received || 0 ) ;
const total _received = new JSBigInt ( data . total _received || 0 ) ;
const locked _balance = new JSBigInt ( data . locked _funds || 0 ) ;
const locked _balance = new JSBigInt ( data . locked _funds || 0 ) ;
var total _sent = new JSBigInt ( data . total _sent || 0 ) // will be modified in place
var total _sent = new JSBigInt ( data . total _sent || 0 ) ; // will be modified in place
//
//
const account _scanned _tx _height = data . scanned _height || 0 ;
const account _scanned _tx _height = data . scanned _height || 0 ;
const account _scanned _block _height = data . scanned _block _height || 0 ;
const account _scanned _block _height = data . scanned _block _height || 0 ;
const account _scan _start _height = data . start _height || 0 ;
const account _scan _start _height = data . start _height || 0 ;
const transaction _height = data . transaction _height || 0 ;
const transaction _height = data . transaction _height || 0 ;
const blockchain _height = data . blockchain _height || 0 ;
const blockchain _height = data . blockchain _height || 0 ;
const spent _outputs = data . spent _outputs || [ ]
const spent _outputs = data . spent _outputs || [ ] ;
//
//
for ( let spent _output of spent _outputs ) {
for ( let spent _output of spent _outputs ) {
var key _image = monero _keyImage _cache _utils . Lazy _KeyImage (
var key _image = monero _keyImage _cache _utils . Lazy _KeyImage (
@ -59,20 +60,23 @@ function Parsed_AddressInfo__sync(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
if ( spent _output . key _image !== key _image ) {
if ( spent _output . key _image !== key _image ) {
// console.log('💬 Output used as mixin (' + spent_output.key_image + '/' + key_image + ')')
// console.log('💬 Output used as mixin (' + spent_output.key_image + '/' + key_image + ')')
total _sent = new JSBigInt ( total _sent ) . subtract ( spent _output . amount )
total _sent = new JSBigInt ( total _sent ) . subtract ( spent _output . amount ) ;
}
}
}
}
//
//
const ratesBySymbol = data . rates || { } // jic it's not there
const ratesBySymbol = data . rates || { } ; // jic it's not there
//
//
const returnValuesByKey =
const returnValuesByKey = {
{
total _received _String : total _received
total _received _String : total _received ? total _received . toString ( ) : null ,
? total _received . toString ( )
locked _balance _String : locked _balance ? locked _balance . toString ( ) : null ,
: null ,
locked _balance _String : locked _balance
? locked _balance . toString ( )
: null ,
total _sent _String : total _sent ? total _sent . toString ( ) : null ,
total _sent _String : total _sent ? total _sent . toString ( ) : null ,
// ^serialized JSBigInt
// ^serialized JSBigInt
spent _outputs : spent _outputs ,
spent _outputs : spent _outputs ,
@ -82,26 +86,29 @@ function Parsed_AddressInfo__sync(
transaction _height : transaction _height ,
transaction _height : transaction _height ,
blockchain _height : blockchain _height ,
blockchain _height : blockchain _height ,
//
//
ratesBySymbol : ratesBySymbol
ratesBySymbol : ratesBySymbol ,
}
} ;
return returnValuesByKey
return returnValuesByKey ;
}
}
function Parsed _AddressInfo _ _sync _ _keyImageManaged (
function Parsed _AddressInfo _ _sync _ _keyImageManaged (
data ,
data ,
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
) { // -> returnValuesByKey
) {
const keyImageCache = monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address )
// -> returnValuesByKey
const keyImageCache = monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith (
address ,
) ;
return Parsed _AddressInfo _ _sync (
return Parsed _AddressInfo _ _sync (
keyImageCache ,
keyImageCache ,
data ,
data ,
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
}
}
function Parsed _AddressInfo (
function Parsed _AddressInfo (
keyImage _cache ,
keyImage _cache ,
@ -110,7 +117,7 @@ function Parsed_AddressInfo(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn // (err?, returnValuesByKey) -> Void
fn , // (err?, returnValuesByKey) -> Void
) {
) {
const returnValuesByKey = Parsed _AddressInfo _ _sync (
const returnValuesByKey = Parsed _AddressInfo _ _sync (
keyImage _cache ,
keyImage _cache ,
@ -118,9 +125,9 @@ function Parsed_AddressInfo(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
fn ( null , returnValuesByKey )
fn ( null , returnValuesByKey ) ;
}
}
function Parsed _AddressInfo _ _keyImageManaged (
function Parsed _AddressInfo _ _keyImageManaged (
data ,
data ,
@ -128,8 +135,9 @@ function Parsed_AddressInfo__keyImageManaged(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn
fn ,
) { // -> returnValuesByKey
) {
// -> returnValuesByKey
Parsed _AddressInfo (
Parsed _AddressInfo (
monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address ) ,
monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address ) ,
data ,
data ,
@ -137,13 +145,13 @@ function Parsed_AddressInfo__keyImageManaged(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn
fn ,
)
) ;
}
}
exports . Parsed _AddressInfo = Parsed _AddressInfo
exports . Parsed _AddressInfo = Parsed _AddressInfo ;
exports . Parsed _AddressInfo _ _keyImageManaged = Parsed _AddressInfo _ _keyImageManaged // in case you can't send a mutable key image cache dictionary
exports . Parsed _AddressInfo _ _keyImageManaged = Parsed _AddressInfo _ _keyImageManaged ; // in case you can't send a mutable key image cache dictionary
exports . Parsed _AddressInfo _ _sync _ _keyImageManaged = Parsed _AddressInfo _ _sync _ _keyImageManaged // in case you can't send a mutable key image cache dictionary
exports . Parsed _AddressInfo _ _sync _ _keyImageManaged = Parsed _AddressInfo _ _sync _ _keyImageManaged ; // in case you can't send a mutable key image cache dictionary
exports . Parsed _AddressInfo _ _sync = Parsed _AddressInfo _ _sync
exports . Parsed _AddressInfo _ _sync = Parsed _AddressInfo _ _sync ;
//
//
function Parsed _AddressTransactions (
function Parsed _AddressTransactions (
keyImage _cache ,
keyImage _cache ,
@ -152,7 +160,7 @@ function Parsed_AddressTransactions(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn // (err?, returnValuesByKey) -> Void
fn , // (err?, returnValuesByKey) -> Void
) {
) {
const returnValuesByKey = Parsed _AddressTransactions _ _sync (
const returnValuesByKey = Parsed _AddressTransactions _ _sync (
keyImage _cache ,
keyImage _cache ,
@ -160,9 +168,9 @@ function Parsed_AddressTransactions(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
fn ( null , returnValuesByKey )
fn ( null , returnValuesByKey ) ;
}
}
function Parsed _AddressTransactions _ _sync (
function Parsed _AddressTransactions _ _sync (
keyImage _cache ,
keyImage _cache ,
@ -170,15 +178,15 @@ function Parsed_AddressTransactions__sync(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
) {
) {
const account _scanned _height = data . scanned _height || 0
const account _scanned _height = data . scanned _height || 0 ;
const account _scanned _block _height = data . scanned _block _height || 0
const account _scanned _block _height = data . scanned _block _height || 0 ;
const account _scan _start _height = data . start _height || 0
const account _scan _start _height = data . start _height || 0 ;
const transaction _height = data . transaction _height || 0
const transaction _height = data . transaction _height || 0 ;
const blockchain _height = data . blockchain _height || 0
const blockchain _height = data . blockchain _height || 0 ;
//
//
const transactions = data . transactions || [ ]
const transactions = data . transactions || [ ] ;
//
//
// TODO: rewrite this with more clarity if possible
// TODO: rewrite this with more clarity if possible
for ( let i = 0 ; i < transactions . length ; ++ i ) {
for ( let i = 0 ; i < transactions . length ; ++ i ) {
@ -191,80 +199,99 @@ function Parsed_AddressTransactions__sync(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
if ( transactions [ i ] . spent _outputs [ j ] . key _image !== key _image ) {
if ( transactions [ i ] . spent _outputs [ j ] . key _image !== key _image ) {
// console.log('Output used as mixin, ignoring (' + transactions[i].spent_outputs[j].key_image + '/' + key_image + ')')
// console.log('Output used as mixin, ignoring (' + transactions[i].spent_outputs[j].key_image + '/' + key_image + ')')
transactions [ i ] . total _sent = new JSBigInt ( transactions [ i ] . total _sent ) . subtract ( transactions [ i ] . spent _outputs [ j ] . amount ) . toString ( )
transactions [ i ] . total _sent = new JSBigInt (
transactions [ i ] . spent _outputs . splice ( j , 1 )
transactions [ i ] . total _sent ,
j --
)
. subtract ( transactions [ i ] . spent _outputs [ j ] . amount )
. toString ( ) ;
transactions [ i ] . spent _outputs . splice ( j , 1 ) ;
j -- ;
}
}
}
}
}
}
if ( new JSBigInt ( transactions [ i ] . total _received || 0 ) . add ( transactions [ i ] . total _sent || 0 ) . compare ( 0 ) <= 0 ) {
if (
transactions . splice ( i , 1 )
new JSBigInt ( transactions [ i ] . total _received || 0 )
i --
. add ( transactions [ i ] . total _sent || 0 )
continue
. compare ( 0 ) <= 0
) {
transactions . splice ( i , 1 ) ;
i -- ;
continue ;
}
}
transactions [ i ] . amount = new JSBigInt ( transactions [ i ] . total _received || 0 ) . subtract ( transactions [ i ] . total _sent || 0 ) . toString ( )
transactions [ i ] . amount = new JSBigInt (
transactions [ i ] . approx _float _amount = parseFloat ( monero _utils . formatMoney ( transactions [ i ] . amount ) )
transactions [ i ] . total _received || 0 ,
transactions [ i ] . timestamp = transactions [ i ] . timestamp
)
const record _ _payment _id = transactions [ i ] . payment _id
. subtract ( transactions [ i ] . total _sent || 0 )
if ( typeof record _ _payment _id !== 'undefined' && record _ _payment _id ) {
. toString ( ) ;
if ( record _ _payment _id . length == 16 ) { // short (encrypted) pid
transactions [ i ] . approx _float _amount = parseFloat (
if ( transactions [ i ] . approx _float _amount < 0 ) { // outgoing
monero _utils . formatMoney ( transactions [ i ] . amount ) ,
delete transactions [ i ] [ "payment_id" ] // need to filter these out .. because the server can't filter out short (encrypted) pids on outgoing txs
) ;
transactions [ i ] . timestamp = transactions [ i ] . timestamp ;
const record _ _payment _id = transactions [ i ] . payment _id ;
if ( typeof record _ _payment _id !== "undefined" && record _ _payment _id ) {
if ( record _ _payment _id . length == 16 ) {
// short (encrypted) pid
if ( transactions [ i ] . approx _float _amount < 0 ) {
// outgoing
delete transactions [ i ] [ "payment_id" ] ; // need to filter these out .. because the server can't filter out short (encrypted) pids on outgoing txs
}
}
}
}
}
}
}
}
transactions . sort ( function ( a , b )
transactions . sort ( function ( a , b ) {
{
if ( a . mempool == true ) {
if ( a . mempool == true ) {
if ( b . mempool != true ) {
if ( b . mempool != true ) {
return - 1 // a first
return - 1 ; // a first
}
}
// both mempool - fall back to .id compare
// both mempool - fall back to .id compare
} else if ( b . mempool == true ) {
} else if ( b . mempool == true ) {
return 1 // b first
return 1 ; // b first
}
}
return b . id - a . id
return b . id - a . id ;
} )
} ) ;
// prepare transactions to be serialized
// prepare transactions to be serialized
for ( let transaction of transactions ) {
for ( let transaction of transactions ) {
transaction . amount = transaction . amount . toString ( ) // JSBigInt -> String
transaction . amount = transaction . amount . toString ( ) ; // JSBigInt -> String
if ( typeof transaction . total _sent !== 'undefined' && transaction . total _sent !== null ) {
if (
transaction . total _sent = transaction . total _sent . toString ( )
typeof transaction . total _sent !== "undefined" &&
transaction . total _sent !== null
) {
transaction . total _sent = transaction . total _sent . toString ( ) ;
}
}
}
}
// on the other side, we convert transactions timestamp to Date obj
// on the other side, we convert transactions timestamp to Date obj
const returnValuesByKey =
const returnValuesByKey = {
{
account _scanned _height : account _scanned _height ,
account _scanned _height : account _scanned _height ,
account _scanned _block _height : account _scanned _block _height ,
account _scanned _block _height : account _scanned _block _height ,
account _scan _start _height : account _scan _start _height ,
account _scan _start _height : account _scan _start _height ,
transaction _height : transaction _height ,
transaction _height : transaction _height ,
blockchain _height : blockchain _height ,
blockchain _height : blockchain _height ,
serialized _transactions : transactions
serialized _transactions : transactions ,
}
} ;
return returnValuesByKey
return returnValuesByKey ;
}
}
function Parsed _AddressTransactions _ _sync _ _keyImageManaged (
function Parsed _AddressTransactions _ _sync _ _keyImageManaged (
data ,
data ,
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
) {
) {
const keyImageCache = monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address )
const keyImageCache = monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith (
address ,
) ;
return Parsed _AddressTransactions _ _sync (
return Parsed _AddressTransactions _ _sync (
keyImageCache ,
keyImageCache ,
data ,
data ,
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
}
}
function Parsed _AddressTransactions _ _keyImageManaged (
function Parsed _AddressTransactions _ _keyImageManaged (
data ,
data ,
@ -272,7 +299,7 @@ function Parsed_AddressTransactions__keyImageManaged(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn
fn ,
) {
) {
Parsed _AddressTransactions (
Parsed _AddressTransactions (
monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address ) ,
monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address ) ,
@ -281,13 +308,13 @@ function Parsed_AddressTransactions__keyImageManaged(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn
fn ,
)
) ;
}
}
exports . Parsed _AddressTransactions = Parsed _AddressTransactions
exports . Parsed _AddressTransactions = Parsed _AddressTransactions ;
exports . Parsed _AddressTransactions _ _keyImageManaged = Parsed _AddressTransactions _ _keyImageManaged
exports . Parsed _AddressTransactions _ _keyImageManaged = Parsed _AddressTransactions _ _keyImageManaged ;
exports . Parsed _AddressTransactions _ _sync = Parsed _AddressTransactions _ _sync
exports . Parsed _AddressTransactions _ _sync = Parsed _AddressTransactions _ _sync ;
exports . Parsed _AddressTransactions _ _sync _ _keyImageManaged = Parsed _AddressTransactions _ _sync _ _keyImageManaged
exports . Parsed _AddressTransactions _ _sync _ _keyImageManaged = Parsed _AddressTransactions _ _sync _ _keyImageManaged ;
//
//
function Parsed _UnspentOuts (
function Parsed _UnspentOuts (
keyImage _cache ,
keyImage _cache ,
@ -296,7 +323,7 @@ function Parsed_UnspentOuts(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn // (err?, returnValuesByKey)
fn , // (err?, returnValuesByKey)
) {
) {
const returnValuesByKey = Parsed _UnspentOuts _ _sync (
const returnValuesByKey = Parsed _UnspentOuts _ _sync (
keyImage _cache ,
keyImage _cache ,
@ -304,9 +331,9 @@ function Parsed_UnspentOuts(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
fn ( null , returnValuesByKey )
fn ( null , returnValuesByKey ) ;
}
}
function Parsed _UnspentOuts _ _sync (
function Parsed _UnspentOuts _ _sync (
keyImage _cache ,
keyImage _cache ,
@ -314,33 +341,53 @@ function Parsed_UnspentOuts__sync(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
) {
) {
const data _outputs = data . outputs
const data _outputs = data . outputs ;
const finalized _unspentOutputs = data . outputs || [ ] // to finalize:
const finalized _unspentOutputs = data . outputs || [ ] ; // to finalize:
for ( var i = 0 ; i < finalized _unspentOutputs . length ; i ++ ) {
for ( var i = 0 ; i < finalized _unspentOutputs . length ; i ++ ) {
const unspent _output = finalized _unspentOutputs [ i ]
const unspent _output = finalized _unspentOutputs [ i ] ;
if ( unspent _output === null
if (
|| typeof unspent _output === 'undefined'
unspent _output === null ||
|| ! unspent _output // just preserving what was in the original code
typeof unspent _output === "undefined" ||
! unspent _output // just preserving what was in the original code
) {
) {
throw "unspent_output at index " + i + " was null"
throw "unspent_output at index " + i + " was null" ;
}
}
const spend _key _images = unspent _output . spend _key _images
const spend _key _images = unspent _output . spend _key _images ;
if ( spend _key _images === null || typeof spend _key _images === 'undefined' ) {
if (
throw "spend_key_images of unspent_output at index " + i + " was null"
spend _key _images === null ||
typeof spend _key _images === "undefined"
) {
throw "spend_key_images of unspent_output at index " +
i +
" was null" ;
}
}
for ( var j = 0 ; j < spend _key _images . length ; j ++ ) {
for ( var j = 0 ; j < spend _key _images . length ; j ++ ) {
const finalized _unspentOutput _atI _beforeSplice = finalized _unspentOutputs [ i ]
const finalized _unspentOutput _atI _beforeSplice =
if ( ! finalized _unspentOutput _atI _beforeSplice || typeof finalized _unspentOutput _atI _beforeSplice === 'undefined' ) {
finalized _unspentOutputs [ i ] ;
console . warn ( ` This unspent output at i ${ i } was literally undefined! Skipping. ` ) // NOTE: Looks like the i-- code below should exit earlier if this is necessary
if (
continue
! finalized _unspentOutput _atI _beforeSplice ||
typeof finalized _unspentOutput _atI _beforeSplice === "undefined"
) {
console . warn (
` This unspent output at i ${ i } was literally undefined! Skipping. ` ,
) ; // NOTE: Looks like the i-- code below should exit earlier if this is necessary
continue ;
}
}
const beforeSplice _ _tx _pub _key = finalized _unspentOutput _atI _beforeSplice . tx _pub _key
const beforeSplice _ _tx _pub _key =
const beforeSplice _ _index = finalized _unspentOutput _atI _beforeSplice . index
finalized _unspentOutput _atI _beforeSplice . tx _pub _key ;
if ( typeof beforeSplice _ _tx _pub _key === 'undefined' || ! beforeSplice _ _tx _pub _key ) {
const beforeSplice _ _index =
console . warn ( "This unspent out was missing a tx_pub_key! Skipping." , finalized _unspentOutput _atI _beforeSplice )
finalized _unspentOutput _atI _beforeSplice . index ;
continue
if (
typeof beforeSplice _ _tx _pub _key === "undefined" ||
! beforeSplice _ _tx _pub _key
) {
console . warn (
"This unspent out was missing a tx_pub_key! Skipping." ,
finalized _unspentOutput _atI _beforeSplice ,
) ;
continue ;
}
}
var key _image = monero _keyImage _cache _utils . Lazy _KeyImage (
var key _image = monero _keyImage _cache _utils . Lazy _KeyImage (
keyImage _cache ,
keyImage _cache ,
@ -349,48 +396,61 @@ function Parsed_UnspentOuts__sync(
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
if ( key _image === finalized _unspentOutput _atI _beforeSplice . spend _key _images [ j ] ) {
if (
key _image ===
finalized _unspentOutput _atI _beforeSplice . spend _key _images [ j ]
) {
// console.log("💬 Output was spent; key image: " + key_image + " amount: " + monero_utils.formatMoneyFull(finalized_unspentOutputs[i].amount));
// console.log("💬 Output was spent; key image: " + key_image + " amount: " + monero_utils.formatMoneyFull(finalized_unspentOutputs[i].amount));
// Remove output from list
// Remove output from list
finalized _unspentOutputs . splice ( i , 1 ) ;
finalized _unspentOutputs . splice ( i , 1 ) ;
const finalized _unspentOutput _atI _afterSplice = finalized _unspentOutputs [ i ]
const finalized _unspentOutput _atI _afterSplice =
finalized _unspentOutputs [ i ] ;
if ( finalized _unspentOutput _atI _afterSplice ) {
if ( finalized _unspentOutput _atI _afterSplice ) {
j = finalized _unspentOutput _atI _afterSplice . spend _key _images . length ;
j =
finalized _unspentOutput _atI _afterSplice . spend _key _images
. length ;
}
}
i -- ;
i -- ;
} else {
} else {
console . log ( "💬 Output used as mixin (" + key _image + "/" + finalized _unspentOutputs [ i ] . spend _key _images [ j ] + ")" ) ;
console . log (
"💬 Output used as mixin (" +
key _image +
"/" +
finalized _unspentOutputs [ i ] . spend _key _images [ j ] +
")" ,
) ;
}
}
}
}
}
}
console . log ( "Unspent outs: " + JSON . stringify ( finalized _unspentOutputs ) ) ;
console . log ( "Unspent outs: " + JSON . stringify ( finalized _unspentOutputs ) ) ;
const unusedOuts = finalized _unspentOutputs . slice ( 0 )
const unusedOuts = finalized _unspentOutputs . slice ( 0 ) ;
const returnValuesByKey =
const returnValuesByKey = {
{
unspentOutputs : finalized _unspentOutputs ,
unspentOutputs : finalized _unspentOutputs ,
unusedOuts : unusedOuts ,
unusedOuts : unusedOuts ,
per _kb _fee : data . per _kb _fee // String
per _kb _fee : data . per _kb _fee , // String
}
} ;
return returnValuesByKey
return returnValuesByKey ;
}
}
function Parsed _UnspentOuts _ _sync _ _keyImageManaged (
function Parsed _UnspentOuts _ _sync _ _keyImageManaged (
data ,
data ,
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
) {
) {
const keyImageCache = monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address )
const keyImageCache = monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith (
address ,
) ;
return Parsed _UnspentOuts _ _sync (
return Parsed _UnspentOuts _ _sync (
keyImageCache ,
keyImageCache ,
data ,
data ,
address ,
address ,
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private
spend _key _ _private ,
)
) ;
}
}
function Parsed _UnspentOuts _ _keyImageManaged (
function Parsed _UnspentOuts _ _keyImageManaged (
data ,
data ,
@ -398,7 +458,7 @@ function Parsed_UnspentOuts__keyImageManaged(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn
fn ,
) {
) {
Parsed _UnspentOuts (
Parsed _UnspentOuts (
monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address ) ,
monero _keyImage _cache _utils . Lazy _KeyImageCacheForWalletWith ( address ) ,
@ -407,10 +467,10 @@ function Parsed_UnspentOuts__keyImageManaged(
view _key _ _private ,
view _key _ _private ,
spend _key _ _public ,
spend _key _ _public ,
spend _key _ _private ,
spend _key _ _private ,
fn
fn ,
)
) ;
}
}
exports . Parsed _UnspentOuts = Parsed _UnspentOuts
exports . Parsed _UnspentOuts = Parsed _UnspentOuts ;
exports . Parsed _UnspentOuts _ _keyImageManaged = Parsed _UnspentOuts _ _keyImageManaged
exports . Parsed _UnspentOuts _ _keyImageManaged = Parsed _UnspentOuts _ _keyImageManaged ;
exports . Parsed _UnspentOuts _ _sync = Parsed _UnspentOuts _ _sync
exports . Parsed _UnspentOuts _ _sync = Parsed _UnspentOuts _ _sync ;
exports . Parsed _UnspentOuts _ _sync _ _keyImageManaged = Parsed _UnspentOuts _ _sync _ _keyImageManaged
exports . Parsed _UnspentOuts _ _sync _ _keyImageManaged = Parsed _UnspentOuts _ _sync _ _keyImageManaged ;