mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
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.
This commit is contained in:
parent
c6ae954e4e
commit
fed95e0069
1 changed files with 2 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue