add chain base64 decode params
This commit is contained in:
parent
df7f13d069
commit
7f47bf452a
10
cli/chain.go
10
cli/chain.go
@ -3,6 +3,7 @@ package cli
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -1248,12 +1249,12 @@ var chainDecodeCmd = &cli.Command{
|
|||||||
var chainDecodeParamsCmd = &cli.Command{
|
var chainDecodeParamsCmd = &cli.Command{
|
||||||
Name: "params",
|
Name: "params",
|
||||||
Usage: "Decode message params",
|
Usage: "Decode message params",
|
||||||
|
ArgsUsage: "[toAddr method params]",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "tipset",
|
Name: "tipset",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ArgsUsage: "[toAddr method hexParams]",
|
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
api, closer, err := GetFullNodeAPI(cctx)
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1276,9 +1277,12 @@ var chainDecodeParamsCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("parsing method id: %w", err)
|
return xerrors.Errorf("parsing method id: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
params, err := hex.DecodeString(cctx.Args().Get(2))
|
params, err := base64.StdEncoding.DecodeString(cctx.Args().Get(2))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("parsing hex params: %w", err)
|
params, err = hex.DecodeString(cctx.Args().Get(2))
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("parsing params: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ts, err := LoadTipSet(ctx, cctx, api)
|
ts, err := LoadTipSet(ctx, cctx, api)
|
||||||
|
Loading…
Reference in New Issue
Block a user