0g-chain/x/kavadist/client/cli/utils.go

25 lines
641 B
Go
Raw Normal View History

package cli
import (
"io/ioutil"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/kava-labs/kava/x/kavadist/types"
)
// ParseCommunityPoolMultiSpendProposalJSON reads and parses a CommunityPoolMultiSpendProposalJSON from a file.
func ParseCommunityPoolMultiSpendProposalJSON(cdc codec.JSONCodec, proposalFile string) (types.CommunityPoolMultiSpendProposalJSON, error) {
proposal := types.CommunityPoolMultiSpendProposalJSON{}
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
}