Skip to content

Commit 0f67d35

Browse files
authored
chore(gnoblog-cli): bump gnoclient version, match new API (#113)
1 parent a0fa77d commit 0f67d35

File tree

4 files changed

+127
-58
lines changed

4 files changed

+127
-58
lines changed

cmd/gnoblog-cli/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package main
22

33
import (
44
"context"
5-
"github.com/gnolang/gno/tm2/pkg/commands"
65
"os"
6+
7+
"github.com/gnolang/gno/tm2/pkg/commands"
78
)
89

910
func main() {

cmd/gnoblog-cli/post.go

+36-29
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import (
44
"context"
55
"flag"
66
"fmt"
7-
"github.com/adrg/frontmatter"
8-
"github.com/gnolang/gno/tm2/pkg/commands"
97
"io"
108
"log/slog"
119
"os"
1210
"strings"
1311
"time"
1412

13+
"github.com/adrg/frontmatter"
1514
"github.com/gnolang/gno/gno.land/pkg/gnoclient"
15+
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
1616
"github.com/gnolang/gno/gnovm/pkg/gnoenv"
17+
"github.com/gnolang/gno/tm2/pkg/commands"
1718
)
1819

1920
type cliCfg struct {
@@ -178,7 +179,32 @@ func execPost(io commands.IO, args []string, cfg *cliCfg) error {
178179
}
179180

180181
func post(c gnoclient.Client, cfg *cliCfg, paths ...string) error {
181-
msgs := make([]gnoclient.MsgCall, 0, len(paths))
182+
msgs := make([]vm.MsgCall, 0, len(paths))
183+
184+
// Get account info
185+
account, err := c.Signer.Info()
186+
if err != nil {
187+
return fmt.Errorf("getting signer info failed: %w", err)
188+
}
189+
190+
address := account.GetAddress()
191+
192+
signingAcc, _, err := c.QueryAccount(address)
193+
if err != nil {
194+
return fmt.Errorf("query account %q failed: %w", account, err)
195+
}
196+
197+
nonce := signingAcc.GetSequence()
198+
accNumber := signingAcc.GetAccountNumber()
199+
200+
// Set up base config
201+
baseTxCfg := gnoclient.BaseTxCfg{
202+
GasFee: cfg.GasFee,
203+
GasWanted: cfg.GasWanted,
204+
AccountNumber: accNumber,
205+
SequenceNumber: nonce,
206+
Memo: "Posted from gnoblog-cli",
207+
}
182208

183209
// Save title for printing to cli
184210
var postTitle string
@@ -220,10 +246,11 @@ func post(c gnoclient.Client, cfg *cliCfg, paths ...string) error {
220246
continue
221247
}
222248

223-
// Pack calls to the chain
224-
callCfg := gnoclient.MsgCall{
225-
PkgPath: cfg.BlogRealmPath,
226-
FuncName: verb,
249+
callMsg := vm.MsgCall{
250+
Caller: address,
251+
Send: nil,
252+
PkgPath: cfg.BlogRealmPath,
253+
Func: verb,
227254
Args: []string{
228255
post.Slug,
229256
post.Title,
@@ -233,35 +260,15 @@ func post(c gnoclient.Client, cfg *cliCfg, paths ...string) error {
233260
strings.Join(post.Tags, ","),
234261
},
235262
}
236-
msgs = append(msgs, callCfg)
263+
264+
msgs = append(msgs, callMsg)
237265
postTitle = post.Title
238266
}
239267

240268
if len(msgs) == 0 {
241269
return fmt.Errorf("%w, exiting", ErrNoNewOrChangedPosts)
242270
}
243271

244-
account, err := c.Signer.Info()
245-
if err != nil {
246-
return fmt.Errorf("getting signer info failed: %w", err)
247-
}
248-
249-
signingAcc, _, err := c.QueryAccount(account.GetAddress())
250-
if err != nil {
251-
return fmt.Errorf("query account %q failed: %w", account, err)
252-
}
253-
254-
nonce := signingAcc.GetSequence()
255-
accNumber := signingAcc.GetAccountNumber()
256-
257-
baseTxCfg := gnoclient.BaseTxCfg{
258-
GasFee: cfg.GasFee,
259-
GasWanted: cfg.GasWanted,
260-
AccountNumber: accNumber,
261-
SequenceNumber: nonce,
262-
Memo: "Posted from gnoblog-cli",
263-
}
264-
265272
_, err = c.Call(baseTxCfg, msgs...)
266273
if err != nil {
267274
return err

go.mod

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
module github.com/gnolang/blog
22

3-
go 1.22
3+
go 1.22.0
44

5-
toolchain go1.22.3
5+
toolchain go1.23.3
66

77
require (
88
github.com/adrg/frontmatter v0.2.0
9-
github.com/gnolang/gno v0.1.1
9+
github.com/gnolang/gno v0.2.0
1010
github.com/stretchr/testify v1.9.0
1111
)
1212

1313
require (
14-
github.com/BurntSushi/toml v0.3.1 // indirect
15-
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
16-
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
14+
github.com/BurntSushi/toml v1.4.0 // indirect
15+
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
16+
github.com/btcsuite/btcd/btcutil v1.1.6 // indirect
1717
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
1818
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
1919
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
@@ -25,36 +25,36 @@ require (
2525
github.com/golang/protobuf v1.5.4 // indirect
2626
github.com/golang/snappy v0.0.4 // indirect
2727
github.com/google/uuid v1.6.0 // indirect
28-
github.com/gorilla/websocket v1.5.1 // indirect
29-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
28+
github.com/gorilla/websocket v1.5.3 // indirect
29+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect
3030
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
3131
github.com/peterbourgon/ff/v3 v3.4.0 // indirect
3232
github.com/pkg/errors v0.9.1 // indirect
3333
github.com/pmezard/go-difflib v1.0.0 // indirect
34-
github.com/rs/xid v1.5.0 // indirect
34+
github.com/rs/xid v1.6.0 // indirect
3535
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
3636
github.com/zondax/hid v0.9.2 // indirect
37-
github.com/zondax/ledger-go v0.14.3 // indirect
38-
go.opentelemetry.io/otel v1.28.0 // indirect
39-
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect
40-
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 // indirect
41-
go.opentelemetry.io/otel/metric v1.28.0 // indirect
42-
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
43-
go.opentelemetry.io/otel/sdk/metric v1.28.0 // indirect
44-
go.opentelemetry.io/otel/trace v1.28.0 // indirect
37+
github.com/zondax/ledger-go v1.0.0 // indirect
38+
go.opentelemetry.io/otel v1.31.0 // indirect
39+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.31.0 // indirect
40+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.31.0 // indirect
41+
go.opentelemetry.io/otel/metric v1.31.0 // indirect
42+
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
43+
go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect
44+
go.opentelemetry.io/otel/trace v1.31.0 // indirect
4545
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
4646
go.uber.org/multierr v1.11.0 // indirect
47-
golang.org/x/crypto v0.25.0 // indirect
48-
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
49-
golang.org/x/mod v0.19.0 // indirect
50-
golang.org/x/net v0.27.0 // indirect
51-
golang.org/x/sys v0.22.0 // indirect
52-
golang.org/x/term v0.22.0 // indirect
53-
golang.org/x/text v0.16.0 // indirect
54-
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect
55-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
56-
google.golang.org/grpc v1.65.0 // indirect
57-
google.golang.org/protobuf v1.34.2 // indirect
47+
golang.org/x/crypto v0.28.0 // indirect
48+
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
49+
golang.org/x/mod v0.21.0 // indirect
50+
golang.org/x/net v0.30.0 // indirect
51+
golang.org/x/sys v0.26.0 // indirect
52+
golang.org/x/term v0.25.0 // indirect
53+
golang.org/x/text v0.19.0 // indirect
54+
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
55+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
56+
google.golang.org/grpc v1.67.1 // indirect
57+
google.golang.org/protobuf v1.35.1 // indirect
5858
gopkg.in/yaml.v2 v2.4.0 // indirect
5959
gopkg.in/yaml.v3 v3.0.1 // indirect
6060
)

0 commit comments

Comments
 (0)