Merge pull request #2154 from nspcc-dev/remark14

wallet: add remark14 option to migrate UTXO assets to N3
This commit is contained in:
Roman Khimov 2021-09-03 13:09:14 +03:00 committed by GitHub
commit 580f1787b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,6 +48,10 @@ var (
Name: "rpc, r", Name: "rpc, r",
Usage: "RPC node address", Usage: "RPC node address",
} }
r14Flag = cli.StringFlag{
Name: "remark14",
Usage: "Remark14 field",
}
timeoutFlag = cli.DurationFlag{ timeoutFlag = cli.DurationFlag{
Name: "timeout, t", Name: "timeout, t",
Usage: "Timeout for the operation", Usage: "Timeout for the operation",
@ -188,6 +192,7 @@ func NewCommands() []cli.Command {
Flags: []cli.Flag{ Flags: []cli.Flag{
walletPathFlag, walletPathFlag,
rpcFlag, rpcFlag,
r14Flag,
timeoutFlag, timeoutFlag,
outFlag, outFlag,
fromAddrFlag, fromAddrFlag,
@ -487,6 +492,8 @@ func transferAsset(ctx *cli.Context) error {
return cli.NewExitError(fmt.Errorf("wallet contains no account for '%s'", from), 1) return cli.NewExitError(fmt.Errorf("wallet contains no account for '%s'", from), 1)
} }
remark14 := ctx.String("remark14")
asset, err := getAssetID(ctx.String("asset")) asset, err := getAssetID(ctx.String("asset"))
if err != nil { if err != nil {
return cli.NewExitError(fmt.Errorf("invalid asset id: %v", err), 1) return cli.NewExitError(fmt.Errorf("invalid asset id: %v", err), 1)
@ -517,6 +524,13 @@ func transferAsset(ctx *cli.Context) error {
return cli.NewExitError(err, 1) return cli.NewExitError(err, 1)
} }
if remark14 != "" {
tx.Attributes = append(tx.Attributes, transaction.Attribute{
Usage: transaction.Remark14,
Data: []byte(remark14),
})
}
toFlag := ctx.Generic("to").(*flags.Address) toFlag := ctx.Generic("to").(*flags.Address)
if !toFlag.IsSet { if !toFlag.IsSet {
return cli.NewExitError("'to' address was not provided", 1) return cli.NewExitError("'to' address was not provided", 1)