2019-05-21 03:02:10 -07:00
|
|
|
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 {
|
2019-07-05 16:25:56 -07:00
|
|
|
Title string `json:"title" yaml:"title"`
|
|
|
|
Description string `json:"description" yaml:"description"`
|
|
|
|
Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
|
2020-03-11 10:03:47 -07:00
|
|
|
Amount string `json:"amount" yaml:"amount"`
|
|
|
|
Deposit string `json:"deposit" yaml:"deposit"`
|
2019-05-21 03:02:10 -07:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
// ParseCommunityPoolSpendProposalJSON reads and parses a CommunityPoolSpendProposalJSON from a file.
|
2020-05-21 14:29:34 -07:00
|
|
|
func ParseCommunityPoolSpendProposalJSON(cdc codec.JSONMarshaler, proposalFile string) (CommunityPoolSpendProposalJSON, error) {
|
2019-05-21 03:02:10 -07:00
|
|
|
proposal := CommunityPoolSpendProposalJSON{}
|
|
|
|
|
|
|
|
contents, err := ioutil.ReadFile(proposalFile)
|
|
|
|
if err != nil {
|
|
|
|
return proposal, err
|
|
|
|
}
|
|
|
|
|
2020-06-09 03:18:44 -07:00
|
|
|
if err = cdc.UnmarshalJSON(contents, &proposal); err != nil {
|
2019-05-21 03:02:10 -07:00
|
|
|
return proposal, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return proposal, nil
|
|
|
|
}
|