hashgraph / hedera-sdk-js

Hedera™ Hashgraph SDK for JavaScript/TypeScript
https://docs.hedera.com/guides/docs/sdks
Apache License 2.0
254 stars 131 forks source link

.toString() is not implemented #2301

Open pathornteng opened 1 month ago

pathornteng commented 1 month ago

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]

const newAccount = await new AccountCreateTransaction()
    .setKey(newAccountPublicKey)
    .setInitialBalance(Hbar.from(1))
    .freezeWith(client);

  console.log(newAccount.toString());

Solution

Alternatives

No response

YuanBoXie commented 1 month ago

At the same time, is it best to maintain consistency in the field naming of SDK deserialization results in different languages?

svetoslav-nikol0v commented 1 month ago

Yes, it is. Where do you find a mismatch?