client

package
v0.39.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NNSAuditContractName is a name of the audit contract in NNS.
	NNSAuditContractName = nns.NameAudit
	// NNSBalanceContractName is a name of the balance contract in NNS.
	NNSBalanceContractName = nns.NameBalance
	// NNSContainerContractName is a name of the container contract in NNS.
	NNSContainerContractName = nns.NameContainer
	// NNSNeoFSIDContractName is a name of the neofsid contract in NNS.
	NNSNeoFSIDContractName = nns.NameNeoFSID
	// NNSNetmapContractName is a name of the netmap contract in NNS.
	NNSNetmapContractName = nns.NameNetmap
	// NNSProxyContractName is a name of the proxy contract in NNS.
	NNSProxyContractName = nns.NameProxy
	// NNSReputationContractName is a name of the reputation contract in NNS.
	NNSReputationContractName = nns.NameReputation
)
View Source
const HaltState = "HALT"

HaltState returned if TestInvoke function processed without panic.

Variables

View Source
var (
	// ErrNilClient is returned by functions that expect
	// a non-nil Client pointer, but received nil.
	ErrNilClient = errors.New("client is nil")

	// ErrConnectionLost is returned when client lost web socket connection
	// to the RPC node and has not been able to establish a new one since.
	ErrConnectionLost = errors.New("connection to the RPC node has been lost")
)
View Source
var (
	// ErrNNSRecordNotFound means that there is no such record in NNS contract.
	ErrNNSRecordNotFound = errors.New("record has not been found in NNS contract")
)
View Source
var ErrStaleNodes = errors.New("RPC nodes are not yet up to date")

ErrStaleNodes is returned from New when minimal required height requirement specified in WithMinRequiredBlockHeight is not satisfied by the given nodes.

Functions

func ArrayFromStackItem added in v0.12.0

func ArrayFromStackItem(param stackitem.Item) ([]stackitem.Item, error)

ArrayFromStackItem returns the slice contract parameters from passed parameter.

If passed parameter carries boolean false value, (nil, nil) returns.

func BigIntFromStackItem added in v0.12.0

func BigIntFromStackItem(param stackitem.Item) (*big.Int, error)

BigIntFromStackItem receives numerical value from the value of a smart contract parameter.

func BoolFromStackItem added in v0.12.0

func BoolFromStackItem(param stackitem.Item) (bool, error)

BoolFromStackItem receives boolean value from the value of a smart contract parameter.

func BytesFromStackItem added in v0.12.0

func BytesFromStackItem(param stackitem.Item) ([]byte, error)

BytesFromStackItem receives binary value from the value of a smart contract parameter.

func CalculateNotaryDepositAmount added in v0.26.0

func CalculateNotaryDepositAmount(c *Client, gasMul, gasDiv int64) (fixedn.Fixed8, error)

CalculateNotaryDepositAmount calculates notary deposit amount using the rule:

IF notaryBalance < gasBalance * gasMul {
    DEPOSIT gasBalance / gasDiv
} ELSE {
    DEPOSIT 1
}

gasMul and gasDiv must be positive.

func GetUniversalSignerScope added in v0.39.0

func GetUniversalSignerScope(nnsHash, balanceHash, cntHash, netmapHash, neofsIDHash util.Uint160) *transaction.Signer

GetUniversalSignerScope returns a universal (applicable for any valid NeoFS contract call) scope that should be used by IR and SNs. It contains a set of Rules for contracts calling each other and a regular CalledByEntry permission.

func IntFromStackItem added in v0.12.0

func IntFromStackItem(param stackitem.Item) (int64, error)

IntFromStackItem receives numerical value from the value of a smart contract parameter.

func NNSAlphabetContractName added in v0.25.0

func NNSAlphabetContractName(index int) string

NNSAlphabetContractName returns contract name of the alphabet contract in NNS based on alphabet index.

func StringFromStackItem added in v0.12.0

func StringFromStackItem(param stackitem.Item) (string, error)

StringFromStackItem receives string value from the value of a smart contract parameter.

Types

type AlphabetKeys added in v0.19.0

type AlphabetKeys func() (keys.PublicKeys, error)

type Callback added in v0.28.0

type Callback func()

Callback is a function that is going to be called on certain Client's state.

type Client

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

Client is a wrapper over web socket neo-go client that provides smart-contract invocation interface and notification subscription functionality.

On connection lost tries establishing new connection to the next RPC (if any). If no RPC node available, switches to inactive mode: any RPC call leads to immediate return with ErrConnectionLost error, every notification consumer passed to any Receive* method is closed.

Working client must be created via constructor New. Using the Client that has been created with new(Client) expression (or just declaring a Client variable) is unsafe and can lead to panic.

func New

func New(key *keys.PrivateKey, opts ...Option) (*Client, error)

New creates, initializes and returns the Client instance. Notary support should be enabled with EnableNotarySupport client method separately.

If private key is nil, it panics.

Other values are set according to provided options, or by default:

  • client context: Background;
  • dial timeout: 5s;
  • blockchain network type: netmode.PrivNet;
  • signer with the CalledByEntry scope;
  • wait interval: 500ms;
  • logger: &zap.Logger{Logger: zap.L()}.

If desired option satisfies the default value, it can be omitted. If multiple options of the same config value are supplied, the option with the highest index in the arguments will be used.

func (*Client) AccountVote added in v0.38.0

func (c *Client) AccountVote(addr util.Uint160) (*keys.PublicKey, error)

AccountVote returns a key the provided account has voted with its NEO tokens for. Nil key with no error is returned if the account has no NEO or if the account hasn't voted for anyone.

func (*Client) BlockCount added in v0.23.0

func (c *Client) BlockCount() (res uint32, err error)

BlockCount returns block count of the network to which the underlying RPC node client is connected.

func (*Client) CalculateNetworkFee added in v0.39.0

func (c *Client) CalculateNetworkFee(tx *transaction.Transaction) (int64, error)

CalculateNetworkFee calculates consensus nodes' fee for given transaction in the blockchain the Client connected to.

func (*Client) CalculateNonceAndVUB added in v0.27.0

func (c *Client) CalculateNonceAndVUB(hash util.Uint256) (nonce uint32, vub uint32, err error)

CalculateNonceAndVUB calculates nonce and ValidUntilBlock values based on transaction hash.

func (*Client) Call added in v0.39.0

func (c *Client) Call(contract util.Uint160, method string, args ...any) (*result.Invoke, error)

Call calls specified method of the Neo smart contract with provided arguments.

func (*Client) CallAndExpandIterator added in v0.39.0

func (c *Client) CallAndExpandIterator(contract util.Uint160, method string, maxItems int, args ...any) (*result.Invoke, error)

CallAndExpandIterator calls specified iterating method of the Neo smart contract with provided arguments, and fetches iterator from the response carrying up to limited number of items.

func (*Client) Close added in v0.28.0

func (c *Client) Close()

Close closes connection to the remote side making this client instance unusable. Closes notification channel returned from Client.Notifications(), Removes all subscription.

func (*Client) Committee added in v0.18.0

func (c *Client) Committee() (res keys.PublicKeys, err error)

Committee returns keys of chain committee from neo native contract.

func (*Client) DepositEndlessNotary added in v0.36.0

func (c *Client) DepositEndlessNotary(amount fixedn.Fixed8) (res util.Uint256, err error)

DepositEndlessNotary calls notary deposit method. Unlike `DepositNotary`, this method sets notary deposit till parameter to a maximum possible value. This allows to avoid ValidAfterDeposit failures.

This function must be invoked with notary enabled otherwise it throws panic.

func (*Client) DepositNotary added in v0.17.0

func (c *Client) DepositNotary(amount fixedn.Fixed8, delta uint32) (res util.Uint256, err error)

DepositNotary calls notary deposit method. Deposit is required to operate with notary contract. It used by notary contract in to produce fallback tx if main tx failed to create. Deposit isn't last forever, so it should be called periodically. Notary support should be enabled in client to use this function.

This function must be invoked with notary enabled otherwise it throws panic.

func (*Client) EnableNotarySupport added in v0.17.0

func (c *Client) EnableNotarySupport(opts ...NotaryOption) error

EnableNotarySupport creates notary structure in client that provides ability for client to get alphabet keys from committee or provided source and use proxy contract script hash to create tx for notary contract.

func (*Client) GasBalance added in v0.17.0

func (c *Client) GasBalance() (res int64, err error)

GasBalance returns GAS amount in the client's wallet.

func (*Client) GetBlockCount added in v0.39.0

func (c *Client) GetBlockCount() (uint32, error)

GetBlockCount returns current height of the Neo blockchain the Client connected to.

func (*Client) GetCommittee added in v0.39.0

func (c *Client) GetCommittee() (keys.PublicKeys, error)

GetCommittee returns current public keys of the committee of the Neo blockchain the Client connected to.

func (*Client) GetContractStateByHash added in v0.39.0

func (c *Client) GetContractStateByHash(addr util.Uint160) (*state.Contract, error)

GetContractStateByHash returns current state of the addressed Neo smart contract deployed in the blockchain the Client connected to. Returns neorpc.ErrUnknownContract if requested contract is missing.

func (*Client) GetContractStateByID added in v0.39.0

func (c *Client) GetContractStateByID(id int32) (*state.Contract, error)

GetContractStateByID returns current state of the identified Neo smart contract deployed in the blockchain the Client connected to. Returns neorpc.ErrUnknownContract if requested contract is missing.

func (*Client) GetDesignateHash added in v0.21.0

func (c *Client) GetDesignateHash() util.Uint160

GetDesignateHash returns hash of the native `RoleManagement` contract.

func (*Client) GetNotaryDeposit added in v0.17.0

func (c *Client) GetNotaryDeposit() (res int64, err error)

GetNotaryDeposit returns deposit of client's account in notary contract. Notary support should be enabled in client to use this function.

This function must be invoked with notary enabled otherwise it throws panic.

func (*Client) GetVersion added in v0.39.0

func (c *Client) GetVersion() (*result.Version, error)

GetVersion returns local settings of the currently active Neo RPC node the Client connected to.

func (*Client) InitSidechainScope added in v0.39.0

func (c *Client) InitSidechainScope() error

InitSidechainScope allows to replace WithAutoSidechainScope option and postpone Sidechain scope initialization when NNS contract is not yet ready while Client is already needed.

func (*Client) Invoke

func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) error

Invoke invokes contract method by sending transaction into blockchain. Supported args types: int64, string, util.Uint160, []byte and bool.

func (*Client) InvokeContractVerify added in v0.39.0

func (c *Client) InvokeContractVerify(contract util.Uint160, params []smartcontract.Parameter, signers []transaction.Signer, witnesses ...transaction.Witness) (*result.Invoke, error)

InvokeContractVerify calls 'verify' method of the referenced Neo smart contract deployed in the blockchain the Client connected to and returns the call result.

func (*Client) InvokeFunction added in v0.39.0

func (c *Client) InvokeFunction(contract util.Uint160, operation string, params []smartcontract.Parameter, signers []transaction.Signer) (*result.Invoke, error)

InvokeFunction calls specified method of the referenced Neo smart contract deployed in the blockchain the Client connected to and returns the call result.

func (*Client) InvokeScript added in v0.39.0

func (c *Client) InvokeScript(script []byte, signers []transaction.Signer) (*result.Invoke, error)

InvokeScript tests given script on the Neo blockchain the Client connected to and returns the script result.

func (*Client) IsNotaryEnabled added in v0.32.0

func (c *Client) IsNotaryEnabled() bool

IsNotaryEnabled returns true if EnableNotarySupport has been successfully called before.

func (*Client) IsValidScript added in v0.27.0

func (c *Client) IsValidScript(script []byte, signers []transaction.Signer) (res bool, err error)

IsValidScript returns true if invocation script executes with HALT state.

func (*Client) MagicNumber added in v0.16.0

func (c *Client) MagicNumber() (uint64, error)

MagicNumber returns the magic number of the network to which the underlying RPC node client is connected.

func (*Client) MsPerBlock added in v0.26.0

func (c *Client) MsPerBlock() (res int64, err error)

MsPerBlock returns MillisecondsPerBlock network parameter.

func (*Client) NNSContractAddress added in v0.25.0

func (c *Client) NNSContractAddress(name string) (sh util.Uint160, err error)

NNSContractAddress returns contract address script hash based on its name in NNS contract. If script hash has not been found, returns ErrNNSRecordNotFound.

func (*Client) NNSHash added in v0.28.0

func (c *Client) NNSHash() (util.Uint160, error)

NNSHash returns NNS contract hash.

func (*Client) NeoFSAlphabetList added in v0.18.0

func (c *Client) NeoFSAlphabetList() (res keys.PublicKeys, err error)

NeoFSAlphabetList returns keys that stored in NeoFS Alphabet role. Main chain stores alphabet node keys of inner ring there, however the sidechain stores both alphabet and non alphabet node keys of inner ring.

func (*Client) NotaryInvoke added in v0.17.0

func (c *Client) NotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce uint32, vub *uint32, method string, args ...any) error

NotaryInvoke invokes contract method by sending tx to notary contract in blockchain. Fallback tx is a `RET`. If Notary support is not enabled it fallbacks to a simple `Invoke()`.

`nonce` and `vub` are used only if notary is enabled.

func (*Client) NotaryInvokeNotAlpha added in v0.25.0

func (c *Client) NotaryInvokeNotAlpha(contract util.Uint160, fee fixedn.Fixed8, method string, args ...any) error

NotaryInvokeNotAlpha does the same as NotaryInvoke but does not use client's private key in Invocation script. It means that main TX of notary request is not expected to be signed by the current node.

Considered to be used by non-IR nodes.

func (*Client) NotarySignAndInvokeTX added in v0.25.0

func (c *Client) NotarySignAndInvokeTX(mainTx *transaction.Transaction) error

NotarySignAndInvokeTX signs and sends notary request that was received from Notary service. NOTE: does not fallback to simple `Invoke()`. Expected to be used only for TXs retrieved from the received notary requests.

func (*Client) Notifications added in v0.39.0

func (c *Client) Notifications() (<-chan *state.ContainedNotificationEvent, <-chan *block.Block, <-chan *result.NotaryRequestEvent)

Notifications returns channels than receive subscribed notification from the connected RPC node. Channels are closed when connections to the RPC nodes are lost.

func (*Client) ProbeNotary added in v0.23.0

func (c *Client) ProbeNotary() (res bool)

ProbeNotary checks if native `Notary` contract is presented on chain.

func (*Client) ReceiveAllNotaryRequests added in v0.39.0

func (c *Client) ReceiveAllNotaryRequests() error

ReceiveAllNotaryRequests subscribes to all notary request events coming from the Neo blockchain the Client connected to. Events are sent to the channel returned from Client.Notifications.

See also Client.ReceiveNotaryRequests.

func (*Client) ReceiveBlocks added in v0.36.1

func (c *Client) ReceiveBlocks() error

ReceiveBlocks performs subscription for new block events. Events are sent to a returned channel. The channel is closed when connection to RPC nodes is lost.

Returns ErrConnectionLost if client has not been able to establish connection to any of passed RPC endpoints.

func (*Client) ReceiveExecutionNotifications added in v0.36.1

func (c *Client) ReceiveExecutionNotifications(contracts []util.Uint160) error

ReceiveExecutionNotifications performs subscription for notifications generated during contract execution. Notification channel may be acquired with [Notifications] method. The channel is closed when connection to RPC nodes is lost.

Returns ErrConnectionLost if client has not been able to establish connection to any of passed RPC endpoints.

func (*Client) ReceiveNotaryRequests added in v0.36.1

func (c *Client) ReceiveNotaryRequests(txSigner util.Uint160) error

ReceiveNotaryRequests performs subscription for notary request payloads addition or removal events to this instance of client. Passed txSigner expands the flow of notary requests to those whose main transaction signers include the specified account. Events are sent to a returned channel. The channel is closed when connection to RPC nodes is lost.

Returns ErrConnectionLost if client has not been able to establish connection to any of passed RPC endpoints.

See also Client.ReceiveAllNotaryRequests.

func (*Client) SendRawTransaction added in v0.39.0

func (c *Client) SendRawTransaction(tx *transaction.Transaction) (util.Uint256, error)

SendRawTransaction sends specified transaction to the Neo blockchain the Client connected to and returns the transaction hash.

func (*Client) SubmitP2PNotaryRequest added in v0.39.0

func (c *Client) SubmitP2PNotaryRequest(req *payload.P2PNotaryRequest) (util.Uint256, error)

SubmitP2PNotaryRequest submits given Notary service request to the Neo blockchain the Client connected to and returns the fallback transaction's hash.

func (*Client) SwitchRPC added in v0.36.1

func (c *Client) SwitchRPC() bool

SwitchRPC performs reconnection and returns true if it was successful.

func (*Client) TerminateSession added in v0.39.0

func (c *Client) TerminateSession(sessionID uuid.UUID) (bool, error)

TerminateSession closes opened session by its ID on the currently active Neo RPC node the Client connected to. Returns true even if session was not found.

func (*Client) TestInvoke

func (c *Client) TestInvoke(contract util.Uint160, method string, args ...any) ([]stackitem.Item, error)

TestInvoke invokes contract method locally in neo-go node. This method should be used to read data from smart-contract.

func (*Client) TestInvokeIterator added in v0.38.0

func (c *Client) TestInvokeIterator(contract util.Uint160, method string, args ...any) (res []stackitem.Item, err error)

TestInvokeIterator is the same Client.TestInvoke but expands an iterator placed on the stack. Returned values are the values an iterator provides.

func (*Client) TransferGas

func (c *Client) TransferGas(receiver util.Uint160, amount fixedn.Fixed8) error

TransferGas to the receiver from local wallet.

func (*Client) TraverseIterator added in v0.39.0

func (c *Client) TraverseIterator(sessionID, iteratorID uuid.UUID, maxItemsCount int) ([]stackitem.Item, error)

TraverseIterator returns at most maxItemsCount next values from the referenced iterator opened within specified session with the currently active Neo RPC node the Client connected to. Returns empty result if either there is no more elements or session is closed.

func (*Client) TxHalt added in v0.19.0

func (c *Client) TxHalt(h util.Uint256) (res bool, err error)

TxHalt returns true if transaction has been successfully executed and persisted.

func (*Client) TxHeight added in v0.28.0

func (c *Client) TxHeight(h util.Uint256) (res uint32, err error)

TxHeight returns true if transaction has been successfully executed and persisted.

func (*Client) UnsubscribeAll added in v0.28.0

func (c *Client) UnsubscribeAll() error

UnsubscribeAll removes all active subscriptions of current client.

Returns ErrConnectionLost if client has not been able to establish connection to any of passed RPC endpoints.

func (*Client) UpdateNeoFSAlphabetList added in v0.18.0

func (c *Client) UpdateNeoFSAlphabetList(prm UpdateAlphabetListPrm) error

UpdateNeoFSAlphabetList updates list of alphabet nodes in designate contract. As for sidechain list should contain all inner ring nodes. Requires committee multi signature.

This function must be invoked with notary enabled otherwise it throws panic.

func (*Client) UpdateNotaryList added in v0.18.0

func (c *Client) UpdateNotaryList(prm UpdateNotaryListPrm) error

UpdateNotaryList updates list of notary nodes in designate contract. Requires committee multi signature.

This function must be invoked with notary enabled otherwise it throws panic.

func (*Client) Wait added in v0.17.0

func (c *Client) Wait(ctx context.Context, n uint32) error

Wait function blocks routing execution until there are `n` new blocks in the chain.

Returns only connection errors.

type Endpoint added in v0.30.0

type Endpoint struct {
	Address  string
	Priority int
}

Endpoint represents morph endpoint together with its priority.

type InvokePrm added in v0.27.0

type InvokePrm struct {
	TestInvokePrm

	// optional parameters
	InvokePrmOptional
}

InvokePrm groups parameters of the Invoke operation.

type InvokePrmOptional added in v0.27.0

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

InvokePrmOptional groups optional parameters of the Invoke operation.

func (*InvokePrmOptional) SetHash added in v0.27.0

func (i *InvokePrmOptional) SetHash(hash util.Uint256)

SetHash sets optional hash of the transaction. If hash is set and notary is enabled, StaticClient uses it for notary nonce and `validUntilBlock` calculation.

type NotaryOption added in v0.17.0

type NotaryOption func(*notaryCfg)

func WithAlphabetSource added in v0.19.0

func WithAlphabetSource(t AlphabetKeys) NotaryOption

WithAlphabetSource returns a notary support option for client that specifies function to return list of alphabet node keys. By default notary subsystem uses committee as a source. This is valid for side chain but notary in main chain should override it.

func WithProxyContract added in v0.22.0

func WithProxyContract(h util.Uint160) NotaryOption

WithProxyContract sets proxy contract hash.

func WithRoundTime added in v0.17.0

func WithRoundTime(t uint32) NotaryOption

WithRoundTime returns a notary support option for client that specifies extra blocks to synchronize side chain height diff of inner ring nodes.

func WithTxValidTime added in v0.17.0

func WithTxValidTime(t uint32) NotaryOption

WithTxValidTime returns a notary support option for client that specifies minimum amount of blocks when mainTx will be valid.

type Option

type Option func(*cfg)

Option is a client configuration change function.

func WithAutoSidechainScope added in v0.39.0

func WithAutoSidechainScope() Option

WithAutoSidechainScope returns a client constructor option that sets automatic transaction scope detection to true which overrides the default CalledByEntry to a set of Rules made specifically for the sidechain.

func WithConnLostCallback added in v0.28.0

func WithConnLostCallback(cb Callback) Option

WithConnLostCallback return a client constructor option that specifies a callback that is called when Client unsuccessfully tried to connect to all the specified endpoints.

func WithConnSwitchCallback added in v0.38.0

func WithConnSwitchCallback(cb Callback) Option

WithConnSwitchCallback returns a client constructor option that specifies a callback that is called when the Client reconnected to a new RPC (from WithEndpoints list) successfully.

func WithContext

func WithContext(ctx context.Context) Option

WithContext returns a client constructor option that specifies the neo-go client context.

Ignores nil value. Has no effect if WithSingleClient is provided.

If option not provided, context.Background() is used.

func WithDialTimeout

func WithDialTimeout(dur time.Duration) Option

WithDialTimeout returns a client constructor option that specifies neo-go client dial timeout duration.

Ignores non-positive value. Has no effect if WithSingleClient is provided.

If option not provided, 5s timeout is used.

func WithEndpoints added in v0.30.0

func WithEndpoints(endpoints []string) Option

WithEndpoints returns a client constructor option that specifies Neo rpc endpoints.

Has no effect if WithSingleClient is provided.

func WithLogger

func WithLogger(logger *zap.Logger) Option

WithLogger returns a client constructor option that specifies the component for writing log messages.

Ignores nil value.

If option not provided, &zap.Logger{Logger: zap.L()} is used.

func WithMinRequiredBlockHeight added in v0.39.0

func WithMinRequiredBlockHeight(h uint32) Option

WithMinRequiredBlockHeight returns a client constructor option that specifies a minimal chain height that is considered as acceptable. New returns ErrStaleNodes if the height could not been reached.

func WithReconnectionRetries added in v0.37.0

func WithReconnectionRetries(r int) Option

WithReconnectionRetries returns a client constructor option that specifies number of reconnection attempts (through the full list provided via WithEndpoints) before RPC connection is considered lost. Non-positive values make no retries.

func WithReconnectionsDelay added in v0.37.0

func WithReconnectionsDelay(d time.Duration) Option

WithReconnectionsDelay returns a client constructor option that specifies delays b/w reconnections.

func WithSingleClient added in v0.25.0

func WithSingleClient(cli *rpcclient.WSClient) Option

WithSingleClient returns a client constructor option that specifies single neo-go client and forces Client to use it for requests.

Passed client must already be initialized.

type StaticClient

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

StaticClient is a wrapper over Neo:Morph client that invokes single smart contract methods with fixed fee.

Working static client must be created via constructor NewStatic. Using the StaticClient that has been created with new(StaticClient) expression (or just declaring a StaticClient variable) is unsafe and can lead to panic.

func NewStatic

func NewStatic(client *Client, scriptHash util.Uint160, fee fixedn.Fixed8, opts ...StaticClientOption) (*StaticClient, error)

NewStatic creates, initializes and returns the StaticClient instance.

If provided Client instance is nil, ErrNilClient is returned.

Specified fee is used by default. Per-operation fees can be customized via WithCustomFee option.

func (StaticClient) ContractAddress added in v0.26.0

func (s StaticClient) ContractAddress() util.Uint160

ContractAddress returns the address of the associated contract.

func (StaticClient) Invoke

func (s StaticClient) Invoke(prm InvokePrm) error

Invoke calls Invoke method of Client with static internal script hash and fee. Supported args types are the same as in Client.

If TryNotary is provided:

  • if AsAlphabet is provided, calls NotaryInvoke;
  • otherwise, calls NotaryInvokeNotAlpha.

If fee for the operation executed using specified method is customized, then StaticClient uses it. Otherwise, default fee is used.

func (*StaticClient) IsAlpha added in v0.28.2

func (s *StaticClient) IsAlpha() bool

IsAlpha returns Alphabet status of the client.

See also AsAlphabet.

func (StaticClient) Morph added in v0.25.0

func (s StaticClient) Morph() *Client

Morph return wrapped raw morph client.

func (StaticClient) TestInvoke

func (s StaticClient) TestInvoke(prm TestInvokePrm) ([]stackitem.Item, error)

TestInvoke calls TestInvoke method of Client with static internal script hash.

func (StaticClient) TestInvokeIterator added in v0.38.0

func (s StaticClient) TestInvokeIterator(prm TestInvokePrm) ([]stackitem.Item, error)

TestInvokeIterator calls TestInvokeIterator method of Client with static internal script hash.

type StaticClientOption added in v0.21.0

type StaticClientOption func(*staticOpts)

StaticClientOption allows to set an optional parameter of StaticClient.

func AsAlphabet added in v0.25.0

func AsAlphabet() StaticClientOption

AsAlphabet returns option to sign main TX of notary requests with client's private key.

Considered to be used by IR nodes only.

func TryNotary added in v0.21.0

func TryNotary() StaticClientOption

TryNotary returns option to enable notary invocation tries.

func WithCustomFee added in v0.27.0

func WithCustomFee(method string, fee fixedn.Fixed8) StaticClientOption

WithCustomFee returns option to specify custom fee for the operation executed using specified contract method.

type TestInvokePrm added in v0.27.0

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

TestInvokePrm groups parameters of the TestInvoke operation.

func (*TestInvokePrm) SetArgs added in v0.27.0

func (ti *TestInvokePrm) SetArgs(args ...any)

SetArgs sets arguments of the contact call.

func (*TestInvokePrm) SetMethod added in v0.27.0

func (ti *TestInvokePrm) SetMethod(method string)

SetMethod sets method of the contract to call.

type UpdateAlphabetListPrm added in v0.27.0

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

UpdateAlphabetListPrm groups parameters of UpdateNeoFSAlphabetList operation.

func (*UpdateAlphabetListPrm) SetHash added in v0.27.0

func (u *UpdateAlphabetListPrm) SetHash(hash util.Uint256)

SetHash sets hash of the transaction that led to the update of the alphabet role in the designate contract.

func (*UpdateAlphabetListPrm) SetList added in v0.27.0

func (u *UpdateAlphabetListPrm) SetList(list keys.PublicKeys)

SetList sets a list of the new alphabet role keys.

type UpdateNotaryListPrm added in v0.27.0

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

UpdateNotaryListPrm groups parameters of UpdateNotaryList operation.

func (*UpdateNotaryListPrm) SetHash added in v0.27.0

func (u *UpdateNotaryListPrm) SetHash(hash util.Uint256)

SetHash sets hash of the transaction that led to the update of the notary role in the designate contract.

func (*UpdateNotaryListPrm) SetList added in v0.27.0

func (u *UpdateNotaryListPrm) SetList(list keys.PublicKeys)

SetList sets a list of the new notary role keys.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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