Parse amount as FIL in paych get

This commit is contained in:
Mike Goelzer 2020-07-25 01:54:21 +00:00
parent f69cce4089
commit b409c8f2be

View File

@ -29,7 +29,7 @@ var paychGetCmd = &cli.Command{
ArgsUsage: "[fromAddress toAddress amount]", ArgsUsage: "[fromAddress toAddress amount]",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 3 { if cctx.Args().Len() != 3 {
return fmt.Errorf("must pass three arguments: <from> <to> <available funds>") return fmt.Errorf("must pass three arguments: <from> <to> <available funds in FIL>")
} }
from, err := address.NewFromString(cctx.Args().Get(0)) from, err := address.NewFromString(cctx.Args().Get(0))
@ -42,9 +42,9 @@ var paychGetCmd = &cli.Command{
return fmt.Errorf("failed to parse to address: %s", err) return fmt.Errorf("failed to parse to address: %s", err)
} }
amt, err := types.BigFromString(cctx.Args().Get(2)) amt, err := types.ParseFIL(cctx.Args().Get(2))
if err != nil { if err != nil {
return fmt.Errorf("parsing amount failed: %s", err) return fmt.Errorf("parsing amount as whole FIL failed: %s", err)
} }
api, closer, err := GetFullNodeAPI(cctx) api, closer, err := GetFullNodeAPI(cctx)
@ -55,7 +55,7 @@ var paychGetCmd = &cli.Command{
ctx := ReqContext(cctx) ctx := ReqContext(cctx)
info, err := api.PaychGet(ctx, from, to, amt) info, err := api.PaychGet(ctx, from, to, types.BigInt(amt))
if err != nil { if err != nil {
return err return err
} }