Closed michavie closed 1 year ago
Hi @michavie,
Thank you for raising the issue :pray:
Do you think you can help us reproduce the issue, by altering the following test case (the one below passes)?
it.only("issue 306", async () => {
const endpoint = AbiRegistry.create({
"endpoints": [
{
"name": "foo",
"inputs": [{
"type": "u64"
}, {
"type": "variadic<bytes>"
}],
"outputs": []
}
]
}).getEndpoint("foo");
// Using both native JavaScript objects and typed values
const typedValues = NativeSerializer.nativeToTypedValues([
42,
...['a', 'b', 'c'],
], endpoint);
assert.deepEqual(typedValues[0].getType(), new U64Type());
assert.deepEqual(typedValues[0].valueOf(), new BigNumber(42));
assert.deepEqual(typedValues[1].getType(), new VariadicType(new BytesType()));
assert.deepEqual(typedValues[1].valueOf(), [Buffer.from('a'), Buffer.from('b'), Buffer.from('c')]);
});
Thank you!
I could reproduce the error in the test results by not providing any values, as in spreading an empty array: ...[]
or providing no value at all
Would make sense as ...[]
evaluates to undefined
and giving no value also equals undefined
Sorry for the initial sloppy example
Submitted a quick PR here: https://github.com/multiversx/mx-sdk-js-core/pull/307
Fixed by your PR, https://github.com/multiversx/mx-sdk-js-core/pull/307.
Thank you :)
Upgrading from
12.1.0
breaks transactions using native variadic arguments, with this error:Worked before and fails after upgrade for Interactions:
Using
VariadicValue
is a temporary fix, but ideally, native values would keep workingLikely caused by this change here: https://github.com/multiversx/mx-sdk-js-core/commit/973c823ac2d35eaf8fe269b3886dabb5874f6186