cmdargs

package
v0.102.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CosignersSeparator marks the start of cosigners cli args.
	CosignersSeparator = "--"
	// ArrayStartSeparator marks the start of array cli arg.
	ArrayStartSeparator = "["
	// ArrayEndSeparator marks the end of array cli arg.
	ArrayEndSeparator = "]"
)
View Source
const (
	// ParamsParsingDoc is a documentation for parameters parsing.
	ParamsParsingDoc = `` /* 3805-byte string literal not displayed */

	// SignersParsingDoc is a documentation for signers parsing.
	SignersParsingDoc = `   Signers represent a set of Uint160 hashes with witness scopes and are used
   to verify hashes in System.Runtime.CheckWitness syscall. First signer is treated
   as a sender. To specify signers use signer[:scope] syntax where
    * 'signer' is a signer's address (as Neo address or hex-encoded 160 bit (20 byte)
               LE value with or without '0x' prefix).
    * 'scope' is a comma-separated set of cosigner's scopes, which could be:
        - 'None' - default witness scope which may be used for the sender
			       to only pay fee for the transaction.
        - 'Global' - allows this witness in all contexts. This cannot be combined
                     with other flags.
        - 'CalledByEntry' - means that this condition must hold: EntryScriptHash
                            == CallingScriptHash. The witness/permission/signature
                            given on first invocation will automatically expire if
                            entering deeper internal invokes. This can be default
                            safe choice for native NEO/GAS.
        - 'CustomContracts' - define valid custom contract hashes for witness check.
                              Hashes are be provided as hex-encoded LE value string.
                              At lest one hash must be provided. Multiple hashes
                              are separated by ':'.
        - 'CustomGroups' - define custom public keys for group members. Public keys are
                           provided as short-form (1-byte prefix + 32 bytes) hex-encoded
                           values. At least one key must be provided. Multiple keys
                           are separated by ':'.

   If no scopes were specified, 'CalledByEntry' used as default. If no signers were
   specified, no array is passed. Note that scopes are properly handled by
   neo-go RPC server only. C# implementation does not support scopes capability.

   Examples:
    * 'NNQk4QXsxvsrr3GSozoWBUxEmfag7B6hz5'
    * 'NVquyZHoPirw6zAEPvY1ZezxM493zMWQqs:Global'
    * '0x0000000009070e030d0f0e020d0c06050e030c02'
    * '0000000009070e030d0f0e020d0c06050e030c02:CalledByEntry,` +
		`CustomGroups:0206d7495ceb34c197093b5fc1cccf1996ada05e69ef67e765462a7f5d88ee14d0'
    * '0000000009070e030d0f0e020d0c06050e030c02:CalledByEntry,` +
		`CustomContracts:1011120009070e030d0f0e020d0c06050e030c02:0x1211100009070e030d0f0e020d0c06050e030c02'`
)

Variables

This section is empty.

Functions

func EnsureNone added in v0.99.2

func EnsureNone(ctx *cli.Context) *cli.ExitError

EnsureNone returns an error if there are any positional arguments present. It can be used to check for them in commands that don't accept arguments.

func GetDataFromContext

func GetDataFromContext(ctx *cli.Context) (int, any, *cli.ExitError)

GetDataFromContext returns data parameter from context args.

func GetSignersAccounts

func GetSignersAccounts(senderAcc *wallet.Account, wall *wallet.Wallet, signers []transaction.Signer, accScope transaction.WitnessScope) ([]actor.SignerAccount, error)

GetSignersAccounts returns the list of signers combined with the corresponding accounts from the provided wallet.

func GetSignersFromContext

func GetSignersFromContext(ctx *cli.Context, offset int) ([]transaction.Signer, *cli.ExitError)

GetSignersFromContext returns signers parsed from context args starting from the specified offset.

func ParseParams

func ParseParams(args []string, calledFromMain bool) (int, []smartcontract.Parameter, error)

ParseParams extracts array of smartcontract.Parameter from the given args and returns the number of handled words, the array itself and an error. `calledFromMain` denotes whether the method was called from the outside or recursively and used to check if CosignersSeparator and ArrayEndSeparator are allowed to be in `args` sequence.

func ParseSigners added in v0.99.5

func ParseSigners(args []string) ([]transaction.Signer, error)

ParseSigners returns array of signers parsed from their string representation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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