client

package
v0.19.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: GPL-3.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const (
	IAMPathKey         = "iam-path"
	IAMARNKey          = "iam-arn"
	IAMCreatedTimeKey  = "ctime"
	IAMModifiedTimeKey = "mtime"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ra actor.RPCActor, acc *wallet.Account, contract util.Uint160, opt Options) (*Client, error)

New creates a new Client. Options can be empty.

func NewSimple

func NewSimple(act *actor.Actor, contract util.Uint160) *Client

NewSimple creates a new Client using exising actor.Actor.

func (Client) AddSubjectKey

func (c Client) AddSubjectKey(addr util.Uint160, key *keys.PublicKey) (tx util.Uint256, vub uint32, err error)

AddSubjectKey adds extra public key to subject. Must be invoked by contract owner.

func (Client) AddSubjectKeyCall

func (c Client) AddSubjectKeyCall(addr util.Uint160, key *keys.PublicKey) (method string, args []any)

AddSubjectKeyCall provides args for AddSubjectKey to use in commonclient.Transaction.

func (Client) AddSubjectToGroup

func (c Client) AddSubjectToGroup(addr util.Uint160, groupID int64) (tx util.Uint256, vub uint32, err error)

AddSubjectToGroup adds a new subject to group. Must be invoked by contract owner.

func (Client) AddSubjectToGroupCall

func (c Client) AddSubjectToGroupCall(addr util.Uint160, groupID int64) (method string, args []any)

AddSubjectToGroupCall provides args for AddSubjectToGroup to use in commonclient.Transaction.

func (Client) ClearAdmin

func (c Client) ClearAdmin() (tx util.Uint256, vub uint32, err error)

ClearAdmin removes address that can perform write operations on contract. Must be invoked by committee.

func (Client) ClearAdminCall

func (c Client) ClearAdminCall() (method string, args []any)

ClearAdminCall provides args for ClearAdmin to use in commonclient.Transaction.

func (Client) CreateGroup

func (c Client) CreateGroup(namespace, group string) (tx util.Uint256, vub uint32, err error)

CreateGroup creates a new group in specific namespace. Must be invoked by contract owner.

func (Client) CreateGroupCall

func (c Client) CreateGroupCall(namespace, group string) (method string, args []any)

CreateGroupCall provides args for CreateGroup to use in commonclient.Transaction.

func (Client) CreateNamespace

func (c Client) CreateNamespace(namespace string) (tx util.Uint256, vub uint32, err error)

CreateNamespace create new namespace. Must be invoked by contract owner.

func (Client) CreateNamespaceCall

func (c Client) CreateNamespaceCall(namespace string) (method string, args []any)

CreateNamespaceCall provides args for CreateNamespace to use in commonclient.Transaction.

func (Client) CreateSubject

func (c Client) CreateSubject(ns string, key *keys.PublicKey) (tx util.Uint256, vub uint32, err error)

CreateSubject creates new subject using public key and namespace. Must be invoked by contract owner.

func (Client) CreateSubjectCall

func (c Client) CreateSubjectCall(ns string, key *keys.PublicKey) (method string, args []any)

CreateSubjectCall provides args for CreateSubject to use in commonclient.Transaction.

func (Client) DeleteGroup

func (c Client) DeleteGroup(namespace string, groupID int64) (tx util.Uint256, vub uint32, err error)

DeleteGroup deletes group. Must be invoked by contract owner.

func (Client) DeleteGroupCall

func (c Client) DeleteGroupCall(namespace string, groupID int64) (method string, args []any)

DeleteGroupCall provides args for DeleteGroup to use in commonclient.Transaction.

func (Client) DeleteGroupKV

func (c Client) DeleteGroupKV(namespace string, groupID int64, key string) (tx util.Uint256, vub uint32, err error)

DeleteGroupKV removes group kv map. Must be invoked by contract owner.

func (Client) DeleteGroupKVCall

func (c Client) DeleteGroupKVCall(namespace string, groupID int64, key string) (method string, args []any)

DeleteGroupKVCall provides args for DeleteGroupKV to use in commonclient.Transaction.

func (Client) DeleteSubject

func (c Client) DeleteSubject(addr util.Uint160) (tx util.Uint256, vub uint32, err error)

DeleteSubject delete subject and removes it from related namespaces and groups. Must be invoked by contract owner.

func (Client) DeleteSubjectCall

func (c Client) DeleteSubjectCall(addr util.Uint160) (method string, args []any)

DeleteSubjectCall provides args for DeleteSubject to use in commonclient.Transaction.

func (Client) DeleteSubjectKV

func (c Client) DeleteSubjectKV(addr util.Uint160, key string) (tx util.Uint256, vub uint32, err error)

DeleteSubjectKV removes subject kv map. Must be invoked by contract owner.

func (Client) DeleteSubjectKVCall

func (c Client) DeleteSubjectKVCall(addr util.Uint160, key string) (method string, args []any)

DeleteSubjectKVCall provides args for DeleteSubjectKV to use in commonclient.Transaction.

func (Client) GetAdmin

func (c Client) GetAdmin() (util.Uint160, bool, error)

GetAdmin returns address that can perform write operations on contract. Second return values is true iff admin is set.

func (Client) GetGroup

func (c Client) GetGroup(namespace string, groupID int64) (*Group, error)

GetGroup gets group.

func (Client) GetGroupByName

func (c Client) GetGroupByName(namespace, groupName string) (*Group, error)

GetGroupByName gets group by its name (namespace scope).

func (Client) GetGroupExtended

func (c Client) GetGroupExtended(namespace string, groupID int64) (*GroupExtended, error)

GetGroupExtended gets extended group.

func (Client) GetGroupIDByName

func (c Client) GetGroupIDByName(namespace, groupName string) (int64, error)

GetGroupIDByName gets group id its name (namespace scope).

func (Client) GetNamespace

func (c Client) GetNamespace(namespace string) (*Namespace, error)

GetNamespace gets namespace.

func (Client) GetNamespaceExtended

func (c Client) GetNamespaceExtended(namespace string) (*NamespaceExtended, error)

GetNamespaceExtended gets extended namespace.

func (Client) GetSubject

func (c Client) GetSubject(addr util.Uint160) (*Subject, error)

GetSubject gets subject by address.

func (Client) GetSubjectByKey

func (c Client) GetSubjectByKey(key *keys.PublicKey) (*Subject, error)

GetSubjectByKey gets subject by its primary or additional keys.

func (Client) GetSubjectByName

func (c Client) GetSubjectByName(namespace, subjectName string) (*Subject, error)

GetSubjectByName gets subject by its name (namespace scope).

func (Client) GetSubjectExtended

func (c Client) GetSubjectExtended(addr util.Uint160) (*SubjectExtended, error)

GetSubjectExtended gets extended subject by address.

func (Client) GetSubjectKeyByName

func (c Client) GetSubjectKeyByName(namespace, subjectName string) (*keys.PublicKey, error)

GetSubjectKeyByName gets subject public key by its name (namespace scope).

func (Client) ListGroupSubjects

func (c Client) ListGroupSubjects(namespace string, groupID int64) ([]util.Uint160, error)

ListGroupSubjects gets all subjects in specific group.

func (Client) ListGroups

func (c Client) ListGroups(namespace string) ([]*Group, error)

ListGroups gets all groups in specific namespace.

func (Client) ListNamespaceSubjects

func (c Client) ListNamespaceSubjects(namespace string) ([]util.Uint160, error)

ListNamespaceSubjects gets all subjects from namespace.

func (Client) ListNamespaces

func (c Client) ListNamespaces() ([]*Namespace, error)

ListNamespaces gets all namespaces.

func (Client) ListNonEmptyGroups

func (c Client) ListNonEmptyGroups(namespace string) ([]string, error)

ListNonEmptyGroups gets groups that contain at least one subject.

func (Client) ListNonEmptyNamespaces

func (c Client) ListNonEmptyNamespaces() ([]string, error)

ListNonEmptyNamespaces gets namespaces that contain at least one subject.

func (Client) ListSubjects

func (c Client) ListSubjects() ([]util.Uint160, error)

ListSubjects gets all subjects.

func (Client) ParseGroupID

func (c Client) ParseGroupID(res *state.AppExecResult, err error) (int64, error)

ParseGroupID fetch groupID from stack after creating group method invocation.

func (Client) RemoveSubjectFromGroup

func (c Client) RemoveSubjectFromGroup(addr util.Uint160, groupID int64) (tx util.Uint256, vub uint32, err error)

RemoveSubjectFromGroup removes subject from group. Must be invoked by contract owner.

func (Client) RemoveSubjectFromGroupCall

func (c Client) RemoveSubjectFromGroupCall(addr util.Uint160, groupID int64) (method string, args []any)

RemoveSubjectFromGroupCall provides args for RemoveSubjectFromGroup to use in commonclient.Transaction.

func (Client) RemoveSubjectKey

func (c Client) RemoveSubjectKey(addr util.Uint160, key *keys.PublicKey) (tx util.Uint256, vub uint32, err error)

RemoveSubjectKey removes extra public key from subject. Must be invoked by contract owner.

func (Client) RemoveSubjectKeyCall

func (c Client) RemoveSubjectKeyCall(addr util.Uint160, key *keys.PublicKey) (method string, args []any)

RemoveSubjectKeyCall provides args for RemoveSubjectKey to use in commonclient.Transaction.

func (Client) SendTx

func (c Client) SendTx(txn *commonclient.Transaction) (tx util.Uint256, vub uint32, err error)

SendTx sends provided transaction to blockchain.

func (Client) SetAdmin

func (c Client) SetAdmin(owner util.Uint160) (tx util.Uint256, vub uint32, err error)

SetAdmin sets address that can perform write operations on contract. Must be invoked by committee.

func (Client) SetAdminCall

func (c Client) SetAdminCall(owner util.Uint160) (method string, args []any)

SetAdminCall provides args for SetAdmin to use in commonclient.Transaction.

func (Client) SetGroupKV

func (c Client) SetGroupKV(namespace string, groupID int64, key, val string) (tx util.Uint256, vub uint32, err error)

SetGroupKV updates group kv map. Must be invoked by contract owner. You can use some predefined key constants: IAMPathKey, IAMARNKey, IAMCreatedTimeKey, IAMModifiedTimeKey.

func (Client) SetGroupKVCall

func (c Client) SetGroupKVCall(namespace string, groupID int64, key, val string) (method string, args []any)

SetGroupKVCall provides args for SetGroupKV to use in commonclient.Transaction.

func (Client) SetGroupName

func (c Client) SetGroupName(namespace string, groupID int64, name string) (tx util.Uint256, vub uint32, err error)

SetGroupName updates subject name. Must be invoked by contract owner.

func (Client) SetGroupNameCall

func (c Client) SetGroupNameCall(namespace string, groupID int64, name string) (method string, args []any)

SetGroupNameCall provides args for SetGroupName to use in commonclient.Transaction.

func (Client) SetSubjectKV

func (c Client) SetSubjectKV(addr util.Uint160, key, val string) (tx util.Uint256, vub uint32, err error)

SetSubjectKV updates subject kv map. Must be invoked by contract owner. You can use some predefined key constants: IAMPathKey, IAMARNKey, IAMCreatedTimeKey, IAMModifiedTimeKey.

func (Client) SetSubjectKVCall

func (c Client) SetSubjectKVCall(addr util.Uint160, key, val string) (method string, args []any)

SetSubjectKVCall provides args for SetSubjectKV to use in commonclient.Transaction.

func (Client) SetSubjectName

func (c Client) SetSubjectName(addr util.Uint160, name string) (tx util.Uint256, vub uint32, err error)

SetSubjectName updates subject name. Must be invoked by contract owner.

func (Client) SetSubjectNameCall

func (c Client) SetSubjectNameCall(addr util.Uint160, name string) (method string, args []any)

SetSubjectNameCall provides args for SetSubjectName to use in commonclient.Transaction.

func (Client) StartTx

func (c Client) StartTx() *commonclient.Transaction

StartTx inits transaction.

func (Client) Version

func (c Client) Version() (int64, error)

Version returns version of contract.

func (Client) Wait

func (c Client) Wait(tx util.Uint256, vub uint32, err error) (*state.AppExecResult, error)

Wait invokes underlying wait method on actor.Actor. Notice that "already exists" err value is treated as an error by this routine unlike actor.Waiter.

func (Client) Waiter

func (c Client) Waiter() waiter.Waiter

Waiter returns underlying waiter.Waiter.

type Group

type Group struct {
	ID        int64
	Name      string
	Namespace string
	KV        map[string]string
}

type GroupExtended

type GroupExtended struct {
	ID            int64
	Name          string
	Namespace     string
	KV            map[string]string
	SubjectsCount int64
}

type Namespace

type Namespace struct {
	Name string
}

type NamespaceExtended

type NamespaceExtended struct {
	Name          string
	GroupsCount   int64
	SubjectsCount int64
}

type Options

type Options struct {
	ProxyContract util.Uint160
}

type Subject

type Subject struct {
	PrimaryKey     *keys.PublicKey
	AdditionalKeys keys.PublicKeys
	Namespace      string
	Name           string
	KV             map[string]string
}

type SubjectExtended

type SubjectExtended struct {
	PrimaryKey     *keys.PublicKey
	AdditionalKeys keys.PublicKeys
	Namespace      string
	Name           string
	KV             map[string]string
	Groups         []*Group
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL