add_contract

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "add-contract <name> <filename>",
	Short: "Deploy a new contract to an account",
	Args:  cobra.ExactArgs(2),
	Run: func(cmd *cobra.Command, args []string) {
		projectConf := cli.LoadConfig()

		contractName := args[0]
		contractFilename := args[1]

		contractSource, err := ioutil.ReadFile(contractFilename)
		if err != nil {
			cli.Exitf(1, "Failed to read contract from source file %s", contractFilename)
		}

		signerAccount := projectConf.Accounts[conf.Signer]

		tx := templates.AddAccountContract(
			signerAccount.Address,
			templates.Contract{
				Name:   contractName,
				Source: string(contractSource),
			},
		)

		cli.SendTransaction(
			projectConf.HostWithOverride(conf.Host),
			signerAccount,
			tx,
			conf.Results,
		)
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Signer  string `default:"service" flag:"signer,s"`
	Host    string `flag:"host" info:"Flow Access API host address"`
	Results bool   `default:"false" flag:"results" info:"Display the results of the transaction"`
}

Jump to

Keyboard shortcuts

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