Currently, our toString function on any object does not return a proper string; instead, it returns an object. We should implement an internal function that serializes a JSON object into a string.
The following code will print [object object]
const newAccount = await new AccountCreateTransaction()
.setKey(newAccountPublicKey)
.setInitialBalance(Hbar.from(1))
.freezeWith(client);
console.log(newAccount.toString());
Problem
Currently, our toString function on any object does not return a proper string; instead, it returns an object. We should implement an internal function that serializes a JSON object into a string.
The following code will print
[object object]
Solution
toString
function for all classesAlternatives
No response