Merge pull request #10105 from filecoin-project/addr-encode
chore:shed:encode address to bytes
This commit is contained in:
commit
4682e8f326
@ -13,6 +13,15 @@ import (
|
|||||||
|
|
||||||
var addressCmd = &cli.Command{
|
var addressCmd = &cli.Command{
|
||||||
Name: "addr",
|
Name: "addr",
|
||||||
|
Usage: "interact with filecoin addresses",
|
||||||
|
Subcommands: cli.Commands{
|
||||||
|
addrDecode,
|
||||||
|
addrEncode,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var addrDecode = &cli.Command{
|
||||||
|
Name: "decode",
|
||||||
Usage: "decode hex bytes into address",
|
Usage: "decode hex bytes into address",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
addrHex := cctx.Args().First()
|
addrHex := cctx.Args().First()
|
||||||
@ -39,3 +48,17 @@ var addressCmd = &cli.Command{
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var addrEncode = &cli.Command{
|
||||||
|
Name: "encode",
|
||||||
|
Usage: "encode address to hex bytes",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
addr, err := address.NewFromString(cctx.Args().First())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("%x\n", addr.Bytes())
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user