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

chore(docs): fix example rpcclient.NewHTTPClient returning variables #2352

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

Molaryy
Copy link
Contributor

@Molaryy Molaryy commented Jun 13, 2024

In the how to connect a Go app to Gno.land tutorial I got an error when I tried to run this line:

rpc := rpcclient.NewHTTPClient("<gno_chain_endpoint>")

It seems that NewHTTPClient returns 2 values

func NewHTTPClient(rpcURL string) (*RPCClient, error);

and in the example we assign only one variable.

I updated the examples with:

rpc, err := rpcclient.NewHTTPClient("<gno.land_remote_endpoint>")
if err != nil {
    panic(err)
}

There is also a step where crypto.AddressFromBech32 is used but I didn't found when the crypto was imported so I also added it in the doc:

import (
    ...
    crypto "github.com/gnolang/gno/tm2/pkg/crypto"
)

@linhpn99
Copy link
Contributor

linhpn99 commented Jun 13, 2024

nitpick :

import (
	rpcclient "github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
)

rpc, err := rpcclient.NewHTTPClient("<gno.land_remote_endpoint>")
if err != nil {
    panic(err)
}

Why don't you also import this one, similar to the crypto library below ?

@Molaryy
Copy link
Contributor Author

Molaryy commented Jun 13, 2024

nitpick :

import (
	rpcclient "github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
)

rpc, err := rpcclient.NewHTTPClient("<gno.land_remote_endpoint>")
if err != nil {
    panic(err)
}

Why don't you also import this one, similar to the crypto library below ?

The import rpcclient is just below the code example in the docs. Or did you mean adding the import before and not after the code example?

@linhpn99
Copy link
Contributor

nitpick :

import (
	rpcclient "github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
)

rpc, err := rpcclient.NewHTTPClient("<gno.land_remote_endpoint>")
if err != nil {
    panic(err)
}

Why don't you also import this one, similar to the crypto library below ?

The import rpcclient is just below the code example in the docs. Or did you mean adding the import before and not after the code example?

I just checked the docs link, and it seems the path has already been imported below as you mentioned

@Kouteki Kouteki added the 🐞 bug Something isn't working label Jun 14, 2024
@Kouteki Kouteki requested a review from leohhhn June 14, 2024 09:43
@thehowl thehowl merged commit 028a4ed into gnolang:master Jun 19, 2024
3 checks passed
gfanton pushed a commit to gfanton/gno that referenced this pull request Jul 23, 2024
…nolang#2352)

In the [how to connect a Go app to
Gno.land](https://docs.gno.land/how-to-guides/connect-from-go) tutorial
I got an error when I tried to run this line:

```go
rpc := rpcclient.NewHTTPClient("<gno_chain_endpoint>")
```

It seems that NewHTTPClient returns 2 values
```go
func NewHTTPClient(rpcURL string) (*RPCClient, error);
``` 
and in the example we assign only one variable.

I updated the examples with:
```go
rpc, err := rpcclient.NewHTTPClient("<gno.land_remote_endpoint>")
if err != nil {
    panic(err)
}
```

There is also a step where `crypto.AddressFromBech32` is used but I
didn't found when the `crypto` was imported so I also added it in the
doc:

```go
import (
    ...
    crypto "github.com/gnolang/gno/tm2/pkg/crypto"
)
```

---------

Co-authored-by: Morgan <git@howl.moe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants