neo-project/neo-vm

JsonSerialize struct Error

Closed this issue · 3 comments

neither ByteString nor UInt160 is supported.

struct Pending
{
    public ByteString user;
    public BigInteger amount;
}
Pending returners = new Pending();
returners.user = bidder;
returners.amount = bidamount;
store[(ByteString)prefix_pendingReturns] = StdLib.JsonSerialize(returners);

fc1ce1a30fa6e41ea0c3069e268863c

For ByteString, we only support string.
For BigInteger, we only support integers that between MIN_SAFE_INTEGER and MAX_SAFE_INTEGER, which is -9007199254740991 and 9007199254740991.

For ByteString, we only support string.
For BigInteger, we only support integers that between MIN_SAFE_INTEGER and MAX_SAFE_INTEGER, which is -9007199254740991 and 9007199254740991.

since UInt160 type can be implicitly converted to ByteString, and it is 20 length bytes, but it can not be serialized. In my example, I input the bidder as UInt160 address hash, amount is 20.

We only support string. UInt160 is not supported.