func (c *Chain33) GetProperFee(in *types.ReqProperFee, result *interface{}) error {
	reply, err := c.cli.GetProperFee(in)
	if err != nil {
		return err
	}
	var properFee rpctypes.ReplyProperFee
	properFee.ProperFee = reply.GetProperFee()
	*result = &properFee
	return nil
}
GetProperFee get  contents in proper fee
package rpc
import (
	"bytes"
	"context"
	"encoding/hex"
	"encoding/json"
	"time"
	"github.com/33cn/chain33/wallet/bipwallet"
	"github.com/pkg/errors"
	"github.com/33cn/chain33/common"
	"github.com/33cn/chain33/common/address"
	rpctypes "github.com/33cn/chain33/rpc/types"
	"github.com/33cn/chain33/types"
	wcom "github.com/33cn/chain33/wallet/common"
)
func (c *Chain33) CreateRawTransaction(in *rpctypes.CreateTx, result *interface{}) error {
	if in == nil {
		log.Error("CreateRawTransaction", "Error", types.ErrInvalidParam)
		return types.ErrInvalidParam
	}
	inpb := &types.CreateTx{
		To:          in.To,
		Amount:      in.Amount,
		Fee:         in.Fee,
		Note:        []byte(in.Note),
		IsWithdraw:  in.IsWithdraw,
		IsToken:     in.IsToken,
		TokenSymbol: in.TokenSymbol,
		ExecName:    in.ExecName,
		Execer:      in.Execer,
	}
	reply, err := c.cli.CreateRawTransaction(inpb)
	if err != nil {
		return err
	}
	*result = common.ToHex(reply)
	return nil
}
func (c *Chain33) ReWriteRawTx(in *rpctypes.ReWriteRawTx, result *interface{}) error {
	inpb := &types.ReWriteRawTx{
		Tx:     in.Tx,
		To:     in.To,
		Fee:    in.Fee,
		Expire: in.Expire,
		Index:  in.Index,
	}
	reply, err := c.cli.ReWriteRawTx(inpb)
	if err != nil {
		return err
	}
	*result = common.ToHex(reply)
	return nil
}
func (c *Chain33) CreateRawTxGroup(in *types.CreateTransactionGroup, result *interface{}) error {
	reply, err := c.cli.CreateRawTxGroup(in)
	if err != nil {
		return err
	}
	*result = common.ToHex(reply)
	return nil
}
func (c *Chain33) CreateNoBlanaceTxs(in *types.NoBalanceTxs, result *string) error {
	tx, err := c.cli.CreateNoBalanceTxs(in)
	if err != nil {
		return err
	}
	grouptx := common.ToHex(types.Encode(tx))
	*result = grouptx
	return nil
}
func (c *Chain33) CreateNoBalanceTransaction(in *types.NoBalanceTx, result *string) error {
	params := &types.NoBalanceTxs{
		TxHexs:  []string{in.GetTxHex()},
		PayAddr: in.GetPayAddr(),
		Privkey: in.GetPrivkey(),
		Expire:  in.GetExpire(),
	}
	tx, err := c.cli.CreateNoBalanceTxs(params)
	if err != nil {
		return err
	}
	grouptx := common.ToHex(types.Encode(tx))
	*result = grouptx
	return nil
}
func (c *Chain33) SendTransaction(in rpctypes.RawParm, result *interface{}) error {
	var parm types.Transaction
	data, err := common.FromHex(in.Data)
	if err != nil {
		return err
	}
	err = types.Decode(data, &parm)
	if err != nil {
		return err
	}
	log.Debug("SendTransaction", "parm", parm.String())
	var reply *types.Reply
	cfg := c.cli.GetConfig()
	if cfg.IsPara() {
		reply, err = c.mainGrpcCli.SendTransaction(context.Background(), &parm)
	} else {
		reply, err = c.cli.SendTx(&parm)
	}
	if err == nil {
		*result = common.ToHex(reply.GetMsg())
	}
	return err
}
func (c *Chain33) SendTransactions(in rpctypes.ReqStrings, result *interface{}) error {
	reply := rpctypes.ReplyHashes{Hashes: make([]string, 0, len(in.Datas))}
	var err error
	for _, data := range in.Datas {
		var txHash interface{}
		err = c.SendTransaction(rpctypes.RawParm{Data: data}, &txHash)
		if err != nil {
			break
		}
		reply.Hashes = append(reply.Hashes, txHash.(string))
	}
	*result = reply
	return err
}
func (c *Chain33) SendTransactionSync(in rpctypes.RawParm, result *interface{}) error {
	err := c.SendTransaction(in, result)
	if err != nil {
		return err
	}
	hash := (*result).(string)
	param := rpctypes.QueryParm{Hash: hash}
	var res interface{}
	for i := 0; i < 100; i++ {
		err = c.QueryTransaction(param, &res)
		if err == types.ErrInvalidParam || err == types.ErrTypeAsset {
			return err
		}
		if _, ok := (res).(*rpctypes.TransactionDetail); ok {
			return nil
		}
		time.Sleep(time.Second / 3)
	}
	return types.ErrTimeout
}
func (c *Chain33) GetHexTxByHash(in rpctypes.QueryParm, result *interface{}) error {
	var data types.ReqHash
	hash, err := common.FromHex(in.Hash)
	if err != nil {
		return err
	}
	data.Hash = hash
	reply, err := c.cli.QueryTx(&data)
	if err != nil {
		return err
	}
	*result = common.ToHex(types.Encode(reply.GetTx()))
	return err
}
func (c *Chain33) QueryTransaction(in rpctypes.QueryParm, result *interface{}) error {
	var data types.ReqHash
	hash, err := common.FromHex(in.Hash)
	if err != nil {
		return err
	}
	data.Hash = hash
	reply, err := c.cli.QueryTx(&data)
	if err != nil {
		return err
	}
	cfg := c.cli.GetConfig()
	transDetail, err := fmtTxDetail(reply, false, cfg.GetCoinExec(), cfg.GetCoinPrecision())
	if err != nil {
		return err
	}
	*result = transDetail
	return nil
}
func (c *Chain33) GetBlocks(in rpctypes.BlockParam, result *interface{}) error {
	reply, err := c.cli.GetBlocks(&types.ReqBlocks{Start: in.Start, End: in.End, IsDetail: in.Isdetail, Pid: []string{""}})
	if err != nil {
		return err
	}
	{
		var blockDetails rpctypes.BlockDetails
		items := reply.GetItems()
		if err := convertBlockDetails(items, &blockDetails, in.Isdetail, c.cli.GetConfig().GetCoinPrecision()); err != nil {
			return err
		}
		*result = &blockDetails
	}
	return nil
}
func (c *Chain33) GetLastHeader(in *types.ReqNil, result *interface{}) error {
	reply, err := c.cli.GetLastHeader()
	if err != nil {
		return err
	}
	{
		var header rpctypes.Header
		header.BlockTime = reply.GetBlockTime()
		header.Height = reply.GetHeight()
		header.ParentHash = common.ToHex(reply.GetParentHash())
		header.StateHash = common.ToHex(reply.GetStateHash())
		header.TxHash = common.ToHex(reply.GetTxHash())
		header.Version = reply.GetVersion()
		header.Hash = common.ToHex(reply.GetHash())
		header.TxCount = reply.TxCount
		header.Difficulty = reply.GetDifficulty()
		*result = &header
	}
	return nil
}
func (c *Chain33) GetTxByAddr(in *types.ReqAddr, result *interface{}) error {
	reply, err := c.cli.GetTransactionByAddr(in)
	if err != nil {
		return err
	}
	{
		var txinfos rpctypes.ReplyTxInfos
		infos := reply.GetTxInfos()
		for _, info := range infos {
			txinfos.TxInfos = append(txinfos.TxInfos, &rpctypes.ReplyTxInfo{Hash: common.ToHex(info.GetHash()),
				Height: info.GetHeight(), Index: info.GetIndex(), Assets: fmtAsssets(info.Assets)})
		}
		*result = &txinfos
	}
	return nil
}
func (c *Chain33) GetTxByHashes(in rpctypes.ReqHashes, result *interface{}) error {
	log.Warn("GetTxByHashes", "hashes", in)
	var parm types.ReqHashes
	parm.Hashes = make([][]byte, 0)
	for _, v := range in.Hashes {
		hb, err := common.FromHex(v)
		if err != nil {
			parm.Hashes = append(parm.Hashes, nil)
			continue
		}
		parm.Hashes = append(parm.Hashes, hb)
	}
	reply, err := c.cli.GetTransactionByHash(&parm)
	if err != nil {
		return err
	}
	txs := reply.GetTxs()
	log.Info("GetTxByHashes", "get tx with count", len(txs))
	var txdetails rpctypes.TransactionDetails
	if 0 != len(txs) {
		for _, tx := range txs {
			txDetail, err := fmtTxDetail(tx, in.DisableDetail, c.cli.GetConfig().GetCoinExec(), c.cli.GetConfig().GetCoinPrecision())
			if err != nil {
				return err
			}
			txdetails.Txs = append(txdetails.Txs, txDetail)
		}
	}
	*result = &txdetails
	return nil
}
func fmtTxDetail(tx *types.TransactionDetail, disableDetail bool, coinExec string, coinPrecision int64) (*rpctypes.TransactionDetail, error) {
	if tx == nil || tx.GetTx() == nil {
		return nil, nil
	}
	var recp rpctypes.ReceiptData
	recp.Ty = tx.GetReceipt().GetTy()
	logs := tx.GetReceipt().GetLogs()
	if disableDetail {
		logs = nil
	}
	for _, lg := range logs {
		recp.Logs = append(recp.Logs,
			&rpctypes.ReceiptLog{Ty: lg.Ty, Log: common.ToHex(lg.GetLog())})
	}
	var recpResult *rpctypes.ReceiptDataResult
	recpResult, err := rpctypes.DecodeLog(tx.Tx.Execer, &recp)
	if err != nil {
		log.Error("GetTxByHashes", "Failed to DecodeLog for type", err)
		return nil, err
	}
	var proofs []string
	txProofs := tx.GetProofs()
	for _, proof := range txProofs {
		proofs = append(proofs, common.ToHex(proof))
	}
	tran, err := rpctypes.DecodeTx(tx.GetTx(), coinPrecision)
	if err != nil {
		log.Info("GetTxByHashes", "Failed to DecodeTx due to", err)
		return nil, err
	}
	if tx.Amount != 0 {
		tran.Amount = tx.Amount
		tran.AmountFmt = types.FormatAmount2FloatDisplay(tran.Amount, coinPrecision, true)
	}
	if tx.GetTx().IsWithdraw(coinExec) {
		tx.Fromaddr, tx.Tx.To = tx.Tx.To, tx.Fromaddr
		tran.To = tx.Tx.GetRealToAddr()
	}
	var fullhash string
	if len(tx.GetFullHash()) != 0 {
		fullhash = common.ToHex(tx.GetFullHash())
	}
	return &rpctypes.TransactionDetail{
		Tx:         tran,
		Height:     tx.GetHeight(),
		Index:      tx.GetIndex(),
		Blocktime:  tx.GetBlocktime(),
		Receipt:    recpResult,
		Proofs:     proofs,
		Amount:     tx.GetAmount(),
		Fromaddr:   tx.GetFromaddr(),
		ActionName: tx.GetActionName(),
		Assets:     fmtAsssets(tx.GetAssets()),
		TxProofs:   fmtTxProofs(tx.GetTxProofs()),
		FullHash:   fullhash,
	}, nil
}
func fmtAsssets(assets []*types.Asset) []*rpctypes.Asset {
	var result []*rpctypes.Asset
	for _, a := range assets {
		asset := &rpctypes.Asset{
			Exec:   a.Exec,
			Symbol: a.Symbol,
			Amount: a.Amount,
		}
		result = append(result, asset)
	}
	return result
}
func (c *Chain33) GetMempool(in *types.ReqGetMempool, result *interface{}) error {
	reply, err := c.cli.GetMempool(in)
	if err != nil {
		return err
	}
	{
		var txlist rpctypes.ReplyTxList
		txs := reply.GetTxs()
		for _, tx := range txs {
			amount, err := tx.Amount()
			if err != nil {
				amount = 0
			}
			tran, err := rpctypes.DecodeTx(tx, c.cli.GetConfig().GetCoinPrecision())
			if err != nil {
				continue
			}
			tran.Amount = amount
			txlist.Txs = append(txlist.Txs, tran)
		}
		*result = &txlist
	}
	return nil
}
func (c *Chain33) GetAccountsV2(in *types.ReqNil, result *interface{}) error {
	req := &types.ReqAccountList{WithoutBalance: false}
	return c.GetAccounts(req, result)
}
func (c *Chain33) GetAccounts(in *types.ReqAccountList, result *interface{}) error {
	req := types.ReqAccountList{WithoutBalance: in.WithoutBalance}
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletGetAccountList", &req)
	if err != nil {
		return err
	}
	accountsList := reply.(*types.WalletAccounts)
	var accounts rpctypes.WalletAccounts
	for _, wallet := range accountsList.Wallets {
		accounts.Wallets = append(accounts.Wallets, &rpctypes.WalletAccount{Label: wallet.GetLabel(),
			Acc: &rpctypes.Account{Currency: wallet.GetAcc().GetCurrency(), Balance: wallet.GetAcc().GetBalance(),
				Frozen: wallet.GetAcc().GetFrozen(), Addr: wallet.GetAcc().GetAddr()}})
	}
	*result = &accounts
	return nil
}
func (c *Chain33) NewAccount(in *types.ReqNewAccount, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "NewAccount", in)
	if err != nil {
		return err
	}
	*result = reply
	return nil
}
func (c *Chain33) NewRandAccount(in *types.GenSeedLang, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "NewRandAccount", in)
	if err != nil {
		return err
	}
	*result = reply
	return nil
}
func (c *Chain33) PubKeyToAddr(in *types.ReqString, result *interface{}) error {
	pub, err := common.FromHex(in.Data)
	if err != nil {
		return errors.Wrapf(err, "fromHex=%s", in.Data)
	}
	addr, err := bipwallet.PubToAddress(pub)
	if err != nil {
		return errors.Wrapf(err, "pub2Addr")
	}
	var rep types.ReplyString
	rep.Data = addr
	*result = &rep
	return nil
}
func (c *Chain33) WalletTxList(in rpctypes.ReqWalletTransactionList, result *interface{}) error {
	var parm types.ReqWalletTransactionList
	parm.FromTx = []byte(in.FromTx)
	parm.Count = in.Count
	parm.Direction = in.Direction
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletTransactionList", &parm)
	if err != nil {
		return err
	}
	{
		var txdetails rpctypes.WalletTxDetails
		err := rpctypes.ConvertWalletTxDetailToJSON(reply.(*types.WalletTxDetails), &txdetails, c.cli.GetConfig().GetCoinExec(), c.cli.GetConfig().GetCoinPrecision())
		if err != nil {
			return err
		}
		*result = &txdetails
	}
	return nil
}
func (c *Chain33) ImportPrivkey(in *types.ReqWalletImportPrivkey, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletImportPrivkey", in)
	if err != nil {
		return err
	}
	*result = reply
	return nil
}
func (c *Chain33) SendToAddress(in *types.ReqWalletSendToAddress, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletSendToAddress", in)
	if err != nil {
		log.Debug("SendToAddress", "Error", err.Error())
		return err
	}
	log.Debug("sendtoaddr", "msg", reply.String())
	*result = &rpctypes.ReplyHash{Hash: common.ToHex(reply.(*types.ReplyHash).GetHash())}
	log.Debug("SendToAddress", "resulrt", *result)
	return nil
}
func (c *Chain33) SetTxFee(in *types.ReqWalletSetFee, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletSetFee", in)
	if err != nil {
		return err
	}
	var resp rpctypes.Reply
	resp.IsOk = reply.(*types.Reply).GetIsOk()
	resp.Msg = string(reply.(*types.Reply).GetMsg())
	*result = &resp
	return nil
}
func (c *Chain33) SetLabl(in *types.ReqWalletSetLabel, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletSetLabel", in)
	if err != nil {
		return err
	}
	*result = &rpctypes.WalletAccount{Acc: &rpctypes.Account{Addr: reply.(*types.WalletAccount).GetAcc().Addr, Currency: reply.(*types.WalletAccount).GetAcc().GetCurrency(),
		Frozen: reply.(*types.WalletAccount).GetAcc().GetFrozen(), Balance: reply.(*types.WalletAccount).GetAcc().GetBalance()}, Label: reply.(*types.WalletAccount).GetLabel()}
	return nil
}
func (c *Chain33) GetAccount(in *types.ReqGetAccount, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletGetAccount", in)
	if err != nil {
		return err
	}
	*result = &rpctypes.WalletAccount{Acc: &rpctypes.Account{Addr: reply.(*types.WalletAccount).GetAcc().Addr, Currency: reply.(*types.WalletAccount).GetAcc().GetCurrency(),
		Frozen: reply.(*types.WalletAccount).GetAcc().GetFrozen(), Balance: reply.(*types.WalletAccount).GetAcc().GetBalance()}, Label: reply.(*types.WalletAccount).GetLabel()}
	return nil
}
func (c *Chain33) MergeBalance(in *types.ReqWalletMergeBalance, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletMergeBalance", in)
	if err != nil {
		return err
	}
	var hashes rpctypes.ReplyHashes
	for _, has := range reply.(*types.ReplyHashes).Hashes {
		hashes.Hashes = append(hashes.Hashes, common.ToHex(has))
	}
	*result = &hashes
	return nil
}
func (c *Chain33) SetPasswd(in *types.ReqWalletSetPasswd, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletSetPasswd", in)
	if err != nil {
		return err
	}
	var resp rpctypes.Reply
	resp.IsOk = reply.(*types.Reply).GetIsOk()
	resp.Msg = string(reply.(*types.Reply).GetMsg())
	*result = &resp
	return nil
}
func (c *Chain33) Lock(in *types.ReqNil, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletLock", in)
	if err != nil {
		return err
	}
	var resp rpctypes.Reply
	resp.IsOk = reply.(*types.Reply).GetIsOk()
	resp.Msg = string(reply.(*types.Reply).GetMsg())
	*result = &resp
	return nil
}
func (c *Chain33) UnLock(in *types.WalletUnLock, result *interface{}) error {
	reply, err := c.cli.ExecWalletFunc("wallet", "WalletUnLock", in)
	if err != nil {
		return err
	}
	var resp rpctypes.Reply
	resp.IsOk = reply.(*types.Reply).GetIsOk()
	resp.Msg = string(reply.(*types.Reply).GetMsg())
	*result = &resp
	return nil
}
func (c *Chain33) GetPeerInfo(in *types.P2PGetPeerReq, result *interface{}) error {
	reply, err := c.cli.PeerInfo(in)
	if err != nil {
		return err
	}
	{
		var peerlist rpctypes.PeerList
		for _, peer := range reply.Peers {
			var pr rpctypes.Peer
			pr.Addr = peer.GetAddr()
			pr.MempoolSize = peer.GetMempoolSize()
			pr.Name = peer.GetName()
			pr.Port = peer.GetPort()
			pr.Self = peer.GetSelf()
			pr.Header = &rpctypes.Header{
				BlockTime:  peer.Header.GetBlockTime(),
				Height:     peer.Header.GetHeight(),
				ParentHash: common.ToHex(peer.GetHeader().GetParentHash()),
				StateHash:  common.ToHex(peer.GetHeader().GetStateHash()),
				TxHash:     common.ToHex(peer.GetHeader().GetTxHash()),
				Version:    peer.GetHeader().GetVersion(),
				Hash:       common.ToHex(peer.GetHeader().GetHash()),
				TxCount:    peer.GetHeader().GetTxCount(),
			}
			pr.Version = peer.GetVersion()
			pr.LocalDBVersion = peer.GetLocalDBVersion()
			pr.StoreDBVersion = peer.GetStoreDBVersion()
			pr.RunningTime = peer.GetRunningTime()
			pr.FullNode = peer.GetFullNode()
			pr.Blocked = peer.GetBlocked()
			peerlist.Peers = append(peerlist.Peers, &pr)
		}
		*result = &peerlist
	}
	return nil
}
func (c *Chain33) GetHeaders(in *types.ReqBlocks, result *interface{}) error {
	reply, err := c.cli.GetHeaders(in)
	if err != nil {
		return err
	}
	var headers rpctypes.Headers
	{
		for _, item := range reply.Items {
			headers.Items = append(headers.Items, &rpctypes.Header{
				BlockTime:  item.GetBlockTime(),
				TxCount:    item.GetTxCount(),
				Hash:       common.ToHex(item.GetHash()),
				Height:     item.GetHeight(),
				ParentHash: common.ToHex(item.GetParentHash()),
				StateHash:  common.ToHex(item.GetStateHash()),
				TxHash:     common.ToHex(item.GetTxHash()),
				Difficulty: item.GetDifficulty(),
				Version: item.GetVersion()})
		}
		*result = &headers
	}
	return nil
}
func (c *Chain33) GetLastMemPool(in *types.ReqNil, result *interface{}) error {
	reply, err := c.cli.GetLastMempool()
	if err != nil {
		return err
	}
	{
		var txlist rpctypes.ReplyTxList
		txs := reply.GetTxs()
		for _, tx := range txs {
			tran, err := rpctypes.DecodeTx(tx, c.cli.GetConfig().GetCoinPrecision())
			if err != nil {
				continue
			}
			txlist.Txs = append(txlist.Txs, tran)
		}
		*result = &txlist
	}
	return nil
}