Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: move tm2/keys/client into gno.land/pkg/keyscli #1438

Closed
wants to merge 10 commits into from
4 changes: 2 additions & 2 deletions contribs/gnokeykc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"fmt"
"os"

"github.com/gnolang/gno/gno.land/pkg/keyscli"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto/keys/client"
"github.com/zalando/go-keyring"
)

func main() {
stdio := commands.NewDefaultIO()
wrappedio := &wrappedIO{IO: stdio}
cmd := client.NewRootCmd(wrappedio)
cmd := keyscli.NewRootCmd(wrappedio)
cmd.AddSubCommands(newKcCmd(stdio))

if err := cmd.ParseAndRun(context.Background(), os.Args[1:]); err != nil {
Expand Down
5 changes: 2 additions & 3 deletions gno.land/cmd/genesis/validator_add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"context"
"testing"

"github.com/gnolang/gno/gno.land/pkg/keyscli"
"github.com/gnolang/gno/tm2/pkg/bft/types"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto"
"github.com/gnolang/gno/tm2/pkg/crypto/bip39"
"github.com/gnolang/gno/tm2/pkg/crypto/hd"
"github.com/gnolang/gno/tm2/pkg/crypto/keys/client"
"github.com/gnolang/gno/tm2/pkg/crypto/secp256k1"
"github.com/gnolang/gno/tm2/pkg/testutils"
"github.com/stretchr/testify/assert"
Expand All @@ -21,11 +21,10 @@ import (
func getDummyKey(t *testing.T) crypto.PubKey {
t.Helper()

mnemonic, err := client.GenerateMnemonic(256)
mnemonic, err := keyscli.GenerateMnemonic(256)
require.NoError(t, err)

seed := bip39.NewSeed(mnemonic, "")

return generateKeyFromSeed(seed, 0).PubKey()
}

Expand Down
10 changes: 5 additions & 5 deletions gno.land/cmd/gnofaucet/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"time"

"github.com/gnolang/gno/gno.land/pkg/gnoland"
keyscli "github.com/gnolang/gno/gno.land/pkg/keyscli"
"github.com/gnolang/gno/tm2/pkg/amino"
rpcclient "github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/crypto/keys/client"
"github.com/gnolang/gno/tm2/pkg/errors"
"github.com/gnolang/gno/tm2/pkg/sdk/bank"
"github.com/gnolang/gno/tm2/pkg/std"
Expand All @@ -35,7 +35,7 @@ type SiteVerifyResponse struct {
}

type config struct {
client.BaseOptions // home, ...
keyscli.BaseOptions // home, ...

ChainID string
GasWanted int64
Expand Down Expand Up @@ -69,21 +69,21 @@ func (c *config) RegisterFlags(fs *flag.FlagSet) {
fs.StringVar(
&c.BaseOptions.Home,
"home",
client.DefaultBaseOptions.Home,
keyscli.DefaultBaseOptions.Home,
"home directory",
)

fs.StringVar(
&c.BaseOptions.Remote,
"remote",
client.DefaultBaseOptions.Remote,
keyscli.DefaultBaseOptions.Remote,
"remote node URL",
)

fs.BoolVar(
&c.BaseOptions.Quiet,
"quiet",
client.DefaultBaseOptions.Quiet,
keyscli.DefaultBaseOptions.Quiet,
"for parsing output",
)

Expand Down
6 changes: 3 additions & 3 deletions gno.land/cmd/gnokey/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"fmt"
"os"

"github.com/gnolang/gno/gno.land/pkg/keyscli"
"github.com/gnolang/gno/gnovm/pkg/gnoenv"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto/keys/client"
)

func main() {
baseCfg := client.BaseOptions{
baseCfg := keyscli.BaseOptions{

Check warning on line 14 in gno.land/cmd/gnokey/main.go

View check run for this annotation

Codecov / codecov/patch

gno.land/cmd/gnokey/main.go#L14

Added line #L14 was not covered by tests
Home: gnoenv.HomeDir(),
Remote: "127.0.0.1:26657",
}

cmd := client.NewRootCmdWithBaseConfig(commands.NewDefaultIO(), baseCfg)
cmd := keyscli.NewRootCmdWithBaseConfig(commands.NewDefaultIO(), baseCfg)

Check warning on line 19 in gno.land/cmd/gnokey/main.go

View check run for this annotation

Codecov / codecov/patch

gno.land/cmd/gnokey/main.go#L19

Added line #L19 was not covered by tests
if err := cmd.ParseAndRun(context.Background(), os.Args[1:]); err != nil {
_, _ = fmt.Fprintf(os.Stderr, "%+v\n", err)

Expand Down
4 changes: 2 additions & 2 deletions gno.land/pkg/integration/testing_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"strings"
"testing"

"github.com/gnolang/gno/gno.land/pkg/keyscli"
"github.com/gnolang/gno/gnovm/pkg/gnoenv"
"github.com/gnolang/gno/tm2/pkg/bft/node"
"github.com/gnolang/gno/tm2/pkg/commands"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/crypto/keys/client"
"github.com/gnolang/gno/tm2/pkg/log"
"github.com/rogpeppe/go-internal/testscript"
)
Expand Down Expand Up @@ -181,7 +181,7 @@ func setupGnolandTestScript(t *testing.T, txtarDir string) testscript.Params {
io := commands.NewTestIO()
io.SetOut(commands.WriteNopCloser(ts.Stdout()))
io.SetErr(commands.WriteNopCloser(ts.Stderr()))
cmd := client.NewRootCmd(io)
cmd := keyscli.NewRootCmd(io)

io.SetIn(strings.NewReader("\n")) // Inject empty password to stdin.
defaultArgs := []string{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

// TODO: move most of the logic in ROOT/gno.land/...

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

type BaseOptions struct {
Home string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"strings"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"strings"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import "github.com/gnolang/gno/tm2/pkg/crypto/bip39"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"flag"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Dedicated to my love, Lexi.
package client
package keyscli

import (
"flag"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package client
package keyscli

import (
"encoding/hex"
Expand Down
11 changes: 11 additions & 0 deletions tm2/pkg/crypto/keys/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# keys/client (Deprecated)

## Deprecation Notice

The `keys/client` package has been deprecated. The functionality that was previously offered by this package is now available in `gno.land/pkg/keycli`. This change has been made to streamline the project structure and enhance maintainability.

For more details on this transition, please refer to the following resources:
- **Issue Discussion**: [Issue #1174](https://github.com/gnolang/gno/issues/1174)
- **Pull Request**: [PR #1438](https://github.com/gnolang/gno/pull/1438)

If you are still using this `client` package, it is recommended to migrate your code to use `gno.land/pkg/keycli` instead.
2 changes: 2 additions & 0 deletions tm2/pkg/crypto/keys/client/deprecated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Deprecated: Please use 'gno.land/pkg/keycli'
package client
Loading