Documentation ¶
Index ¶
- Variables
- func AddManifestGroup(cw *wallet.Wallet, h util.Uint160, cs *ContractState) error
- func AwaitTx(cmd *cobra.Command, c Client, txs []HashVUBPair) error
- func CheckNotaryEnabled(c Client) error
- func DeployNNS(c *InitializeContext, method string) error
- func DomainOf(contract string) string
- func EmitNewEpochCall(bw *io.BufBinWriter, wCtx *InitializeContext, nmHash util.Uint160, ...) error
- func GetAlphabetNNSDomain(i int) string
- func GetAlphabetWallets(v *viper.Viper, walletDir string) ([]*wallet.Wallet, error)
- func GetComitteAcc(cmd *cobra.Command, v *viper.Viper) *wallet.Account
- func GetContractByID(r *management.ContractReader, id int32) (*state.Contract, error)
- func GetContractDeployData(c *InitializeContext, ctrName string, keysParam []any, method string) ([]any, error)
- func GetContractDeployParameters(cs *ContractState, deployData []any) []any
- func GetDefaultNetmapContractConfigMap() map[string]any
- func GetDesignatedByRole(inv *invoker.Invoker, h util.Uint160, role noderoles.Role, u uint32) (keys.PublicKeys, error)
- func GetFrostfsIDAdmin(v *viper.Viper) (util.Uint160, bool, error)
- func GetNetConfigFromNetmapContract(roInvoker *invoker.Invoker) ([]stackitem.Item, error)
- func GetWalletAccount(w *wallet.Wallet, typ string) (*wallet.Account, error)
- func InitializeContractWallet(v *viper.Viper, walletDir string) (*wallet.Wallet, error)
- func InvalidConfigValueErr(key string) error
- func InvokeFunction(c Client, h util.Uint160, method string, parameters []any, ...) (*result.Invoke, error)
- func MergeNetmapConfig(roInvoker *invoker.Invoker, md map[string]any) error
- func NNSIsAvailable(c Client, nnsHash util.Uint160, name string) (bool, error)
- func NNSResolve(inv *invoker.Invoker, nnsHash util.Uint160, domain string) (stackitem.Item, error)
- func NNSResolveHash(inv *invoker.Invoker, nnsHash util.Uint160, domain string) (util.Uint160, error)
- func NNSResolveKey(inv *invoker.Invoker, nnsHash util.Uint160, domain string) (*keys.PublicKey, error)
- func NewActor(c actor.RPCActor, committeeAcc *wallet.Account) (*actor.Actor, error)
- func NextPollInterval(it int, previous time.Duration) (time.Duration, bool)
- func ParseConfigFromNetmapContract(arr []stackitem.Item) (map[string][]byte, error)
- func ParseGASAmount(s string) (fixedn.Fixed8, error)
- func ParseNNSResolveResult(res stackitem.Item) (util.Uint160, error)
- type Cache
- type Client
- type ClientContext
- type ContractState
- type HashVUBPair
- type InitializeContext
- func (c *InitializeContext) AwaitTx() error
- func (c *InitializeContext) Close()
- func (c *InitializeContext) EmitUpdateNNSGroupScript(bw *io.BufBinWriter, nnsHash util.Uint160, pub *keys.PublicKey) (bool, bool, error)
- func (c *InitializeContext) GetAlphabetDeployItems(i, n int) []any
- func (c *InitializeContext) GetContract(ctrName string) *ContractState
- func (c *InitializeContext) GetSigner(tryGroup bool, acc *wallet.Account) transaction.Signer
- func (c *InitializeContext) IsUpdated(ctrHash util.Uint160, cs *ContractState) bool
- func (c *InitializeContext) MultiSign(tx *transaction.Transaction, accType string) error
- func (c *InitializeContext) MultiSignAndSend(tx *transaction.Transaction, accType string) error
- func (c *InitializeContext) NNSContractState() (*state.Contract, error)
- func (c *InitializeContext) NNSRegisterDomainScript(nnsHash, expectedHash util.Uint160, domain string) ([]byte, bool, error)
- func (c *InitializeContext) NNSRootRegistered(nnsHash util.Uint160, zone string) (bool, error)
- func (c *InitializeContext) SendCommitteeTx(script []byte, tryGroup bool) error
- func (c *InitializeContext) SendConsensusTx(script []byte) error
- type LocalActor
- func (a *LocalActor) Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error)
- func (a *LocalActor) CallAndExpandIterator(_ util.Uint160, _ string, _ int, _ ...any) (*result.Invoke, error)
- func (a *LocalActor) GetRPCInvoker() invoker.RPCInvoke
- func (a *LocalActor) MakeCall(_ util.Uint160, _ string, _ ...any) (*transaction.Transaction, error)
- func (a *LocalActor) MakeRun(_ []byte) (*transaction.Transaction, error)
- func (a *LocalActor) MakeUnsignedCall(_ util.Uint160, _ string, _ []transaction.Attribute, _ ...any) (*transaction.Transaction, error)
- func (a *LocalActor) MakeUnsignedRun(_ []byte, _ []transaction.Attribute) (*transaction.Transaction, error)
- func (a *LocalActor) SendCall(contract util.Uint160, method string, params ...any) (util.Uint256, uint32, error)
- func (a *LocalActor) SendRun(script []byte) (util.Uint256, uint32, error)
- func (a *LocalActor) Sender() util.Uint160
- func (a *LocalActor) TerminateSession(_ uuid.UUID) error
- func (a *LocalActor) TraverseIterator(sessionID uuid.UUID, iterator *result.Iterator, num int) ([]stackitem.Item, error)
- func (a *LocalActor) Wait(h util.Uint256, vub uint32, err error) (*state.AppExecResult, error)
- type LocalClient
- func (l *LocalClient) CalculateNetworkFee(tx *transaction.Transaction) (int64, error)
- func (l *LocalClient) Dump() (err error)
- func (l *LocalClient) GetApplicationLog(h util.Uint256, t *trigger.Type) (*result.ApplicationLog, error)
- func (l *LocalClient) GetBlockCount() (uint32, error)
- func (l *LocalClient) GetCommittee() (keys.PublicKeys, error)
- func (l *LocalClient) GetNativeContracts() ([]state.Contract, error)
- func (l *LocalClient) GetVersion() (*result.Version, error)
- func (l *LocalClient) InvokeContractVerify(util.Uint160, []smartcontract.Parameter, []transaction.Signer, ...) (*result.Invoke, error)
- func (l *LocalClient) InvokeFunction(h util.Uint160, method string, sPrm []smartcontract.Parameter, ...) (*result.Invoke, error)
- func (l *LocalClient) InvokeScript(script []byte, signers []transaction.Signer) (*result.Invoke, error)
- func (l *LocalClient) SendRawTransaction(tx *transaction.Transaction) (util.Uint256, error)
- func (l *LocalClient) TerminateSession(_ uuid.UUID) (bool, error)
- func (l *LocalClient) TraverseIterator(_, _ uuid.UUID, _ int) ([]stackitem.Item, error)
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyAlphabetNodes = fmt.Errorf("too many alphabet nodes (maximum allowed is %d)", constants.MaxAlphabetNodes)
Functions ¶
func AddManifestGroup ¶
func CheckNotaryEnabled ¶
func DeployNNS ¶
func DeployNNS(c *InitializeContext, method string) error
func EmitNewEpochCall ¶
func EmitNewEpochCall(bw *io.BufBinWriter, wCtx *InitializeContext, nmHash util.Uint160, countEpoch int64) error
func GetAlphabetNNSDomain ¶
func GetAlphabetWallets ¶
func GetContractByID ¶ added in v0.42.0
func GetContractByID(r *management.ContractReader, id int32) (*state.Contract, error)
GetContractByID retrieves a contract by its ID using the standard GetContractByID method. However, if the returned state.Contract is nil, it returns an error indicating that the contract was not found. See https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/1210
func GetContractDeployData ¶
func GetContractDeployParameters ¶
func GetContractDeployParameters(cs *ContractState, deployData []any) []any
func GetDesignatedByRole ¶
func GetWalletAccount ¶
func InvalidConfigValueErr ¶
func InvokeFunction ¶
func MergeNetmapConfig ¶
func NNSIsAvailable ¶
func NNSResolve ¶
func NNSResolveHash ¶
func NNSResolveHash(inv *invoker.Invoker, nnsHash util.Uint160, domain string) (util.Uint160, error)
NNSResolveHash Returns errMissingNNSRecord if invocation fault exception contains "token not found".
func NNSResolveKey ¶
Types ¶
type Client ¶
type Client interface { invoker.RPCInvoke GetBlockCount() (uint32, error) GetNativeContracts() ([]state.Contract, error) GetApplicationLog(util.Uint256, *trigger.Type) (*result.ApplicationLog, error) GetVersion() (*result.Version, error) SendRawTransaction(*transaction.Transaction) (util.Uint256, error) GetCommittee() (keys.PublicKeys, error) CalculateNetworkFee(tx *transaction.Transaction) (int64, error) }
Client represents N3 client interface capable of test-invoking scripts and sending signed transactions to chain.
type ClientContext ¶
type ClientContext struct { Client Client // a raw neo-go client OR a local chain implementation CommitteeAct *actor.Actor // committee actor with the Global witness scope ReadOnlyInvoker *invoker.Invoker // R/O contract invoker, does not contain any signer SentTxs []HashVUBPair }
func DefaultClientContext ¶
func DefaultClientContext(c Client, committeeAcc *wallet.Account) (*ClientContext, error)
func (*ClientContext) SendTx ¶
func (c *ClientContext) SendTx(tx *transaction.Transaction, cmd *cobra.Command, await bool) error
type ContractState ¶
type ContractState struct { NEF *nef.File RawNEF []byte Manifest *manifest.Manifest RawManifest []byte Hash util.Uint160 }
func ReadContract ¶
func ReadContract(ctrPath, ctrName string) (*ContractState, error)
func (*ContractState) Parse ¶
func (cs *ContractState) Parse() error
type HashVUBPair ¶
type InitializeContext ¶
type InitializeContext struct { ClientContext Cache // CommitteeAcc is used for retrieving the committee address and the verification script. CommitteeAcc *wallet.Account // ConsensusAcc is used for retrieving the committee address and the verification script. ConsensusAcc *wallet.Account Wallets []*wallet.Wallet // ContractWallet is a wallet for providing the contract group signature. ContractWallet *wallet.Wallet // Accounts contains simple signature accounts in the same order as in Wallets. Accounts []*wallet.Account Contracts map[string]*ContractState Command *cobra.Command ContractPath string ContractURL string }
func NewInitializeContext ¶
func (*InitializeContext) AwaitTx ¶
func (c *InitializeContext) AwaitTx() error
func (*InitializeContext) Close ¶
func (c *InitializeContext) Close()
func (*InitializeContext) EmitUpdateNNSGroupScript ¶
func (c *InitializeContext) EmitUpdateNNSGroupScript(bw *io.BufBinWriter, nnsHash util.Uint160, pub *keys.PublicKey) (bool, bool, error)
EmitUpdateNNSGroupScript emits script for updating group key stored in NNS. First return value is true iff the key is already there and nothing should be done. Second return value is true iff a domain registration code was emitted.
func (*InitializeContext) GetAlphabetDeployItems ¶
func (c *InitializeContext) GetAlphabetDeployItems(i, n int) []any
func (*InitializeContext) GetContract ¶
func (c *InitializeContext) GetContract(ctrName string) *ContractState
func (*InitializeContext) GetSigner ¶
func (c *InitializeContext) GetSigner(tryGroup bool, acc *wallet.Account) transaction.Signer
func (*InitializeContext) IsUpdated ¶
func (c *InitializeContext) IsUpdated(ctrHash util.Uint160, cs *ContractState) bool
func (*InitializeContext) MultiSign ¶
func (c *InitializeContext) MultiSign(tx *transaction.Transaction, accType string) error
func (*InitializeContext) MultiSignAndSend ¶
func (c *InitializeContext) MultiSignAndSend(tx *transaction.Transaction, accType string) error
func (*InitializeContext) NNSContractState ¶
func (c *InitializeContext) NNSContractState() (*state.Contract, error)
func (*InitializeContext) NNSRegisterDomainScript ¶
func (*InitializeContext) NNSRootRegistered ¶
func (*InitializeContext) SendCommitteeTx ¶
func (c *InitializeContext) SendCommitteeTx(script []byte, tryGroup bool) error
SendCommitteeTx creates transaction from script, signs it by committee nodes and sends it to RPC. If tryGroup is false, global scope is used for the signer (useful when working with native contracts).
func (*InitializeContext) SendConsensusTx ¶
func (c *InitializeContext) SendConsensusTx(script []byte) error
SendConsensusTx creates transaction from script, signs it by alphabet nodes and sends it to RPC. Not that because this is used only after the contracts were initialized and deployed, we always try to have a group scope.
type LocalActor ¶
LocalActor is a kludge, do not use it outside of the morph commands.
func NewLocalActor ¶
NewLocalActor create LocalActor with accounts form provided wallets. In case of empty wallets provided created actor with dummy account only for read operation.
func (*LocalActor) CallAndExpandIterator ¶
func (*LocalActor) GetRPCInvoker ¶ added in v0.38.6
func (a *LocalActor) GetRPCInvoker() invoker.RPCInvoke
func (*LocalActor) MakeCall ¶
func (a *LocalActor) MakeCall(_ util.Uint160, _ string, _ ...any) (*transaction.Transaction, error)
func (*LocalActor) MakeRun ¶
func (a *LocalActor) MakeRun(_ []byte) (*transaction.Transaction, error)
func (*LocalActor) MakeUnsignedCall ¶
func (a *LocalActor) MakeUnsignedCall(_ util.Uint160, _ string, _ []transaction.Attribute, _ ...any) (*transaction.Transaction, error)
func (*LocalActor) MakeUnsignedRun ¶
func (a *LocalActor) MakeUnsignedRun(_ []byte, _ []transaction.Attribute) (*transaction.Transaction, error)
func (*LocalActor) Sender ¶
func (a *LocalActor) Sender() util.Uint160
func (*LocalActor) TerminateSession ¶
func (a *LocalActor) TerminateSession(_ uuid.UUID) error
func (*LocalActor) TraverseIterator ¶
func (*LocalActor) Wait ¶
func (a *LocalActor) Wait(h util.Uint256, vub uint32, err error) (*state.AppExecResult, error)
type LocalClient ¶
type LocalClient struct {
// contains filtered or unexported fields
}
func NewLocalClient ¶
func (*LocalClient) CalculateNetworkFee ¶
func (l *LocalClient) CalculateNetworkFee(tx *transaction.Transaction) (int64, error)
CalculateNetworkFee calculates network fee for the given transaction. Copied from neo-go with minor corrections (no need to support non-notary mode): https://github.com/nspcc-dev/neo-go/blob/v0.103.0/pkg/services/rpcsrv/server.go#L911
func (*LocalClient) Dump ¶
func (l *LocalClient) Dump() (err error)
func (*LocalClient) GetApplicationLog ¶
func (l *LocalClient) GetApplicationLog(h util.Uint256, t *trigger.Type) (*result.ApplicationLog, error)
func (*LocalClient) GetBlockCount ¶
func (l *LocalClient) GetBlockCount() (uint32, error)
func (*LocalClient) GetCommittee ¶
func (l *LocalClient) GetCommittee() (keys.PublicKeys, error)
func (*LocalClient) GetNativeContracts ¶
func (l *LocalClient) GetNativeContracts() ([]state.Contract, error)
func (*LocalClient) GetVersion ¶
func (l *LocalClient) GetVersion() (*result.Version, error)
GetVersion return default version.
func (*LocalClient) InvokeContractVerify ¶
func (l *LocalClient) InvokeContractVerify(util.Uint160, []smartcontract.Parameter, []transaction.Signer, ...transaction.Witness) (*result.Invoke, error)
func (*LocalClient) InvokeFunction ¶
func (l *LocalClient) InvokeFunction(h util.Uint160, method string, sPrm []smartcontract.Parameter, ss []transaction.Signer) (*result.Invoke, error)
InvokeFunction is implemented via `InvokeScript`.
func (*LocalClient) InvokeScript ¶
func (l *LocalClient) InvokeScript(script []byte, signers []transaction.Signer) (*result.Invoke, error)
func (*LocalClient) SendRawTransaction ¶
func (l *LocalClient) SendRawTransaction(tx *transaction.Transaction) (util.Uint256, error)
func (*LocalClient) TerminateSession ¶
func (l *LocalClient) TerminateSession(_ uuid.UUID) (bool, error)