github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/auth/ibc-tx/txencoder.go (about)

     1  package ibc_tx
     2  
     3  import (
     4  	"fmt"
     5  
     6  	ibctx "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types/ibc-adapter"
     7  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/auth/types"
     8  	"github.com/gogo/protobuf/proto"
     9  )
    10  
    11  func IbcTxEncoder() ibctx.IBCTxEncoder {
    12  	return func(tx ibctx.Tx) ([]byte, error) {
    13  		txWrapper, ok := tx.(*wrapper)
    14  		if !ok {
    15  			return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, tx)
    16  		}
    17  
    18  		raw := &types.TxRaw{
    19  			BodyBytes:     txWrapper.getBodyBytes(),
    20  			AuthInfoBytes: txWrapper.getAuthInfoBytes(),
    21  			Signatures:    txWrapper.tx.Signatures,
    22  		}
    23  
    24  		return proto.Marshal(raw)
    25  	}
    26  }