Documentation ¶
Overview ¶
Package contract implements generate and deploy chaincode for hyperledger fabric
Package contract implements generate and deploy chaincode for hyperledger fabric
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func NewGenerator(opts *GenOptions) contract.Generator
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type DeployOption
- func WithChaincodeID(ccID string) DeployOption
- func WithChaincodeInitArgs(ccArgs string) DeployOption
- func WithChaincodePath(ccPath string) DeployOption
- func WithChaincodePolicy(ccPolicy string) DeployOption
- func WithChaincodeVersion(ccVersion string) DeployOption
- func WithChannelID(channelID string) DeployOption
- func WithFabricConfig(configFiles ...string) DeployOption
- func WithOrgName(org string) DeployOption
- func WithUserName(user string) DeployOption
- type Deployer
- type GenOptions
- type Generator
- type Options
- type ResourceRef
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewGenerator ¶
func NewGenerator(opts *GenOptions) contract.Generator
NewGenerator is the generator constructor
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type DeployOption ¶ added in v0.1.3
DeployOption func for each Opts argument
func WithChaincodeID ¶ added in v0.1.3
func WithChaincodeID(ccID string) DeployOption
WithChaincodeID sets the ID of the chaincode to be deployed
func WithChaincodeInitArgs ¶ added in v0.1.3
func WithChaincodeInitArgs(ccArgs string) DeployOption
WithChaincodeInitArgs sets the init-args for instantiating the chaincode
func WithChaincodePath ¶ added in v0.1.3
func WithChaincodePath(ccPath string) DeployOption
WithChaincodePath sets the chaincode source code location, which should be the full path of the generated source code folder
func WithChaincodePolicy ¶ added in v0.1.3
func WithChaincodePolicy(ccPolicy string) DeployOption
WithChaincodePolicy sets the policy for instantiating the chaincode
func WithChaincodeVersion ¶ added in v0.1.3
func WithChaincodeVersion(ccVersion string) DeployOption
WithChaincodeVersion sets the version of the chaincode to be deployed
func WithChannelID ¶ added in v0.1.3
func WithChannelID(channelID string) DeployOption
WithChannelID sets the Fabric channel for instantiating the chaincode
func WithFabricConfig ¶ added in v0.1.3
func WithFabricConfig(configFiles ...string) DeployOption
WithFabricConfig sets the local fabric network config yaml and entity matcher override file if necessary
func WithOrgName ¶ added in v0.1.3
func WithOrgName(org string) DeployOption
WithOrgName sets org name of a fabric network member
func WithUserName ¶ added in v0.1.3
func WithUserName(user string) DeployOption
WithUserName sets admin user name of the org
type Deployer ¶
type Deployer struct { }
Deployer defines the deployer attributes
func (*Deployer) Deploy ¶
func (d *Deployer) Deploy(options ...DeployOption) error
Deploy deploys a smart contract for the given options
func (*Deployer) Instantiate ¶ added in v0.1.3
func (d *Deployer) Instantiate(options ...DeployOption) error
Instantiate starts instances for a smart contract on specified channel and org
type GenOptions ¶
GenOptions defines the generator options
func NewGenOptions ¶
func NewGenOptions(targetPath, modelFile, version string, enableSecurity bool) *GenOptions
NewGenOptions is the options constructor
type Generator ¶
type Generator struct {
Opts *GenOptions
}
Generator defines the generator attributes
type Options ¶
type Options struct { ChaincodeID string ChaincodePath string ChaincodeRoot string ChaincodeVersion string NetworkConfigPath string NetworkOverridePath string UserName string OrgName string ChaincodePolicy string ChaincodeInitArgs string ChannelID string }
Options defines the deployer options
type ResourceRef ¶
type TemplateData ¶
type TemplateData struct { CCName string ActivityRefs map[string]ResourceRef TriggerRefs map[string]ResourceRef Functions map[string]string EnableTxnSecurity bool }