elrond-sdk-erdjs
elrond-sdk-erdjs copied to clipboard
BooleanValue is always encoded as false
Here is a reproductible example :
const booleanString = "true"
const value = NativeSerializer.nativeToTypedValues(
[booleanString],
new EndpointDefinition(
"test",
[
new EndpointParameterDefinition("test", "test", new BooleanType())
],
[],
new EndpointModifiers("mutable", [])
)
)[0]
const codec = new BinaryCodec()
const encodedTopLevel = codec.encodeTopLevel(value)
const encodedNested = codec.encodeNested(value)
console.log({
encodedTopLevel: encodedTopLevel.toString("hex"),
encodedNested: encodedNested.toString("hex")
})
And what is logged :
{ encodedTopLevel: '', encodedNested: '00' }
The result is the same if I replace "true" by "1"
I'm using @multiversx/sdk-core: ^11.3.0
It may not be a bug since true or 1 instead of "true" or "1" is working, but this leads to confusion to consider "true" as false