mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 19:29:39 +00:00
cli/smartcontract: allow deploying contracts from multisig accounts
By providing `--out` flag.
This commit is contained in:
parent
99ca0b2578
commit
26eff7110c
1 changed files with 16 additions and 3 deletions
|
@ -113,6 +113,7 @@ func NewCommands() []cli.Command {
|
|||
},
|
||||
walletFlag,
|
||||
addressFlag,
|
||||
outFlag,
|
||||
gasFlag,
|
||||
}
|
||||
deployFlags = append(deployFlags, options.RPC...)
|
||||
|
@ -865,9 +866,21 @@ func contractDeploy(ctx *cli.Context) error {
|
|||
return cli.NewExitError(fmt.Errorf("failed to test-invoke deployment script: %w", err), 1)
|
||||
}
|
||||
|
||||
txHash, err := c.SignAndPushInvocationTx(txScript, acc, invRes.GasConsumed, gas, nil)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to push invocation tx: %w", err), 1)
|
||||
var txHash util.Uint256
|
||||
if out := ctx.String("out"); out != "" {
|
||||
tx, err := c.CreateTxFromScript(txScript, acc, invRes.GasConsumed, int64(gas), nil)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to create tx: %w", err), 1)
|
||||
}
|
||||
if err := paramcontext.InitAndSave(c.GetNetwork(), tx, acc, out); err != nil {
|
||||
return cli.NewExitError(err, 1)
|
||||
}
|
||||
txHash = tx.Hash()
|
||||
} else {
|
||||
txHash, err = c.SignAndPushInvocationTx(txScript, acc, invRes.GasConsumed, gas, nil)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to push invocation tx: %w", err), 1)
|
||||
}
|
||||
}
|
||||
hash := state.CreateContractHash(sender, nefFile.Checksum, m.Name)
|
||||
fmt.Fprintf(ctx.App.Writer, "Contract: %s\n", hash.StringLE())
|
||||
|
|
Loading…
Reference in a new issue