fn new_signed_tx(
    msg_pay_for_blobs: &MsgPayForBlobs,
    base_account: &BaseAccount,
    gas_limit: u64,
    fee: u64,
    chain_id: String,
    signing_key: &SecretKey,
) -> Tx {
    const SIGNING_MODE_INFO: Option<ModeInfo> = Some(ModeInfo {
        sum: Some(Sum::Single(Single { mode: 1 })),
    });

    let fee_coin = Coin {
        denom: UNITS_SUFFIX.to_string(),
        amount: fee.to_string(),
    };
    let fee = Fee {
        amount: vec![fee_coin],
        gas_limit,
        ..Fee::default()
    };

    let public_key = ec_proto::PubKey {
        key: Bytes::from(
            signing_key
                .public_key(&Secp256k1::new())
                .serialize()
                .to_vec(),
        ),
    };
    let public_key_as_any = pbjson_types::Any {
        type_url: ec_proto::PubKey::type_url(),
        value: public_key.encode_to_vec().into(),
    };
    let auth_info = AuthInfo {
        signer_infos: vec![SignerInfo {
            public_key: Some(public_key_as_any),
            mode_info: SIGNING_MODE_INFO,
            sequence: base_account.sequence,
        }],
        fee: Some(fee),
        tip: None,
    };

    let msg = pbjson_types::Any {
        type_url: MsgPayForBlobs::type_url(),
        value: msg_pay_for_blobs.encode_to_vec().into(),
    };
    let tx_body = TxBody {
        messages: vec![msg],
        ..TxBody::default()
    };

    let bytes_to_sign = SignDoc {
        body_bytes: Bytes::from(tx_body.encode_to_vec()),
        auth_info_bytes: Bytes::from(auth_info.encode_to_vec()),
        chain_id,
        account_number: base_account.account_number,
    }
    .encode_to_vec();
    let hashed_bytes: [u8; 32] = sha2::Sha256::digest(bytes_to_sign).into();
    let signature = secp256k1::Secp256k1::new().sign_ecdsa(
        &secp256k1::Message::from_slice(&hashed_bytes[..]).unwrap(), // unwrap is safe here because we know the length of the hashed bytes
        signing_key,
    );
    Tx {
        body: Some(tx_body),
        auth_info: Some(auth_info),
        signatures: vec![Bytes::from(signature.serialize_compact().to_vec())],
    }
}
Returns a signed tx for the given message, account and metadata.
core/node/da_clients/src/celestia/sdk.rs