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

25 lines
642 B
Go
Raw Normal View History

package cli
import (
"io/ioutil"
"github.com/cosmos/cosmos-sdk/codec"
2024-08-03 09:51:56 +00:00
"github.com/0glabs/0g-chain/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
}