Skip to content

Commit

Permalink
Merge branch 'master' into feat/contribs-gnobro
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton authored Aug 22, 2024
2 parents d7af192 + e60e4ca commit 0a12aca
Show file tree
Hide file tree
Showing 12 changed files with 473 additions and 483 deletions.
18 changes: 9 additions & 9 deletions contribs/gnodev/pkg/dev/node_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

emitter "github.com/gnolang/gno/contribs/gnodev/internal/mock"
"github.com/gnolang/gno/contribs/gnodev/pkg/events"
"github.com/gnolang/gno/gno.land/pkg/gnoclient"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -87,10 +87,10 @@ func TestSaveCurrentState(t *testing.T) {
require.NoError(t, err)

// Send a new tx
msg := gnoclient.MsgCall{
PkgPath: testCounterRealm,
FuncName: "Inc",
Args: []string{"10"},
msg := vm.MsgCall{
PkgPath: testCounterRealm,
Func: "Inc",
Args: []string{"10"},
}

res, err := testingCallRealm(t, node, msg)
Expand Down Expand Up @@ -169,10 +169,10 @@ func Render(_ string) string { return strconv.Itoa(value) }
for i := 0; i < inc; i++ {
t.Logf("call %d", i)
// Craft `Inc` msg
msg := gnoclient.MsgCall{
PkgPath: testCounterRealm,
FuncName: "Inc",
Args: []string{"1"},
msg := vm.MsgCall{
PkgPath: testCounterRealm,
Func: "Inc",
Args: []string{"1"},
}

res, err := testingCallRealm(t, node, msg)
Expand Down
23 changes: 16 additions & 7 deletions contribs/gnodev/pkg/dev/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/gnolang/gno/gno.land/pkg/gnoclient"
"github.com/gnolang/gno/gno.land/pkg/gnoland/ugnot"
"github.com/gnolang/gno/gno.land/pkg/integration"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/gnovm/pkg/gnoenv"
core_types "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
"github.com/gnolang/gno/tm2/pkg/crypto"
Expand Down Expand Up @@ -190,11 +191,11 @@ func Render(_ string) string { return str }
require.Equal(t, render, "foo")

// Call `UpdateStr` to update `str` value with "bar"
msg := gnoclient.MsgCall{
PkgPath: "gno.land/r/dev/foo",
FuncName: "UpdateStr",
Args: []string{"bar"},
Send: "",
msg := vm.MsgCall{
PkgPath: "gno.land/r/dev/foo",
Func: "UpdateStr",
Args: []string{"bar"},
Send: nil,
}
res, err := testingCallRealm(t, node, msg)
require.NoError(t, err)
Expand Down Expand Up @@ -237,7 +238,7 @@ func testingRenderRealm(t *testing.T, node *Node, rlmpath string) (string, error
return render, err
}

func testingCallRealm(t *testing.T, node *Node, msgs ...gnoclient.MsgCall) (*core_types.ResultBroadcastTxCommit, error) {
func testingCallRealm(t *testing.T, node *Node, msgs ...vm.MsgCall) (*core_types.ResultBroadcastTxCommit, error) {
t.Helper()

signer := newInMemorySigner(t, node.Config().ChainID())
Expand All @@ -251,7 +252,15 @@ func testingCallRealm(t *testing.T, node *Node, msgs ...gnoclient.MsgCall) (*cor
GasWanted: 2_000_000, // Gas wanted
}

return cli.Call(txcfg, msgs...)
// Set Caller in the msgs
caller, err := signer.Info()
require.NoError(t, err)
vmMsgs := make([]vm.MsgCall, 0, len(msgs))
for _, msg := range msgs {
vmMsgs = append(vmMsgs, vm.NewMsgCall(caller.GetAddress(), msg.Send, msg.PkgPath, msg.Func, msg.Args))
}

return cli.Call(txcfg, vmMsgs...)
}

func generateTestingPackage(t *testing.T, nameFile ...string) PackagePath {
Expand Down
20 changes: 15 additions & 5 deletions docs/how-to-guides/connecting-from-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,21 @@ message type. We will use the wrapped ugnot realm for this example, wrapping
`1000000ugnot` (1 $GNOT) for demonstration purposes.

```go
msg := gnoclient.MsgCall{
PkgPath: "gno.land/r/demo/wugnot", // wrapped ugnot realm path
FuncName: "Deposit", // function to call
Args: nil, // arguments in string format
Send: "1000000ugnot", // coins to send along with transaction
import (
...
"github.com/gnolang/gno/gno.land/pkg/gnoland/ugnot"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
)
```

```go
msg := vm.MsgCall{
Caller: addr, // address of the caller (signer)
PkgPath: "gno.land/r/demo/wugnot", // wrapped ugnot realm path
Func: "Deposit", // function to call
Args: nil, // arguments in string format
Send: std.Coins{{Denom: ugnot.Denom, Amount: int64(1000000)}}, // coins to send along with transaction
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/network-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ id: network-config
| Portal Loop | https://rpc.gno.land:443 | `portal-loop` |
| Test4 | https://rpc.test4.gno.land:443 | `test4` |
| Test3 | https://rpc.test3.gno.land:443 | `test3` |
| Staging | http://rpc.staging.gno.land:36657 | `staging` |
| Staging | https://rpc.staging.gno.land:443 | `staging` |

### WebSocket endpoints
All networks follow the same pattern for websocket connections:
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/art/millipede/millipede.gno
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func Render(path string) string {

output := "```\n" + Draw(size) + "```\n"
if size > minSize {
output += ufmt.Sprintf("[%d](/r/demo/art/millpede:%d)< ", size-1, size-1)
output += ufmt.Sprintf("[%d](/r/demo/art/millipede:%d)< ", size-1, size-1)
}
if size < maxSize {
output += ufmt.Sprintf(" >[%d](/r/demo/art/millipede:%d)", size+1, size+1)
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/art/millipede/millipede_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestRender(t *testing.T) {
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
` + "```\n[19](/r/demo/art/millpede:19)< >[21](/r/demo/art/millipede:21)",
` + "```\n[19](/r/demo/art/millipede:19)< >[21](/r/demo/art/millipede:21)",
},
{
path: "4",
Expand All @@ -45,7 +45,7 @@ func TestRender(t *testing.T) {
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
` + "```\n[3](/r/demo/art/millpede:3)< >[5](/r/demo/art/millipede:5)",
` + "```\n[3](/r/demo/art/millipede:3)< >[5](/r/demo/art/millipede:5)",
},
}

Expand Down
Loading

0 comments on commit 0a12aca

Please sign in to comment.