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

feat: add add-to-basket cli command #750

Merged
merged 11 commits into from
Feb 12, 2022
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.14
github.com/tendermint/tm-db v0.6.6
golang.org/x/crypto v0.0.0-20220209155544-dad33157f4bf // indirect
golang.org/x/crypto v0.0.0-20220209195652-db638375bc3a // indirect
google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068 // indirect
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1149,8 +1149,8 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220209155544-dad33157f4bf h1:gdgmgieTI2lLaGI2N+xEiaCMUgo2XFmAS0rlF8HZoso=
golang.org/x/crypto v0.0.0-20220209155544-dad33157f4bf/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220209195652-db638375bc3a h1:atOEWVSedO4ksXBe/UrlbSLVxQQ9RxM/tT2Jy10IaHo=
golang.org/x/crypto v0.0.0-20220209195652-db638375bc3a/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down
6 changes: 6 additions & 0 deletions proto/regen/ecocredit/basket/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ message BasketCredit {
// credit type for this batch.
string amount = 2;
}

// BasketCredits represents the slice of BasketCredit objects.
message BasketCredits {
// credits is the list of basket credits
repeated BasketCredit credits = 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a way to do this without adding this to the proto file

Copy link
Collaborator

@robert-zaremba robert-zaremba Feb 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I second that. Lets don't pollute proto if the only thing we want is to parse helper structure in CLI. And we also don't need proto JSON marshaller for that. The stdlib should work.
In the client/basket package we can just do:

var credits = []basket.BasketCredit{}
bz, err := ioutil.ReadAll(filename)
err = json.Unmarshal(bz, &credits)

so the JSON in the file is an array (without { "credits": ...})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we want changes to proto definitions merged into master and backported to the release branch. We will need to add this addition to master as well, correct? @aaronc @technicallyty @robert-zaremba

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do either way (unless there is a change in state.proto). Those backports needs to be done manually.

ryanchristo marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 16 additions & 0 deletions x/basket/spec/protobuf.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- [regen/ecocredit/basket/v1/types.proto](#regen/ecocredit/basket/v1/types.proto)
- [BasketCredit](#regen.ecocredit.basket.v1.BasketCredit)
- [BasketCredits](#regen.ecocredit.basket.v1.BasketCredits)

- [regen/ecocredit/basket/v1/tx.proto](#regen/ecocredit/basket/v1/tx.proto)
- [MsgCreate](#regen.ecocredit.basket.v1.MsgCreate)
Expand Down Expand Up @@ -43,6 +44,21 @@ BasketCredit represents the information for a credit batch inside a basket.




<a name="regen.ecocredit.basket.v1.BasketCredits"></a>

### BasketCredits
BasketCredits represents the slice of BasketCredit objects.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| credits | [BasketCredit](#regen.ecocredit.basket.v1.BasketCredit) | repeated | credits is the list of basket credits |





<!-- end messages -->

<!-- end enums -->
Expand Down
6 changes: 3 additions & 3 deletions x/ecocredit/basket/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

200 changes: 194 additions & 6 deletions x/ecocredit/basket/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading