INNER CODE UNIT · Go
fromBinary
wavesplatform/gowaves · cmd/convert/main.go:138
func fromBinary(data []byte, cfg config) (proto.Transaction, error) {
var bts []byte
if cfg.base64 {
bts = make([]byte, base64.StdEncoding.DecodedLen(len(data)))
cnt, err := base64.StdEncoding.Decode(bts, data)
if err != nil {
return nil, fmt.Errorf("failed to decode from Base64: %w", err)
}
bts = bts[:cnt]
} else {
bts = data
}
tx, err := proto.SignedTxFromProtobuf(bts)
if err != nil {
if tx, err = proto.BytesToTransaction(bts, cfg.scheme); err != nil {
return nil, fmt.Errorf("failed to read transaction from binary: %w", err)
}
}