Skip to content

Commit

Permalink
Merge pull request #4 from astriaorg/joroshiba/use-buf
Browse files Browse the repository at this point in the history
use buf protos
  • Loading branch information
joroshiba authored Dec 1, 2023
2 parents f5b28bb + eda33a2 commit 0df599d
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 1,055 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ func main() {
}
```

### Generating Go files from protos

```sh
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
protoc -I=. --go_out=. query_response.proto types.proto transaction.proto && mv github.com/astriaorg/go-sequencer-client/* proto/ && rm -r github.com/
```

### CLI

```sh
Expand Down
5 changes: 3 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
coretypes "github.com/cometbft/cometbft/rpc/core/types"
proto "google.golang.org/protobuf/proto"

sqproto "github.com/astriaorg/go-sequencer-client/proto"
primproto "buf.build/gen/go/astria/astria/protocolbuffers/go/astria/primitive/v1"
sqproto "buf.build/gen/go/astria/astria/protocolbuffers/go/astria/sequencer/v1alpha1"
)

// Client is an HTTP tendermint client.
Expand Down Expand Up @@ -83,7 +84,7 @@ func (c *Client) GetNonce(ctx context.Context, addr [20]byte) (uint32, error) {
return nonceResp.Nonce, nil
}

func protoU128ToBigInt(u128 *sqproto.Uint128) *big.Int {
func protoU128ToBigInt(u128 *primproto.Uint128) *big.Int {
lo := big.NewInt(0).SetUint64(u128.Lo)
hi := big.NewInt(0).SetUint64(u128.Hi)
hi.Lsh(hi, 64)
Expand Down
6 changes: 3 additions & 3 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/big"
"testing"

sqproto "github.com/astriaorg/go-sequencer-client/proto"
sqproto "buf.build/gen/go/astria/astria/protocolbuffers/go/astria/sequencer/v1alpha1"

"github.com/stretchr/testify/require"
)
Expand All @@ -23,8 +23,8 @@ func TestSignAndBroadcastTx(t *testing.T) {
{
Value: &sqproto.Action_SequenceAction{
SequenceAction: &sqproto.SequenceAction{
ChainId: []byte("test-chain"),
Data: []byte("test-data"),
RollupId: []byte("test-chain"),
Data: []byte("test-data"),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions client/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package client
import (
"crypto/ed25519"
"crypto/sha256"

sqproto "github.com/astriaorg/go-sequencer-client/proto"
proto "google.golang.org/protobuf/proto"

sqproto "buf.build/gen/go/astria/astria/protocolbuffers/go/astria/sequencer/v1alpha1"
)

const DEFAULT_ASTRIA_ASSET = "nria"
Expand Down
8 changes: 7 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ module github.com/astriaorg/go-sequencer-client
go 1.20

require (
buf.build/gen/go/astria/astria/protocolbuffers/go v1.31.0-20231130012811-2fd7e6d46ebd.2
github.com/cometbft/cometbft v0.37.0
github.com/stretchr/testify v1.8.1
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
google.golang.org/protobuf v1.31.0
)

require (
buf.build/gen/go/cosmos/cosmos-proto/protocolbuffers/go v1.31.0-20211202220400-1935555c206d.2 // indirect
buf.build/gen/go/cosmos/cosmos-sdk/protocolbuffers/go v1.31.0-20230719110346-aa25660f4ff7.2 // indirect
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.31.0-20230509103710-5e5b9fdd0180.2 // indirect
buf.build/gen/go/cosmos/ibc/protocolbuffers/go v1.31.0-20230913112312-7ab44ae956a0.2 // indirect
buf.build/gen/go/penumbra-zone/penumbra/protocolbuffers/go v1.31.0-20231120132728-bc443669626d.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand Down
19 changes: 17 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
buf.build/gen/go/astria/astria/protocolbuffers/go v1.31.0-20231130012811-2fd7e6d46ebd.2 h1:gq4dRHG9GJEh8tkTsFwgrHA+tPiZead6YKRgsaidQJg=
buf.build/gen/go/astria/astria/protocolbuffers/go v1.31.0-20231130012811-2fd7e6d46ebd.2/go.mod h1:OPKBvxqrsHTBen+bbkQT/beHK/aSznSulzR+JeDSUKw=
buf.build/gen/go/cosmos/cosmos-proto/protocolbuffers/go v1.31.0-20211202220400-1935555c206d.2 h1:O+V9Yq7KkauH1cMnUAHxsl5n+b7ZD/RZnHo9ZiJICGg=
buf.build/gen/go/cosmos/cosmos-proto/protocolbuffers/go v1.31.0-20211202220400-1935555c206d.2/go.mod h1:yHKMbegvhfMbDGsQp/q7tECJTfZf0wrgTRcH1glgEQk=
buf.build/gen/go/cosmos/cosmos-sdk/protocolbuffers/go v1.31.0-20230522115704-e7a85cef453e.2/go.mod h1:d16Ahcn3H831Oe+NnNOWuXkV3aTiPOBZvUAZaHYECkU=
buf.build/gen/go/cosmos/cosmos-sdk/protocolbuffers/go v1.31.0-20230719110346-aa25660f4ff7.2 h1:mDJdIdbHw10arzuVIpFoQr6h8cxKPcdT2r91Q2izQu0=
buf.build/gen/go/cosmos/cosmos-sdk/protocolbuffers/go v1.31.0-20230719110346-aa25660f4ff7.2/go.mod h1:vg3BLbBJ3Vl9Wu7GE6BmxYq1+VMU4Yg8cv9YG7qF2AQ=
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.31.0-20221020125208-34d970b699f8.2/go.mod h1:rTzewyj2LANV2IIuGZnKMsvbIEVAguDwBvMdxD1pa3k=
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.31.0-20230509103710-5e5b9fdd0180.2 h1:4JCzFq6Gwr5hx3BpGky420OsrZjdMI8rAB3T7zcsDrs=
buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.31.0-20230509103710-5e5b9fdd0180.2/go.mod h1:rTzewyj2LANV2IIuGZnKMsvbIEVAguDwBvMdxD1pa3k=
buf.build/gen/go/cosmos/ibc/protocolbuffers/go v1.31.0-20230913112312-7ab44ae956a0.2 h1:9LwQA/UwYerRClC/fNzeyynz+AfDenAmyZj5G8HPLmU=
buf.build/gen/go/cosmos/ibc/protocolbuffers/go v1.31.0-20230913112312-7ab44ae956a0.2/go.mod h1:piKWSxT4f990Ium90hWQnNwuqxhsoYxhPtZYcOz2vNs=
buf.build/gen/go/cosmos/ics23/protocolbuffers/go v1.31.0-20221207100654-55085f7c710a.2/go.mod h1:1V7tFOxP2P2x8G0oasO+VqSHN0Bhly5I/e+2vENGomQ=
buf.build/gen/go/penumbra-zone/penumbra/protocolbuffers/go v1.31.0-20231120132728-bc443669626d.2 h1:IOCmnR+xxYcOUdG2fRR6KRAkATFKMJYE1Z5zVV1Pphg=
buf.build/gen/go/penumbra-zone/penumbra/protocolbuffers/go v1.31.0-20231120132728-bc443669626d.2/go.mod h1:h82VMeit0Ae3VmGvS6QH6yJx9GPHM3y4y0x1JU3Vyyc=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
Expand Down Expand Up @@ -530,8 +545,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 h1:KR8+MyP7/qOlV+8Af01LtjL04bu7on42eVsxT4EyBQk=
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
233 changes: 0 additions & 233 deletions proto/query_response.pb.go

This file was deleted.

Loading

0 comments on commit 0df599d

Please sign in to comment.