From fed95e0069e1da3e841f70a2f3c4b162f4339f13 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 3 Jun 2020 18:56:20 +0300 Subject: [PATCH] smartcontract: (un)marshal AnyType value as null Neo 3 can emit Null in its transfer notifications in `from` or `to` fields when minting/burning tokens (unlike Neo 2 that emitted util.Uint256{} for this case), then it gets converted to Parameter as AnyType and we have to JSONize it somehow for proper RPC functioning. --- pkg/smartcontract/parameter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/smartcontract/parameter.go b/pkg/smartcontract/parameter.go index 5dad09926..54eb394a5 100644 --- a/pkg/smartcontract/parameter.go +++ b/pkg/smartcontract/parameter.go @@ -85,7 +85,7 @@ func (p *Parameter) MarshalJSON() ([]byte, error) { case MapType: ppair := p.Value.([]ParameterPair) resultRawValue, resultErr = json.Marshal(ppair) - case InteropInterfaceType: + case InteropInterfaceType, AnyType: resultRawValue = []byte("null") default: resultErr = errors.Errorf("Marshaller for type %s not implemented", p.Type) @@ -168,7 +168,7 @@ func (p *Parameter) UnmarshalJSON(data []byte) (err error) { return } p.Value = h - case InteropInterfaceType: + case InteropInterfaceType, AnyType: // stub, ignore value, it can only be null p.Value = nil default: