From 48e47ddc23f7330c92304b3c69140338859ecaf6 Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Fri, 11 Sep 2020 15:52:09 -0700 Subject: [PATCH 1/3] fix(paych): fix paych status command line --- api/api_full.go | 4 ++-- api/apistruct/struct.go | 12 ++++++------ cli/paych.go | 6 ++++-- markets/retrievaladapter/client.go | 2 +- node/impl/paych/paych.go | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/api/api_full.go b/api/api_full.go index 23226443a..cbf05b363 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -452,8 +452,8 @@ type FullNode interface { PaychGet(ctx context.Context, from, to address.Address, amt types.BigInt) (*ChannelInfo, error) PaychGetWaitReady(context.Context, cid.Cid) (address.Address, error) - PaychAvailableFunds(ch address.Address) (*ChannelAvailableFunds, error) - PaychAvailableFundsByFromTo(from, to address.Address) (*ChannelAvailableFunds, error) + PaychAvailableFunds(ctx context.Context, ch address.Address) (*ChannelAvailableFunds, error) + PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*ChannelAvailableFunds, error) PaychList(context.Context) ([]address.Address, error) PaychStatus(context.Context, address.Address) (*PaychStatus, error) PaychSettle(context.Context, address.Address) (cid.Cid, error) diff --git a/api/apistruct/struct.go b/api/apistruct/struct.go index fdb9843ff..53c8414ba 100644 --- a/api/apistruct/struct.go +++ b/api/apistruct/struct.go @@ -219,8 +219,8 @@ type FullNodeStruct struct { PaychGet func(ctx context.Context, from, to address.Address, amt types.BigInt) (*api.ChannelInfo, error) `perm:"sign"` PaychGetWaitReady func(context.Context, cid.Cid) (address.Address, error) `perm:"sign"` - PaychAvailableFunds func(address.Address) (*api.ChannelAvailableFunds, error) `perm:"sign"` - PaychAvailableFundsByFromTo func(address.Address, address.Address) (*api.ChannelAvailableFunds, error) `perm:"sign"` + PaychAvailableFunds func(context.Context, address.Address) (*api.ChannelAvailableFunds, error) `perm:"sign"` + PaychAvailableFundsByFromTo func(context.Context, address.Address, address.Address) (*api.ChannelAvailableFunds, error) `perm:"sign"` PaychList func(context.Context) ([]address.Address, error) `perm:"read"` PaychStatus func(context.Context, address.Address) (*api.PaychStatus, error) `perm:"read"` PaychSettle func(context.Context, address.Address) (cid.Cid, error) `perm:"sign"` @@ -944,12 +944,12 @@ func (c *FullNodeStruct) PaychGetWaitReady(ctx context.Context, sentinel cid.Cid return c.Internal.PaychGetWaitReady(ctx, sentinel) } -func (c *FullNodeStruct) PaychAvailableFunds(ch address.Address) (*api.ChannelAvailableFunds, error) { - return c.Internal.PaychAvailableFunds(ch) +func (c *FullNodeStruct) PaychAvailableFunds(ctx context.Context, ch address.Address) (*api.ChannelAvailableFunds, error) { + return c.Internal.PaychAvailableFunds(ctx, ch) } -func (c *FullNodeStruct) PaychAvailableFundsByFromTo(from, to address.Address) (*api.ChannelAvailableFunds, error) { - return c.Internal.PaychAvailableFundsByFromTo(from, to) +func (c *FullNodeStruct) PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*api.ChannelAvailableFunds, error) { + return c.Internal.PaychAvailableFundsByFromTo(ctx, from, to) } func (c *FullNodeStruct) PaychList(ctx context.Context) ([]address.Address, error) { diff --git a/cli/paych.go b/cli/paych.go index 57fd1c142..12bcb20d7 100644 --- a/cli/paych.go +++ b/cli/paych.go @@ -103,6 +103,7 @@ var paychStatusByFromToCmd = &cli.Command{ if cctx.Args().Len() != 2 { return ShowHelp(cctx, fmt.Errorf("must pass two arguments: ")) } + ctx := ReqContext(cctx) from, err := address.NewFromString(cctx.Args().Get(0)) if err != nil { @@ -120,7 +121,7 @@ var paychStatusByFromToCmd = &cli.Command{ } defer closer() - avail, err := api.PaychAvailableFundsByFromTo(from, to) + avail, err := api.PaychAvailableFundsByFromTo(ctx, from, to) if err != nil { return err } @@ -138,6 +139,7 @@ var paychStatusCmd = &cli.Command{ if cctx.Args().Len() != 1 { return ShowHelp(cctx, fmt.Errorf("must pass an argument: ")) } + ctx := ReqContext(cctx) ch, err := address.NewFromString(cctx.Args().Get(0)) if err != nil { @@ -150,7 +152,7 @@ var paychStatusCmd = &cli.Command{ } defer closer() - avail, err := api.PaychAvailableFunds(ch) + avail, err := api.PaychAvailableFunds(ctx, ch) if err != nil { return err } diff --git a/markets/retrievaladapter/client.go b/markets/retrievaladapter/client.go index 17c56c167..ab81dd8c9 100644 --- a/markets/retrievaladapter/client.go +++ b/markets/retrievaladapter/client.go @@ -80,7 +80,7 @@ func (rcn *retrievalClientNode) WaitForPaymentChannelReady(ctx context.Context, func (rcn *retrievalClientNode) CheckAvailableFunds(ctx context.Context, paymentChannel address.Address) (retrievalmarket.ChannelAvailableFunds, error) { - channelAvailableFunds, err := rcn.payAPI.PaychAvailableFunds(paymentChannel) + channelAvailableFunds, err := rcn.payAPI.PaychAvailableFunds(ctx, paymentChannel) if err != nil { return retrievalmarket.ChannelAvailableFunds{}, err } diff --git a/node/impl/paych/paych.go b/node/impl/paych/paych.go index 84c2cc030..94fcc320d 100644 --- a/node/impl/paych/paych.go +++ b/node/impl/paych/paych.go @@ -39,11 +39,11 @@ func (a *PaychAPI) PaychGet(ctx context.Context, from, to address.Address, amt t }, nil } -func (a *PaychAPI) PaychAvailableFunds(ch address.Address) (*api.ChannelAvailableFunds, error) { +func (a *PaychAPI) PaychAvailableFunds(ctx context.Context, ch address.Address) (*api.ChannelAvailableFunds, error) { return a.PaychMgr.AvailableFunds(ch) } -func (a *PaychAPI) PaychAvailableFundsByFromTo(from, to address.Address) (*api.ChannelAvailableFunds, error) { +func (a *PaychAPI) PaychAvailableFundsByFromTo(ctx context.Context, from, to address.Address) (*api.ChannelAvailableFunds, error) { return a.PaychMgr.AvailableFundsByFromTo(from, to) } From ac8ef29d351b61d5d6cedcb8156aabb8d14c44f6 Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Fri, 11 Sep 2020 15:53:11 -0700 Subject: [PATCH 2/3] fix(paych): add paych status from to cmd add missing from to status to list --- cli/paych.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/paych.go b/cli/paych.go index 12bcb20d7..dc5b54c4a 100644 --- a/cli/paych.go +++ b/cli/paych.go @@ -29,6 +29,7 @@ var paychCmd = &cli.Command{ paychVoucherCmd, paychSettleCmd, paychStatusCmd, + paychStatusByFromToCmd, paychCloseCmd, }, } From 17e44af542404b9ffa6a7ca3a346beb1c2c98f6b Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Mon, 14 Sep 2020 18:44:45 -0700 Subject: [PATCH 3/3] docs(api): fix api docs --- documentation/en/api-methods.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/documentation/en/api-methods.md b/documentation/en/api-methods.md index 27875eca1..d72beca98 100644 --- a/documentation/en/api-methods.md +++ b/documentation/en/api-methods.md @@ -2375,7 +2375,12 @@ There are not yet any comments for this method. Perms: sign -Inputs: `null` +Inputs: +```json +[ + "t01234" +] +``` Response: ```json @@ -2399,6 +2404,7 @@ Perms: sign Inputs: ```json [ + "t01234", "t01234" ] ```