core: add json marshaller for Cosigner's scopes

Following C# implementation, we should marshal Scopes as a set of
strings instead of single byte.
This commit is contained in:
Anna Shaleva 2020-06-15 12:16:18 +03:00
parent fe31c7ed2d
commit 3568ab3d6d
6 changed files with 112 additions and 18 deletions

View file

@ -21,8 +21,8 @@ func TestParam_UnmarshalJSON(t *testing.T) {
{"sender": "f84d6a337fbc3d3a201d41da99e86b479e7a2554", "cosigner": "f84d6a337fbc3d3a201d41da99e86b479e7a2554"},
{"contract": "f84d6a337fbc3d3a201d41da99e86b479e7a2554"},
{"state": "HALT"},
{"account": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569", "scopes": 0},
[{"account": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569", "scopes": 0}]]`
{"account": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569"},
[{"account": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569", "scopes": "Global"}]]`
contr, err := util.Uint160DecodeStringLE("f84d6a337fbc3d3a201d41da99e86b479e7a2554")
require.NoError(t, err)
accountHash, err := util.Uint160DecodeStringLE("cadb3dc2faa3ef14a13b619c9a43124755aa2569")