Skip to content

Commit

Permalink
chore: bump api to v0.0.56 with updated client options
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Mar 7, 2024
1 parent 33c8b30 commit 0a88e49
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
11 changes: 7 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"fmt"
"reflect"

"github.com/spf13/pflag"
"golang.org/x/net/context"

sdkclient "github.com/cosmos/cosmos-sdk/client"

aclient "github.com/akash-network/akash-api/go/node/client"
cltypes "github.com/akash-network/akash-api/go/node/client/types"
"github.com/akash-network/akash-api/go/node/client/v1beta2"
)

Expand All @@ -37,17 +37,20 @@ func DiscoverQueryClient(ctx context.Context, cctx sdkclient.Context) (v1beta2.Q
return cl, nil
}

func DiscoverClient(ctx context.Context, cctx sdkclient.Context, flags *pflag.FlagSet) (v1beta2.Client, error) {
func DiscoverClient(ctx context.Context, cctx sdkclient.Context, opts ...cltypes.ClientOption) (v1beta2.Client, error) {
var cl v1beta2.Client
err := aclient.DiscoverClient(ctx, cctx, flags, func(i interface{}) error {

setupFn := func(i interface{}) error {
var valid bool

if cl, valid = i.(v1beta2.Client); !valid {
return fmt.Errorf("%w: expected %s, actual %s", ErrInvalidClient, reflect.TypeOf(cl), reflect.TypeOf(i))
}

return nil
})
}

err := aclient.DiscoverClient(ctx, cctx, setupFn, opts...)

if err != nil {
return nil, err
Expand Down
9 changes: 8 additions & 1 deletion cmd/provider-services/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"
"time"

cltypes "github.com/akash-network/akash-api/go/node/client/types"
sdkclient "github.com/cosmos/cosmos-sdk/client"
"github.com/pkg/errors"
"github.com/shopspring/decimal"
Expand Down Expand Up @@ -542,7 +543,13 @@ func doRunCmd(ctx context.Context, cmd *cobra.Command, _ []string) error {
}

cctx = cctx.WithSkipConfirmation(true)
cl, err := client.DiscoverClient(ctx, cctx, cmd.Flags())

opts, err := cltypes.ClientOptionsFromFlags(cmd.Flags())
if err != nil {
return err
}

cl, err := client.DiscoverClient(ctx, cctx, opts...)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/akash-network/provider
go 1.21

require (
github.com/akash-network/akash-api v0.0.55
github.com/akash-network/akash-api v0.0.56
github.com/akash-network/node v0.30.3
github.com/avast/retry-go/v4 v4.5.0
github.com/blang/semver/v4 v4.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/akash-network/akash-api v0.0.55 h1:koRFImeVbEggkWGEQ97U+qHuryQ/LRDg5yHqnGmMXcg=
github.com/akash-network/akash-api v0.0.55/go.mod h1:pNr61L4+0sheol7ZK0HjgK3rxpIAbYBGq1w1oH4B0+M=
github.com/akash-network/akash-api v0.0.56 h1:dUiDR7DXeMXgh9xyxCik4gznTsjSJhi8Pq3iPcZoqSc=
github.com/akash-network/akash-api v0.0.56/go.mod h1:pNr61L4+0sheol7ZK0HjgK3rxpIAbYBGq1w1oH4B0+M=
github.com/akash-network/cometbft v0.34.27-akash h1:V1dApDOr8Ee7BJzYyQ7Z9VBtrAul4+baMeA6C49dje0=
github.com/akash-network/cometbft v0.34.27-akash/go.mod h1:BcCbhKv7ieM0KEddnYXvQZR+pZykTKReJJYf7YC7qhw=
github.com/akash-network/ledger-go v0.14.3 h1:LCEFkTfgGA2xFMN2CtiKvXKE7dh0QSM77PJHCpSkaAo=
Expand Down

0 comments on commit 0a88e49

Please sign in to comment.