cosmos-sdk/x/distribution/client/cli/utils.go
SaReN 0786e68296
Add proto compatible community spend cli tx (#6215)
* Add NewSubmitProposal for x/distribution

* Addressed comments

* Fix description for fund tx

* Remove old splitAndApply

* Update utils

* Add missing flag

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-09 10:18:44 +00:00

36 lines
1.0 KiB
Go

package cli
import (
"io/ioutil"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type (
// CommunityPoolSpendProposalJSON defines a CommunityPoolSpendProposal with a deposit
CommunityPoolSpendProposalJSON struct {
Title string `json:"title" yaml:"title"`
Description string `json:"description" yaml:"description"`
Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
Amount string `json:"amount" yaml:"amount"`
Deposit string `json:"deposit" yaml:"deposit"`
}
)
// ParseCommunityPoolSpendProposalJSON reads and parses a CommunityPoolSpendProposalJSON from a file.
func ParseCommunityPoolSpendProposalJSON(cdc codec.JSONMarshaler, proposalFile string) (CommunityPoolSpendProposalJSON, error) {
proposal := CommunityPoolSpendProposalJSON{}
contents, err := ioutil.ReadFile(proposalFile)
if err != nil {
return proposal, err
}
if err = cdc.UnmarshalJSON(contents, &proposal); err != nil {
return proposal, err
}
return proposal, nil
}