2019-09-03 15:00:10 +00:00
|
|
|
package iteratorcontract
|
2018-08-31 08:23:57 +00:00
|
|
|
|
|
|
|
import (
|
2020-03-03 14:21:42 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
2018-08-31 08:23:57 +00:00
|
|
|
)
|
|
|
|
|
2020-08-10 10:42:02 +00:00
|
|
|
// NotifyKeysAndValues sends notification with `foo` storage keys and values
|
|
|
|
func NotifyKeysAndValues() bool {
|
2018-08-31 08:23:57 +00:00
|
|
|
iter := storage.Find(storage.GetContext(), []byte("foo"))
|
|
|
|
values := iterator.Values(iter)
|
|
|
|
keys := iterator.Keys(iter)
|
|
|
|
|
|
|
|
runtime.Notify("found storage values", values)
|
2020-11-24 13:36:35 +00:00
|
|
|
// For illustration purposes event is emitted with 'Any' type.
|
|
|
|
var typedKeys interface{} = keys
|
|
|
|
runtime.Notify("found storage keys", typedKeys)
|
2018-08-31 08:23:57 +00:00
|
|
|
|
|
|
|
return true
|
|
|
|
}
|