Merge pull request #1266 from nspcc-dev/notifications/filter_by_name

rpc: filter subscriptions' notifications by name
This commit is contained in:
Roman Khimov 2020-08-05 10:00:15 +03:00 committed by GitHub
commit 4bbe863904
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 90 additions and 19 deletions

View file

@ -21,11 +21,14 @@ func TestParam_UnmarshalJSON(t *testing.T) {
{"signer": "f84d6a337fbc3d3a201d41da99e86b479e7a2554"},
{"sender": "f84d6a337fbc3d3a201d41da99e86b479e7a2554", "signer": "f84d6a337fbc3d3a201d41da99e86b479e7a2554"},
{"contract": "f84d6a337fbc3d3a201d41da99e86b479e7a2554"},
{"name": "my_pretty_notification"},
{"contract": "f84d6a337fbc3d3a201d41da99e86b479e7a2554", "name":"my_pretty_notification"},
{"state": "HALT"},
{"account": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569"},
[{"account": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569", "scopes": "Global"}]]`
contr, err := util.Uint160DecodeStringLE("f84d6a337fbc3d3a201d41da99e86b479e7a2554")
require.NoError(t, err)
name := "my_pretty_notification"
accountHash, err := util.Uint160DecodeStringLE("cadb3dc2faa3ef14a13b619c9a43124755aa2569")
require.NoError(t, err)
expected := Params{
@ -86,7 +89,15 @@ func TestParam_UnmarshalJSON(t *testing.T) {
},
{
Type: NotificationFilterT,
Value: NotificationFilter{Contract: contr},
Value: NotificationFilter{Contract: &contr},
},
{
Type: NotificationFilterT,
Value: NotificationFilter{Name: &name},
},
{
Type: NotificationFilterT,
Value: NotificationFilter{Contract: &contr, Name: &name},
},
{
Type: ExecutionFilterT,