diff --git a/cli/wallet/wallet.go b/cli/wallet/wallet.go index 71f4fbe9a..b6cfb7f9a 100644 --- a/cli/wallet/wallet.go +++ b/cli/wallet/wallet.go @@ -3,6 +3,7 @@ package wallet import ( "bufio" "context" + "encoding/hex" "encoding/json" "errors" "fmt" @@ -143,6 +144,10 @@ func NewCommands() []cli.Command { Name: "name, n", Usage: "Optional account name", }, + cli.StringFlag{ + Name: "contract", + Usage: "Verification script for custom contracts", + }, }, }, { @@ -403,6 +408,14 @@ func importWallet(ctx *cli.Context) error { return cli.NewExitError(err, 1) } + if ctrFlag := ctx.String("contract"); ctrFlag != "" { + ctr, err := hex.DecodeString(ctrFlag) + if err != nil { + return cli.NewExitError("invalid contract", 1) + } + acc.Contract.Script = ctr + } + acc.Label = ctx.String("name") if err := addAccountAndSave(wall, acc); err != nil { return cli.NewExitError(err, 1)