Skip to content

Commit

Permalink
docs(gnokey): add more info on vm/qfile (#2770)
Browse files Browse the repository at this point in the history
<!-- please provide a detailed description of the changes made in this
pull request. -->

## Description

This PR adds more info for the `vm/qfile` query.

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
- [x] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
  • Loading branch information
leohhhn committed Sep 9, 2024
1 parent 9396400 commit 68b8f54
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions docs/gno-tooling/cli/gnokey/querying-a-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Below is a list of queries a user can make with `gnokey`:
- `auth/accounts/{ADDRESS}` - returns information about an account
- `bank/balances/{ADDRESS}` - returns balances of an account
- `vm/qfuncs` - returns the exported functions for a given pkgpath
- `vm/qfile` - returns the list of files for a given pkgpath
- `vm/qfile` - returns package contents for a given pkgpath
- `vm/qeval` - evaluates an expression in read-only mode on and returns the results
- `vm/qrender` - shorthand for evaluating `vm/qeval Render("")` for a given pkgpath

Expand Down Expand Up @@ -124,14 +124,16 @@ data: [

## `vm/qfile`

With the `vm/qfile` query, we can fetch files found on a specific package path.
To specify the path we want to query, we can use the `-data` flag:
With the `vm/qfile` query, we can fetch files and their content found on a
specific package path. To specify the path we want to query, we can use the
`-data` flag:

```bash
gnokey query vm/qfile -data "gno.land/r/demo/wugnot" -remote https://rpc.gno.land:443
```

The output is a list of all files found within the `wugnot` realm:
If the `-data` field contains only the package path, the output is a list of all
files found within the `wugnot` realm:

```bash
height: 0
Expand All @@ -140,6 +142,40 @@ wugnot.gno
z0_filetest.gno
```

If the `-data` field also specifies a file name after the path, the source code
of the file will be retrieved:

```bash
gnokey query vm/qfile -data "gno.land/r/demo/wugnot/wugnot.gno" -remote https://rpc.gno.land:443
```

Output:
```bash
height: 0
data: package wugnot

import (
"std"
"strings"

"gno.land/p/demo/grc/grc20"
"gno.land/p/demo/ufmt"
pusers "gno.land/p/demo/users"
"gno.land/r/demo/users"
)

var (
banker *grc20.Banker = grc20.NewBanker("wrapped GNOT", "wugnot", 0)
Token = banker.Token()
)

const (
ugnotMinDeposit uint64 = 1000
wugnotMinDeposit uint64 = 1
)
...
```

## `vm/qeval`

`vm/qeval` allows us to evaluate a call to an exported function without using gas,
Expand Down

0 comments on commit 68b8f54

Please sign in to comment.