config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BatchPrefix = "batchTransactions"

BatchPrefix is a prefix for batched transactions

Variables

View Source
var (
	ErrAdminEmpty            = errors.New("'admin' address is empty")
	ErrIssuerEmpty           = errors.New("'issuer' address is empty")
	ErrFeeSetterEmpty        = errors.New("'fee-setter' address is empty")
	ErrFeeAddressSetterEmpty = errors.New("'fee-address-setter' address is empty")
)

positional args specific errors

View Source
var ErrCfgBytesEmpty = errors.New("config bytes is empty")

Functions

func FromArgsWithAdmin

func FromArgsWithAdmin(symbol string, args []string) (*proto.Config, error)

FromArgsWithAdmin configures the proto.Config with an admin address. Args: [platformSKI (deprecated), robotSKI, adminAddress]

func FromArgsWithIssuerAndAdmin

func FromArgsWithIssuerAndAdmin(symbol string, args []string) (*proto.Config, error)

FromArgsWithIssuerAndAdmin configures the proto.Config with an issuer and admin address. Args: [platformSKI (deprecated), robotSKI, issuerAddress, adminAddress]

func FromArgsWithIssuerAndFeeSetter

func FromArgsWithIssuerAndFeeSetter(symbol string, args []string) (*proto.Config, error)

FromArgsWithIssuerAndFeeSetter configures the proto.Config with an issuer and fee setter address. Args: [platformSKI (deprecated), robotSKI, issuerAddress, feeSetter]

func FromArgsWithIssuerFeeSetterAndFeeAddressSetter

func FromArgsWithIssuerFeeSetterAndFeeAddressSetter(symbol string, args []string) (*proto.Config, error)

FromArgsWithIssuerFeeSetterAndFeeAddressSetter configures the proto.Config with an issuer, fee setter, and fee admin setter address. Args: [platformSKI (deprecated), robotSKI, issuerAddress, feeSetter, feeAddressSetter]

func FromBytes

func FromBytes(cfgBytes []byte) (*proto.Config, error)

FromBytes parses the provided byte slice containing JSON-encoded configuration and returns a pointer to a proto.Config struct.

func FromInitArgs deprecated

func FromInitArgs(channel string, args []string) ([]byte, error)

Deprecated: added only for backward compatibility. FromInitArgs parses positional initialization arguments and generates JSON-config of []byte type. Accepts the channel name (chaincode) and the list of positional initialization parameters. Only needed to maintain backward compatibility. Marked for deletion after all deploy tools will be switched to JSON-config initialization of chaincodes.

func IsJSON

func IsJSON(args []string) bool

IsJSON checks if the provided arguments represent a valid JSON configuration.

The function returns true if there is exactly one argument in the initialization args slice, and if the content of that argument is a valid JSON.

func Load

func Load(stub shim.ChaincodeStubInterface) ([]byte, error)

Load retrieves and returns the raw configuration data from the state using the provided State interface.

The function returns the configuration data as a byte slice and nil error if successful.

If there is an error while loading the data from the state, an error is returned with additional information about the error.

If the retrieved configuration data is empty, the function returns an ErrCfgBytesEmpty error.

func Save

func Save(stub shim.ChaincodeStubInterface, cfgBytes []byte) error

Save saves configuration data to the state using the provided State interface.

If the provided cfgBytes slice is empty, the function returns an ErrCfgBytesEmpty error.

If there is an error while saving the data to the state, an error is returned with additional information about the error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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