Closed juanky201271 closed 3 weeks ago
Yes, updating my projects to the new version of Zingolib, but got stuck on this for hours. For now my workaround is to recreate a valid JSON from the result:
const balStr = await native.zingolib_execute_async('balance', '');
const validJsonStr = balStr
.replace(/[\[\]]/g, '') // Remove square braces
.replace(/(\s*\w+:\s*[\d_]+)/g, '$1,') // Add commas after each entry
.replace(/(\w+):/g, '"$1":') // Add double quotes to value name
.replace(/_/g, '') // Remove underscores
.replace(/,\s*$/, '') // Remove trailing comma
.trim(); // Trim whitespace or line breaks
const balJson = JSON.parse(`{${validJsonStr}}`); // Add curly braces before parsing
It's awful, but works.
Will the command balance
be back to "normal" ?
Ooops! Didnt realize this string needed to be JSON. reverted and documented in #1492
Thanks @fluidvanadium the balance
command is fixed.
sorry @james-katz
Ref: https://github.com/zingolabs/zingolib/pull/1464
I don't really understand why the
balance
command changed from a valid JSON string to something else...Before:
Now:
When we change some command result, we need to think about the consumers like our friend:
zingo-mobile
. Please someone can fix this soon?