[#48] Add commonclient package

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-11-07 13:57:30 +03:00
parent 5cc810096f
commit b76f592095
3 changed files with 118 additions and 0 deletions

20
commonclient/invoker.go Normal file
View file

@ -0,0 +1,20 @@
package commonclient
import (
"github.com/google/uuid"
"github.com/nspcc-dev/neo-go/pkg/neorpc/result"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
)
// Invoker is a subset of methods provided by struct invoker.Invoker. The subset contains only those
// methods that are used by ActorWrapper and clients of the contracts.
type Invoker interface {
Call(contract util.Uint160, method string, params ...any) (*result.Invoke, error)
TraverseIterator(sessionID uuid.UUID, iterator *result.Iterator, num int) ([]stackitem.Item, error)
TerminateSession(sessionID uuid.UUID) error
}
// Ensure the interface is compatible with the invoker.Invoker struct.
var _ Invoker = (*invoker.Invoker)(nil)