Fixed input parsing for computing a witness

pull/4470/head
ioedeveloper 10 months ago committed by Aniket
parent ac045bcef5
commit 659b88b9c2
  1. 15
      apps/circuit-compiler/src/app/components/witness.tsx

@ -12,9 +12,18 @@ export function WitnessSection ({ plugin, signalInputs, status }: {plugin: Circo
let value = e.target.value
try {
value = JSON.parse(value)
if (!Array.isArray(value)) throw new Error('Invalid JSON')
value = JSON.parse(JSON.stringify(value, (key, value) => {
if (typeof value === 'bigint') {
return value.toString()
} else {
try {
const parsedValue = JSON.parse(value)
return Array.isArray(parsedValue) ? parsedValue : value
} catch (e) {
return value
}
}}))
} catch (e) {
// do nothing
}

Loading…
Cancel
Save